\
- \
+/* Import theme specific language pack */
+ tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_advanced_autoImportCSSClasses=true;var TinyMCE_advanced_foreColor="#000000";var TinyMCE_advanced_anchorName="";var TinyMCE_advanced_resizer=new Object();var TinyMCE_advanced_buttons=[['bold','{$lang_bold_img}','{$lang_bold_desc}','Bold'],['italic','{$lang_italic_img}','{$lang_italic_desc}','Italic'],['underline','{$lang_underline_img}','{$lang_underline_desc}','Underline'],['strikethrough','strikethrough.gif','{$lang_striketrough_desc}','Strikethrough'],['justifyleft','left.gif','{$lang_justifyleft_desc}','JustifyLeft'],['justifycenter','center.gif','{$lang_justifycenter_desc}','JustifyCenter'],['justifyright','right.gif','{$lang_justifyright_desc}','JustifyRight'],['justifyfull','full.gif','{$lang_justifyfull_desc}','JustifyFull'],['bullist','bullist.gif','{$lang_bullist_desc}','InsertUnorderedList'],['numlist','numlist.gif','{$lang_numlist_desc}','InsertOrderedList'],['outdent','outdent.gif','{$lang_outdent_desc}','Outdent'],['indent','indent.gif','{$lang_indent_desc}','Indent'],['cut','cut.gif','{$lang_cut_desc}','Cut'],['copy','copy.gif','{$lang_copy_desc}','Copy'],['paste','paste.gif','{$lang_paste_desc}','Paste'],['undo','undo.gif','{$lang_undo_desc}','Undo'],['redo','redo.gif','{$lang_redo_desc}','Redo'],['link','link.gif','{$lang_link_desc}','mceLink',true],['unlink','unlink.gif','{$lang_unlink_desc}','unlink'],['image','image.gif','{$lang_image_desc}','mceImage',true],['cleanup','cleanup.gif','{$lang_cleanup_desc}','mceCleanup'],['help','help.gif','{$lang_help_desc}','mceHelp'],['code','code.gif','{$lang_theme_code_desc}','mceCodeEditor'],['hr','hr.gif','{$lang_theme_hr_desc}','inserthorizontalrule'],['removeformat','removeformat.gif','{$lang_theme_removeformat_desc}','removeformat'],['sub','sub.gif','{$lang_theme_sub_desc}','subscript'],['sup','sup.gif','{$lang_theme_sup_desc}','superscript'],['forecolor','forecolor.gif','{$lang_theme_forecolor_desc}','mceForeColor',true],['backcolor','backcolor.gif','{$lang_theme_backcolor_desc}','mceBackColor',true],['charmap','charmap.gif','{$lang_theme_charmap_desc}','mceCharMap'],['visualaid','visualaid.gif','{$lang_theme_visualaid_desc}','mceToggleVisualAid'],['anchor','anchor.gif','{$lang_theme_anchor_desc}','mceInsertAnchor'],['newdocument','newdocument.gif','{$lang_newdocument_desc}','mceNewDocument']];function TinyMCE_advanced_getControlHTML(button_name){var buttonTileMap=new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif','charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif','cut.gif','forecolor.gif','full.gif','help.gif','hr.gif','image.gif','indent.gif','left.gif','link.gif','numlist.gif','outdent.gif','paste.gif','redo.gif','removeformat.gif','right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif','unlink.gif','visualaid.gif');for(var i=0;i';}}}return ' ';}}switch(button_name){case "formatselect":var html='';return html;case "styleselect":return '';case "fontselect":return '';case "fontsizeselect":return '';case "|":case "separator":return ' ';case "spacer":return ' ';case "rowseparator":return ' ';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var inputColor=TinyMCE_advanced_foreColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=240;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var inputColor=TinyMCE_advanced_foreColor;if(!inputColor){inputColor="#000000";}template['file']='color_picker.htm';template['width']=210;template['height']=200;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case "mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=210;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;savedVal['document'].getElementById(savedVal['element_id']).value=value;}return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=tinyMCE.getParam("theme_advanced_source_editor_width",500);template['height']=tinyMCE.getParam("theme_advanced_source_editor_height",400);tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550;template['height']=280;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=130;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",name:TinyMCE_advanced_anchorName,action:(TinyMCE_advanced_anchorName==""?"insert":"update")});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i ';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i'+key+'';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var buttonNamesRow1=tinyMCE.getParam("theme_advanced_buttons1","bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",true,',');buttonNamesRow1=removeFromArray(buttonNamesRow1,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow1=addToArray(buttonNamesRow1,tinyMCE.getParam("theme_advanced_buttons1_add","",true,','));buttonNamesRow1=addToArray(tinyMCE.getParam("theme_advanced_buttons1_add_before","",true,','),buttonNamesRow1);for(var i=0;i0){toolbarHTML+=" ";deltaHeight-=23;}var buttonNamesRow2=tinyMCE.getParam("theme_advanced_buttons2","bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",true,',');buttonNamesRow2=removeFromArray(buttonNamesRow2,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow2=addToArray(buttonNamesRow2,tinyMCE.getParam("theme_advanced_buttons2_add","",true,','));buttonNamesRow2=addToArray(tinyMCE.getParam("theme_advanced_buttons2_add_before","",true,','),buttonNamesRow2);for(var i=0;i0){toolbarHTML+=" ";deltaHeight-=23;}var buttonNamesRow3=tinyMCE.getParam("theme_advanced_buttons3","hr,removeformat,visualaid,separator,sub,sup,separator,charmap",true,',');buttonNamesRow3=removeFromArray(buttonNamesRow3,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow3=addToArray(buttonNamesRow3,tinyMCE.getParam("theme_advanced_buttons3_add","",true,','));buttonNamesRow3=addToArray(tinyMCE.getParam("theme_advanced_buttons3_add_before","",true,','),buttonNamesRow3);for(var i=0;i0){deltaHeight-=20;}template['html']='';if(toolbarLocation=="top"){template['html']+='| '+toolbarHTML+' | ';}if(statusbarLocation=="top"){template['html']+='| '+statusbarHTML+' | ';deltaHeight-=23;}template['html']+=' | ';if(toolbarLocation=="bottom"){template['html']+='| '+toolbarHTML+' | ';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"default_document",tinyMCE.baseURL+"/blank.htm");elm.className="mceToolbarExternal";elm.id="mceExternalToolbar";elm.innerHTML='';bod.appendChild(elm);bod.style.marginTop=elm.offsetHeight+"px";tinyMCE.isExternalToolbar=true;}else{tinyMCE.isExternalToolbar=false;}if(statusbarLocation=="bottom"){template['html']+='| '+statusbarHTML+' | ';deltaHeight-=23;}template['html']+=' ';break;case "RowLayout":template['html']='';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i| \
+ \
| ';}else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+='| '+statusbarHTML+' | ';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j0){curContainerHTML+=" ";deltaHeight-=23;}template['html']+='| '+curContainerHTML+' | ';}}template['html']+=' ';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']+='';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_setResizing(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_advanced_resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;if(tinyMCE.isMSIE){width+=2;height+=2;}resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_advanced_resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_advanced_resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_advanced_resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",false);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display="block";inst.getDoc().designMode="On";}}function TinyMCE_advanced_resizeEventHandler(e){var resizer=TinyMCE_advanced_resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case "mousemove":if(resizer.horizontal)resizeBox.style.width=(resizer.width+dx)+"px";resizeBox.style.height=(resizer.height+dy)+"px";break;case "mouseup":resizer.resizing=false;TinyMCE_advanced_setResizing(e,editorId,false);var editorContainer=document.getElementById(editorId+'_parent');var tableElm=editorContainer.firstChild;var inst=tinyMCE.getInstanceById(editorId);var width=resizer.width+dx;var height=resizer.height+dy;if(resizer.horizontal)var iframeWidth=resizer.iframeWidth+dx;var iframeHeight=resizer.iframeHeight+dy;if(tinyMCE.isGecko){width+=2;height+=2;}if(iframeHeight<40)return;if(resizer.horizontal)tableElm.style.width=width+"px";tableElm.style.height=height+"px";if(resizer.horizontal)inst.iframeElement.style.width=iframeWidth+"px";if(tinyMCE.isGecko&&!resizer.horizontal)inst.iframeElement.style.width=resizer.iframeWidth+"px";inst.iframeElement.style.height=iframeHeight+"px";if(resizer.horizontal){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(getAttrib(path[i],"className"),false);if(className!=""){nodeData+="class: "+className+" ";}if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&getAttrib(path[i],'name')=="mce_plugin_flash"){nodeName="flash";nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(getAttrib(path[i],"className"),false);if(className!=""){nodeName+="."+className;}}if(tinyMCE.isMSIE){html+=''+nodeName+'';}else{html+=''+nodeName+'';}if(i>0){html+=" » ";}}pathElm.innerHTML=tinyMCE.getLang('lang_theme_path')+": "+html+" ";}var colorElm=tinyMCE.getParentElement(node,"font","color");if(colorElm){TinyMCE_advanced_foreColor=""+colorElm.color.toUpperCase();}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');var anchorName=tinyMCE.getParentElement(node,"a","name");TinyMCE_advanced_anchorName="";if(anchorName){TinyMCE_advanced_anchorName=anchorName.getAttribute("name");tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');}var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"font","face");if(elm){selectByValue(selectElm,elm.getAttribute("face"));}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"font","size");if(elm&&getAttrib(elm,"size")!=""){selectByValue(selectElm,elm.getAttribute("size"));}else{selectByValue(selectElm,"0");}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode));if(tinyMCE.isGecko&&node.nodeType==3){var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(doc.queryCommandState("Bold")){tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');}if(doc.queryCommandState("Italic")){tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}if(doc.queryCommandState("Strikethrough")){tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');}}do{switch(node.nodeName.toLowerCase()){case "b":case "strong":tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');break;case "i":case "em":tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');break;case "u":tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');break;case "strike":tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');break;case "ul":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "ol":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "sub":tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonSelected');break;case "sup":tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonSelected');break;case "hr":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "img":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode));};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i0){selectElm.setAttribute('cssImported','true');}}};
\ No newline at end of file
diff --git a/wp-admin/tinymce/themes/advanced/editor_template_src.js b/wp-admin/tinymce/themes/advanced/editor_template_src.js
index 71bb9177cc..9db2b0027b 100644
--- a/wp-admin/tinymce/themes/advanced/editor_template_src.js
+++ b/wp-admin/tinymce/themes/advanced/editor_template_src.js
@@ -1,1150 +1,1150 @@
-/* Import theme specific language pack */
-tinyMCE.importThemeLanguagePack('advanced');
-
-// Variable declarations
-var TinyMCE_advanced_autoImportCSSClasses = true;
-var TinyMCE_advanced_foreColor = "#000000";
-var TinyMCE_advanced_anchorName = "";
-var TinyMCE_advanced_resizer = new Object();
-var TinyMCE_advanced_buttons = [
- // Control id, button img, button title, command, user_interface, value
- ['bold', '{$lang_bold_img}', '{$lang_bold_desc}', 'Bold'],
- ['italic', '{$lang_italic_img}', '{$lang_italic_desc}', 'Italic'],
- ['underline', '{$lang_underline_img}', '{$lang_underline_desc}', 'Underline'],
- ['strikethrough', 'strikethrough.gif', '{$lang_striketrough_desc}', 'Strikethrough'],
- ['justifyleft', 'left.gif', '{$lang_justifyleft_desc}', 'JustifyLeft'],
- ['justifycenter', 'center.gif', '{$lang_justifycenter_desc}', 'JustifyCenter'],
- ['justifyright', 'right.gif', '{$lang_justifyright_desc}', 'JustifyRight'],
- ['justifyfull', 'full.gif', '{$lang_justifyfull_desc}', 'JustifyFull'],
- ['bullist', 'bullist.gif', '{$lang_bullist_desc}', 'InsertUnorderedList'],
- ['numlist', 'numlist.gif', '{$lang_numlist_desc}', 'InsertOrderedList'],
- ['outdent', 'outdent.gif', '{$lang_outdent_desc}', 'Outdent'],
- ['indent', 'indent.gif', '{$lang_indent_desc}', 'Indent'],
- ['cut', 'cut.gif', '{$lang_cut_desc}', 'Cut'],
- ['copy', 'copy.gif', '{$lang_copy_desc}', 'Copy'],
- ['paste', 'paste.gif', '{$lang_paste_desc}', 'Paste'],
- ['undo', 'undo.gif', '{$lang_undo_desc}', 'Undo'],
- ['redo', 'redo.gif', '{$lang_redo_desc}', 'Redo'],
- ['link', 'link.gif', '{$lang_link_desc}', 'mceLink', true],
- ['unlink', 'unlink.gif', '{$lang_unlink_desc}', 'unlink'],
- ['image', 'image.gif', '{$lang_image_desc}', 'mceImage', true],
- ['cleanup', 'cleanup.gif', '{$lang_cleanup_desc}', 'mceCleanup'],
- ['help', 'help.gif', '{$lang_help_desc}', 'mceHelp'],
- ['code', 'code.gif', '{$lang_theme_code_desc}', 'mceCodeEditor'],
- ['hr', 'hr.gif', '{$lang_theme_hr_desc}', 'inserthorizontalrule'],
- ['removeformat', 'removeformat.gif', '{$lang_theme_removeformat_desc}', 'removeformat'],
- ['sub', 'sub.gif', '{$lang_theme_sub_desc}', 'subscript'],
- ['sup', 'sup.gif', '{$lang_theme_sup_desc}', 'superscript'],
- ['forecolor', 'forecolor.gif', '{$lang_theme_forecolor_desc}', 'mceForeColor', true],
- ['backcolor', 'backcolor.gif', '{$lang_theme_backcolor_desc}', 'mceBackColor', true],
- ['charmap', 'charmap.gif', '{$lang_theme_charmap_desc}', 'mceCharMap'],
- ['visualaid', 'visualaid.gif', '{$lang_theme_visualaid_desc}', 'mceToggleVisualAid'],
- ['anchor', 'anchor.gif', '{$lang_theme_anchor_desc}', 'mceInsertAnchor'],
- ['newdocument', 'newdocument.gif', '{$lang_newdocument_desc}', 'mceNewDocument']
-];
-
-/**
- * Returns HTML code for the specificed control.
- */
-function TinyMCE_advanced_getControlHTML(button_name)
-{
- var buttonTileMap = new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif',
- 'charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif',
- 'cut.gif','forecolor.gif','full.gif','help.gif','hr.gif',
- 'image.gif','indent.gif','left.gif','link.gif','numlist.gif',
- 'outdent.gif','paste.gif','redo.gif','removeformat.gif',
- 'right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif',
- 'unlink.gif','visualaid.gif');
-
- // Lookup button in button list
- for (var i=0; i';
- }
- }
- }
-
- // Old style
- return ' ';
- }
- }
-
- // Custom controlls other than buttons
- switch (button_name)
- {
- case "formatselect":
- var html = '';
- //formatselect
- return html;
-
- case "styleselect":
- //styleselect
- return '';
-
- case "fontselect":
- //fontselect
- return '';
-
- case "fontsizeselect":
- //fontsizeselect
- return '';
-
- case "|":
- case "separator":
- return ' ';
-
- case "spacer":
- return ' ';
-
- case "rowseparator":
- return ' ';
- }
-
- return "";
-}
-
-/**
- * Theme specific exec command handeling.
- */
-function TinyMCE_advanced_execCommand(editor_id, element, command, user_interface, value)
-{
- switch (command)
- {
- case "mceForeColor":
- var template = new Array();
- var inputColor = TinyMCE_advanced_foreColor;
-
- if (!inputColor)
- inputColor = "#000000";
-
- template['file'] = 'color_picker.htm';
- template['width'] = 220;
- template['height'] = 240;
-
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
- return true;
-
- case "mceBackColor":
- var template = new Array();
- var inputColor = TinyMCE_advanced_foreColor;
-
- if (!inputColor)
- {
- inputColor = "#000000";
- }
-
- template['file'] = 'color_picker.htm';
- template['width'] = 210;
- template['height'] = 200;
-
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
- //mceBackColor
- return true;
-
- case "mceColorPicker":
- if (user_interface) {
- var template = new Array();
- var inputColor = value['document'].getElementById(value['element_id']).value;
-
- template['file'] = 'color_picker.htm';
- template['width'] = 220;
- template['height'] = 210;
-
- tinyMCE.lastColorPickerValue = value;
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "mceColorPicker", input_color : inputColor});
- } else {
- var savedVal = tinyMCE.lastColorPickerValue;
- savedVal['document'].getElementById(savedVal['element_id']).value = value;
- }
- return true;
-
- case "mceCodeEditor":
- var template = new Array();
-
- template['file'] = 'source_editor.htm';
- template['width'] = tinyMCE.getParam("theme_advanced_source_editor_width", 500);
- template['height'] = tinyMCE.getParam("theme_advanced_source_editor_height", 400);
-
- tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"});
- //mceCodeEditor
- return true;
-
- case "mceCharMap":
- var template = new Array();
-
- template['file'] = 'charmap.htm';
- template['width'] = 550;
- template['height'] = 280;
-
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
- //mceCharMap
- return true;
-
- case "mceInsertAnchor":
- var template = new Array();
-
- template['file'] = 'anchor.htm';
- template['width'] = 320;
- template['height'] = 130;
-
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", name : TinyMCE_advanced_anchorName, action : (TinyMCE_advanced_anchorName == "" ? "insert" : "update")});
- return true;
-
- case "mceNewDocument":
- if (confirm(tinyMCE.getLang('lang_newdocument')))
- tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, '');
-
- return true;
- }
-
- // Default behavior
- return false;
-}
-
-/**
- * Editor instance template function.
- */
-function TinyMCE_advanced_getEditorTemplate(settings, editorId)
-{
- function removeFromArray(in_array, remove_array)
- {
- var outArray = new Array();
-
- for (var i=0; i ';
- var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout");
-
- // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
- var styleSelectHTML = '';
- if (settings['theme_advanced_styles'])
- {
- var stylesAr = settings['theme_advanced_styles'].split(';');
-
- for (var i=0; i' + key + '';
- }
-
- TinyMCE_advanced_autoImportCSSClasses = false;
- }
-
- switch(layoutManager)
- {
- case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
- var toolbarHTML = "";
- var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
- var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center");
- var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity
- var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation);
-
- // Render row 1
- var buttonNamesRow1 = tinyMCE.getParam("theme_advanced_buttons1", "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect", true, ',');
- buttonNamesRow1 = removeFromArray(buttonNamesRow1, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
- buttonNamesRow1 = addToArray(buttonNamesRow1, tinyMCE.getParam("theme_advanced_buttons1_add", "", true, ','));
- buttonNamesRow1 = addToArray(tinyMCE.getParam("theme_advanced_buttons1_add_before", "", true, ','), buttonNamesRow1);
-
- for (var i=0; i 0)
- {
- toolbarHTML += " ";
- deltaHeight -= 23;
- }
-
- // Render row 2
- var buttonNamesRow2 = tinyMCE.getParam("theme_advanced_buttons2", "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code", true, ',');
- buttonNamesRow2 = removeFromArray(buttonNamesRow2, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
- buttonNamesRow2 = addToArray(buttonNamesRow2, tinyMCE.getParam("theme_advanced_buttons2_add", "", true, ','));
- buttonNamesRow2 = addToArray(tinyMCE.getParam("theme_advanced_buttons2_add_before", "", true, ','), buttonNamesRow2);
-
- for (var i=0; i 0)
- {
- toolbarHTML += " ";
- deltaHeight -= 23;
- }
-
- // Render row 3
- var buttonNamesRow3 = tinyMCE.getParam("theme_advanced_buttons3", "hr,removeformat,visualaid,separator,sub,sup,separator,charmap", true, ',');
- buttonNamesRow3 = removeFromArray(buttonNamesRow3, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
- buttonNamesRow3 = addToArray(buttonNamesRow3, tinyMCE.getParam("theme_advanced_buttons3_add", "", true, ','));
- buttonNamesRow3 = addToArray(tinyMCE.getParam("theme_advanced_buttons3_add_before", "", true, ','), buttonNamesRow3);
-
- for (var i=0; i 0)
- {
- deltaHeight -= 20;
- }
-
- // Setup template html
- template['html'] = '';
-
- if (toolbarLocation == "top")
- {
- template['html'] += '| ' + toolbarHTML + ' | ';
- }
-
- if (statusbarLocation == "top")
- {
- template['html'] += '| ' + statusbarHTML + ' | ';
- deltaHeight -= 23;
- }
-
- template['html'] += ' | ';
-
- if (toolbarLocation == "bottom")
- {
- template['html'] += '| ' + toolbarHTML + ' | ';
- }
-
- // External toolbar changes
- if (toolbarLocation == "external")
- {
- var bod = document.body;
- var elm = document.createElement ("div");
-
- toolbarHTML = tinyMCE.replaceVars(toolbarHTML, tinyMCE.settings);
- toolbarHTML = tinyMCE.replaceVars(toolbarHTML, tinyMCELang);
- toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML);
- toolbarHTML = tinyMCE.replaceVar(toolbarHTML, "editor_id", editorId);
- toolbarHTML = tinyMCE.replaceVar(toolbarHTML, "default_document", tinyMCE.baseURL + "/blank.htm");
-
- elm.className = "mceToolbarExternal";
- elm.id = "mceExternalToolbar";
- elm.innerHTML = '';
- bod.appendChild (elm);
- bod.style.marginTop = elm.offsetHeight + "px";
-
- tinyMCE.isExternalToolbar = true;
-
- //template['html'] = '' + template["html"];
- }
- else
- {
- tinyMCE.isExternalToolbar = false;
- }
-
- if (statusbarLocation == "bottom")
- {
- template['html'] += '| ' + statusbarHTML + ' | ';
- deltaHeight -= 23;
- }
-
- template['html'] += ' ';
- //"SimpleLayout"
- break;
-
- case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom.
- template['html'] = '';
-
- var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ",");
- var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container");
- var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center");
-
- //Render Containers:
- for (var i = 0; i < containers.length; i++)
- {
- if (containers[i] == "mceEditor") //Exceptions for mceEditor and ...
- {
- template['html'] += '| \
- \
- | ';
- }
- else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath:
- {
- var pathClass = "mceStatusbar";
-
- if (i == containers.length-1)
- {
- pathClass = "mceStatusbarBottom";
- }
- else if (i == 0)
- {
- pathClass = "mceStatusbar";
- }
- else
- {
- deltaHeight-=2;
- }
-
- template['html'] += '| ' + statusbarHTML + ' | ';
- deltaHeight -= 22;
- }
- else //Render normal Container:
- {
- var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ',');
- var curContainerHTML = "";
- var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
- var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
-
- for (var j=0; j 0)
- {
- curContainerHTML += " ";
- deltaHeight -= 23;
- }
-
- template['html'] += '| ' + curContainerHTML + ' | ';
- }
- }
-
- template['html'] += ' ';
- //RowLayout
- break;
-
- case "BorderLayout" : //will be like java.awt.BorderLayout of SUN Java...
- // Not implemented yet...
- break;
-
- case "CustomLayout" : //User defined layout callback...
- var customLayout = tinyMCE.getParam("theme_advanced_custom_layout","");
-
- if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined")
- {
- template = eval(customLayout + "(template);");
- }
- break;
-
- default:
- alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');
- //CustomLayout
- break;
- }
-
- template['html'] += '';
- template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
- template['delta_width'] = 0;
- template['delta_height'] = deltaHeight;
-
- return template;
-}
-
-/**
- * Starts/stops the editor resizing.
- */
-function TinyMCE_advanced_setResizing(e, editor_id, state) {
- e = typeof(e) == "undefined" ? window.event : e;
-
- var resizer = TinyMCE_advanced_resizer;
- var editorContainer = document.getElementById(editor_id + '_parent');
- var editorArea = document.getElementById(editor_id + '_parent').firstChild;
- var resizeBox = document.getElementById(editor_id + '_resize_box');
- var inst = tinyMCE.getInstanceById(editor_id);
-
- if (state) {
- // Place box over editor area
- var width = editorArea.clientWidth;
- var height = editorArea.clientHeight;
-
- if (tinyMCE.isMSIE) {
- width += 2;
- height += 2;
- }
-
- resizeBox.style.width = width + "px";
- resizeBox.style.height = height + "px";
-
- resizer.iframeWidth = inst.iframeElement.clientWidth;
- resizer.iframeHeight = inst.iframeElement.clientHeight;
-
- // Hide editor and show resize box
- editorArea.style.display = "none";
- resizeBox.style.display = "block";
-
- // Add event handlers, only once
- if (!resizer.eventHandlers) {
- if (tinyMCE.isMSIE)
- tinyMCE.addEvent(document, "mousemove", TinyMCE_advanced_resizeEventHandler);
- else
- tinyMCE.addEvent(window, "mousemove", TinyMCE_advanced_resizeEventHandler);
-
- tinyMCE.addEvent(document, "mouseup", TinyMCE_advanced_resizeEventHandler);
-
- resizer.eventHandlers = true;
- }
-
- resizer.resizing = true;
- resizer.downX = e.screenX;
- resizer.downY = e.screenY;
- resizer.width = parseInt(resizeBox.style.width);
- resizer.height = parseInt(resizeBox.style.height);
- resizer.editorId = editor_id;
- resizer.resizeBox = resizeBox;
- resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", false);
- } else {
- resizer.resizing = false;
- resizeBox.style.display = "none";
- editorArea.style.display = "block";
- inst.getDoc().designMode = "On";
- }
-}
-
-/**
- * Handles resizing events.
- */
-function TinyMCE_advanced_resizeEventHandler(e) {
- var resizer = TinyMCE_advanced_resizer;
-
- // Do nothing
- if (!resizer.resizing)
- return;
-
- e = typeof(e) == "undefined" ? window.event : e;
-
- var dx = e.screenX - resizer.downX;
- var dy = e.screenY - resizer.downY;
- var resizeBox = resizer.resizeBox;
- var editorId = resizer.editorId;
-
- switch (e.type) {
- case "mousemove":
- if (resizer.horizontal)
- resizeBox.style.width = (resizer.width + dx) + "px";
-
- resizeBox.style.height = (resizer.height + dy) + "px";
- break;
-
- case "mouseup":
- resizer.resizing = false;
- TinyMCE_advanced_setResizing(e, editorId, false);
-
- var editorContainer = document.getElementById(editorId + '_parent');
- var tableElm = editorContainer.firstChild;
- var inst = tinyMCE.getInstanceById(editorId);
- var width = resizer.width + dx;
- var height = resizer.height + dy;
-
- if (resizer.horizontal)
- var iframeWidth = resizer.iframeWidth + dx;
-
- var iframeHeight = resizer.iframeHeight + dy;
-
- if (tinyMCE.isGecko) {
- width += 2;
- height += 2;
- }
-
- // Range check
- if (iframeHeight < 40)
- return;
-
- // Resize editor container
- if (resizer.horizontal)
- tableElm.style.width = width + "px";
-
- tableElm.style.height = height + "px";
-
- // Resize iframe
- if (resizer.horizontal)
- inst.iframeElement.style.width = iframeWidth + "px";
-
- // Fixes 100% bug
- if (tinyMCE.isGecko && !resizer.horizontal)
- inst.iframeElement.style.width = resizer.iframeWidth + "px";
-
- inst.iframeElement.style.height = iframeHeight + "px";
-
- // Is it to small, make it bigger again
- if (resizer.horizontal) {
- var tableBodyElm = tableElm.firstChild;
- var minIframeWidth = tableBodyElm.scrollWidth;
- if (inst.iframeElement.clientWidth < minIframeWidth) {
- dx = minIframeWidth - inst.iframeElement.clientWidth;
-
- tableElm.style.width = (width + dx) + "px";
- inst.iframeElement.style.width = (iframeWidth + dx) + "px";
- }
- }
-
- break;
- }
-}
-
-/**
- * Insert link template function.
- */
-function TinyMCE_advanced_getInsertLinkTemplate()
-{
- var template = new Array();
-
- template['file'] = 'link.htm';
- template['width'] = 300;
- template['height'] = 150;
-
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0);
-
- return template;
-};
-
-/**
- * Insert image template function.
- */
-function TinyMCE_advanced_getInsertImageTemplate()
-{
- var template = new Array();
-
- template['file'] = 'image.htm?src={$src}';
- template['width'] = 340;
- template['height'] = 280;
-
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
-
- return template;
-};
-
-/**
- * Node change handler.
- */
-function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
- undo_levels, visual_aid, any_selection)
-{
- function selectByValue(select_elm, value)
- {
- if (select_elm)
- {
- for (var i=0; i=0; i--)
- {
- var nodeName = path[i].nodeName.toLowerCase();
- var nodeData = "";
-
- if (nodeName == "b")
- {
- nodeName = "strong";
- }
-
- if (nodeName == "i")
- {
- nodeName = "em";
- }
-
- if (getAttrib(path[i], 'id') != "")
- {
- nodeData += "id: " + path[i].getAttribute('id') + " ";
- }
-
- var className = tinyMCE.getVisualAidClass(getAttrib(path[i], "className"), false);
- if (className != "")
- {
- nodeData += "class: " + className + " ";
- }
-
- if (getAttrib(path[i], 'src') != "")
- {
- nodeData += "src: " + path[i].getAttribute('src') + " ";
- }
-
- if (getAttrib(path[i], 'href') != "")
- {
- nodeData += "href: " + path[i].getAttribute('href') + " ";
- }
-
- if (nodeName == "img" && getAttrib(path[i], 'name') == "mce_plugin_flash")
- {
- nodeName = "flash";
- nodeData = "";
- }
-
- if (getAttrib(path[i], 'name').indexOf("mce_") != 0)
- {
- var className = tinyMCE.getVisualAidClass(getAttrib(path[i], "className"), false);
- if (className != "")
- {
- nodeName += "." + className;
- }
- }
-
- if (tinyMCE.isMSIE)
- {
- html += '' + nodeName + '';
- }
- else
- {
- html += '' + nodeName + '';
- }
-
- if (i > 0)
- {
- html += " » ";
- }
- }
-
- pathElm.innerHTML = tinyMCE.getLang('lang_theme_path') + ": " + html + " ";
- }
-
- // Get element color
- var colorElm = tinyMCE.getParentElement(node, "font", "color");
-
- if (colorElm)
- {
- TinyMCE_advanced_foreColor = "" + colorElm.color.toUpperCase();
- }
-
- // Reset old states
- tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_justifyright', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_justifycenter', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_justifyfull', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_anchor', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_link', 'mceButtonDisabled', true);
- tinyMCE.switchClassSticky(editor_id + '_unlink', 'mceButtonDisabled', true);
- tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonDisabled', true);
- tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonNormal');
- tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonNormal');
-
- // Get anchor name
- var anchorName = tinyMCE.getParentElement(node, "a", "name");
-
- TinyMCE_advanced_anchorName = "";
-
- if (anchorName)
- {
- TinyMCE_advanced_anchorName = anchorName.getAttribute("name");
- tinyMCE.switchClassSticky(editor_id + '_anchor', 'mceButtonSelected');
- }
-
- // Get link
- var anchorLink = tinyMCE.getParentElement(node, "a", "href");
-
- if (anchorLink || any_selection)
- {
- tinyMCE.switchClassSticky(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal', false);
- tinyMCE.switchClassSticky(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal', false);
- }
-
- // Handle visual aid
- tinyMCE.switchClassSticky(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal', false);
-
- if (undo_levels != -1)
- {
- tinyMCE.switchClassSticky(editor_id + '_undo', 'mceButtonDisabled', true);
- tinyMCE.switchClassSticky(editor_id + '_redo', 'mceButtonDisabled', true);
- }
-
- // Within li, blockquote
- if (tinyMCE.getParentElement(node, "li,blockquote"))
- {
- tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonNormal', false);
- }
-
- // Has redo levels
- if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0))
- {
- tinyMCE.switchClassSticky(editor_id + '_redo', 'mceButtonNormal', false);
- }
-
- // Has undo levels
- if (undo_index != -1 && (undo_index > 0 && undo_levels > 0))
- {
- tinyMCE.switchClassSticky(editor_id + '_undo', 'mceButtonNormal', false);
- }
-
- // Select class in select box
- var selectElm = document.getElementById(editor_id + "_styleSelect");
-
- if (selectElm)
- {
- TinyMCE_advanced_setupCSSClasses(editor_id);
-
- classNode = node;
- breakOut = false;
- var index = 0;
-
- do
- {
- if (classNode && classNode.className)
- {
- for (var i=0; i");
- }
- else
- {
- selectByValue(selectElm, "");
- }
- }
-
- // Select fontselect
- var selectElm = document.getElementById(editor_id + "_fontNameSelect");
-
- if (selectElm)
- {
- var elm = tinyMCE.getParentElement(node, "font", "face");
-
- if (elm)
- {
- selectByValue(selectElm, elm.getAttribute("face"));
- }
- else
- {
- selectByValue(selectElm, "");
- }
- }
-
- // Select fontsize
- var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
-
- if (selectElm)
- {
- var elm = tinyMCE.getParentElement(node, "font", "size");
-
- if (elm && getAttrib(elm, "size") != "")
- {
- selectByValue(selectElm, elm.getAttribute("size"));
- }
- else
- {
- selectByValue(selectElm, "0");
- }
- }
-
- // Handle align attributes
- alignNode = node;
- breakOut = false;
- do
- {
- if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
- {
- continue;
- }
-
- switch (alignNode.getAttribute('align').toLowerCase())
- {
- case "left":
- tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonSelected');
- breakOut = true;
- break;
-
- case "right":
- tinyMCE.switchClassSticky(editor_id + '_justifyright', 'mceButtonSelected');
- breakOut = true;
- break;
-
- case "middle":
- case "center":
- tinyMCE.switchClassSticky(editor_id + '_justifycenter', 'mceButtonSelected');
- breakOut = true;
- break;
-
- case "justify":
- tinyMCE.switchClassSticky(editor_id + '_justifyfull', 'mceButtonSelected');
- breakOut = true;
- break;
- }
- } while (!breakOut && (alignNode = alignNode.parentNode));
-
- // Do special text
- if (tinyMCE.isGecko && node.nodeType == 3)
- {
- var inst = tinyMCE.getInstanceById(editor_id);
- var doc = inst.getDoc();
-
- if (doc.queryCommandState("Bold"))
- {
- tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
- }
-
- if (doc.queryCommandState("Italic"))
- {
- tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
- }
-
- if (doc.queryCommandState("Underline") &&
- (node.parentNode == null || node.parentNode.nodeName != "A"))
- {
- tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
- }
-
- if (doc.queryCommandState("Strikethrough"))
- {
- tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
- }
- }
-
- // Handle elements
- do
- {
- switch (node.nodeName.toLowerCase())
- {
- case "b":
- case "strong":
- tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
- break;
-
- case "i":
- case "em":
- tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
- break;
-
- case "u":
- tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
- break;
-
- case "strike":
- tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
- break;
-
- case "ul":
- tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');
- break;
-
- case "ol":
- tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');
- break;
-
- case "sub":
- tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonSelected');
- break;
-
- case "sup":
- tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonSelected');
- break;
-
- case "hr":
- tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonSelected');
- break;
-
- case "img":
- if (getAttrib(node, 'name').indexOf('mce_') != 0)
- {
- tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonSelected');
- }
- break;
- }
- } while ((node = node.parentNode));
-};
-
-// This function auto imports CSS classes into the class selection droplist
-function TinyMCE_advanced_setupCSSClasses(editor_id)
-{
- if (!TinyMCE_advanced_autoImportCSSClasses)
- {
- return;
- }
-
- var selectElm = document.getElementById(editor_id + '_styleSelect');
-
- if (selectElm && selectElm.getAttribute('cssImported') != 'true')
- {
- var csses = tinyMCE.getCSSClasses(editor_id);
- if (csses && selectElm)
- {
- for (var i=0; i 0)
- {
- selectElm.setAttribute('cssImported', 'true');
- }
- }
-};
+/* Import theme specific language pack */
+tinyMCE.importThemeLanguagePack('advanced');
+
+// Variable declarations
+var TinyMCE_advanced_autoImportCSSClasses = true;
+var TinyMCE_advanced_foreColor = "#000000";
+var TinyMCE_advanced_anchorName = "";
+var TinyMCE_advanced_resizer = new Object();
+var TinyMCE_advanced_buttons = [
+ // Control id, button img, button title, command, user_interface, value
+ ['bold', '{$lang_bold_img}', '{$lang_bold_desc}', 'Bold'],
+ ['italic', '{$lang_italic_img}', '{$lang_italic_desc}', 'Italic'],
+ ['underline', '{$lang_underline_img}', '{$lang_underline_desc}', 'Underline'],
+ ['strikethrough', 'strikethrough.gif', '{$lang_striketrough_desc}', 'Strikethrough'],
+ ['justifyleft', 'left.gif', '{$lang_justifyleft_desc}', 'JustifyLeft'],
+ ['justifycenter', 'center.gif', '{$lang_justifycenter_desc}', 'JustifyCenter'],
+ ['justifyright', 'right.gif', '{$lang_justifyright_desc}', 'JustifyRight'],
+ ['justifyfull', 'full.gif', '{$lang_justifyfull_desc}', 'JustifyFull'],
+ ['bullist', 'bullist.gif', '{$lang_bullist_desc}', 'InsertUnorderedList'],
+ ['numlist', 'numlist.gif', '{$lang_numlist_desc}', 'InsertOrderedList'],
+ ['outdent', 'outdent.gif', '{$lang_outdent_desc}', 'Outdent'],
+ ['indent', 'indent.gif', '{$lang_indent_desc}', 'Indent'],
+ ['cut', 'cut.gif', '{$lang_cut_desc}', 'Cut'],
+ ['copy', 'copy.gif', '{$lang_copy_desc}', 'Copy'],
+ ['paste', 'paste.gif', '{$lang_paste_desc}', 'Paste'],
+ ['undo', 'undo.gif', '{$lang_undo_desc}', 'Undo'],
+ ['redo', 'redo.gif', '{$lang_redo_desc}', 'Redo'],
+ ['link', 'link.gif', '{$lang_link_desc}', 'mceLink', true],
+ ['unlink', 'unlink.gif', '{$lang_unlink_desc}', 'unlink'],
+ ['image', 'image.gif', '{$lang_image_desc}', 'mceImage', true],
+ ['cleanup', 'cleanup.gif', '{$lang_cleanup_desc}', 'mceCleanup'],
+ ['help', 'help.gif', '{$lang_help_desc}', 'mceHelp'],
+ ['code', 'code.gif', '{$lang_theme_code_desc}', 'mceCodeEditor'],
+ ['hr', 'hr.gif', '{$lang_theme_hr_desc}', 'inserthorizontalrule'],
+ ['removeformat', 'removeformat.gif', '{$lang_theme_removeformat_desc}', 'removeformat'],
+ ['sub', 'sub.gif', '{$lang_theme_sub_desc}', 'subscript'],
+ ['sup', 'sup.gif', '{$lang_theme_sup_desc}', 'superscript'],
+ ['forecolor', 'forecolor.gif', '{$lang_theme_forecolor_desc}', 'mceForeColor', true],
+ ['backcolor', 'backcolor.gif', '{$lang_theme_backcolor_desc}', 'mceBackColor', true],
+ ['charmap', 'charmap.gif', '{$lang_theme_charmap_desc}', 'mceCharMap'],
+ ['visualaid', 'visualaid.gif', '{$lang_theme_visualaid_desc}', 'mceToggleVisualAid'],
+ ['anchor', 'anchor.gif', '{$lang_theme_anchor_desc}', 'mceInsertAnchor'],
+ ['newdocument', 'newdocument.gif', '{$lang_newdocument_desc}', 'mceNewDocument']
+];
+
+/**
+ * Returns HTML code for the specificed control.
+ */
+function TinyMCE_advanced_getControlHTML(button_name)
+{
+ var buttonTileMap = new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif',
+ 'charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif',
+ 'cut.gif','forecolor.gif','full.gif','help.gif','hr.gif',
+ 'image.gif','indent.gif','left.gif','link.gif','numlist.gif',
+ 'outdent.gif','paste.gif','redo.gif','removeformat.gif',
+ 'right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif',
+ 'unlink.gif','visualaid.gif');
+
+ // Lookup button in button list
+ for (var i=0; i';
+ }
+ }
+ }
+
+ // Old style
+ return ' ';
+ }
+ }
+
+ // Custom controlls other than buttons
+ switch (button_name)
+ {
+ case "formatselect":
+ var html = '';
+ //formatselect
+ return html;
+
+ case "styleselect":
+ //styleselect
+ return '';
+
+ case "fontselect":
+ //fontselect
+ return '';
+
+ case "fontsizeselect":
+ //fontsizeselect
+ return '';
+
+ case "|":
+ case "separator":
+ return ' ';
+
+ case "spacer":
+ return ' ';
+
+ case "rowseparator":
+ return ' ';
+ }
+
+ return "";
+}
+
+/**
+ * Theme specific exec command handeling.
+ */
+function TinyMCE_advanced_execCommand(editor_id, element, command, user_interface, value)
+{
+ switch (command)
+ {
+ case "mceForeColor":
+ var template = new Array();
+ var inputColor = TinyMCE_advanced_foreColor;
+
+ if (!inputColor)
+ inputColor = "#000000";
+
+ template['file'] = 'color_picker.htm';
+ template['width'] = 220;
+ template['height'] = 240;
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor});
+ return true;
+
+ case "mceBackColor":
+ var template = new Array();
+ var inputColor = TinyMCE_advanced_foreColor;
+
+ if (!inputColor)
+ {
+ inputColor = "#000000";
+ }
+
+ template['file'] = 'color_picker.htm';
+ template['width'] = 210;
+ template['height'] = 200;
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor});
+ //mceBackColor
+ return true;
+
+ case "mceColorPicker":
+ if (user_interface) {
+ var template = new Array();
+ var inputColor = value['document'].getElementById(value['element_id']).value;
+
+ template['file'] = 'color_picker.htm';
+ template['width'] = 220;
+ template['height'] = 210;
+
+ tinyMCE.lastColorPickerValue = value;
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "mceColorPicker", input_color : inputColor});
+ } else {
+ var savedVal = tinyMCE.lastColorPickerValue;
+ savedVal['document'].getElementById(savedVal['element_id']).value = value;
+ }
+ return true;
+
+ case "mceCodeEditor":
+ var template = new Array();
+
+ template['file'] = 'source_editor.htm';
+ template['width'] = tinyMCE.getParam("theme_advanced_source_editor_width", 500);
+ template['height'] = tinyMCE.getParam("theme_advanced_source_editor_height", 400);
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"});
+ //mceCodeEditor
+ return true;
+
+ case "mceCharMap":
+ var template = new Array();
+
+ template['file'] = 'charmap.htm';
+ template['width'] = 550;
+ template['height'] = 280;
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
+ //mceCharMap
+ return true;
+
+ case "mceInsertAnchor":
+ var template = new Array();
+
+ template['file'] = 'anchor.htm';
+ template['width'] = 320;
+ template['height'] = 130;
+
+ tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", name : TinyMCE_advanced_anchorName, action : (TinyMCE_advanced_anchorName == "" ? "insert" : "update")});
+ return true;
+
+ case "mceNewDocument":
+ if (confirm(tinyMCE.getLang('lang_newdocument')))
+ tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, '');
+
+ return true;
+ }
+
+ // Default behavior
+ return false;
+}
+
+/**
+ * Editor instance template function.
+ */
+function TinyMCE_advanced_getEditorTemplate(settings, editorId)
+{
+ function removeFromArray(in_array, remove_array)
+ {
+ var outArray = new Array();
+
+ for (var i=0; i ';
+ var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout");
+
+ // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
+ var styleSelectHTML = '';
+ if (settings['theme_advanced_styles'])
+ {
+ var stylesAr = settings['theme_advanced_styles'].split(';');
+
+ for (var i=0; i' + key + '';
+ }
+
+ TinyMCE_advanced_autoImportCSSClasses = false;
+ }
+
+ switch(layoutManager)
+ {
+ case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
+ var toolbarHTML = "";
+ var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
+ var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center");
+ var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity
+ var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation);
+
+ // Render row 1
+ var buttonNamesRow1 = tinyMCE.getParam("theme_advanced_buttons1", "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect", true, ',');
+ buttonNamesRow1 = removeFromArray(buttonNamesRow1, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
+ buttonNamesRow1 = addToArray(buttonNamesRow1, tinyMCE.getParam("theme_advanced_buttons1_add", "", true, ','));
+ buttonNamesRow1 = addToArray(tinyMCE.getParam("theme_advanced_buttons1_add_before", "", true, ','), buttonNamesRow1);
+
+ for (var i=0; i 0)
+ {
+ toolbarHTML += " ";
+ deltaHeight -= 23;
+ }
+
+ // Render row 2
+ var buttonNamesRow2 = tinyMCE.getParam("theme_advanced_buttons2", "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code", true, ',');
+ buttonNamesRow2 = removeFromArray(buttonNamesRow2, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
+ buttonNamesRow2 = addToArray(buttonNamesRow2, tinyMCE.getParam("theme_advanced_buttons2_add", "", true, ','));
+ buttonNamesRow2 = addToArray(tinyMCE.getParam("theme_advanced_buttons2_add_before", "", true, ','), buttonNamesRow2);
+
+ for (var i=0; i 0)
+ {
+ toolbarHTML += " ";
+ deltaHeight -= 23;
+ }
+
+ // Render row 3
+ var buttonNamesRow3 = tinyMCE.getParam("theme_advanced_buttons3", "hr,removeformat,visualaid,separator,sub,sup,separator,charmap", true, ',');
+ buttonNamesRow3 = removeFromArray(buttonNamesRow3, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
+ buttonNamesRow3 = addToArray(buttonNamesRow3, tinyMCE.getParam("theme_advanced_buttons3_add", "", true, ','));
+ buttonNamesRow3 = addToArray(tinyMCE.getParam("theme_advanced_buttons3_add_before", "", true, ','), buttonNamesRow3);
+
+ for (var i=0; i 0)
+ {
+ deltaHeight -= 20;
+ }
+
+ // Setup template html
+ template['html'] = '';
+
+ if (toolbarLocation == "top")
+ {
+ template['html'] += '| ' + toolbarHTML + ' | ';
+ }
+
+ if (statusbarLocation == "top")
+ {
+ template['html'] += '| ' + statusbarHTML + ' | ';
+ deltaHeight -= 23;
+ }
+
+ template['html'] += ' | ';
+
+ if (toolbarLocation == "bottom")
+ {
+ template['html'] += '| ' + toolbarHTML + ' | ';
+ }
+
+ // External toolbar changes
+ if (toolbarLocation == "external")
+ {
+ var bod = document.body;
+ var elm = document.createElement ("div");
+
+ toolbarHTML = tinyMCE.replaceVars(toolbarHTML, tinyMCE.settings);
+ toolbarHTML = tinyMCE.replaceVars(toolbarHTML, tinyMCELang);
+ toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML);
+ toolbarHTML = tinyMCE.replaceVar(toolbarHTML, "editor_id", editorId);
+ toolbarHTML = tinyMCE.replaceVar(toolbarHTML, "default_document", tinyMCE.baseURL + "/blank.htm");
+
+ elm.className = "mceToolbarExternal";
+ elm.id = "mceExternalToolbar";
+ elm.innerHTML = '';
+ bod.appendChild (elm);
+ bod.style.marginTop = elm.offsetHeight + "px";
+
+ tinyMCE.isExternalToolbar = true;
+
+ //template['html'] = '' + template["html"];
+ }
+ else
+ {
+ tinyMCE.isExternalToolbar = false;
+ }
+
+ if (statusbarLocation == "bottom")
+ {
+ template['html'] += '| ' + statusbarHTML + ' | ';
+ deltaHeight -= 23;
+ }
+
+ template['html'] += ' ';
+ //"SimpleLayout"
+ break;
+
+ case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom.
+ template['html'] = '';
+
+ var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ",");
+ var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container");
+ var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center");
+
+ //Render Containers:
+ for (var i = 0; i < containers.length; i++)
+ {
+ if (containers[i] == "mceEditor") //Exceptions for mceEditor and ...
+ {
+ template['html'] += '| \
+ \
+ | ';
+ }
+ else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath:
+ {
+ var pathClass = "mceStatusbar";
+
+ if (i == containers.length-1)
+ {
+ pathClass = "mceStatusbarBottom";
+ }
+ else if (i == 0)
+ {
+ pathClass = "mceStatusbar";
+ }
+ else
+ {
+ deltaHeight-=2;
+ }
+
+ template['html'] += '| ' + statusbarHTML + ' | ';
+ deltaHeight -= 22;
+ }
+ else //Render normal Container:
+ {
+ var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ',');
+ var curContainerHTML = "";
+ var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
+ var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
+
+ for (var j=0; j 0)
+ {
+ curContainerHTML += " ";
+ deltaHeight -= 23;
+ }
+
+ template['html'] += '| ' + curContainerHTML + ' | ';
+ }
+ }
+
+ template['html'] += ' ';
+ //RowLayout
+ break;
+
+ case "BorderLayout" : //will be like java.awt.BorderLayout of SUN Java...
+ // Not implemented yet...
+ break;
+
+ case "CustomLayout" : //User defined layout callback...
+ var customLayout = tinyMCE.getParam("theme_advanced_custom_layout","");
+
+ if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined")
+ {
+ template = eval(customLayout + "(template);");
+ }
+ break;
+
+ default:
+ alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');
+ //CustomLayout
+ break;
+ }
+
+ template['html'] += '';
+ template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
+ template['delta_width'] = 0;
+ template['delta_height'] = deltaHeight;
+
+ return template;
+}
+
+/**
+ * Starts/stops the editor resizing.
+ */
+function TinyMCE_advanced_setResizing(e, editor_id, state) {
+ e = typeof(e) == "undefined" ? window.event : e;
+
+ var resizer = TinyMCE_advanced_resizer;
+ var editorContainer = document.getElementById(editor_id + '_parent');
+ var editorArea = document.getElementById(editor_id + '_parent').firstChild;
+ var resizeBox = document.getElementById(editor_id + '_resize_box');
+ var inst = tinyMCE.getInstanceById(editor_id);
+
+ if (state) {
+ // Place box over editor area
+ var width = editorArea.clientWidth;
+ var height = editorArea.clientHeight;
+
+ if (tinyMCE.isMSIE) {
+ width += 2;
+ height += 2;
+ }
+
+ resizeBox.style.width = width + "px";
+ resizeBox.style.height = height + "px";
+
+ resizer.iframeWidth = inst.iframeElement.clientWidth;
+ resizer.iframeHeight = inst.iframeElement.clientHeight;
+
+ // Hide editor and show resize box
+ editorArea.style.display = "none";
+ resizeBox.style.display = "block";
+
+ // Add event handlers, only once
+ if (!resizer.eventHandlers) {
+ if (tinyMCE.isMSIE)
+ tinyMCE.addEvent(document, "mousemove", TinyMCE_advanced_resizeEventHandler);
+ else
+ tinyMCE.addEvent(window, "mousemove", TinyMCE_advanced_resizeEventHandler);
+
+ tinyMCE.addEvent(document, "mouseup", TinyMCE_advanced_resizeEventHandler);
+
+ resizer.eventHandlers = true;
+ }
+
+ resizer.resizing = true;
+ resizer.downX = e.screenX;
+ resizer.downY = e.screenY;
+ resizer.width = parseInt(resizeBox.style.width);
+ resizer.height = parseInt(resizeBox.style.height);
+ resizer.editorId = editor_id;
+ resizer.resizeBox = resizeBox;
+ resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", false);
+ } else {
+ resizer.resizing = false;
+ resizeBox.style.display = "none";
+ editorArea.style.display = "block";
+ inst.getDoc().designMode = "On";
+ }
+}
+
+/**
+ * Handles resizing events.
+ */
+function TinyMCE_advanced_resizeEventHandler(e) {
+ var resizer = TinyMCE_advanced_resizer;
+
+ // Do nothing
+ if (!resizer.resizing)
+ return;
+
+ e = typeof(e) == "undefined" ? window.event : e;
+
+ var dx = e.screenX - resizer.downX;
+ var dy = e.screenY - resizer.downY;
+ var resizeBox = resizer.resizeBox;
+ var editorId = resizer.editorId;
+
+ switch (e.type) {
+ case "mousemove":
+ if (resizer.horizontal)
+ resizeBox.style.width = (resizer.width + dx) + "px";
+
+ resizeBox.style.height = (resizer.height + dy) + "px";
+ break;
+
+ case "mouseup":
+ resizer.resizing = false;
+ TinyMCE_advanced_setResizing(e, editorId, false);
+
+ var editorContainer = document.getElementById(editorId + '_parent');
+ var tableElm = editorContainer.firstChild;
+ var inst = tinyMCE.getInstanceById(editorId);
+ var width = resizer.width + dx;
+ var height = resizer.height + dy;
+
+ if (resizer.horizontal)
+ var iframeWidth = resizer.iframeWidth + dx;
+
+ var iframeHeight = resizer.iframeHeight + dy;
+
+ if (tinyMCE.isGecko) {
+ width += 2;
+ height += 2;
+ }
+
+ // Range check
+ if (iframeHeight < 40)
+ return;
+
+ // Resize editor container
+ if (resizer.horizontal)
+ tableElm.style.width = width + "px";
+
+ tableElm.style.height = height + "px";
+
+ // Resize iframe
+ if (resizer.horizontal)
+ inst.iframeElement.style.width = iframeWidth + "px";
+
+ // Fixes 100% bug
+ if (tinyMCE.isGecko && !resizer.horizontal)
+ inst.iframeElement.style.width = resizer.iframeWidth + "px";
+
+ inst.iframeElement.style.height = iframeHeight + "px";
+
+ // Is it to small, make it bigger again
+ if (resizer.horizontal) {
+ var tableBodyElm = tableElm.firstChild;
+ var minIframeWidth = tableBodyElm.scrollWidth;
+ if (inst.iframeElement.clientWidth < minIframeWidth) {
+ dx = minIframeWidth - inst.iframeElement.clientWidth;
+
+ tableElm.style.width = (width + dx) + "px";
+ inst.iframeElement.style.width = (iframeWidth + dx) + "px";
+ }
+ }
+
+ break;
+ }
+}
+
+/**
+ * Insert link template function.
+ */
+function TinyMCE_advanced_getInsertLinkTemplate()
+{
+ var template = new Array();
+
+ template['file'] = 'link.htm';
+ template['width'] = 300;
+ template['height'] = 150;
+
+ // Language specific width and height addons
+ template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0);
+
+ return template;
+};
+
+/**
+ * Insert image template function.
+ */
+function TinyMCE_advanced_getInsertImageTemplate()
+{
+ var template = new Array();
+
+ template['file'] = 'image.htm?src={$src}';
+ template['width'] = 340;
+ template['height'] = 280;
+
+ // Language specific width and height addons
+ template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
+
+ return template;
+};
+
+/**
+ * Node change handler.
+ */
+function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index,
+ undo_levels, visual_aid, any_selection)
+{
+ function selectByValue(select_elm, value)
+ {
+ if (select_elm)
+ {
+ for (var i=0; i=0; i--)
+ {
+ var nodeName = path[i].nodeName.toLowerCase();
+ var nodeData = "";
+
+ if (nodeName == "b")
+ {
+ nodeName = "strong";
+ }
+
+ if (nodeName == "i")
+ {
+ nodeName = "em";
+ }
+
+ if (getAttrib(path[i], 'id') != "")
+ {
+ nodeData += "id: " + path[i].getAttribute('id') + " ";
+ }
+
+ var className = tinyMCE.getVisualAidClass(getAttrib(path[i], "className"), false);
+ if (className != "")
+ {
+ nodeData += "class: " + className + " ";
+ }
+
+ if (getAttrib(path[i], 'src') != "")
+ {
+ nodeData += "src: " + path[i].getAttribute('src') + " ";
+ }
+
+ if (getAttrib(path[i], 'href') != "")
+ {
+ nodeData += "href: " + path[i].getAttribute('href') + " ";
+ }
+
+ if (nodeName == "img" && getAttrib(path[i], 'name') == "mce_plugin_flash")
+ {
+ nodeName = "flash";
+ nodeData = "";
+ }
+
+ if (getAttrib(path[i], 'name').indexOf("mce_") != 0)
+ {
+ var className = tinyMCE.getVisualAidClass(getAttrib(path[i], "className"), false);
+ if (className != "")
+ {
+ nodeName += "." + className;
+ }
+ }
+
+ if (tinyMCE.isMSIE)
+ {
+ html += '' + nodeName + '';
+ }
+ else
+ {
+ html += '' + nodeName + '';
+ }
+
+ if (i > 0)
+ {
+ html += " » ";
+ }
+ }
+
+ pathElm.innerHTML = tinyMCE.getLang('lang_theme_path') + ": " + html + " ";
+ }
+
+ // Get element color
+ var colorElm = tinyMCE.getParentElement(node, "font", "color");
+
+ if (colorElm)
+ {
+ TinyMCE_advanced_foreColor = "" + colorElm.color.toUpperCase();
+ }
+
+ // Reset old states
+ tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_justifyright', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_justifycenter', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_justifyfull', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_anchor', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_link', 'mceButtonDisabled', true);
+ tinyMCE.switchClassSticky(editor_id + '_unlink', 'mceButtonDisabled', true);
+ tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonDisabled', true);
+ tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonNormal');
+ tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonNormal');
+
+ // Get anchor name
+ var anchorName = tinyMCE.getParentElement(node, "a", "name");
+
+ TinyMCE_advanced_anchorName = "";
+
+ if (anchorName)
+ {
+ TinyMCE_advanced_anchorName = anchorName.getAttribute("name");
+ tinyMCE.switchClassSticky(editor_id + '_anchor', 'mceButtonSelected');
+ }
+
+ // Get link
+ var anchorLink = tinyMCE.getParentElement(node, "a", "href");
+
+ if (anchorLink || any_selection)
+ {
+ tinyMCE.switchClassSticky(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal', false);
+ tinyMCE.switchClassSticky(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal', false);
+ }
+
+ // Handle visual aid
+ tinyMCE.switchClassSticky(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal', false);
+
+ if (undo_levels != -1)
+ {
+ tinyMCE.switchClassSticky(editor_id + '_undo', 'mceButtonDisabled', true);
+ tinyMCE.switchClassSticky(editor_id + '_redo', 'mceButtonDisabled', true);
+ }
+
+ // Within li, blockquote
+ if (tinyMCE.getParentElement(node, "li,blockquote"))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_outdent', 'mceButtonNormal', false);
+ }
+
+ // Has redo levels
+ if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_redo', 'mceButtonNormal', false);
+ }
+
+ // Has undo levels
+ if (undo_index != -1 && (undo_index > 0 && undo_levels > 0))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_undo', 'mceButtonNormal', false);
+ }
+
+ // Select class in select box
+ var selectElm = document.getElementById(editor_id + "_styleSelect");
+
+ if (selectElm)
+ {
+ TinyMCE_advanced_setupCSSClasses(editor_id);
+
+ classNode = node;
+ breakOut = false;
+ var index = 0;
+
+ do
+ {
+ if (classNode && classNode.className)
+ {
+ for (var i=0; i");
+ }
+ else
+ {
+ selectByValue(selectElm, "");
+ }
+ }
+
+ // Select fontselect
+ var selectElm = document.getElementById(editor_id + "_fontNameSelect");
+
+ if (selectElm)
+ {
+ var elm = tinyMCE.getParentElement(node, "font", "face");
+
+ if (elm)
+ {
+ selectByValue(selectElm, elm.getAttribute("face"));
+ }
+ else
+ {
+ selectByValue(selectElm, "");
+ }
+ }
+
+ // Select fontsize
+ var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
+
+ if (selectElm)
+ {
+ var elm = tinyMCE.getParentElement(node, "font", "size");
+
+ if (elm && getAttrib(elm, "size") != "")
+ {
+ selectByValue(selectElm, elm.getAttribute("size"));
+ }
+ else
+ {
+ selectByValue(selectElm, "0");
+ }
+ }
+
+ // Handle align attributes
+ alignNode = node;
+ breakOut = false;
+ do
+ {
+ if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
+ {
+ continue;
+ }
+
+ switch (alignNode.getAttribute('align').toLowerCase())
+ {
+ case "left":
+ tinyMCE.switchClassSticky(editor_id + '_justifyleft', 'mceButtonSelected');
+ breakOut = true;
+ break;
+
+ case "right":
+ tinyMCE.switchClassSticky(editor_id + '_justifyright', 'mceButtonSelected');
+ breakOut = true;
+ break;
+
+ case "middle":
+ case "center":
+ tinyMCE.switchClassSticky(editor_id + '_justifycenter', 'mceButtonSelected');
+ breakOut = true;
+ break;
+
+ case "justify":
+ tinyMCE.switchClassSticky(editor_id + '_justifyfull', 'mceButtonSelected');
+ breakOut = true;
+ break;
+ }
+ } while (!breakOut && (alignNode = alignNode.parentNode));
+
+ // Do special text
+ if (tinyMCE.isGecko && node.nodeType == 3)
+ {
+ var inst = tinyMCE.getInstanceById(editor_id);
+ var doc = inst.getDoc();
+
+ if (doc.queryCommandState("Bold"))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
+ }
+
+ if (doc.queryCommandState("Italic"))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
+ }
+
+ if (doc.queryCommandState("Underline") &&
+ (node.parentNode == null || node.parentNode.nodeName != "A"))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
+ }
+
+ if (doc.queryCommandState("Strikethrough"))
+ {
+ tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
+ }
+ }
+
+ // Handle elements
+ do
+ {
+ switch (node.nodeName.toLowerCase())
+ {
+ case "b":
+ case "strong":
+ tinyMCE.switchClassSticky(editor_id + '_bold', 'mceButtonSelected');
+ break;
+
+ case "i":
+ case "em":
+ tinyMCE.switchClassSticky(editor_id + '_italic', 'mceButtonSelected');
+ break;
+
+ case "u":
+ tinyMCE.switchClassSticky(editor_id + '_underline', 'mceButtonSelected');
+ break;
+
+ case "strike":
+ tinyMCE.switchClassSticky(editor_id + '_strikethrough', 'mceButtonSelected');
+ break;
+
+ case "ul":
+ tinyMCE.switchClassSticky(editor_id + '_bullist', 'mceButtonSelected');
+ break;
+
+ case "ol":
+ tinyMCE.switchClassSticky(editor_id + '_numlist', 'mceButtonSelected');
+ break;
+
+ case "sub":
+ tinyMCE.switchClassSticky(editor_id + '_sub', 'mceButtonSelected');
+ break;
+
+ case "sup":
+ tinyMCE.switchClassSticky(editor_id + '_sup', 'mceButtonSelected');
+ break;
+
+ case "hr":
+ tinyMCE.switchClassSticky(editor_id + '_hr', 'mceButtonSelected');
+ break;
+
+ case "img":
+ if (getAttrib(node, 'name').indexOf('mce_') != 0)
+ {
+ tinyMCE.switchClassSticky(editor_id + '_image', 'mceButtonSelected');
+ }
+ break;
+ }
+ } while ((node = node.parentNode));
+};
+
+// This function auto imports CSS classes into the class selection droplist
+function TinyMCE_advanced_setupCSSClasses(editor_id)
+{
+ if (!TinyMCE_advanced_autoImportCSSClasses)
+ {
+ return;
+ }
+
+ var selectElm = document.getElementById(editor_id + '_styleSelect');
+
+ if (selectElm && selectElm.getAttribute('cssImported') != 'true')
+ {
+ var csses = tinyMCE.getCSSClasses(editor_id);
+ if (csses && selectElm)
+ {
+ for (var i=0; i 0)
+ {
+ selectElm.setAttribute('cssImported', 'true');
+ }
+ }
+};
diff --git a/wp-admin/tinymce/themes/advanced/image.htm b/wp-admin/tinymce/themes/advanced/image.htm
index 7655da135a..2019cee8dd 100644
--- a/wp-admin/tinymce/themes/advanced/image.htm
+++ b/wp-admin/tinymce/themes/advanced/image.htm
@@ -1,188 +1,188 @@
-
-
-{$lang_insert_image_title}
-
-
-
-
-
-
-
-
+
+
+{$lang_insert_image_title}
+
+
+
+
+
+
+
+
diff --git a/wp-admin/tinymce/themes/advanced/images/Thumbs.db b/wp-admin/tinymce/themes/advanced/images/Thumbs.db
index 06cf975f6e..9fdb13bf67 100644
Binary files a/wp-admin/tinymce/themes/advanced/images/Thumbs.db and b/wp-admin/tinymce/themes/advanced/images/Thumbs.db differ
diff --git a/wp-admin/tinymce/themes/advanced/link.htm b/wp-admin/tinymce/themes/advanced/link.htm
index 653f906bad..fa3efb8330 100644
--- a/wp-admin/tinymce/themes/advanced/link.htm
+++ b/wp-admin/tinymce/themes/advanced/link.htm
@@ -1,189 +1,189 @@
-
-
-{$lang_insert_link_title}
-
-
-
-
-
-
-
-
+
+
+{$lang_insert_link_title}
+
+
+
+
+
+
+
+
diff --git a/wp-admin/tinymce/themes/advanced/source_editor.htm b/wp-admin/tinymce/themes/advanced/source_editor.htm
index 235470bcc9..4f68fd498d 100644
--- a/wp-admin/tinymce/themes/advanced/source_editor.htm
+++ b/wp-admin/tinymce/themes/advanced/source_editor.htm
@@ -1,86 +1,86 @@
-
-
-{$lang_theme_code_title}
-
-
-
-
-
-
-
-
+
+
+{$lang_theme_code_title}
+
+
+
+
+
+
+
+
diff --git a/wp-admin/tinymce/tiny_mce.js b/wp-admin/tinymce/tiny_mce.js
index 748a4c190f..144856db5c 100644
--- a/wp-admin/tinymce/tiny_mce.js
+++ b/wp-admin/tinymce/tiny_mce.js
@@ -1,12 +1,12 @@
-/**
- * $RCSfile: tiny_mce.js,v $
- * $Revision: 1.256 $
- * $Date: 2005/06/23 12:04:39 $
- *
- * @author Moxiecode
- * @copyright Copyright © 2004, Moxiecode Systems AB, All rights reserved.
- */
- function TinyMCE(){this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.dialogCounter=0;this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(tinyMCE.isMSIE)var styleSheet=doc.createStyleSheet(css_file);else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))headArr[0].appendChild(elm);}};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"(","(","gi");htm=tinyMCE.regexpReplace(htm,")",")","gi");htm=tinyMCE.regexpReplace(htm,";",";","gi");htm=tinyMCE.regexpReplace(htm,""",""","gi");htm=tinyMCE.regexpReplace(htm,"^","^","gi");if(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._convertOnClick=function(node){if(tinyMCE.isMSIE5)return;var elms=node.getElementsByTagName("a");for(var i=0;i","gi");content=tinyMCE.regexpReplace(content,"\r"," ","gi");content=tinyMCE.regexpReplace(content,"\n"," ","gi");}content=tinyMCE._customCleanup("insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"paste",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings['force_p_newlines'])content=content.replace(new RegExp('<>','g'),"");if(tinyMCE.settings['cleanup_on_startup'])inst.getBody().innerHTML=tinyMCE._cleanupHTML(doc,this.settings,contentElement);else{content=tinyMCE.regexpReplace(content,"","","gi");content=tinyMCE.regexpReplace(content,"","","gi");inst.getBody().innerHTML=content;}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}tinyMCE._convertOnClick(inst.getBody());var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual']);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);inst.startContent=inst.getBody().innerHTML;tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup("insert_to_editor_dom",inst.contentWindow.document.body);};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i");rng.collapse(false);rng.select();tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual']);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(13,45,36,35,33,34,37,38,39,40);var posKey=false;for(var i=0;i18&&e.keyCode!=255)){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;tinyMCE.triggerNodeChange(false);}if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);var keys=new Array(8,46);for(var i=0;i0){for(var i=0;i"+this.convertStringToXML(String.fromCharCode(160))+""+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+""+elementName+">";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="";else output+="<"+elementName+elementAttribs+">";for(var i=0;i ";else output+=""+elementName+">";}else{if(openTag)output+="<"+elementName+elementAttribs+">"+elementName+">";else{output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName.toLowerCase()=="script")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i127)output+=''+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i[ \n\r]* [ \n\r]*',' ','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])alert("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,' ',' ');html=tinyMCE.regexpReplace(html,'
',' ');if(!tinyMCE.isMSIE)html=html.replace(new RegExp('','g'),"");if(tinyMCE.settings['apply_source_formatting']){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n$1$2>\n");html=html.replace(new RegExp(' ','g')," \n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp(' ','g');html=html.replace(re," ");}if(tinyMCE.settings['force_p_newlines']){var re=new RegExp('<>','g');html=html.replace(re,"");}if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');html=tinyMCE._customCleanup(on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk==" "||chk==" "||chk==" "||chk==" "||chk=="")html="";if(tinyMCE.settings["preformatted"])return ""+html+" ";return html;};TinyMCE.prototype.setAttrib=function(element,name,value,no_fix_value){if(!no_fix_value&&value!=null){var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(value!=null&&value!="")element.setAttribute(name,value);else element.removeAttribute(name);if(value!=null&&value!="")element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){this.execCommand("mceAddUndoLevel");if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'mce_onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,''+this.selectedInstance.getSelectedHTML()+'');}else this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,' ');else this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x=strTok2.length){for(var i=0;i=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return url_to_relative;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outputString+="../";for(var i=breakPoint-1;i=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";if(baseURL['protocol'])start+=baseURL['protocol']+"://";if(baseURL['host'])start+=baseURL['host'];if(baseURL['port'])start+=":"+baseURL['port'];if(relURL['query'])end+="?"+relURL['query'];if(relURL['anchor'])end+="#"+relURL['anchor'];if(relative_url.charAt(relative_url.length-1)=="/")end+="/";return start+absPath+end;};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i ';div.innerHTML=html;document.body.appendChild(div);tinyMCE._currentDialog=id;}}}};TinyMCE.prototype.closeDialog=function(){if(tinyMCE.settings["dialog_type"]=="div"){var div=document.getElementById(tinyMCE._currentDialog);if(div)div.parentNode.removeChild(div);}else window.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(element,deep,state){if(!element)return;var tableElement=null;switch(element.nodeName.toLowerCase()){case "table":var oldW=element.style.width;var oldH=element.style.height;element.className=tinyMCE.getVisualAidClass(element.className,state&&element.getAttribute("border")==0);element.style.width=oldW;element.style.height=oldH;for(var y=0;y ','g');html_content=html_content.replace(re," ");}try{doc.body.innerHTML=html_content;}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<\/o:p>"," ");html=tinyMCE.regexpReplace(html," <\/o:p>","");html=tinyMCE.regexpReplace(html,"","");html=tinyMCE.regexpReplace(html,"<\/p>","");html=tinyMCE.regexpReplace(html," <\/p>\r\n <\/p>","");html=tinyMCE.regexpReplace(html," <\/p>"," ");html=tinyMCE.regexpReplace(html," \s*( \s*)?"," ");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?"," ");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j0){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(0).rules : doc.styleSheets[0].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.openFileBrowser=function(field_name,url,type,win){var cb=tinyMCE.getParam("file_browser_callback");this.setWindowArg("window",win);if(eval('typeof('+cb+')')=="undefined")alert("Callback function: "+cb+" could not be found.");else eval(cb+"(field_name, url, type, win);");};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(node.absTop>scrollY&&node.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i "+blockName+"><"+blockName+"> "+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){var nodes=contents.firstChild.childNodes;for(var i=0;i0)rng.pasteHTML(''+rng.htmlText+" ");tinyMCE.triggerNodeChange();return;}}}switch(command){case "mceStoreSelection":this.selectionBookmark=this.getBookmark();break;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);break;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"> <"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,""+this.getSelectedHTML()+"");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case "FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "HiliteColor":if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand('hilitecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('BackColor',false,value);break;case "Cut":case "Copy":case "Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.getLang('lang_clipboard_msg')))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case "mceSetContent":if(!value)value="";value=tinyMCE._customCleanup("insert_to_editor",value);tinyMCE._setHTML(doc,value);doc.body.innerHTML=tinyMCE._cleanupHTML(doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanupWord":if(tinyMCE.isMSIE){var html=this.getBody().createTextRange().htmlText;if(html.indexOf('="mso')!=-1){tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);html=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);}this.getBody().innerHTML=html;}break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);this.repaint();tinyMCE.triggerNodeChange();break;case "mceAnchor":if(!user_interface){var aElm=tinyMCE.getParentElement(this.getFocusElement(),"a","name");if(aElm){if(value==null||value==""){if(tinyMCE.isMSIE){aElm.outerHTML=aElm.innerHTML;}else{var rng=aElm.ownerDocument.createRange();rng.setStartBefore(aElm);rng.setEndAfter(aElm);rng.deleteContents();rng.insertNode(rng.createContextualFragment(aElm.innerHTML));}}else aElm.setAttribute('name',value);}else{this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":var selectedText=false;if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=(rng.text&&rng.text.length>0);}else selectedText=(this.getSel().toString().length>0);if(tinyMCE.selectedNode)tinyMCE.selectedElement=tinyMCE.selectedNode;if(selectedText&&!tinyMCE.selectedNode){this.getDoc().execCommand("RemoveFormat",false,null);if(value==null)return this.execCommand("RemoveFormat",false,null);this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;xcustomUndoLevels){for(var i=0;i0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);tinyMCE.triggerNodeChange();break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);rng.pasteHTML(rng.text);}catch(e){}}else this.getDoc().execCommand(command,user_interface,value);if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();}};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html=''+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);html=tinyMCE.replaceVar(html,"default_document",tinyMCE.baseURL+"/blank.htm");this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName.toLowerCase()=="textarea")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+='';else html+='';html+='';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html=""+''+''+''+''+'blank_page'+''+''+''+''+'';try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse)rng.collapse(true);var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var elm=(sel&&sel.anchorNode)?sel.anchorNode:null;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img")elm=tinyMCE.selectedElement;}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();function debug(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\
- Debug output:\
- |