From 2c633703e97eb6e7aa7ba840ef86b1fc1bd98ada Mon Sep 17 00:00:00 2001 From: svncommit Date: Thu, 24 May 2007 03:49:19 +0000 Subject: upgrade to TinyMCE v2.1.1.1 --- program/include/main.inc | 2 +- program/include/rcube_db.inc | 0 program/include/rcube_mdb2.inc | 0 program/js/editor.js | 201 +- program/js/googiespell.js | 2 +- program/js/tiny_mce/plugins/media/css/content.css | 0 program/js/tiny_mce/plugins/media/css/media.css | 0 program/js/tiny_mce/plugins/media/editor_plugin.js | 2 +- .../js/tiny_mce/plugins/media/editor_plugin_src.js | 8 +- program/js/tiny_mce/plugins/media/images/flash.gif | Bin program/js/tiny_mce/plugins/media/images/media.gif | Bin .../js/tiny_mce/plugins/media/images/quicktime.gif | Bin .../js/tiny_mce/plugins/media/images/realmedia.gif | Bin .../js/tiny_mce/plugins/media/images/shockwave.gif | Bin .../tiny_mce/plugins/media/images/windowsmedia.gif | Bin .../js/tiny_mce/plugins/media/jscripts/embed.js | 0 .../js/tiny_mce/plugins/media/jscripts/media.js | 24 +- program/js/tiny_mce/plugins/media/langs/en.js | 2 +- program/js/tiny_mce/plugins/media/media.htm | 2 +- .../tiny_mce/plugins/nonbreaking/editor_plugin.js | 0 .../plugins/nonbreaking/editor_plugin_src.js | 0 .../plugins/nonbreaking/images/nonbreaking.gif | Bin .../js/tiny_mce/plugins/nonbreaking/langs/en.js | 0 .../plugins/searchreplace/css/searchreplace.css | 0 .../searchreplace/images/replace_all_button_bg.gif | Bin .../searchreplace/images/replace_button_bg.gif | Bin .../searchreplace/jscripts/searchreplace.js | 0 .../plugins/searchreplace/searchreplace.htm | 0 .../spellchecker/classes/TinyGoogleSpell.class.php | 74 +- .../js/tiny_mce/plugins/spellchecker/config.php | 4 +- .../js/tiny_mce/plugins/table/images/buttons.gif | Bin 1765 -> 1787 bytes .../plugins/table/images/table_delete_col.gif | Bin 163 -> 153 bytes .../plugins/table/images/table_delete_row.gif | Bin 171 -> 160 bytes program/js/tiny_mce/plugins/table/langs/en.js | 2 +- .../tiny_mce/plugins/visualchars/editor_plugin.js | 0 .../plugins/visualchars/editor_plugin_src.js | 0 .../plugins/visualchars/images/visualchars.gif | Bin .../js/tiny_mce/plugins/visualchars/langs/en.js | 0 .../js/tiny_mce/themes/advanced/editor_template.js | 2 +- .../themes/advanced/editor_template_src.js | 94 +- program/js/tiny_mce/themes/advanced/image.htm | 14 +- .../js/tiny_mce/themes/advanced/images/colors.jpg | Bin .../themes/advanced/jscripts/color_picker.js | 13 +- .../js/tiny_mce/themes/advanced/jscripts/link.js | 8 + program/js/tiny_mce/themes/advanced/langs/en.js | 8 +- program/js/tiny_mce/themes/advanced/link.htm | 3 +- .../js/tiny_mce/themes/advanced/source_editor.htm | 2 +- program/js/tiny_mce/tiny_mce.js | 2 +- program/js/tiny_mce/tiny_mce_popup.js | 54 +- program/js/tiny_mce/tiny_mce_src.js | 3577 ++++++++++---------- program/lib/Auth/SASL.php | 0 program/lib/Auth/SASL/Anonymous.php | 0 program/lib/Auth/SASL/Common.php | 0 program/lib/Auth/SASL/CramMD5.php | 0 program/lib/Auth/SASL/DigestMD5.php | 0 program/lib/Auth/SASL/Login.php | 0 program/lib/Auth/SASL/Plain.php | 0 program/localization/am/labels.inc | 0 program/localization/am/messages.inc | 0 program/localization/ar/labels.inc | 0 program/localization/ar/messages.inc | 0 program/localization/cz/labels.inc | 0 program/localization/cz/messages.inc | 0 program/localization/el/labels.inc | 0 program/localization/el/messages.inc | 0 program/localization/ru/labels.inc | 0 program/localization/ru/messages.inc | 0 program/localization/sl/labels.inc | 0 program/localization/sl/messages.inc | 0 program/localization/th/labels.inc | 0 program/localization/th/messages.inc | 0 program/localization/vn/labels.inc | 0 program/localization/vn/messages.inc | 0 program/localization/zh_TW/labels.inc | 0 program/localization/zh_TW/messages.inc | 0 75 files changed, 2059 insertions(+), 2041 deletions(-) mode change 100755 => 100644 program/include/rcube_db.inc mode change 100755 => 100644 program/include/rcube_mdb2.inc mode change 100755 => 100644 program/js/googiespell.js mode change 100755 => 100644 program/js/tiny_mce/plugins/media/css/content.css mode change 100755 => 100644 program/js/tiny_mce/plugins/media/css/media.css mode change 100755 => 100644 program/js/tiny_mce/plugins/media/editor_plugin.js mode change 100755 => 100644 program/js/tiny_mce/plugins/media/editor_plugin_src.js mode change 100755 => 100644 program/js/tiny_mce/plugins/media/images/flash.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/media/images/media.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/media/images/quicktime.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/media/images/realmedia.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/media/images/shockwave.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/media/images/windowsmedia.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/media/jscripts/embed.js mode change 100755 => 100644 program/js/tiny_mce/plugins/media/jscripts/media.js mode change 100755 => 100644 program/js/tiny_mce/plugins/media/langs/en.js mode change 100755 => 100644 program/js/tiny_mce/plugins/media/media.htm mode change 100755 => 100644 program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js mode change 100755 => 100644 program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js mode change 100755 => 100644 program/js/tiny_mce/plugins/nonbreaking/images/nonbreaking.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/nonbreaking/langs/en.js mode change 100755 => 100644 program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css mode change 100755 => 100644 program/js/tiny_mce/plugins/searchreplace/images/replace_all_button_bg.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/searchreplace/images/replace_button_bg.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js mode change 100755 => 100644 program/js/tiny_mce/plugins/searchreplace/searchreplace.htm mode change 100755 => 100644 program/js/tiny_mce/plugins/visualchars/editor_plugin.js mode change 100755 => 100644 program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js mode change 100755 => 100644 program/js/tiny_mce/plugins/visualchars/images/visualchars.gif mode change 100755 => 100644 program/js/tiny_mce/plugins/visualchars/langs/en.js mode change 100755 => 100644 program/js/tiny_mce/themes/advanced/images/colors.jpg mode change 100755 => 100644 program/lib/Auth/SASL.php mode change 100755 => 100644 program/lib/Auth/SASL/Anonymous.php mode change 100755 => 100644 program/lib/Auth/SASL/Common.php mode change 100755 => 100644 program/lib/Auth/SASL/CramMD5.php mode change 100755 => 100644 program/lib/Auth/SASL/DigestMD5.php mode change 100755 => 100644 program/lib/Auth/SASL/Login.php mode change 100755 => 100644 program/lib/Auth/SASL/Plain.php mode change 100755 => 100644 program/localization/am/labels.inc mode change 100755 => 100644 program/localization/am/messages.inc mode change 100755 => 100644 program/localization/ar/labels.inc mode change 100755 => 100644 program/localization/ar/messages.inc mode change 100755 => 100644 program/localization/cz/labels.inc mode change 100755 => 100644 program/localization/cz/messages.inc mode change 100755 => 100644 program/localization/el/labels.inc mode change 100755 => 100644 program/localization/el/messages.inc mode change 100755 => 100644 program/localization/ru/labels.inc mode change 100755 => 100644 program/localization/ru/messages.inc mode change 100755 => 100644 program/localization/sl/labels.inc mode change 100755 => 100644 program/localization/sl/messages.inc mode change 100755 => 100644 program/localization/th/labels.inc mode change 100755 => 100644 program/localization/th/messages.inc mode change 100755 => 100644 program/localization/vn/labels.inc mode change 100755 => 100644 program/localization/vn/messages.inc mode change 100755 => 100644 program/localization/zh_TW/labels.inc mode change 100755 => 100644 program/localization/zh_TW/messages.inc (limited to 'program') diff --git a/program/include/main.inc b/program/include/main.inc index 6aa8b91a1..0332e3a26 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -1613,7 +1613,7 @@ function console($msg) */ function write_log($name, $line) { - global $CONFIG; + global $CONFIG, $INSTALL_PATH; if (!is_string($line)) $line = var_export($line, true); diff --git a/program/include/rcube_db.inc b/program/include/rcube_db.inc old mode 100755 new mode 100644 diff --git a/program/include/rcube_mdb2.inc b/program/include/rcube_mdb2.inc old mode 100755 new mode 100644 diff --git a/program/js/editor.js b/program/js/editor.js index 536ad2ada..536762e72 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -9,140 +9,109 @@ +-----------------------------------------------------------------------+ | Author: Eric Stadtherr | +-----------------------------------------------------------------------+ - + $Id: editor.js 000 2006-05-18 19:12:28Z roundcube $ */ // Initialize the message editor function rcmail_editor_init(skin_path) -{ - tinyMCE.init({ mode : 'specific_textareas', - accessibility_focus : false, - apply_source_formatting : true, - theme : 'advanced', - plugins : 'emotions,media,nonbreaking,table,searchreplace,spellchecker,visualchars', - theme_advanced_buttons1 : 'bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,forecolor,backcolor,formatselect,fontselect,fontsizeselect', - theme_advanced_buttons2 : 'undo,redo,image,media,hr,link,unlink,emotions,charmap,code,nonbreaking,visualchars,separator,search,replace,spellchecker,separator,tablecontrols', - theme_advanced_buttons3 : '', - theme_advanced_toolbar_location : 'top', - theme_advanced_toolbar_align : 'left', - extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]', - content_css : skin_path + '/editor_content.css', - popups_css : skin_path + '/editor_popup.css', - editor_css : skin_path + '/editor_ui.css' - }); -} + { + tinyMCE.init({ mode : 'specific_textareas', + accessibility_focus : false, + apply_source_formatting : true, + theme : 'advanced', + plugins : 'emotions,media,nonbreaking,table,searchreplace,spellchecker,visualchars', + theme_advanced_buttons1 : 'bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,bullist,numlist,outdent,indent,separator,link,unlink,emotions,forecolor,backcolor,formatselect,fontselect,fontsizeselect', + theme_advanced_buttons2 : 'undo,redo,image,media,hr,charmap,code,nonbreaking,visualchars,separator,search,replace,spellchecker,separator,tablecontrols', + theme_advanced_buttons3 : '', + theme_advanced_toolbar_location : 'top', + theme_advanced_toolbar_align : 'left', + extended_valid_elements : 'font[face|size|color|style],span[id|class|align|style]', + content_css : skin_path + '/editor_content.css', + popups_css : skin_path + '/editor_popup.css', + editor_css : skin_path + '/editor_ui.css' + }); + } // Set the state of the HTML/Plain toggles based on the _is_html field value function rcmail_set_editor_toggle_states() -{ - // set the editor toggle based on the state of the editor - - var htmlFlag = document.getElementsByName('_is_html')[0]; - var toggles = document.getElementsByName('_editorSelect'); - for(var t=0; t"; - composeElement.value = htmlText; - tinyMCE.execCommand('mceAddControl', true, '_message'); - htmlFlag.value = "1"; - } - else - { - rcmail.set_busy(true, 'converting'); - var thisMCE = tinyMCE.getInstanceById('_message'); - var existingHtml = tinyMCE.getContent(); - rcmail_html2plain(existingHtml); - tinyMCE.execCommand('mceRemoveControl', true, '_message'); - htmlFlag.value = "0"; - } -} + { + var selectedEditor = toggler.value; + + // determine the currently displayed editor + + var htmlFlag = document.getElementsByName('_is_html')[0]; + var currentEditor = htmlFlag.value; + + if (selectedEditor == currentEditor) + { + return; + } + + // do the appropriate conversion + + var composeElement = document.getElementById('compose-body'); + + if (selectedEditor == 'html') + { + var existingPlainText = composeElement.value; + var htmlText = "
" + existingPlainText + "
"; + composeElement.value = htmlText; + tinyMCE.execCommand('mceAddControl', true, '_message'); + htmlFlag.value = "1"; + } + else + { + rcmail.set_busy(true, 'converting'); + var thisMCE = tinyMCE.getInstanceById('_message'); + var existingHtml = tinyMCE.getContent(); + rcmail_html2plain(existingHtml); + tinyMCE.execCommand('mceRemoveControl', true, '_message'); + htmlFlag.value = "0"; + } + } function rcmail_html2plain(htmlText) -{ - var http_request = new rcube_http_request(); - - http_request.onerror = function(o) { rcmail_handle_toggle_error(o); }; - http_request.oncomplete = function(o) { rcmail_set_text_value(o); }; - var url = rcmail.env.bin_path+'html2text.php'; - console.log('HTTP request: ' + url); - http_request.POST(url, htmlText, 'application/octet-stream'); -} + { + var http_request = new rcube_http_request(); -/* -function old_html2Plain(htmlText) -{ - var http_request = false; - if (window.XMLHttpRequest) - { - http_request = new XMLHttpRequest(); - //http_request.overrideMimeType('text/plain'); - } - - if (http_request) - { - rcmail.set_busy(true); - - http_request.onreadystatechange = function() - { setTextValue(http_request); }; - //var url = window.location.protocol + '://' + - //window.location.host + window.location.pathname + - //'conv_html.php'; - - var url = 'conv_html.php'; - //alert('calling ' + url); - var reqbody = 'htmlText=' + htmlText; - http_request.open('POST', url, true); - http_request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); - http_request.send(reqbody); - } -} - -*/ + http_request.onerror = function(o) { rcmail_handle_toggle_error(o); }; + http_request.oncomplete = function(o) { rcmail_set_text_value(o); }; + var url=rcmail.env.comm_path+'&_action=html2text'; + console('HTTP request: ' + url); + http_request.POST(url, htmlText, 'application/octet-stream'); + } function rcmail_set_text_value(httpRequest) -{ - rcmail.set_busy(false); - var composeElement = document.getElementById('compose-body'); - composeElement.value = httpRequest.get_text(); -} + { + rcmail.set_busy(false); + var composeElement = document.getElementById('compose-body'); + composeElement.value = httpRequest.get_text(); + } function rcmail_handle_toggle_error(httpRequest) -{ - alert('html2text request returned with error ' + httpRequest.xmlhttp.status); -} + { + alert('html2text request returned with error ' + httpRequest.xmlhttp.status); + } diff --git a/program/js/googiespell.js b/program/js/googiespell.js old mode 100755 new mode 100644 index aa729318b..8b9d1cc71 --- a/program/js/googiespell.js +++ b/program/js/googiespell.js @@ -1258,7 +1258,7 @@ GoogieSpell.prototype.setLanguages = function(lang_dict) { GoogieSpell.prototype.decorateTextarea = function(id, /*optional*/spell_container_id, force_width) { var me = this; - + if(typeof(id) == "string") this.text_area = AJS.getElement(id); else diff --git a/program/js/tiny_mce/plugins/media/css/content.css b/program/js/tiny_mce/plugins/media/css/content.css old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/css/media.css b/program/js/tiny_mce/plugins/media/css/media.css old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/editor_plugin.js b/program/js/tiny_mce/plugins/media/editor_plugin.js old mode 100755 new mode 100644 index 18337a69c..d43198656 --- a/program/js/tiny_mce/plugins/media/editor_plugin.js +++ b/program/js/tiny_mce/plugins/media/editor_plugin.js @@ -1 +1 @@ -tinyMCE.importPluginLanguagePack('media');var TinyMCE_MediaPlugin={getInfo:function(){return{longname:'Media',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(inst.hasPlugin('flash')&&!tinyMCE.flashWarn){alert('Flash plugin is deprecated and should not be used together with the media plugin.');tinyMCE.flashWarn=true}if(!tinyMCE.settings['media_skip_plugin_css'])tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/media/css/content.css")},getControlHTML:function(cn){switch(cn){case"media":return tinyMCE.getButtonHTML(cn,'lang_media_desc','{$pluginurl}/images/media.gif','mceMedia')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceMedia":tinyMCE.openWindow({file:'../../plugins/media/media.htm',width:430+tinyMCE.getLang('lang_media_delta_width',0),height:470+tinyMCE.getLang('lang_media_delta_height',0)},{editor_id:editor_id,inline:"yes"});return true}return false},cleanup:function(type,content,inst){var nl,img,i,ne,d,s,ci;switch(type){case"insert_to_editor":img=tinyMCE.getParam("theme_href")+'/images/spacer.gif';content=content.replace(/]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,'');content=content.replace(/]*)>/gi,'
');content=content.replace(/]*)>/gi,'
');content=content.replace(/<\/(object|embed)([^>]*)>/gi,'
');content=content.replace(/]*)>/gi,'
');content=content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>','gi'),'class="mceItemParam">
');break;case"insert_to_editor_dom":d=inst.getDoc();nl=content.getElementsByTagName("img");for(i=0;i',startPos);attribs=TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos+4,endPos));if(!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))continue;endPos+=2;at=attribs['title'];if(at){at=at.replace(/&(#39|apos);/g,"'");at=at.replace(/&#quot;/g,'"');try{pl=eval('x={'+at+'};')}catch(ex){pl={}}}if(!tinyMCE.getParam('media_use_script',false)){switch(attribs['class']){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166B1BCA-3F9C-11CF-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=tinyMCE.getParam('media_wmp6_compatible')?'05589FA1-C356-11CE-BF01-00AA0055595A':'6BF52A52-394A-11D3-B153-00C04F79FAA6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break}if(!tinyMCE.getParam("relative_urls"))pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);embedHTML=TinyMCE_MediaPlugin._getEmbed(ci,cb,mt,pl,attribs)}else{switch(attribs['class']){case'mceItemFlash':s='writeFlash';break;case'mceItemShockWave':s='writeShockWave';break;case'mceItemWindowsMedia':s='writeWindowsMedia';break;case'mceItemQuickTime':s='writeQuickTime';break;case'mceItemRealMedia':s='writeRealMedia';break}if(attribs.width)at=at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g,"width:'"+attribs.width+"'");if(attribs.height)at=at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g,"height:'"+attribs.height+"'");if(!tinyMCE.getParam("relative_urls")){pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);at=at.replace(new RegExp("src:'[^']*'","g"),"src:'"+pl.src+"'")}embedHTML=''}chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node,'class'))){tinyMCE.switchClass(editor_id+'_media','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_media','mceButtonNormal');return true},_createImgFromEmbed:function(n,d,cl){var ne,at,i,ti='',an;ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;at=n.attributes;for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;n.parentNode.replaceChild(ne,n)},_createImg:function(cl,d,n){var i,nl,ti="",an,av,al=new Array();ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;al.id=tinyMCE.getAttrib(n,'id');al.name=tinyMCE.getAttrib(n,'name');al.width=tinyMCE.getAttrib(n,'width');al.height=tinyMCE.getAttrib(n,'height');al.bgcolor=tinyMCE.getAttrib(n,'bgcolor');al.align=tinyMCE.getAttrib(n,'align');al.class_name=tinyMCE.getAttrib(n,'mce_class');nl=n.getElementsByTagName('div');for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;return ne},_getEmbed:function(cls,cb,mt,p,at){var h='',n;p.width=at.width?at.width:p.width;p.height=at.height?at.height:p.height;h+='';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+=''}}h+=']*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,'');content=content.replace(/]*)>/gi,'
');content=content.replace(/]*)>/gi,'
');content=content.replace(/<\/(object|embed)([^>]*)>/gi,'
');content=content.replace(/]*)>/gi,'
');content=content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>','gi'),'class="mceItemParam">
');break;case"insert_to_editor_dom":d=inst.getDoc();nl=content.getElementsByTagName("img");for(i=0;i',startPos);attribs=TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos+4,endPos));if(!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class']))continue;endPos+=2;at=attribs['title'];if(at){at=at.replace(/&(#39|apos);/g,"'");at=at.replace(/&#quot;/g,'"');try{pl=eval('x={'+at+'};')}catch(ex){pl={}}}if(!tinyMCE.getParam('media_use_script',false)){switch(attribs['class']){case'mceItemFlash':ci='d27cdb6e-ae6d-11cf-96b8-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='application/x-shockwave-flash';break;case'mceItemShockWave':ci='166B1BCA-3F9C-11CF-8075-444553540000';cb='http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';mt='application/x-director';break;case'mceItemWindowsMedia':ci=tinyMCE.getParam('media_wmp6_compatible')?'05589FA1-C356-11CE-BF01-00AA0055595A':'6BF52A52-394A-11D3-B153-00C04F79FAA6';cb='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';mt='application/x-mplayer2';break;case'mceItemQuickTime':ci='02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';cb='http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';mt='video/quicktime';break;case'mceItemRealMedia':ci='CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';cb='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';mt='audio/x-pn-realaudio-plugin';break}if(!tinyMCE.getParam("relative_urls"))pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);embedHTML=TinyMCE_MediaPlugin._getEmbed(ci,cb,mt,pl,attribs)}else{switch(attribs['class']){case'mceItemFlash':s='writeFlash';break;case'mceItemShockWave':s='writeShockWave';break;case'mceItemWindowsMedia':s='writeWindowsMedia';break;case'mceItemQuickTime':s='writeQuickTime';break;case'mceItemRealMedia':s='writeRealMedia';break}if(attribs.width)at=at.replace(/width:[^0-9]?[0-9]+%?[^0-9]?/g,"width:'"+attribs.width+"'");if(attribs.height)at=at.replace(/height:[^0-9]?[0-9]+%?[^0-9]?/g,"height:'"+attribs.height+"'");if(!tinyMCE.getParam("relative_urls")){pl.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],pl.src);at=at.replace(new RegExp("src:'[^']*'","g"),"src:'"+pl.src+"'")}embedHTML=''}chunkBefore=content.substring(0,startPos);chunkAfter=content.substring(endPos);content=chunkBefore+embedHTML+chunkAfter}break}return content},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){if(node==null)return;do{if(node.nodeName=="IMG"&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(node,'class'))){tinyMCE.switchClass(editor_id+'_media','mceButtonSelected');return true}}while((node=node.parentNode));tinyMCE.switchClass(editor_id+'_media','mceButtonNormal');return true},_createImgFromEmbed:function(n,d,cl){var ne,at,i,ti='',an;ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;at=n.attributes;for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;n.parentNode.replaceChild(ne,n)},_createImg:function(cl,d,n){var i,nl,ti="",an,av,al=new Array();ne=d.createElement('img');ne.src=tinyMCE.getParam("theme_href")+'/images/spacer.gif';ne.width=tinyMCE.getAttrib(n,'width');ne.height=tinyMCE.getAttrib(n,'height');ne.className=cl;al.id=tinyMCE.getAttrib(n,'id');al.name=tinyMCE.getAttrib(n,'name');al.width=tinyMCE.getAttrib(n,'width');al.height=tinyMCE.getAttrib(n,'height');al.bgcolor=tinyMCE.getAttrib(n,'bgcolor');al.align=tinyMCE.getAttrib(n,'align');al.class_name=tinyMCE.getAttrib(n,'mce_class');nl=n.getElementsByTagName('div');for(i=0;i0?ti.substring(0,ti.length-1):ti;ne.title=ti;return ne},_getEmbed:function(cls,cb,mt,p,at){var h='',n;p.width=at.width?at.width:p.width;p.height=at.height?at.height:p.height;h+='';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+=''}}h+=''; // Add extra url parameter if it's an absolute URL on WMP diff --git a/program/js/tiny_mce/plugins/media/images/flash.gif b/program/js/tiny_mce/plugins/media/images/flash.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/images/media.gif b/program/js/tiny_mce/plugins/media/images/media.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/images/quicktime.gif b/program/js/tiny_mce/plugins/media/images/quicktime.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/images/realmedia.gif b/program/js/tiny_mce/plugins/media/images/realmedia.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/images/shockwave.gif b/program/js/tiny_mce/plugins/media/images/shockwave.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/images/windowsmedia.gif b/program/js/tiny_mce/plugins/media/images/windowsmedia.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/jscripts/embed.js b/program/js/tiny_mce/plugins/media/jscripts/embed.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/media/jscripts/media.js b/program/js/tiny_mce/plugins/media/jscripts/media.js old mode 100755 new mode 100644 index 44b68fa4d..691a8bdbd --- a/program/js/tiny_mce/plugins/media/jscripts/media.js +++ b/program/js/tiny_mce/plugins/media/jscripts/media.js @@ -209,7 +209,7 @@ function insertMedia() { break; } - if (fe.width != f.width.value || fe.height != f.width.height) + if (fe.width != f.width.value || fe.height != f.height.height) tinyMCE.selectedInstance.repaint(); fe.title = serializeParameters(); @@ -275,7 +275,25 @@ function getMediaListHTML() { } function getType(v) { - var fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'), i, c, el, x; + var fo, i, c, el, x, f = document.forms[0]; + + fo = tinyMCE.getParam("media_types", "flash=swf;shockwave=dcr;qt=mov,qt,mpg,mp3,mp4,mpeg;shockwave=dcr;wmp=avi,wmv,wm,asf,asx,wmx,wvx;rmp=rm,ra,ram").split(';'); + + // YouTube + if (v.indexOf('http://www.youtube.com/watch?v=') == 0) { + f.width.value = '425'; + f.height.value = '350'; + f.src.value = 'http://www.youtube.com/v/' + v.substring('http://www.youtube.com/watch?v='.length); + return 'flash'; + } + + // Google video + if (v.indexOf('http://video.google.com/videoplay?docid=') == 0) { + f.width.value = '425'; + f.height.value = '326'; + f.src.value = 'http://video.google.com/googleplayer.swf?docId=' + v.substring('http://video.google.com/videoplay?docid='.length) + '&hl=en'; + return 'flash'; + } for (i=0; i - +
diff --git a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/nonbreaking/images/nonbreaking.gif b/program/js/tiny_mce/plugins/nonbreaking/images/nonbreaking.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/nonbreaking/langs/en.js b/program/js/tiny_mce/plugins/nonbreaking/langs/en.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css b/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/searchreplace/images/replace_all_button_bg.gif b/program/js/tiny_mce/plugins/searchreplace/images/replace_all_button_bg.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/searchreplace/images/replace_button_bg.gif b/program/js/tiny_mce/plugins/searchreplace/images/replace_button_bg.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php index 33e7b1cc1..7be929731 100644 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php +++ b/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php @@ -1,4 +1,5 @@ lang = $lang; + $this->spellurl = $config['googlespell.url']; } // Returns array with bad words or false if failed. function checkWords($word_array) { - $words = array(); + $words = array (); $wordstr = implode(' ', $word_array); $matches = $this->_getMatches($wordstr); - for ($i=0; $iunhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8")); return $words; @@ -37,7 +40,7 @@ class TinyGoogleSpell { // Returns array with suggestions or false if failed. function getSuggestion($word) { - $sug = array(); + $sug = array (); $matches = $this->_getMatches($word); @@ -48,43 +51,41 @@ class TinyGoogleSpell { } function _xmlChars($string) { - $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES); - - foreach ($trans as $k => $v) - $trans[$k] = "&#".ord($k).";"; + $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES); + + foreach ($trans as $k => $v) + $trans[$k] = "&#" . ord($k) . ";"; - return strtr($string, $trans); + return strtr($string, $trans); } function _getMatches($word_list) { - $server = "www.google.com"; - $port = 443; - $path = "/tbproxy/spell?lang=" . $this->lang . "&hl=en"; - $host = "www.google.com"; - $url = "https://" . $server; + $url = $this->spellurl . "&" . $this->lang; + + $path = preg_replace("/^https?:\/\//i", "", $url); // Setup XML request - $xml = '' . $word_list . ''; - - $header = "POST ".$path." HTTP/1.0 \r\n"; - $header .= "MIME-Version: 1.0 \r\n"; - $header .= "Content-type: application/PTI26 \r\n"; - $header .= "Content-length: ".strlen($xml)." \r\n"; - $header .= "Content-transfer-encoding: text \r\n"; - $header .= "Request-number: 1 \r\n"; - $header .= "Document-type: Request \r\n"; - $header .= "Interface-Version: Test 1.4 \r\n"; - $header .= "Connection: close \r\n\r\n"; - $header .= $xml; + $xml = '' . $word_list . ''; + + $header = "POST " . $path . " HTTP/1.0 \r\n"; + $header .= "MIME-Version: 1.0 \r\n"; + $header .= "Content-type: application/PTI26 \r\n"; + $header .= "Content-length: " . strlen($xml) . " \r\n"; + $header .= "Content-transfer-encoding: text \r\n"; + $header .= "Request-number: 1 \r\n"; + $header .= "Document-type: Request \r\n"; + $header .= "Interface-Version: Test 1.4 \r\n"; + $header .= "Connection: close \r\n\r\n"; + $header .= $xml; //$this->_debugData($xml); - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL,$url); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); - $xml = curl_exec($ch); - curl_close($ch); + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $header); + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); + $xml = curl_exec($ch); + curl_close($ch); //$this->_debugData($xml); @@ -95,13 +96,12 @@ class TinyGoogleSpell { } function _debugData($data) { - $fh = @fopen("debug.log", 'a+'); - @fwrite($fh, $data); - @fclose($fh); + $fh = @ fopen("debug.log", 'a+'); + @ fwrite($fh, $data); + @ fclose($fh); } } // Setup classname, should be the same as the name of the spellchecker class $spellCheckerConfig['class'] = "TinyGoogleSpell"; - ?> diff --git a/program/js/tiny_mce/plugins/spellchecker/config.php b/program/js/tiny_mce/plugins/spellchecker/config.php index f008d11ca..6622248c0 100644 --- a/program/js/tiny_mce/plugins/spellchecker/config.php +++ b/program/js/tiny_mce/plugins/spellchecker/config.php @@ -21,4 +21,6 @@ // Pspell shell specific settings $spellCheckerConfig['tinypspellshell.aspell'] = '/usr/bin/aspell'; $spellCheckerConfig['tinypspellshell.tmp'] = '/tmp'; -?> + + $spellCheckerConfig['googlespell.url'] = 'https://www.google.com/tbproxy/spell?hl=en' +?> \ No newline at end of file diff --git a/program/js/tiny_mce/plugins/table/images/buttons.gif b/program/js/tiny_mce/plugins/table/images/buttons.gif index 8c09ff952..56a7396b8 100644 Binary files a/program/js/tiny_mce/plugins/table/images/buttons.gif and b/program/js/tiny_mce/plugins/table/images/buttons.gif differ diff --git a/program/js/tiny_mce/plugins/table/images/table_delete_col.gif b/program/js/tiny_mce/plugins/table/images/table_delete_col.gif index 91f53af02..260aa04ca 100644 Binary files a/program/js/tiny_mce/plugins/table/images/table_delete_col.gif and b/program/js/tiny_mce/plugins/table/images/table_delete_col.gif differ diff --git a/program/js/tiny_mce/plugins/table/images/table_delete_row.gif b/program/js/tiny_mce/plugins/table/images/table_delete_row.gif index 7025733fe..2fb5f2bab 100644 Binary files a/program/js/tiny_mce/plugins/table/images/table_delete_row.gif and b/program/js/tiny_mce/plugins/table/images/table_delete_row.gif differ diff --git a/program/js/tiny_mce/plugins/table/langs/en.js b/program/js/tiny_mce/plugins/table/langs/en.js index 7597b3c21..e2fbba2e5 100644 --- a/program/js/tiny_mce/plugins/table/langs/en.js +++ b/program/js/tiny_mce/plugins/table/langs/en.js @@ -38,7 +38,7 @@ props_desc : 'Table properties', bordercolor : 'Border color', bgcolor : 'Background color', merge_cells_title : 'Merge table cells', -split_cells_desc : 'Split table cells', +split_cells_desc : 'Split merged table cells', merge_cells_desc : 'Merge table cells', cut_row_desc : 'Cut table row', copy_row_desc : 'Copy table row', diff --git a/program/js/tiny_mce/plugins/visualchars/editor_plugin.js b/program/js/tiny_mce/plugins/visualchars/editor_plugin.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/visualchars/images/visualchars.gif b/program/js/tiny_mce/plugins/visualchars/images/visualchars.gif old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/plugins/visualchars/langs/en.js b/program/js/tiny_mce/plugins/visualchars/langs/en.js old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/themes/advanced/editor_template.js b/program/js/tiny_mce/themes/advanced/editor_template.js index 9f965daad..6e781d782 100644 --- a/program/js/tiny_mce/themes/advanced/editor_template.js +++ b/program/js/tiny_mce/themes/advanced/editor_template.js @@ -1 +1 @@ -tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"000000,993300,333300,003300,003366,000080,333399,333333,800000,FF6600,808000,008000,008080,0000FF,666699,808080,FF0000,FF9900,99CC00,339966,33CCCC,3366FF,800080,999999,FF00FF,FFCC00,FFFF00,00FF00,00FFFF,00CCFF,993366,C0C0C0,FF99CC,FFCC99,FFFF99,CCFFCC,CCFFFF,99CCFF,CC99FF,FFFFFF",_autoImportCSSClasses:true,_resizer:{},_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','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.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','forecolor',true],['forecolorpicker','forecolor.gif','lang_theme_forecolor_desc','forecolorpicker',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['backcolorpicker','backcolor.gif','lang_theme_backcolor_desc','backcolorpicker',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']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='';return html;case"styleselect":return'';case"fontselect":var fontHTML='';return fontHTML;case"fontsizeselect":return'';case"|":case"separator":return'';case"spacer":return'';case"rowseparator":return'
'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}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,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);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 true;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:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._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(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorpicker":this._pickColor(editor_id,'forecolor');return true;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"backcolorpicker":this._pickColor(editor_id,'HiliteColor');return true;case"mceColorPicker":if(user_interface){var template=[];if(!value['callback']&&!value['color'])value['color']=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=380;template['height']=250;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:value['color']})}else{var savedVal=tinyMCE.lastColorPickerValue,elm;if(savedVal['callback']){savedVal['callback'](value);return true}elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));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+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);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']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array(),skip;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_AdvancedTheme._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 defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='0){toolbarHTML+="
";deltaHeight-=23}}toolbarHTML+='
';template['html']='';if(toolbarLocation=="top")template['html']+='';if(statusbarLocation=="top"){template['html']+='';deltaHeight-=23}template['html']+='';if(toolbarLocation=="bottom")template['html']+='';if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='
'+toolbarHTML+'
'+statusbarHTML+'
'+toolbarHTML+'
'+toolbarHTML+'
';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}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']+='';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);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j0){curContainerHTML+="
";deltaHeight-=23}template['html']+='
'}}template['html']+='
'+statusbarHTML+'
'+curContainerHTML+'
';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);if(!template['delta_width'])template['delta_width']=0;if(!template['delta_height'])template['delta_height']=deltaHeight;return template},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},removeInstance:function(inst){new TinyMCE_Layer(inst.editorId+'_fcMenu').remove();new TinyMCE_Layer(inst.editorId+'_bcMenu').remove()},hideInstance:function(inst){TinyMCE_AdvancedTheme._hideMenus(inst.editorId)},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_Layer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+tinyMCE.xmlEncode(st)+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+tinyMCE.xmlEncode(face)+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+tinyMCE.xmlEncode(size)+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+tinyMCE.xmlEncode(color)+" "}if(tinyMCE.getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(tinyMCE.getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+tinyMCE.xmlEncode(src)+" "}if(path[i].nodeName=='A'&&tinyMCE.getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+tinyMCE.xmlEncode(href)+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i].getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+tinyMCE.xmlEncode(anchor);nodeData=""}if(tinyMCE.getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+=''+nodeName+'';if(i>0){html+=" » "}}pathElm.innerHTML=''+tinyMCE.getLang('lang_theme_path')+": "+html+' '}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._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){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth';for(i=0;i';if((i+1)%8==0)h+=''}h+='';if(tinyMCE.getParam("theme_advanced_more_colors",true))h+=''+tinyMCE.getLang('lang_more_colors')+'';return h},_pickColor:function(id,cm){var inputColor,inst=tinyMCE.selectedInstance;if(cm=='forecolor'&&inst)inputColor=inst.foreColor;if((cm=='backcolor'||cm=='HiliteColor')&&inst)inputColor=inst.backColor;tinyMCE.execCommand('mceColorPicker',true,{color:inputColor,callback:function(c){tinyMCE.execInstanceCommand(id,cm,false,c)}})},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand('mceBeginUndoLevel');if(src=="")return;if(!tinyMCE.imgElement&&tinyMCE.isSafari){var html="";html+=''+alt+'';tinyMCE.execCommand("mceInsertContent",false,html)}else{if(!tinyMCE.imgElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,'');else tinyMCE.selectedInstance.contentDocument.execCommand("insertimage",false,tinyMCE.uniqueURL);tinyMCE.imgElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"img","src",tinyMCE.uniqueURL)}}if(tinyMCE.imgElement){var needsRepaint=false;var msrc=src;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(tinyMCE.getParam('convert_urls'))msrc=src;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!=tinyMCE.imgElement.getAttribute("width")||height!=tinyMCE.imgElement.getAttribute("height")||align!=tinyMCE.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(tinyMCE.imgElement,'src',src);tinyMCE.setAttrib(tinyMCE.imgElement,'mce_src',msrc);tinyMCE.setAttrib(tinyMCE.imgElement,'alt',alt);tinyMCE.setAttrib(tinyMCE.imgElement,'title',title);tinyMCE.setAttrib(tinyMCE.imgElement,'align',align);tinyMCE.setAttrib(tinyMCE.imgElement,'border',border,true);tinyMCE.setAttrib(tinyMCE.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(tinyMCE.imgElement,'width',width,true);tinyMCE.setAttrib(tinyMCE.imgElement,'height',height,true);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(tinyMCE.imgElement,'onmouseout',onmouseout);if(width&&width!="")tinyMCE.imgElement.style.pixelWidth=width;if(height&&height!="")tinyMCE.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint()}tinyMCE.execCommand('mceEndUndoLevel')},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,''+tinyMCE.selectedInstance.selection.getSelectedHTML()+'')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='';return html;case"styleselect":return'';case"fontselect":var fontHTML='';return fontHTML;case"fontsizeselect":return'';case"|":case"separator":return'';case"spacer":return'';case"rowseparator":return'
'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes"});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}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,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);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 true;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:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._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(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorpicker":this._pickColor(editor_id,'forecolor');return true;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"backcolorpicker":this._pickColor(editor_id,'HiliteColor');return true;case"mceColorPicker":if(user_interface){var template=[];if(!value['callback']&&!value['color'])value['color']=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=380;template['height']=250;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:value['color']})}else{var savedVal=tinyMCE.lastColorPickerValue,elm;if(savedVal['callback']){savedVal['callback'](value);return true}elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));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+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);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']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array(),skip;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_AdvancedTheme._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 defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='0){toolbarHTML+="
";deltaHeight-=23}}toolbarHTML+='
';template['html']='';if(toolbarLocation=="top")template['html']+='';if(statusbarLocation=="top"){template['html']+='';deltaHeight-=23}template['html']+='';if(toolbarLocation=="bottom")template['html']+='';if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='
'+toolbarHTML+'
'+statusbarHTML+'
'+toolbarHTML+'
'+toolbarHTML+'
';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}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']+='';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);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j0){curContainerHTML+="
";deltaHeight-=23}template['html']+='
'}}template['html']+='
'+statusbarHTML+'
'+curContainerHTML+'
';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);if(!template['delta_width'])template['delta_width']=0;if(!template['delta_height'])template['delta_height']=deltaHeight;return template},initInstance:function(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},removeInstance:function(inst){new TinyMCE_Layer(inst.editorId+'_fcMenu').remove();new TinyMCE_Layer(inst.editorId+'_bcMenu').remove()},hideInstance:function(inst){TinyMCE_AdvancedTheme._hideMenus(inst.editorId)},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_Layer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+tinyMCE.xmlEncode(st)+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+tinyMCE.xmlEncode(face)+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="size: "+tinyMCE.xmlEncode(size)+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+tinyMCE.xmlEncode(color)+" "}if(tinyMCE.getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(tinyMCE.getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+tinyMCE.xmlEncode(src)+" "}if(path[i].nodeName=='A'&&tinyMCE.getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+tinyMCE.xmlEncode(href)+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i].getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+tinyMCE.xmlEncode(anchor);nodeData=""}if(tinyMCE.getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+=''+nodeName+'';if(i>0){html+=" » "}}pathElm.innerHTML=''+tinyMCE.getLang('lang_theme_path')+": "+html+' '}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_anchor','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._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){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(selectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expires.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGecko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth';for(i=0;i';if((i+1)%8==0)h+=''}h+='';if(tinyMCE.getParam("theme_advanced_more_colors",true))h+=''+tinyMCE.getLang('lang_more_colors')+'';return h},_pickColor:function(id,cm){var inputColor,inst=tinyMCE.selectedInstance;if(cm=='forecolor'&&inst)inputColor=inst.foreColor;if((cm=='backcolor'||cm=='HiliteColor')&&inst)inputColor=inst.backColor;tinyMCE.execCommand('mceColorPicker',true,{color:inputColor,callback:function(c){tinyMCE.execInstanceCommand(id,cm,false,c)}})},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand("mceInsertContent",false,tinyMCE.createTagHTML('img',{src:tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src),mce_src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout}))},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,''+tinyMCE.selectedInstance.selection.getSelectedHTML()+'')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i'; + return ''; case "spacer": - return ''; + return ''; case "rowseparator": return '
'; @@ -1399,7 +1399,7 @@ var TinyMCE_AdvancedTheme = { h += ''; if (tinyMCE.getParam("theme_advanced_more_colors", true)) - h += '' + tinyMCE.getLang('lang_more_colors') + ''; + h += '' + tinyMCE.getLang('lang_more_colors') + ''; return h; }, @@ -1419,78 +1419,20 @@ var TinyMCE_AdvancedTheme = { }, _insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) { - tinyMCE.execCommand('mceBeginUndoLevel'); - - if (src == "") - return; - - if (!tinyMCE.imgElement && tinyMCE.isSafari) { - var html = ""; - - html += '' + alt + ''; - - tinyMCE.execCommand("mceInsertContent", false, html); - } else { - if (!tinyMCE.imgElement && tinyMCE.selectedInstance) { - if (tinyMCE.isSafari) - tinyMCE.execCommand("mceInsertContent", false, ''); - else - tinyMCE.selectedInstance.contentDocument.execCommand("insertimage", false, tinyMCE.uniqueURL); - - tinyMCE.imgElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "img", "src", tinyMCE.uniqueURL); - } - } - - if (tinyMCE.imgElement) { - var needsRepaint = false; - var msrc = src; - - src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, tinyMCE.imgElement);"); - - if (tinyMCE.getParam('convert_urls')) - msrc = src; - - 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);") + "';"; - - // Use alt as title if it's undefined - if (typeof(title) == "undefined") - title = alt; - - if (width != tinyMCE.imgElement.getAttribute("width") || height != tinyMCE.imgElement.getAttribute("height") || align != tinyMCE.imgElement.getAttribute("align")) - needsRepaint = true; - - tinyMCE.setAttrib(tinyMCE.imgElement, 'src', src); - tinyMCE.setAttrib(tinyMCE.imgElement, 'mce_src', msrc); - tinyMCE.setAttrib(tinyMCE.imgElement, 'alt', alt); - tinyMCE.setAttrib(tinyMCE.imgElement, 'title', title); - tinyMCE.setAttrib(tinyMCE.imgElement, 'align', align); - tinyMCE.setAttrib(tinyMCE.imgElement, 'border', border, true); - tinyMCE.setAttrib(tinyMCE.imgElement, 'hspace', hspace, true); - tinyMCE.setAttrib(tinyMCE.imgElement, 'vspace', vspace, true); - tinyMCE.setAttrib(tinyMCE.imgElement, 'width', width, true); - tinyMCE.setAttrib(tinyMCE.imgElement, 'height', height, true); - tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseover', onmouseover); - tinyMCE.setAttrib(tinyMCE.imgElement, 'onmouseout', onmouseout); - - // Fix for bug #989846 - Image resize bug - if (width && width != "") - tinyMCE.imgElement.style.pixelWidth = width; - - if (height && height != "") - tinyMCE.imgElement.style.pixelHeight = height; - - if (needsRepaint) - tinyMCE.selectedInstance.repaint(); - } - - tinyMCE.execCommand('mceEndUndoLevel'); + tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', { + src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute + mce_src : src, + alt : alt, + border : border, + hspace : hspace, + vspace : vspace, + width : width, + height : height, + align : align, + title : title, + onmouseover : onmouseover, + onmouseout : onmouseout + })); }, _insertLink : function(href, target, title, onclick, style_class) { diff --git a/program/js/tiny_mce/themes/advanced/image.htm b/program/js/tiny_mce/themes/advanced/image.htm index e971bf916..96a9a758d 100644 --- a/program/js/tiny_mce/themes/advanced/image.htm +++ b/program/js/tiny_mce/themes/advanced/image.htm @@ -22,7 +22,7 @@ - +
 
@@ -47,7 +47,7 @@ - + @@ -66,21 +66,21 @@ - + x - + - + - + - + diff --git a/program/js/tiny_mce/themes/advanced/images/colors.jpg b/program/js/tiny_mce/themes/advanced/images/colors.jpg old mode 100755 new mode 100644 diff --git a/program/js/tiny_mce/themes/advanced/jscripts/color_picker.js b/program/js/tiny_mce/themes/advanced/jscripts/color_picker.js index 358d6d706..00fc823de 100644 --- a/program/js/tiny_mce/themes/advanced/jscripts/color_picker.js +++ b/program/js/tiny_mce/themes/advanced/jscripts/color_picker.js @@ -153,7 +153,7 @@ function generateWebColors() { for (i=0; i' - + '' + + '' + '' + colors[i] +  ''; if ((i+1) % 18 == 0) h += ''; @@ -173,22 +173,13 @@ function generateNamedColors() { for (n in named) { v = named[n]; - h += '' + h += '' } el.innerHTML = h; el.className = 'generated'; } -function selectColor() { - var color = document.getElementById("color").value; - - if(window.opener) - window.opener.tinyMCE.execInstanceCommand(tinyMCE.getWindowArg('editor_id'),tinyMCE.getWindowArg('command'),false,color); - - window.close(); -} - function dechex(n) { return strhex.charAt(Math.floor(n / 16)) + strhex.charAt(n % 16); } diff --git a/program/js/tiny_mce/themes/advanced/jscripts/link.js b/program/js/tiny_mce/themes/advanced/jscripts/link.js index e80f2a436..e195497e1 100644 --- a/program/js/tiny_mce/themes/advanced/jscripts/link.js +++ b/program/js/tiny_mce/themes/advanced/jscripts/link.js @@ -50,6 +50,14 @@ function init() { } } +function checkPrefix(n) { + if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCE.getLang('lang_is_email'))) + n.value = 'mailto:' + n.value; + + if (/^\s*www./i.test(n.value) && confirm(tinyMCE.getLang('lang_is_external'))) + n.value = 'http://' + n.value; +} + function insertLink() { var href = document.forms[0].href.value; var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value; diff --git a/program/js/tiny_mce/themes/advanced/langs/en.js b/program/js/tiny_mce/themes/advanced/langs/en.js index c658d6d96..8409e582b 100644 --- a/program/js/tiny_mce/themes/advanced/langs/en.js +++ b/program/js/tiny_mce/themes/advanced/langs/en.js @@ -82,10 +82,12 @@ invalid_data : 'Error: Invalid values entered, these are marked in red.', more_colors : 'More colors', color_picker_tab : 'Picker', color_picker : 'Color picker', -web_colors_tab : 'Web safe', -web_colors : 'Web safe colors', +web_colors_tab : 'Palette', +web_colors : 'Palette colors', named_colors_tab : 'Named', named_colors : 'Named colors', color : 'Color:', -color_name : 'Name:' +color_name : 'Name:', +is_email : 'The URL you entered seems to be an email address, do you want to add the required mailto: prefix?', +is_external : 'The URL you entered seems to external link, do you want to add the required http:// prefix?' }); diff --git a/program/js/tiny_mce/themes/advanced/link.htm b/program/js/tiny_mce/themes/advanced/link.htm index 4e72eaad5..b27af9b6c 100644 --- a/program/js/tiny_mce/themes/advanced/link.htm +++ b/program/js/tiny_mce/themes/advanced/link.htm @@ -4,6 +4,7 @@ + @@ -23,7 +24,7 @@ - +
 
diff --git a/program/js/tiny_mce/themes/advanced/source_editor.htm b/program/js/tiny_mce/themes/advanced/source_editor.htm index a8fb00511..c3f80c4f7 100644 --- a/program/js/tiny_mce/themes/advanced/source_editor.htm +++ b/program/js/tiny_mce/themes/advanced/source_editor.htm @@ -16,7 +16,7 @@
- +
diff --git a/program/js/tiny_mce/tiny_mce.js b/program/js/tiny_mce/tiny_mce.js index 65a5f1078..ef604804e 100644 --- a/program/js/tiny_mce/tiny_mce.js +++ b/program/js/tiny_mce/tiny_mce.js @@ -1 +1 @@ -function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="1.0";this.releaseDate="2007-02-13";this.instances=new Array();this.switchClassCache=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.pendingFiles=new Array();this.loadingIndex=0;this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.log=new Array();this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=ua.indexOf('Opera')!=-1;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=new Array();this.themes=new Array();this.menus=new Array();this.loadedPlugins=new Array();this.buttonMap=new Array();this.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');nl=document.getElementsByTagName('base');for(i=0;i');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",'');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings['browsers'].indexOf('msie')==-1)return;if(this.isGecko&&this.settings['browsers'].indexOf('gecko')==-1)return;if(this.isSafari&&this.settings['browsers'].indexOf('safari')==-1)return;if(this.isOpera&&this.settings['browsers'].indexOf('opera')==-1)return;baseHREF=tinyMCE.settings['document_base_url'];var h=document.location.href;var p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings['document_base_url']=baseHREF;tinyMCE.settings['document_base_prefix']=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings['base_href']=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings['theme'];this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=new Array(13,45,36,35,33,34,37,38,39,40);this.uniqueURL='javascript:void(091039730);';this.uniqueTag='';this.callbacks=new Array('onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance');this.settings['theme_href']=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings['force_br_newlines']=false;if(tinyMCE.getParam("popups_css",false)){var cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['popups_css']=this.documentBasePath+"/"+cssPath;else this.settings['popups_css']=cssPath}else this.settings['popups_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){var cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings['editor_css']=this.documentBasePath+"/"+cssPath;else this.settings['editor_css']=cssPath}else{if(this.settings.editor_css!='')this.settings['editor_css']=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(tinyMCE.settings['debug']){var msg="Debug: \n";msg+="baseURL: "+this.baseURL+"\n";msg+="documentBasePath: "+this.documentBasePath+"\n";msg+="content_css: "+this.settings['content_css']+"\n";msg+="popups_css: "+this.settings['popups_css']+"\n";msg+="editor_css: "+this.settings['editor_css']+"\n";alert(msg)}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings['theme']+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings['language']+'.js');this.loadCSS(this.settings['editor_css']);var p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(var i=0;i&"\']','g');this.xmlEncodeRe=new RegExp('[<>&"]','g');},_addUnloadEvents:function(){if(tinyMCE.isIE){if(tinyMCE.settings['add_unload_trigger']){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(tinyMCE.settings['add_unload_trigger'])tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substring(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex0){for(i=0,lflen=this.loadedFiles.length;i');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',');var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings['convert_on_click']||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm'])))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':var inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value['element'],value['document']),value['element'],value['document']);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case"mceToggleEditor":var inst=tinyMCE.getInstanceById(value),pe,te;if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';te.value=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';inst.setHTML(te.value);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(!tinyMCE.isIE){for(var n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="on"}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings['focus_alert'])alert(tinyMCELang['lang_focus_alert'])},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings['area_width'];ah=""+tinyMCE.settings['area_height'];if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings["auto_resize"])iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings['default_document']);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i;var doc=inst.getDoc();var head=doc.getElementsByTagName('head').item(0);var content=inst.startContent;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/</g,'<');content=content.replace(/>/g,'>');content=content.replace(/"/g,'"');content=content.replace(/&/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings['theme']+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings['content_css']);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'');inst.addShortcut('ctrl','7','','FormatBlock',false,'

');inst.addShortcut('ctrl','8','','FormatBlock',false,'

');inst.addShortcut('ctrl','9','','FormatBlock',false,'
');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings['nowrap'])doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings['directionality'];doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings['base_href']);if(tinyMCE.settings['convert_newlines_to_brs']){content=tinyMCE.regexpReplace(content,"\r\n","
","gi");content=tinyMCE.regexpReplace(content,"\r","
","gi");content=tinyMCE.regexpReplace(content,"\n","
","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])doc.styleSheets[0].addRule("p","margin: 0;");var body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.isGecko&&tinyMCE.settings['remove_lt_gt'])content=content.replace(new RegExp('<>','g'),"");if(tinyMCE.settings['cleanup_on_startup'])tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}')}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.dispatchCallback(inst,'setupcontent_callback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.add({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_selects_on_submit'))return;if(typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");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":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");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'],tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="  ";else elm.innerHTML=" "}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i';h+='';h+=''}else{h+='';h+='';h+=''}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='';else h+='';h+='';h+='';h+='';h+=''}else{if(tinyMCE.isRealIE)h+='';else h+='';h+='';h+='';h+='';h+=''}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i;var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");po=tinyMCE.themes[tinyMCE.settings['theme']];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);var tableElement=null;switch(el.nodeName){case"TABLE":var oldW=el.style.width;var oldH=el.style.height;var bo=tinyMCE.getAttrib(el,"border");bo=bo==""||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(var y=0;y0)return inst.cssClasses;if(typeof(editor_id)=="undefined"&&typeof(doc)=="undefined"){var instance;for(var instanceName in tinyMCE.instances){instance=tinyMCE.instances[instanceName];if(!tinyMCE.isInstance(instance))continue;break}doc=instance.getDoc()}if(typeof(doc)=="undefined"){var instance=tinyMCE.getInstanceById(editor_id);doc=instance.getDoc()}if(doc){var styles=doc.styleSheets;if(styles&&styles.length>0){for(var x=0;x'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings['theme']];if(o.getControlHTML&&(v=o.getControlHTML(c))!=''){if(rtl)return''+v+'';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!=''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},xmlEncode:function(s,skip_apos){return s?(''+s).replace(!skip_apos?this.xmlEncodeAposRe:this.xmlEncodeRe,function(c,b){switch(c){case'&':return'&';case'"':return'"';case'\'':return''';case'<':return'<';case'>':return'>'}return c}):s},extend:function(p,np){var o={};o.parent=p;for(n in p)o[n]=p[n];for(n in np)o[n]=np[n];return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,to,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.settings=s;this.settings['theme']=tinyMCE.getParam("theme","default");this.settings['width']=tinyMCE.getParam("width",-1);this.settings['height']=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=new Array();this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings['theme'];if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;to={};for(i=0;i0){for(i=0;i1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index']}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i0)rng.pasteHTML('
'+rng.htmlText+"
");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.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,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'

');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){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.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value']==null?'':value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings['merge_styles_invalid_parents']!=''?new RegExp(tinyMCE.settings['merge_styles_invalid_parents'],"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,new Array(),1);for(var z=0;z=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('','gi').test(tmp.innerHTML)){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":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&| |<|>)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value)}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(//gi,'\n');return''+c+''});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s,skip_apos){var cl=this,re=!skip_apos?this.xmlEncodeAposRe:this.xmlEncodeRe;this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s,skip_apos);case"named":return s.replace(re,function(c,b){b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c,b){return b?'&#'+c.charCodeAt(0)+';':c})}return s},split:function(re,s){var c=s.split(re);var i,l,o=new Array();for(i=0,l=c.length;i':'>'+h+'';return o};TinyMCE_Engine.prototype.createTag=function(d,tn,a,h){var o=d.createElement(tn);if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o};TinyMCE_Engine.prototype.getElementByAttributeValue=function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]};TinyMCE_Engine.prototype.getElementsByAttributeValue=function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=new Array();for(i=0;i]*)>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/strong>/gi,'');h=h.replace(/<\/em>/gi,'')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/]*)>\u00A0?<\/p>/gi,' 

');h=h.replace(/]*)>\s* \s*<\/p>/gi,' 

');h=h.replace(/]*)>\s+<\/p>/gi,' 

');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}};TinyMCE_Engine.prototype.getOuterHTML=function(e){if(tinyMCE.isIE)return e.outerHTML;var d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML};TinyMCE_Engine.prototype.setOuterHTML=function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i=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 targetURL.path;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";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="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)};TinyMCE_Engine.prototype.convertURL=function(url,node,on_save){var prot=document.location.protocol;var host=document.location.hostname;var port=document.location.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0)=="#")return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings['base_href']+url;if(on_save&&tinyMCE.getParam('relative_urls')){var curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(curl.charAt(0)=='/')curl=tinyMCE.settings['document_base_prefix']+curl;var urlParts=tinyMCE.parseURL(curl);var tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings['document_base_url']);if(urlParts['host']==tmpUrlParts['host']&&(urlParts['port']==tmpUrlParts['port']))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'],curl)}if(!tinyMCE.getParam('relative_urls')){var urlParts=tinyMCE.parseURL(url);var baseUrlParts=tinyMCE.parseURL(tinyMCE.settings['base_href']);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],url);if(urlParts['anchor']&&urlParts['path']==baseUrlParts['path'])return"#"+urlParts['anchor']}if(tinyMCE.getParam('remove_script_host')){var start="",portPart="";if(port!="")portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url};TinyMCE_Engine.prototype.convertAllRelativeURLs=function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;ibookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return false;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,new Array(),3);if(nodes.length>0)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},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeftvp.left+vp.width||pos.absTopvp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeftcvp.left+cvp.width||p.absTopcvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;return r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.collapseToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=new Array();this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents;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+"> ";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.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);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML=" ";if(isEmpty(paraAfter))paraAfter.innerHTML=" ";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re);var w=parseInt(re.offsetWidth);var h=parseInt(re.offsetHeight);var e=this.getElement();var ew=parseInt(e.offsetWidth);var eh=parseInt(e.offsetHeight);var x,y;switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.display='block';this.updateBlocker()}},hide:function(){var el=this.getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=new Array();this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=new Array()},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='';h+='';for(i=0;i'}h+='
';break;case'title':h+='
'+t+'';break;case'disabled':h+='
'+t+'';break;default:h+='
'+t+''}h+='
';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});if(!Function.prototype.call){Function.prototype.call=function(){var a=arguments,s=a[0],i,as='',r,o;for(i=1;i1?',':'')+'a['+i+']';o=s._fu;s._fu=this;r=eval('s._fu('+as+')');s._fu=o;return r}};TinyMCE_Engine.prototype.debug=function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",'');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);this._def("forced_root_block",false);this._def("remove_trailing_nbsp",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings.browsers.indexOf('msie')==-1)return;if(this.isGecko&&this.settings.browsers.indexOf('gecko')==-1)return;if(this.isSafari&&this.settings.browsers.indexOf('safari')==-1)return;if(this.isOpera&&this.settings.browsers.indexOf('opera')==-1)return;baseHREF=tinyMCE.settings.document_base_url;h=document.location.href;p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings.document_base_url=baseHREF;tinyMCE.settings.document_base_prefix=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings.base_href=baseHREF.substring(0,baseHREF.lastIndexOf('/'))+"/";theme=this.settings.theme;this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=[13,45,36,35,33,34,37,38,39,40];this.uniqueURL='javascript:void(091039730);';this.uniqueTag='';this.callbacks=['onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance'];this.settings.theme_href=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings.force_br_newlines=false;if(tinyMCE.getParam("popups_css",false)){cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.popups_css=this.documentBasePath+"/"+cssPath;else this.settings.popups_css=cssPath}else this.settings.popups_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.editor_css=this.documentBasePath+"/"+cssPath;else this.settings.editor_css=cssPath}else{if(this.settings.editor_css!=='')this.settings.editor_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMCE.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings.theme+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings.language+'.js');this.loadCSS(this.settings.editor_css);p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i&"]','g')},_addUnloadEvents:function(){var st=tinyMCE.settings.add_unload_trigger;if(tinyMCE.isIE){if(st){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(st)tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substring(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex0){for(i=0,lflen=this.loadedFiles.length;i');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',');var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings.convert_on_click||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang.lang_edit_confirm)))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement,n,inst,doc;formElement=document.getElementById(form_element_name);for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value.element,value.document),value.element,value.document);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCEControl(value);return;case"mceToggleEditor":inst=tinyMCE.getInstanceById(value);if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')te.value=inst.getHTML();else te.innerHTML=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')inst.setHTML(te.value);else inst.setHTML(te.innerHTML);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(tinyMCE.isGecko){for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].getDoc().designMode="off";tinyMCE.instances[n].getDoc().designMode="on";tinyMCE.instances[n].useCSS=false}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings.focus_alert)alert(tinyMCELang.lang_focus_alert)},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings.area_width;ah=""+tinyMCE.settings.area_height;if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings.auto_resize)iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings.default_document);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i,doc=inst.getDoc(),head=doc.getElementsByTagName('head').item(0);var content=inst.startContent,contentElement,body;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/</g,'<');content=content.replace(/>/g,'>');content=content.replace(/"/g,'"');content=content.replace(/&/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head||!doc.body){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings.theme+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings.content_css);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'');inst.addShortcut('ctrl','7','','FormatBlock',false,'

');inst.addShortcut('ctrl','8','','FormatBlock',false,'

');inst.addShortcut('ctrl','9','','FormatBlock',false,'
');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings.nowrap)doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings.directionality;doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings.base_href);if(tinyMCE.settings.convert_newlines_to_brs){content=tinyMCE.regexpReplace(content,"\r\n","
","gi");content=tinyMCE.regexpReplace(content,"\r","
","gi");content=tinyMCE.regexpReplace(content,"\n","
","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings.force_br_newlines)doc.styleSheets[0].addRule("p","margin: 0;");body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){contentElement=inst.getDoc().createElement("body");doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings.cleanup_on_startup)tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings.cleanup_on_startup){tinyMCE._setHTML(inst.getDoc(),content);try{tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,inst.contentDocument,this.settings,inst.getBody()))}catch(e){}}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings.visual,inst);tinyMCE.dispatchCallback(inst,'setupcontent_callback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.add({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*\"([^ >\"]*)\"','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*\"([^ >\"]*)\"','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_selects_on_submit'))return;if(typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");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;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;inst._fixRootBlocks();if(inst.settings.remove_trailing_nbsp)inst._fixTrailingNbsp();if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;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,tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="  ";else elm.innerHTML=" "}}}keys=tinyMCE.posKeyCodes;var posKey=false;for(i=0;i';h+='{$'+lang+'}';h+=''}else{h+='';h+='{$'+lang+'}';h+=''}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='';else h+='';h+='';h+='';h+='';h+=''}else{if(tinyMCE.isRealIE)h+='';else h+='';h+='';h+='';h+='';h+=''}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i0);if(tinyMCE.settings.custom_undo_redo){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i,customCleanup;customCleanup=tinyMCE.settings.cleanup_callback;if(customCleanup!='')content=tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback,window)(type,content,inst);po=tinyMCE.themes[tinyMCE.settings.theme];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){var i,x,y,tableElement,anchorName,oldW,oldH,bo,cn;if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,inst);tableElement=null;switch(el.nodeName){case"TABLE":oldW=el.style.width;oldH=el.style.height;bo=tinyMCE.getAttrib(el,"border");bo=bo==''||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(y=0;y0)return inst.cssClasses;if(!doc)return;styles=doc.styleSheets;if(styles&&styles.length>0){for(x=0;x'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings.theme];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return''+v+'';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!==''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i0)return true}}l=tinyMCE.themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},resolveDots:function(s,o){var i;if(typeof(s)=='string'){for(i=0,s=s.split('.');i':return'>'}return c}):s},add:function(c,m){var n;for(n in m)c.prototype[n]=m[n]},extend:function(p,np){var o={},n;o.parent=p;for(n in p)o[n]=p[n];for(n in np)o[n]=np[n];return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,tos,fu,p,x,fn,fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.enabled=true;this.settings=s;this.settings.theme=tinyMCE.getParam("theme","default");this.settings.width=tinyMCE.getParam("width",-1);this.settings.height=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=[];this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings.theme;if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;tos={};for(i=0;i0){for(i=0;i1&&tinyMCE.currentConfig!=this.settings.index){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings.index}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentElement(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i1&&/(^\u00a0|\u00a0$)/.test(v)){e.firstChild.nodeValue=v.replace(/(^\u00a0|\u00a0$)/,'');s.selectNode(e.firstChild,true,false,false);}}},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var i,x,z,align,img,div,doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCSS(false);this.useCSS=true}this.contentDocument=doc;if(!/mceStartTyping|mceEndTyping/.test(command)){if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return}if(focusElm&&focusElm.nodeName=="IMG"){align=focusElm.getAttribute('align');img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left')img.removeAttribute('align');else img.setAttribute('align','left');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.removeAttribute('align');div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div)}else{div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right')img.removeAttribute('align');else img.setAttribute('align','right');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return}}if(tinyMCE.settings.force_br_newlines){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!==''){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('
'+rng.htmlText+"
");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.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,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'

');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMCE.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){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(i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value.command;var sname=value.name;var svalue=value.value==null?'':value.value;var wrapper=value.wrapper?value.wrapper:"span";var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings.merge_styles_invalid_parents!==''?new RegExp(tinyMCE.settings.merge_styles_invalid_parents,"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table|img','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,[],1);for(z=0;z=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i],isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.innerHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('','gi').test(tmp.innerHTML)){for(x=0;x0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}this._addBogusBR();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":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&| |<|>)/g)){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{value=doc.createTextNode(tinyMCE.entityDecode(value))}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttribs[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(//gi,'\n');return''+c+''});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this,re=this.xmlEncodeRe;if(!this.entitiesDone)this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(re,function(c){var b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c){return'&#'+c.charCodeAt(0)+';'})}return s},split:function(re,s){var i,l,o=[],c=s.split(re);for(i=0,l=c.length;i':'>'+h+'';return o},createTag:function(d,tn,a,h){var o=d.createElement(tn),n;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o},getElementByAttributeValue:function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i]*)>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/]*)>/gi,'');h=h.replace(/<\/strong>/gi,'');h=h.replace(/<\/em>/gi,'')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/]*)>\u00A0?<\/p>/gi,' 

');h=h.replace(/]*)>\s* \s*<\/p>/gi,' 

');h=h.replace(/]*)>\s+<\/p>/gi,' 

');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}},getOuterHTML:function(e){var d;if(tinyMCE.isIE)return e.outerHTML;d=e.ownerDocument.createElement("body");d.appendChild(e.cloneNode(true));return d.innerHTML},setOuterHTML:function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i=strTok2.length){for(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 targetURL.path;for(i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(i=breakPoint-1;i=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();newRelURLParts=[];numBack=0;for(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();len=baseURLParts.length-numBack;absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');start="";end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)},convertURL:function(url,node,on_save){var dl=document.location,start,portPart,urlParts,baseUrlParts,tmpUrlParts,curl;var prot=dl.protocol,host=dl.hostname,port=dl.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||/^[ \t\r\n\+]*[#\?]/.test(url))return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings.base_href+url;if(on_save&&tinyMCE.getParam('relative_urls')){curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(curl.charAt(0)=='/')curl=tinyMCE.settings.document_base_prefix+curl;urlParts=tinyMCE.parseURL(curl);tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings.document_base_url);if(urlParts.host==tmpUrlParts.host&&(urlParts.port==tmpUrlParts.port))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url,curl)}if(!tinyMCE.getParam('relative_urls')){urlParts=tinyMCE.parseURL(url);baseUrlParts=tinyMCE.parseURL(tinyMCE.settings.base_href);url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(urlParts.anchor&&urlParts.path==baseUrlParts.path)return"#"+urlParts.anchor}if(tinyMCE.getParam('remove_script_host')){start="";portPart="";if(port!=='')portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url},convertAllRelativeURLs:function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;ibookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return false;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);if(!tinyMCE.isOpera)win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAndExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,[],3);if(nodes.length>0)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},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeftvp.left+vp.width||pos.absTopvp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();cvp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeftcvp.left+cvp.width||p.absTopcvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;return r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.collapseToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUndoIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){inst.isNotDirty=false;tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings.custom_undo_redo_levels;if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents,i;function isEmpty(para){var nodes;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;nodes=tinyMCE.getNodeTree(para,[],3);for(i=0;i <"+blockName+"> ";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst.selection.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);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML=" ";if(isEmpty(paraAfter))paraAfter.innerHTML=" ";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&endChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:function(re,p){var rep=this.getAbsPosition(re),e=this.getElement(),x,y;var w=parseInt(re.offsetWidth),h=parseInt(re.offsetHeight);var ew=parseInt(e.offsetWidth),eh=parseInt(e.offsetHeight);switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.display='block';this.updateBlocker()}},hide:function(){var el=this.getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.src='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=[];this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{init:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=[]},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='';h+='';for(i=0;i'}h+='
';break;case'title':h+='
'+t+'';break;case'disabled':h+='
'+t+'';break;default:h+='
'+t+''}h+='
';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});tinyMCE.add(TinyMCE_Engine,{debug:function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i 0) { elms = document.forms[0].elements; for (i=0; i=0; i--) { + for (i=nodes.length-1; i>=0; i--) { if (wrapper.hasChildNodes()) wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild); else @@ -164,7 +165,7 @@ TinyMCE_Popup.prototype = { // Create iframe iframe = document.createElement("iframe"); iframe.id = "mcWinIframe"; - iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings['default_document']; + iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document; iframe.width = "100%"; iframe.height = "100%"; iframe.style.margin = '0'; @@ -191,6 +192,7 @@ TinyMCE_Popup.prototype = { resizeToContent : function() { var isMSIE = (navigator.appName == "Microsoft Internet Explorer"); var isOpera = (navigator.userAgent.indexOf("Opera") != -1); + var elm, width, height, x, y, dx, dy; if (isOpera) return; @@ -198,11 +200,11 @@ TinyMCE_Popup.prototype = { if (isMSIE) { try { window.resizeTo(10, 10); } catch (e) {} - var elm = document.body; - var width = elm.offsetWidth; - var height = elm.offsetHeight; - var dx = (elm.scrollWidth - width) + 4; - var dy = elm.scrollHeight - height; + elm = document.body; + width = elm.offsetWidth; + height = elm.offsetHeight; + dx = (elm.scrollWidth - width) + 4; + dy = elm.scrollHeight - height; try { window.resizeBy(dx, dy); } catch (e) {} } else { @@ -211,8 +213,8 @@ TinyMCE_Popup.prototype = { window.resizeBy(window.innerWidth * 2, window.innerHeight * 2); window.sizeToContent(); window.scrollTo(0, 0); - var x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); - var y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); + x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0); + y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0); window.moveTo(x, y); } } @@ -223,8 +225,10 @@ TinyMCE_Popup.prototype = { }, restoreSelection : function() { + var inst; + if (this.storeSelection) { - var inst = tinyMCE.selectedInstance; + inst = tinyMCE.selectedInstance; inst.getWin().focus(); @@ -272,9 +276,11 @@ TinyMCE_Popup.prototype = { }, importClass : function(c) { + var n; + window[c] = function() {}; - for (var n in window.opener[c].prototype) + for (n in window.opener[c].prototype) window[c].prototype[n] = window.opener[c].prototype[n]; window[c].constructor = window.opener[c].constructor; diff --git a/program/js/tiny_mce/tiny_mce_src.js b/program/js/tiny_mce/tiny_mce_src.js index 9f8de6e12..ba713a897 100644 --- a/program/js/tiny_mce/tiny_mce_src.js +++ b/program/js/tiny_mce/tiny_mce_src.js @@ -5,22 +5,23 @@ function TinyMCE_Engine() { var ua; this.majorVersion = "2"; - this.minorVersion = "1.0"; - this.releaseDate = "2007-02-13"; - - this.instances = new Array(); - this.switchClassCache = new Array(); - this.windowArgs = new Array(); - this.loadedFiles = new Array(); - this.pendingFiles = new Array(); + this.minorVersion = "1.1.1"; + this.releaseDate = "2007-05-14"; + + this.instances = []; + this.switchClassCache = []; + this.windowArgs = []; + this.loadedFiles = []; + this.pendingFiles = []; this.loadingIndex = 0; - this.configs = new Array(); + this.configs = []; this.currentConfig = 0; - this.eventHandlers = new Array(); - this.log = new Array(); + this.eventHandlers = []; + this.log = []; this.undoLevels = []; this.undoIndex = 0; this.typingUndoIndex = -1; + this.settings = []; // Browser check ua = navigator.userAgent; @@ -28,18 +29,18 @@ function TinyMCE_Engine() { this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1); this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1); this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1); - this.isGecko = ua.indexOf('Gecko') != -1; + this.isGecko = ua.indexOf('Gecko') != -1; // Will also be true on Safari this.isSafari = ua.indexOf('Safari') != -1; - this.isOpera = ua.indexOf('Opera') != -1; + this.isOpera = window['opera'] && opera.buildNumber ? true : false; this.isMac = ua.indexOf('Mac') != -1; this.isNS7 = ua.indexOf('Netscape/7') != -1; this.isNS71 = ua.indexOf('Netscape/7.1') != -1; this.dialogCounter = 0; - this.plugins = new Array(); - this.themes = new Array(); - this.menus = new Array(); - this.loadedPlugins = new Array(); - this.buttonMap = new Array(); + this.plugins = []; + this.themes = []; + this.menus = []; + this.loadedPlugins = []; + this.buttonMap = []; this.isLoaded = false; // Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those @@ -58,7 +59,7 @@ function TinyMCE_Engine() { TinyMCE_Engine.prototype = { init : function(settings) { - var theme, nl, baseHREF = "", i; + var theme, nl, baseHREF = "", i, cssPath, entities, h, p, src, elements = [], head; // IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry. if (this.isMSIE5_0) @@ -72,7 +73,17 @@ TinyMCE_Engine.prototype = { // Get script base path if (!tinyMCE.baseURL) { - var elements = document.getElementsByTagName('script'); + // Search through head + head = document.getElementsByTagName('head')[0]; + + if (head) { + for (i=0, nl = head.getElementsByTagName('script'); i 0 && document.location.protocol != "file:") { p = h.indexOf('/', p + 3); h = h.substring(0, p); @@ -225,66 +237,54 @@ TinyMCE_Engine.prototype = { if (baseHREF.indexOf('://') == -1) baseHREF = h + baseHREF; - tinyMCE.settings['document_base_url'] = baseHREF; - tinyMCE.settings['document_base_prefix'] = h; + tinyMCE.settings.document_base_url = baseHREF; + tinyMCE.settings.document_base_prefix = h; } // Trim away query part if (baseHREF.indexOf('?') != -1) baseHREF = baseHREF.substring(0, baseHREF.indexOf('?')); - this.settings['base_href'] = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/"; + this.settings.base_href = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/"; - theme = this.settings['theme']; + theme = this.settings.theme; this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment'; this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment'; - this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; + this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP'; this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i"); - this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40); + this.posKeyCodes = [13,45,36,35,33,34,37,38,39,40]; this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL this.uniqueTag = ''; - this.callbacks = new Array('onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance'); + this.callbacks = ['onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance']; // Theme url - this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme; + this.settings.theme_href = tinyMCE.baseURL + "/themes/" + theme; if (!tinyMCE.isIE || tinyMCE.isOpera) - this.settings['force_br_newlines'] = false; + this.settings.force_br_newlines = false; if (tinyMCE.getParam("popups_css", false)) { - var cssPath = tinyMCE.getParam("popups_css", ""); + cssPath = tinyMCE.getParam("popups_css", ""); // Is relative if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') - this.settings['popups_css'] = this.documentBasePath + "/" + cssPath; + this.settings.popups_css = this.documentBasePath + "/" + cssPath; else - this.settings['popups_css'] = cssPath; + this.settings.popups_css = cssPath; } else - this.settings['popups_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css"; + this.settings.popups_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css"; if (tinyMCE.getParam("editor_css", false)) { - var cssPath = tinyMCE.getParam("editor_css", ""); + cssPath = tinyMCE.getParam("editor_css", ""); // Is relative if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/') - this.settings['editor_css'] = this.documentBasePath + "/" + cssPath; + this.settings.editor_css = this.documentBasePath + "/" + cssPath; else - this.settings['editor_css'] = cssPath; + this.settings.editor_css = cssPath; } else { - if (this.settings.editor_css != '') - this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; - } - - if (tinyMCE.settings['debug']) { - var msg = "Debug: \n"; - - msg += "baseURL: " + this.baseURL + "\n"; - msg += "documentBasePath: " + this.documentBasePath + "\n"; - msg += "content_css: " + this.settings['content_css'] + "\n"; - msg += "popups_css: " + this.settings['popups_css'] + "\n"; - msg += "editor_css: " + this.settings['editor_css'] + "\n"; - - alert(msg); + if (this.settings.editor_css !== '') + this.settings.editor_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css"; } // Only do this once @@ -304,14 +304,14 @@ TinyMCE_Engine.prototype = { } } - this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings['theme'] + '/editor_template' + tinyMCE.srcMode + '.js'); - this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings['language'] + '.js'); - this.loadCSS(this.settings['editor_css']); + this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings.theme + '/editor_template' + tinyMCE.srcMode + '.js'); + this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings.language + '.js'); + this.loadCSS(this.settings.editor_css); // Add plugins - var p = tinyMCE.getParam('plugins', '', true, ','); + p = tinyMCE.getParam('plugins', '', true, ','); if (p.length > 0) { - for (var i=0; i&"\']', 'g'); this.xmlEncodeRe = new RegExp('[<>&"]', 'g'); -// this.xmlEncodeEnts = {'&':'&','"':'"',"'":''','<':'<','>':'>'}; }, _addUnloadEvents : function() { + var st = tinyMCE.settings.add_unload_trigger; + if (tinyMCE.isIE) { - if (tinyMCE.settings['add_unload_trigger']) { + if (st) { tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler); tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler); } } else { - if (tinyMCE.settings['add_unload_trigger']) + if (st) tinyMCE.addEvent(window, "unload", function () {tinyMCE.triggerSave(true, true);}); } }, @@ -449,8 +450,7 @@ TinyMCE_Engine.prototype = { loadCSS : function(url) { var ar = url.replace(/\s+/, '').split(','); - var lflen = 0, csslen = 0; - var skip = false; + var lflen = 0, csslen = 0, skip = false; var x = 0, i = 0, nl, le; for (x = 0,csslen = ar.length; x", "gi"); content = tinyMCE.regexpReplace(content, "\r", "
", "gi"); content = tinyMCE.regexpReplace(content, "\n", "
", "gi"); @@ -951,10 +966,10 @@ TinyMCE_Engine.prototype = { // Ugly!!! window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500); - if (tinyMCE.settings["force_br_newlines"]) + if (tinyMCE.settings.force_br_newlines) doc.styleSheets[0].addRule("p", "margin: 0;"); - var body = inst.getBody(); + body = inst.getBody(); body.editorId = editor_id; } @@ -962,27 +977,27 @@ TinyMCE_Engine.prototype = { // Fix for bug #958637 if (!tinyMCE.isIE) { - var contentElement = inst.getDoc().createElement("body"); - var doc = inst.getDoc(); + contentElement = inst.getDoc().createElement("body"); + doc = inst.getDoc(); contentElement.innerHTML = content; - // Remove weridness! - if (tinyMCE.isGecko && tinyMCE.settings['remove_lt_gt']) - content = content.replace(new RegExp('<>', 'g'), ""); - - if (tinyMCE.settings['cleanup_on_startup']) + if (tinyMCE.settings.cleanup_on_startup) tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement)); else tinyMCE.setInnerHTML(inst.getBody(), content); tinyMCE.convertAllRelativeURLs(inst.getBody()); } else { - if (tinyMCE.settings['cleanup_on_startup']) { + if (tinyMCE.settings.cleanup_on_startup) { tinyMCE._setHTML(inst.getDoc(), content); // Produces permission denied error in MSIE 5.5 - eval('try {tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));} catch(e) {}'); + try { + tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody())); + } catch(e) { + // Ignore + } } else tinyMCE._setHTML(inst.getDoc(), content); } @@ -990,7 +1005,7 @@ TinyMCE_Engine.prototype = { // Fix for bug #957681 //inst.getDoc().designMode = inst.getDoc().designMode; - tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst); + tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings.visual, inst); tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc()); // Re-add design mode on mozilla @@ -1106,7 +1121,7 @@ TinyMCE_Engine.prototype = { }, handleEvent : function(e) { - var inst = tinyMCE.selectedInstance; + var inst = tinyMCE.selectedInstance, i, elm, keys; // Remove odd, error if (typeof(tinyMCE) == "undefined") @@ -1149,19 +1164,17 @@ TinyMCE_Engine.prototype = { } } - window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings['base_href']);tinyMCE._resetIframeHeight();", 1); + window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();", 1); return; case "submit": - tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target); - tinyMCE.triggerSave(); - tinyMCE.isNotDirty = true; + tinyMCE.formSubmit(tinyMCE.isMSIE ? window.event.srcElement : e.target); return; case "reset": var formObj = tinyMCE.isIE ? window.event.srcElement : e.target; - for (var i=0; i'; - h += ''; + h += '{$'+lang+'}'; h += ''; } else { // Normal button h += ''; - h += ''; + h += '{$'+lang+'}'; h += ''; } @@ -1500,15 +1516,45 @@ TinyMCE_Engine.prototype = { this.buttonMap[a[i]] = i; }, + formSubmit : function(f, p) { + var n, inst, found = false; + + if (f.form) + f = f.form; + + // Is it a form that has a TinyMCE instance + for (n in tinyMCE.instances) { + inst = tinyMCE.instances[n]; + + if (!tinyMCE.isInstance(inst)) + continue; + + if (inst.formElement) { + if (f == inst.formElement.form) { + found = true; + inst.isNotDirty = true; + } + } + } + + // Is valid + if (found) { + tinyMCE.removeTinyMCEFormElements(f); + tinyMCE.triggerSave(); + } + + // Is it patched + if (f.mceOldSubmit && p) + f.mceOldSubmit(); + }, + submitPatch : function() { - tinyMCE.removeTinyMCEFormElements(this); - tinyMCE.triggerSave(); - tinyMCE.isNotDirty = true; - this.mceOldSubmit(); + tinyMCE.formSubmit(this, true); }, onLoad : function() { - var r; + var r, i, c, mode, trigger, elements, element, settings, elementId, elm; + var selector, deselector, elementRefAr, form; // Wait for everything to be loaded first if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) { @@ -1527,7 +1573,7 @@ TinyMCE_Engine.prototype = { // IE produces JS error if TinyMCE is placed in a frame // It seems to have something to do with the selection not beeing // correctly initialized in IE so this hack solves the problem - if (tinyMCE.isRealIE && document.body) { + if (tinyMCE.isRealIE && document.body && window.location.href != window.top.location.href) { r = document.body.createTextRange(); r.collapse(true); r.select(); @@ -1535,24 +1581,24 @@ TinyMCE_Engine.prototype = { tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad'); - for (var c=0; c 0); - if (tinyMCE.settings['custom_undo_redo']) { + if (tinyMCE.settings.custom_undo_redo) { undoIndex = inst.undoRedo.undoIndex; undoLevels = inst.undoRedo.undoLevels.length; } @@ -1756,15 +1799,15 @@ TinyMCE_Engine.prototype = { }, _customCleanup : function(inst, type, content) { - var pl, po, i; + var pl, po, i, customCleanup; // Call custom cleanup - var customCleanup = tinyMCE.settings['cleanup_callback']; - if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined") - content = eval(customCleanup + "(type, content, inst);"); + customCleanup = tinyMCE.settings.cleanup_callback; + if (customCleanup != '') + content = tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback, window)(type, content, inst); // Trigger theme cleanup - po = tinyMCE.themes[tinyMCE.settings['theme']]; + po = tinyMCE.themes[tinyMCE.settings.theme]; if (po && po.cleanup) content = po.cleanup(type, content, inst); @@ -1789,9 +1832,9 @@ TinyMCE_Engine.prototype = { importThemeLanguagePack : function(name) { if (typeof(name) == "undefined") - name = tinyMCE.settings['theme']; + name = tinyMCE.settings.theme; - tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings['language'] + '.js'); + tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings.language + '.js'); }, importPluginLanguagePack : function(name) { @@ -1800,16 +1843,16 @@ TinyMCE_Engine.prototype = { if (this.plugins[name]) b = this.plugins[name].baseURL; - tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings['language'] + '.js'); + tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings.language + '.js'); }, - applyTemplate : function(h, as) { + applyTemplate : function(h, ag) { return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) { if (s.indexOf('lang_') == 0 && tinyMCELang[s]) return tinyMCELang[s]; - if (as && as[s]) - return as[s]; + if (ag && ag[s]) + return ag[s]; if (tinyMCE.settings[s]) return tinyMCE.settings[s]; @@ -1826,20 +1869,20 @@ TinyMCE_Engine.prototype = { }, openWindow : function(template, args) { - var html, width, height, x, y, resizable, scrollbars, url; + var html, width, height, x, y, resizable, scrollbars, url, name, win, modal, features; args = !args ? {} : args; - args['mce_template_file'] = template['file']; - args['mce_width'] = template['width']; - args['mce_height'] = template['height']; + args.mce_template_file = template.file; + args.mce_width = template.width; + args.mce_height = template.height; tinyMCE.windowArgs = args; - html = template['html']; - if (!(width = parseInt(template['width']))) + html = template.html; + if (!(width = parseInt(template.width))) width = 320; - if (!(height = parseInt(template['height']))) + if (!(height = parseInt(template.height))) height = 200; // Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!! @@ -1851,16 +1894,16 @@ TinyMCE_Engine.prototype = { x = parseInt(screen.width / 2.0) - (width / 2.0); y = parseInt(screen.height / 2.0) - (height / 2.0); - resizable = (args && args['resizable']) ? args['resizable'] : "no"; - scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no"; + resizable = (args && args.resizable) ? args.resizable : "no"; + scrollbars = (args && args.scrollbars) ? args.scrollbars : "no"; - if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1) - url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file']; + if (template.file.charAt(0) != '/' && template.file.indexOf('://') == -1) + url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template.file; else - url = template['file']; + url = template.file; // Replace all args as variables in URL - for (var name in args) { + for (name in args) { if (typeof(args[name]) == 'function') continue; @@ -1868,12 +1911,12 @@ TinyMCE_Engine.prototype = { } if (html) { - html = tinyMCE.replaceVar(html, "css", this.settings['popups_css']); + html = tinyMCE.replaceVar(html, "css", this.settings.popups_css); html = tinyMCE.applyTemplate(html, args); - var win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable); + win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable); if (win == null) { - alert(tinyMCELang['lang_popup_blocked']); + alert(tinyMCELang.lang_popup_blocked); return; } @@ -1882,34 +1925,35 @@ TinyMCE_Engine.prototype = { win.resizeTo(width, height); win.focus(); } else { - if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings["dialog_type"] == "modal") { + if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings.dialog_type == "modal") { height += 10; - var features = "resizable:" + resizable - + ";scroll:" - + scrollbars + ";status:yes;center:yes;help:no;dialogWidth:" - + width + "px;dialogHeight:" + height + "px;"; + features = "resizable:" + resizable + ";scroll:" + scrollbars + ";status:yes;center:yes;help:no;dialogWidth:" + width + "px;dialogHeight:" + height + "px;"; window.showModalDialog(url, window, features); } else { - var modal = (resizable == "yes") ? "no" : "yes"; + modal = (resizable == "yes") ? "no" : "yes"; if (tinyMCE.isGecko && tinyMCE.isMac) modal = "no"; - if (template['close_previous'] != "no") + if (template.close_previous != "no") try {tinyMCE.lastWindow.close();} catch (ex) {} - var win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable); + win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable); if (win == null) { - alert(tinyMCELang['lang_popup_blocked']); + alert(tinyMCELang.lang_popup_blocked); return; } - if (template['close_previous'] != "no") + if (template.close_previous != "no") tinyMCE.lastWindow = win; - eval('try { win.resizeTo(width, height); } catch(e) { }'); + try { + win.resizeTo(width, height); + } catch(e) { + // Ignore + } // Make it bigger if statusbar is forced if (tinyMCE.isGecko) { @@ -1927,19 +1971,19 @@ TinyMCE_Engine.prototype = { }, getVisualAidClass : function(class_name, state) { - var aidClass = tinyMCE.settings['visual_table_class']; + var i, classNames, ar, className, aidClass = tinyMCE.settings.visual_table_class; if (typeof(state) == "undefined") - state = tinyMCE.settings['visual']; + state = tinyMCE.settings.visual; // Split - var classNames = new Array(); - var ar = class_name.split(' '); - for (var i=0; i 0) className += " "; @@ -1959,30 +2003,32 @@ TinyMCE_Engine.prototype = { }, handleVisualAid : function(el, deep, state, inst, skip_dispatch) { + var i, x, y, tableElement, anchorName, oldW, oldH, bo, cn; + if (!el) return; if (!skip_dispatch) tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst); - var tableElement = null; + tableElement = null; switch (el.nodeName) { case "TABLE": - var oldW = el.style.width; - var oldH = el.style.height; - var bo = tinyMCE.getAttrib(el, "border"); + oldW = el.style.width; + oldH = el.style.height; + bo = tinyMCE.getAttrib(el, "border"); - bo = bo == "" || bo == "0" ? true : false; + bo = bo == '' || bo == "0" ? true : false; tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo)); el.style.width = oldW; el.style.height = oldH; - for (var y=0; y', 'gi'), ''); @@ -2112,11 +2127,12 @@ TinyMCE_Engine.prototype = { } // Content duplication bug fix - if (tinyMCE.isIE && tinyMCE.settings['fix_content_duplication']) { + if (tinyMCE.isIE && tinyMCE.settings.fix_content_duplication) { // Remove P elements in P elements - 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*)?", "

"); - }*/ + html = doc.body.innerHTML; // Always set the htmlText output tinyMCE.setInnerHTML(doc.body, html); @@ -2156,6 +2154,7 @@ TinyMCE_Engine.prototype = { getEditorId : function(form_element) { var inst = this.getInstanceById(form_element); + if (!inst) return null; @@ -2163,25 +2162,27 @@ TinyMCE_Engine.prototype = { }, getInstanceById : function(editor_id) { - var inst = this.instances[editor_id]; + var inst = this.instances[editor_id], n; + if (!inst) { - for (var n in tinyMCE.instances) { - var instance = tinyMCE.instances[n]; - if (!tinyMCE.isInstance(instance)) + for (n in tinyMCE.instances) { + inst = tinyMCE.instances[n]; + + if (!tinyMCE.isInstance(inst)) continue; - if (instance.formTargetElementId == editor_id) { - inst = instance; - break; - } + if (inst.formTargetElementId == editor_id) + return inst; } - } + } else + return inst; - return inst; + return null; }, queryInstanceCommandValue : function(editor_id, command) { var inst = tinyMCE.getInstanceById(editor_id); + if (inst) return inst.queryCommandValue(command); @@ -2190,6 +2191,7 @@ TinyMCE_Engine.prototype = { queryInstanceCommandState : function(editor_id, command) { var inst = tinyMCE.getInstanceById(editor_id); + if (inst) return inst.queryCommandState(command); @@ -2205,76 +2207,72 @@ TinyMCE_Engine.prototype = { }, getCSSClasses : function(editor_id, doc) { - var inst = tinyMCE.getInstanceById(editor_id); - - // Is cached, use that - if (inst && inst.cssClasses.length > 0) - return inst.cssClasses; - - if (typeof(editor_id) == "undefined" && typeof(doc) == "undefined") { - var instance; + var i, c, x, rule, styles, rules, csses, selectorText, inst = tinyMCE.getInstanceById(editor_id); + var cssClass, addClass, p; - for (var instanceName in tinyMCE.instances) { - instance = tinyMCE.instances[instanceName]; - if (!tinyMCE.isInstance(instance)) - continue; + if (!inst) + inst = tinyMCE.selectedInstance; - break; - } + if (!inst) + return []; - doc = instance.getDoc(); - } + if (!doc) + doc = inst.getDoc(); - if (typeof(doc) == "undefined") { - var instance = tinyMCE.getInstanceById(editor_id); - doc = instance.getDoc(); - } + // Is cached, use that + if (inst && inst.cssClasses.length > 0) + return inst.cssClasses; - if (doc) { - var styles = doc.styleSheets; + if (!doc) + return; - if (styles && styles.length > 0) { - for (var x=0; x 0) { + for (x=0; x' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '
'; @@ -2324,8 +2325,8 @@ TinyMCE_Engine.prototype = { } } - o = tinyMCE.themes[tinyMCE.settings['theme']]; - if (o.getControlHTML && (v = o.getControlHTML(c)) != '') { + o = tinyMCE.themes[tinyMCE.settings.theme]; + if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') { if (rtl) return '' + v + ''; @@ -2361,7 +2362,7 @@ TinyMCE_Engine.prototype = { l = tinyMCE.getParam(p, ''); - if (l != '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0) + if (l !== '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0) return true; if (ins != null) { @@ -2384,8 +2385,20 @@ TinyMCE_Engine.prototype = { return false; }, - xmlEncode : function(s, skip_apos) { - return s ? ('' + s).replace(!skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe, function (c, b) { + resolveDots : function(s, o) { + var i; + + if (typeof(s) == 'string') { + for (i=0, s=s.split('.'); i 0) { for (i=0; i 1 && tinyMCE.currentConfig != this.settings['index']) { + if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings.index) { tinyMCE.settings = this.settings; - tinyMCE.currentConfig = this.settings['index']; + tinyMCE.currentConfig = this.settings.index; } }, @@ -2709,10 +2727,12 @@ TinyMCE_Control.prototype = { isDirty : function() { // Is content modified and not in a submit procedure - return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty; + return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !this.isNotDirty; }, _mergeElements : function(scmd, pa, ch, override) { + var st, stc, className, n; + if (scmd == "removeformat") { pa.className = ""; pa.style.cssText = ""; @@ -2721,22 +2741,22 @@ TinyMCE_Control.prototype = { return; } - var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style")); - var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style")); - var className = tinyMCE.getAttrib(pa, "class"); + st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style")); + stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style")); + className = tinyMCE.getAttrib(pa, "class"); // Removed class adding due to bug #1478272 className = tinyMCE.getAttrib(ch, "class"); if (override) { - for (var n in st) { + for (n in st) { if (typeof(st[n]) == 'function') continue; stc[n] = st[n]; } } else { - for (var n in stc) { + for (n in stc) { if (typeof(stc[n]) == 'function') continue; @@ -2752,6 +2772,55 @@ TinyMCE_Control.prototype = { ch.removeAttribute("style"); }, + _fixRootBlocks : function() { + var rb, b, ne, be, nx, bm; + + rb = tinyMCE.getParam('forced_root_block'); + if (!rb) + return; + + b = this.getBody(); + ne = b.firstChild; + + while (ne) { + nx = ne.nextSibling; + + // If text node or inline element wrap it in a block element + if (ne.nodeType == 3 || !tinyMCE.blockRegExp.test(ne.nodeName)) { + if (!bm) + bm = this.selection.getBookmark(); + + if (!be) { + be = this.getDoc().createElement(rb); + be.appendChild(ne.cloneNode(true)); + b.replaceChild(be, ne); + } else { + be.appendChild(ne.cloneNode(true)); + b.removeChild(ne); + } + } else + be = null; + + ne = nx; + } + + if (bm) + this.selection.moveToBookmark(bm); + }, + + _fixTrailingNbsp : function() { + var s = this.selection, e = s.getFocusElement(), bm, v; + + if (e && tinyMCE.blockRegExp.test(e.nodeName) && e.firstChild) { + v = e.firstChild.nodeValue; + + if (v && v.length > 1 && /(^\u00a0|\u00a0$)/.test(v)) { + e.firstChild.nodeValue = v.replace(/(^\u00a0|\u00a0$)/, ''); + s.selectNode(e.firstChild, true, false, false); // Select and collapse + } + } + }, + _setUseCSS : function(b) { var d = this.getDoc(); @@ -2766,7 +2835,7 @@ TinyMCE_Control.prototype = { }, execCommand : function(command, user_interface, value) { - var doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement(); + var i, x, z, align, img, div, doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement(); // Is not a undo specific command if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) @@ -2789,8 +2858,8 @@ TinyMCE_Control.prototype = { // Fix align on images if (focusElm && focusElm.nodeName == "IMG") { - var align = focusElm.getAttribute('align'); - var img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm; + align = focusElm.getAttribute('align'); + img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm; switch (command) { case "JustifyLeft": @@ -2800,7 +2869,7 @@ TinyMCE_Control.prototype = { img.setAttribute('align', 'left'); // Remove the div - var div = focusElm.parentNode; + div = focusElm.parentNode; if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) div.parentNode.replaceChild(img, div); @@ -2813,14 +2882,14 @@ TinyMCE_Control.prototype = { img.removeAttribute('align'); // Is centered - var div = tinyMCE.getParentElement(focusElm, "div"); + div = tinyMCE.getParentElement(focusElm, "div"); if (div && div.style.textAlign == "center") { // Remove div if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) div.parentNode.replaceChild(img, div); } else { // Add div - var div = this.getDoc().createElement("div"); + div = this.getDoc().createElement("div"); div.style.textAlign = 'center'; div.appendChild(img); focusElm.parentNode.replaceChild(div, focusElm); @@ -2838,7 +2907,7 @@ TinyMCE_Control.prototype = { img.setAttribute('align', 'right'); // Remove the div - var div = focusElm.parentNode; + div = focusElm.parentNode; if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode) div.parentNode.replaceChild(img, div); @@ -2849,7 +2918,7 @@ TinyMCE_Control.prototype = { } } - if (tinyMCE.settings['force_br_newlines']) { + if (tinyMCE.settings.force_br_newlines) { var alignValue = ""; if (doc.selection.type != "Control") { @@ -2871,7 +2940,7 @@ TinyMCE_Control.prototype = { break; } - if (alignValue != "") { + if (alignValue !== '') { var rng = doc.selection.createRange(); if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null) @@ -2925,7 +2994,7 @@ TinyMCE_Control.prototype = { break; case "FormatBlock": - if (value == null || value == "") { + if (value == null || value == '') { var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp"); if (elm) @@ -2970,7 +3039,7 @@ TinyMCE_Control.prototype = { case "mceSelectNodeDepth": var parentNode = this.getFocusElement(); - for (var i=0; parentNode; i++) { + for (i=0; parentNode; i++) { if (parentNode.nodeName.toLowerCase() == "body") break; @@ -2996,14 +3065,14 @@ TinyMCE_Control.prototype = { case "SetStyleInfo": var rng = this.getRng(); var sel = this.getSel(); - var scmd = value['command']; - var sname = value['name']; - var svalue = value['value'] == null ? '' : value['value']; + var scmd = value.command; + var sname = value.name; + var svalue = value.value == null ? '' : value.value; //var svalue = value['value'] == null ? '' : value['value']; - var wrapper = value['wrapper'] ? value['wrapper'] : "span"; + var wrapper = value.wrapper ? value.wrapper : "span"; var parentElm = null; var invalidRe = new RegExp("^BODY|HTML$", "g"); - var invalidParentsRe = tinyMCE.settings['merge_styles_invalid_parents'] != '' ? new RegExp(tinyMCE.settings['merge_styles_invalid_parents'], "gi") : null; + var invalidParentsRe = tinyMCE.settings.merge_styles_invalid_parents !== '' ? new RegExp(tinyMCE.settings.merge_styles_invalid_parents, "gi") : null; // Whole element selected check if (tinyMCE.isIE) { @@ -3022,7 +3091,7 @@ TinyMCE_Control.prototype = { } } else { var felm = this.getFocusElement(); - if (sel.isCollapsed || (new RegExp('td|tr|tbody|table', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode)) + if (sel.isCollapsed || (new RegExp('td|tr|tbody|table|img', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode)) parentElm = felm; } @@ -3040,8 +3109,8 @@ TinyMCE_Control.prototype = { } // Remove style/attribs from all children - var ch = tinyMCE.getNodeTree(parentElm, new Array(), 1); - for (var z=0; z=0; i--) { + for (i=nodes.length-1; i>=0; i--) { var elm = nodes[i]; var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true"; @@ -3132,9 +3201,8 @@ TinyMCE_Control.prototype = { // Remove empty wrappers var nodes = doc.getElementsByTagName(wrapper); - for (var i=nodes.length-1; i>=0; i--) { - var elm = nodes[i]; - var isEmpty = true; + for (i=nodes.length-1; i>=0; i--) { + var elm = nodes[i], isEmpty = true; // Check if it has any attribs var tmp = doc.createElement("body"); @@ -3144,7 +3212,7 @@ TinyMCE_Control.prototype = { tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), ''); //tinyMCE.debug(tmp.innerHTML); if (new RegExp('', 'gi').test(tmp.innerHTML)) { - for (var x=0; x' + editorTemplate['html']; + deltaWidth = editorTemplate.delta_width ? editorTemplate.delta_width : 0; + deltaHeight = editorTemplate.delta_height ? editorTemplate.delta_height : 0; + html = '' + editorTemplate.html; html = tinyMCE.replaceVar(html, "editor_id", this.editorId); - 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.default_document) + this.settings.default_document = tinyMCE.baseURL + "/blank.htm"; + + this.settings.old_width = this.settings.width; + this.settings.old_height = this.settings.height; // Set default width, height - if (this.settings['width'] == -1) - this.settings['width'] = replace_element.offsetWidth; + 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.height == -1) + this.settings.height = replace_element.offsetHeight; // Try the style width - if (this.settings['width'] == 0) - this.settings['width'] = replace_element.style.width; + if (this.settings.width == 0) + this.settings.width = replace_element.style.width; // Try the style height - if (this.settings['height'] == 0) - this.settings['height'] = replace_element.style.height; + if (this.settings.height == 0) + this.settings.height = replace_element.style.height; // If no width/height then default to 320x240, better than nothing - if (this.settings['width'] == 0) - this.settings['width'] = 320; + if (this.settings.width == 0) + this.settings.width = 320; - if (this.settings['height'] == 0) - this.settings['height'] = 240; + 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; - - this.settings['width_style'] = "" + this.settings['width']; - this.settings['height_style'] = "" + this.settings['height']; + 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; + this.settings.width_style = "" + this.settings.width; + this.settings.height_style = "" + this.settings.height; // Special % handling - if (("" + this.settings['width']).indexOf('%') != -1) - this.settings['area_width'] = "100%"; + if (("" + this.settings.width).indexOf('%') != -1) + this.settings.area_width = "100%"; else - this.settings['width_style'] += 'px'; + this.settings.width_style += 'px'; - if (("" + this.settings['height']).indexOf('%') != -1) - this.settings['area_height'] = "100%"; + if (("" + this.settings.height).indexOf('%') != -1) + this.settings.area_height = "100%"; else - this.settings['height_style'] += 'px'; + this.settings.height_style += 'px'; if (("" + replace_element.style.width).indexOf('%') != -1) { - this.settings['width'] = replace_element.style.width; - this.settings['area_width'] = "100%"; - this.settings['width_style'] = "100%"; + this.settings.width = replace_element.style.width; + this.settings.area_width = "100%"; + this.settings.width_style = "100%"; } if (("" + replace_element.style.height).indexOf('%') != -1) { - this.settings['height'] = replace_element.style.height; - this.settings['area_height'] = "100%"; - this.settings['height_style'] = "100%"; + this.settings.height = replace_element.style.height; + this.settings.area_height = "100%"; + this.settings.height_style = "100%"; } html = tinyMCE.applyTemplate(html); - this.settings['width'] = this.settings['old_width']; - this.settings['height'] = this.settings['old_height']; + this.settings.width = this.settings.old_width; + this.settings.height = this.settings.old_height; - this.visualAid = this.settings['visual']; + this.visualAid = this.settings.visual; this.formTargetElementId = form_element_name; // Get replace_element contents @@ -3716,13 +3794,9 @@ TinyMCE_Control.prototype = { this.oldTargetElement = replace_element; // Debug mode - if (tinyMCE.settings['debug']) { - hc = ''; - } else { - hc = ''; - this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); - this.oldTargetElement.style.display = "none"; - } + hc = ''; + this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); + this.oldTargetElement.style.display = "none"; html += ''; @@ -3733,10 +3807,10 @@ TinyMCE_Control.prototype = { // Output HTML and set editable if (tinyMCE.isGecko) { - var rng = replace_element.ownerDocument.createRange(); + rng = replace_element.ownerDocument.createRange(); rng.setStartBefore(replace_element); - var fragment = rng.createContextualFragment(html); + fragment = rng.createContextualFragment(html); tinyMCE.insertAfter(fragment, replace_element); } else replace_element.insertAdjacentHTML("beforeBegin", html); @@ -3746,25 +3820,23 @@ TinyMCE_Control.prototype = { // Just hide the textarea element this.oldTargetElement = replace_element; - if (!tinyMCE.settings['debug']) { - this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); - this.oldTargetElement.style.display = "none"; - } + this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline'); + this.oldTargetElement.style.display = "none"; // Output HTML and set editable if (tinyMCE.isGecko) { - var rng = replace_element.ownerDocument.createRange(); + rng = replace_element.ownerDocument.createRange(); rng.setStartBefore(replace_element); - var fragment = rng.createContextualFragment(html); + fragment = rng.createContextualFragment(html); tinyMCE.insertAfter(fragment, replace_element); } else replace_element.insertAdjacentHTML("beforeBegin", html); } // Setup iframe - var dynamicIFrame = false; - var tElm = targetDoc.getElementById(this.editorId); + dynamicIFrame = false; + tElm = targetDoc.getElementById(this.editorId); if (!tinyMCE.isIE) { // Node case is preserved in XML strict mode @@ -3801,9 +3873,9 @@ TinyMCE_Control.prototype = { } // Setup base HTML - var doc = this.contentDocument; + doc = this.contentDocument; if (dynamicIFrame) { - var html = tinyMCE.getParam('doctype') + 'blank_page'; + html = tinyMCE.getParam('doctype') + 'blank_page'; try { if (!this.isHidden()) @@ -3824,7 +3896,7 @@ TinyMCE_Control.prototype = { window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1); // Setup element references - var parentElm = this.targetDoc.getElementById(this.editorId + '_parent'); + parentElm = this.targetDoc.getElementById(this.editorId + '_parent'); this.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling; tinyMCE.setupContent(this.editorId, true); @@ -3847,7 +3919,7 @@ TinyMCE_Control.prototype = { b.setAttribute('href', u); h.appendChild(b); } else { - if (u == "" || u == null) + if (u == '' || u == null) b.parentNode.removeChild(b); else b.setAttribute('href', u); @@ -3886,7 +3958,10 @@ TinyMCE_Control.prototype = { }, triggerSave : function(skip_cleanup, skip_callback) { - var e, nl = [], i, s; + var e, nl = [], i, s, content, htm; + + if (!this.enabled) + return; this.switchSettings(); s = tinyMCE.settings; @@ -3908,7 +3983,7 @@ TinyMCE_Control.prototype = { } while ((e = e.parentNode) != null) } - tinyMCE.settings['preformatted'] = false; + tinyMCE.settings.preformatted = false; // Default to false if (typeof(skip_cleanup) == "undefined") @@ -3921,17 +3996,17 @@ TinyMCE_Control.prototype = { tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML); // Remove visual aids when cleanup is disabled - if (this.settings['cleanup'] == false) { + if (this.settings.cleanup == false) { tinyMCE.handleVisualAid(this.getBody(), true, false, this); tinyMCE._setEventsEnabled(this.getBody(), true); } tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body); - var htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true); + htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true); htm = tinyMCE._customCleanup(this, "submit_content", htm); - if (!skip_callback && tinyMCE.settings['save_callback'] != "") - var content = eval(tinyMCE.settings['save_callback'] + "(this.formTargetElementId,htm,this.getBody());"); + if (!skip_callback && tinyMCE.settings.save_callback !== '') + content = tinyMCE.resolveDots(tinyMCE.settings.save_callback, window)(this.formTargetElementId,htm,this.getBody()); // Use callback content if available if ((typeof(content) != "undefined") && content != null) @@ -3963,444 +4038,441 @@ TinyMCE_Control.prototype = { /* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */ -TinyMCE_Engine.prototype.cleanupHTMLCode = function(s) { - s = s.replace(new RegExp('

', 'gi'), '

 

'); - s = s.replace(new RegExp('

\\s*<\\/p>', 'gi'), '

 

'); +tinyMCE.add(TinyMCE_Engine, { + cleanupHTMLCode : function(s) { + s = s.replace(new RegExp('

', 'gi'), '

 

'); + s = s.replace(new RegExp('

\\s*<\\/p>', 'gi'), '

 

'); - // Fix close BR elements - s = s.replace(new RegExp('
\\s*<\\/br>', 'gi'), '
'); + // Fix close BR elements + s = s.replace(new RegExp('
\\s*<\\/br>', 'gi'), '
'); - // Open closed tags like to - s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3>'); + // Open closed tags like to + s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3>'); - // Remove trailing space to - s = s.replace(new RegExp('\\s+> to + s = s.replace(new RegExp('\\s+> to - s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />'); + // Close tags to + s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />'); - // Weird MSIE bug,


breaks runtime? - if (tinyMCE.isIE) - s = s.replace(new RegExp('


<\\/p>', 'gi'), "
"); - - // Weird tags will make IE error #bug: 1538495 - if (tinyMCE.isIE) - s = s.replace(//g, ''); + // Weird MSIE bug,


breaks runtime? + if (tinyMCE.isIE) + s = s.replace(new RegExp('


<\\/p>', 'gi'), "
"); - // Convert relative anchors to absolute URLs ex: #something to file.htm#something - // Removed: Since local document anchors should never be forced absolute example edit.php?id=something - //if (tinyMCE.getParam('convert_urls')) - // s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings['document_base_url'] + "#"); + // Weird tags will make IE error #bug: 1538495 + if (tinyMCE.isIE) + s = s.replace(//g, ''); - return s; -}; + // Convert relative anchors to absolute URLs ex: #something to file.htm#something + // Removed: Since local document anchors should never be forced absolute example edit.php?id=something + //if (tinyMCE.getParam('convert_urls')) + // s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings.document_base_url + "#"); -TinyMCE_Engine.prototype.parseStyle = function(str) { - var ar = new Array(); + return s; + }, - if (str == null) - return ar; + parseStyle : function(str) { + var ar = [], st, i, re, pa; - var st = str.split(';'); + if (str == null) + return ar; - tinyMCE.clearArray(ar); + st = str.split(';'); - for (var i=0; i 1) - val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')"; - } + if (m.length > 1) + val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')"; + } - // Force HEX colors - if (tinyMCE.getParam("force_hex_style_colors")) - val = tinyMCE.convertRGBToHex(val, true); + // Force HEX colors + if (tinyMCE.getParam("force_hex_style_colors")) + val = tinyMCE.convertRGBToHex(val, true); - val = val.replace(/\"/g, '\''); + val = val.replace(/\"/g, '\''); - if (val != "url('')") - str += key.toLowerCase() + ": " + val + "; "; + if (val != "url('')") + str += key.toLowerCase() + ": " + val + "; "; + } } - } - if (new RegExp('; $').test(str)) - str = str.substring(0, str.length - 2); + if (new RegExp('; $').test(str)) + str = str.substring(0, str.length - 2); - return str; -}; + return str; + }, -TinyMCE_Engine.prototype.convertRGBToHex = function(s, k) { - if (s.toLowerCase().indexOf('rgb') != -1) { - var re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi"); - var rgb = s.replace(re, "$1,$2,$3,$4,$5").split(','); - if (rgb.length == 5) { - r = parseInt(rgb[1]).toString(16); - g = parseInt(rgb[2]).toString(16); - b = parseInt(rgb[3]).toString(16); + convertRGBToHex : function(s, k) { + var re, rgb; - r = r.length == 1 ? '0' + r : r; - g = g.length == 1 ? '0' + g : g; - b = b.length == 1 ? '0' + b : b; + if (s.toLowerCase().indexOf('rgb') != -1) { + re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi"); + rgb = s.replace(re, "$1,$2,$3,$4,$5").split(','); - s = "#" + r + g + b; + if (rgb.length == 5) { + r = parseInt(rgb[1]).toString(16); + g = parseInt(rgb[2]).toString(16); + b = parseInt(rgb[3]).toString(16); - if (k) - s = rgb[0] + s + rgb[4]; - } - } + r = r.length == 1 ? '0' + r : r; + g = g.length == 1 ? '0' + g : g; + b = b.length == 1 ? '0' + b : b; - return s; -}; + s = "#" + r + g + b; -TinyMCE_Engine.prototype.convertHexToRGB = function(s) { - if (s.indexOf('#') != -1) { - s = s.replace(new RegExp('[^0-9A-F]', 'gi'), ''); - return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")"; - } + if (k) + s = rgb[0] + s + rgb[4]; + } + } - return s; -}; + return s; + }, + + convertHexToRGB : function(s) { + if (s.indexOf('#') != -1) { + s = s.replace(new RegExp('[^0-9A-F]', 'gi'), ''); + return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")"; + } -TinyMCE_Engine.prototype.convertSpansToFonts = function(doc) { - var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); + return s; + }, - /*var h = doc.body.innerHTML; - h = h.replace(/ 0) { - tinyMCE.setAttrib(s[i], 'size', fSize); - s[i].style.fontSize = ''; - } + if (fSize > 0) { + tinyMCE.setAttrib(s[i], 'size', fSize); + s[i].style.fontSize = ''; + } - var fFace = s[i].style.fontFamily; - if (fFace != null && fFace != "") { - tinyMCE.setAttrib(s[i], 'face', fFace); - s[i].style.fontFamily = ''; - } + fFace = s[i].style.fontFamily; + if (fFace != null && fFace !== '') { + tinyMCE.setAttrib(s[i], 'face', fFace); + s[i].style.fontFamily = ''; + } - var fColor = s[i].style.color; - if (fColor != null && fColor != "") { - tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor)); - s[i].style.color = ''; + fColor = s[i].style.color; + if (fColor != null && fColor !== '') { + tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor)); + s[i].style.color = ''; + } } - } -}; + }, -TinyMCE_Engine.prototype.convertFontsToSpans = function(doc) { - var sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); + convertFontsToSpans : function(doc) { + var fsClasses, s, i, fSize, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(','); -/* var h = doc.body.innerHTML; - h = h.replace(/ 0 && fSize < 8) { + if (fsClasses != null) + tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]); + else + s[i].style.fontSize = sizes[fSize-1]; + } - if (fSize != "") { - fSize = parseInt(fSize); + s[i].removeAttribute('size'); + } - if (fSize > 0 && fSize < 8) { - if (fsClasses != null) - tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]); - else - s[i].style.fontSize = sizes[fSize-1]; + if (fFace !== '') { + s[i].style.fontFamily = fFace; + s[i].removeAttribute('face'); } - s[i].removeAttribute('size'); + if (fColor !== '') { + s[i].style.color = fColor; + s[i].removeAttribute('color'); + } } + }, - if (fFace != "") { - s[i].style.fontFamily = fFace; - s[i].removeAttribute('face'); - } + cleanupAnchors : function(doc) { + var i, cn, x, an = doc.getElementsByTagName("a"); + + // Loops backwards due to bug #1467987 + for (i=an.length-1; i>=0; i--) { + if (tinyMCE.getAttrib(an[i], "name") !== '' && tinyMCE.getAttrib(an[i], "href") == '') { + cn = an[i].childNodes; - if (fColor != "") { - s[i].style.color = fColor; - s[i].removeAttribute('color'); + for (x=cn.length-1; x>=0; x--) + tinyMCE.insertAfter(cn[x], an[i]); + } } - } -}; + }, -TinyMCE_Engine.prototype.cleanupAnchors = function(doc) { - var i, cn, x, an = doc.getElementsByTagName("a"); + getContent : function(editor_id) { + if (typeof(editor_id) != "undefined") + tinyMCE.getInstanceById(editor_id).select(); - // Loops backwards due to bug #1467987 - for (i=an.length-1; i>=0; i--) { - if (tinyMCE.getAttrib(an[i], "name") != "" && tinyMCE.getAttrib(an[i], "href") == "") { - cn = an[i].childNodes; + if (tinyMCE.selectedInstance) + return tinyMCE.selectedInstance.getHTML(); - for (x=cn.length-1; x>=0; x--) - tinyMCE.insertAfter(cn[x], an[i]); - } - } -}; + return null; + }, -TinyMCE_Engine.prototype.getContent = function(editor_id) { - if (typeof(editor_id) != "undefined") - tinyMCE.getInstanceById(editor_id).select(); + _fixListElements : function(d) { + var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np; - if (tinyMCE.selectedInstance) - return tinyMCE.selectedInstance.getHTML(); + for (x=0; x]*>/gi, ''); - h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), ''); - h = h.replace(/


<\/p>/g, '
'); - h = h.replace(/

( | )<\/p>


( | )<\/p>/g, '


'); - h = h.replace(/\s*
\s*<\/td>/g, '' + nb + ''); - h = h.replace(/

\s*
\s*<\/p>/g, '

' + nb + '

'); - h = h.replace(/
$/, ''); // Remove last BR for Gecko - h = h.replace(/
<\/p>/g, '

'); // Remove last BR in P tags for Gecko - h = h.replace(/

\s*( | )\s*
\s*( | )\s*<\/p>/g, '

' + nb + '

'); - h = h.replace(/

\s*( | )\s*
\s*<\/p>/g, '

' + nb + '

'); - h = h.replace(/

\s*
\s* \s*<\/p>/g, '

' + nb + '

'); - h = h.replace(new RegExp('(.*?)<\\/a>', 'g'), '$1'); - h = h.replace(/]*)>\s*<\/p>/g, '' + nb + '

'); - - // Clean body - if (/^\s*(
|

 <\/p>|

 <\/p>|

<\/p>)\s*$/.test(h)) - h = ''; - - // If preformatted - if (s.preformatted) { - h = h.replace(/^

/, '');
-		h = h.replace(/<\/pre>$/, '');
-		h = '
' + h + '
'; - } + if (tinyMCE.getParam("convert_fonts_to_spans")) + tinyMCE.convertFontsToSpans(doc); - // Gecko specific processing - if (tinyMCE.isGecko) { - h = h.replace(//g, ''); - h = h.replace(/]*)>\s*
\s*<\/td>/g, '' + nb + ''); - } + if (tinyMCE.getParam("fix_list_elements")) + tinyMCE._fixListElements(doc); - if (s.force_br_newlines) - h = h.replace(/

( | )<\/p>/g, '
'); + if (tinyMCE.getParam("fix_table_elements")) + tinyMCE._fixTables(doc); - // Call custom cleanup code - h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h); + // Call custom cleanup code + tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body); - // Remove internal classes - if (on_save) { - h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), ''); - h = h.replace(new RegExp(' ?class=""', 'g'), ''); - } + if (d) + t2 = new Date().getTime(); - if (s.remove_linebreaks && !c.settings.indent) - h = h.replace(/\n|\r/g, ' '); + c.settings.on_save = on_save; - if (d) - t4 = new Date().getTime(); + c.idCount = 0; + c.serializationId = new Date().getTime().toString(32); // Unique ID needed for the content duplication bug + c.serializedNodes = []; + c.sourceIndex = -1; - if (on_save && c.settings.indent) - h = c.formatHTML(h); + if (s.cleanup_serializer == "xml") + h = c.serializeNodeAsXML(elm, inn); + else + h = c.serializeNodeAsHTML(elm, inn); + + if (d) + t3 = new Date().getTime(); + + // Post processing + nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? ' ' : ' '; + h = h.replace(/<\/?(body|head|html)[^>]*>/gi, ''); + h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), ''); + h = h.replace(/


<\/p>/g, '
'); + h = h.replace(/

( | )<\/p>


( | )<\/p>/g, '


'); + h = h.replace(/\s*
\s*<\/td>/g, '' + nb + ''); + h = h.replace(/

\s*
\s*<\/p>/g, '

' + nb + '

'); + h = h.replace(/
$/, ''); // Remove last BR for Gecko + h = h.replace(/
<\/p>/g, '

'); // Remove last BR in P tags for Gecko + h = h.replace(/

\s*( | )\s*
\s*( | )\s*<\/p>/g, '

' + nb + '

'); + h = h.replace(/

\s*( | )\s*
\s*<\/p>/g, '

' + nb + '

'); + h = h.replace(/

\s*
\s* \s*<\/p>/g, '

' + nb + '

'); + h = h.replace(new RegExp('
(.*?)<\\/a>', 'g'), '$1'); + h = h.replace(/]*)>\s*<\/p>/g, '' + nb + '

'); + + // Clean body + if (/^\s*(
|

 <\/p>|

 <\/p>|

<\/p>)\s*$/.test(h)) + h = ''; + + // If preformatted + if (s.preformatted) { + h = h.replace(/^

/, '');
+			h = h.replace(/<\/pre>$/, '');
+			h = '
' + h + '
'; + } + + // Gecko specific processing + if (tinyMCE.isGecko) { + // Makes no sence but FF generates it!! + h = h.replace(/
\s*<\/li>/g, ''); + h = h.replace(/ \s*<\/(dd|dt)>/g, ''); + h = h.replace(//g, ''); + h = h.replace(/]*)>\s*
\s*<\/td>/g, '' + nb + ''); + } - // If encoding (not recommended option) - if (on_submit && (s.encoding == "xml" || s.encoding == "html")) - h = c.xmlEncode(h); + if (s.force_br_newlines) + h = h.replace(/

( | )<\/p>/g, '
'); - if (d) - t5 = new Date().getTime(); + // Call custom cleanup code + h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h); - if (c.settings.debug) - tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + "."); + // Remove internal classes + if (on_save) { + h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), ''); + h = h.replace(new RegExp(' ?class=""', 'g'), ''); + } - return h; -}; + if (s.remove_linebreaks && !c.settings.indent) + h = h.replace(/\n|\r/g, ' '); + + if (d) + t4 = new Date().getTime(); + + if (on_save && c.settings.indent) + h = c.formatHTML(h); + + // If encoding (not recommended option) + if (on_submit && (s.encoding == "xml" || s.encoding == "html")) + h = c.xmlEncode(h); + + if (d) + t5 = new Date().getTime(); + + if (c.settings.debug) + tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + "."); + + return h; + } +}); function TinyMCE_Cleanup() { this.isIE = (navigator.appName == "Microsoft Internet Explorer"); - this.rules = tinyMCE.clearArray(new Array()); + this.rules = tinyMCE.clearArray([]); // Default config this.settings = { @@ -4418,7 +4490,7 @@ function TinyMCE_Cleanup() { verify_html : false }; - this.vElements = tinyMCE.clearArray(new Array()); + this.vElements = tinyMCE.clearArray([]); this.vElementsRe = ''; this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/; this.codeElementsRe = /^(SCRIPT|STYLE)$/; @@ -4448,7 +4520,7 @@ TinyMCE_Cleanup.prototype = { this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>'); this.serializedNodes = []; - if (s.invalid_elements != '') + if (s.invalid_elements !== '') this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$'); else this.iveRe = null; @@ -4469,19 +4541,17 @@ TinyMCE_Cleanup.prototype = { this.fillStr = s.entity_encoding == "named" ? " " : " "; this.idCount = 0; this.xmlEncodeRe = new RegExp('[\u007F-\uFFFF<>&"]', 'g'); - this.xmlEncodeAposRe = new RegExp('[\u007F-\uFFFF<>&"\']', 'g'); }, addRuleStr : function(s) { - var r = this.parseRuleStr(s); - var n; + var r = this.parseRuleStr(s), n; for (n in r) { if (r[n]) this.rules[n] = r[n]; } - this.vElements = tinyMCE.clearArray(new Array()); + this.vElements = tinyMCE.clearArray([]); for (n in this.rules) { if (this.rules[n]) @@ -4492,7 +4562,8 @@ TinyMCE_Cleanup.prototype = { }, isValid : function(n) { - this._setupRules(); // Will initialize cleanup rules + if (!this.rulesDone) + this._setupRules(); // Will initialize cleanup rules // Empty is true since it removes formatting if (!n) @@ -4548,9 +4619,9 @@ TinyMCE_Cleanup.prototype = { } r += ')$'; -//tinyMCE.debug(t + "=" + r); + if (this.childRules == null) - this.childRules = tinyMCE.clearArray(new Array()); + this.childRules = tinyMCE.clearArray([]); this.childRules[tn[y]] = new RegExp(r); @@ -4561,7 +4632,7 @@ TinyMCE_Cleanup.prototype = { }, parseRuleStr : function(s) { - var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray(new Array()), dv; + var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray([]), dv; if (s == null || s.length == 0) return or; @@ -4621,19 +4692,19 @@ TinyMCE_Cleanup.prototype = { if (av && av.length > 0) { if (av[0].charAt(0) == ':') { if (!r.forceAttribs) - r.forceAttribs = tinyMCE.clearArray(new Array()); + r.forceAttribs = tinyMCE.clearArray([]); r.forceAttribs[t.toLowerCase()] = av[0].substring(1); } else if (av[0].charAt(0) == '=') { if (!r.defaultAttribs) - r.defaultAttribs = tinyMCE.clearArray(new Array()); + r.defaultAttribs = tinyMCE.clearArray([]); dv = av[0].substring(1); - r.defaultAttribs[t.toLowerCase()] = dv == "" ? "mce_empty" : dv; + r.defaultAttribs[t.toLowerCase()] = dv == '' ? "mce_empty" : dv; } else if (av[0].charAt(0) == '<') { if (!r.validAttribValues) - r.validAttribValues = tinyMCE.clearArray(new Array()); + r.validAttribValues = tinyMCE.clearArray([]); r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i'); } @@ -4656,7 +4727,7 @@ TinyMCE_Cleanup.prototype = { //tinyMCE.debug(r.tag, r.oTagName, r.vAttribsRe, r.vAttribsReWC); } else { r.vAttribsRe = ''; - r.vAttribs = tinyMCE.clearArray(new Array()); + r.vAttribs = tinyMCE.clearArray([]); r.vAttribsReIsWild = false; } @@ -4745,7 +4816,8 @@ TinyMCE_Cleanup.prototype = { serializeNodeAsHTML : function(n, inn) { var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr, nn; - this._setupRules(); // Will initialize cleanup rules + if (!this.rulesDone) + this._setupRules(); // Will initialize cleanup rules if (tinyMCE.isRealIE && this._isDuplicate(n)) return ''; @@ -4767,12 +4839,19 @@ TinyMCE_Cleanup.prototype = { if (st) break; - // MSIE sometimes produces - if ((tinyMCE.isRealIE) && n.nodeName.indexOf('/') != -1) - break; - nn = n.nodeName; + if (tinyMCE.isRealIE) { + // MSIE sometimes produces + if (n.nodeName.indexOf('/') != -1) + break; + + // MSIE has it's NS in a separate attrib + if (n.scopeName && n.scopeName != 'HTML') + nn = n.scopeName.toUpperCase() + ':' + nn.toUpperCase(); + } else if (tinyMCE.isOpera && nn.indexOf(':') > 0) + nn = nn.toUpperCase(); + // Convert fonts to spans if (this.settings.convert_fonts_to_spans) { // On get content FONT -> SPAN @@ -4959,25 +5038,26 @@ TinyMCE_Cleanup.prototype = { return o; }, - xmlEncode : function(s, skip_apos) { - var cl = this, re = !skip_apos ? this.xmlEncodeAposRe : this.xmlEncodeRe; + xmlEncode : function(s) { + var cl = this, re = this.xmlEncodeRe; - this._setupEntities(); // Will intialize lookup table + if (!this.entitiesDone) + this._setupEntities(); // Will intialize lookup table switch (this.settings.entity_encoding) { case "raw": - return tinyMCE.xmlEncode(s, skip_apos); + return tinyMCE.xmlEncode(s); case "named": - return s.replace(re, function (c, b) { - b = cl.entities[c.charCodeAt(0)]; + return s.replace(re, function (c) { + var b = cl.entities[c.charCodeAt(0)]; return b ? '&' + b + ';' : c; }); case "numeric": - return s.replace(re, function (c, b) { - return b ? '&#' + c.charCodeAt(0) + ';' : c; + return s.replace(re, function (c) { + return '&#' + c.charCodeAt(0) + ';'; }); } @@ -4985,11 +5065,10 @@ TinyMCE_Cleanup.prototype = { }, split : function(re, s) { - var c = s.split(re); - var i, l, o = new Array(); + var i, l, o = [], c = s.split(re); for (i=0, l=c.length; i' : '>' + h + ''; + o += !h ? ' />' : '>' + h + ''; - return o; -}; + return o; + }, -TinyMCE_Engine.prototype.createTag = function(d, tn, a, h) { - var o = d.createElement(tn); + createTag : function(d, tn, a, h) { + var o = d.createElement(tn), n; - if (a) { - for (n in a) { - if (typeof(a[n]) != 'function' && a[n] != null) - tinyMCE.setAttrib(o, n, a[n]); + if (a) { + for (n in a) { + if (typeof(a[n]) != 'function' && a[n] != null) + tinyMCE.setAttrib(o, n, a[n]); + } } - } - - if (h) - o.innerHTML = h; - return o; -}; + if (h) + o.innerHTML = h; -TinyMCE_Engine.prototype.getElementByAttributeValue = function(n, e, a, v) { - return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0]; -}; + return o; + }, -TinyMCE_Engine.prototype.getElementsByAttributeValue = function(n, e, a, v) { - var i, nl = n.getElementsByTagName(e), o = new Array(); + getElementByAttributeValue : function(n, e, a, v) { + return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0]; + }, - for (i=0; i]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/]*)>/gi, ''); - h = h.replace(/<\/strong>/gi, '
'); - h = h.replace(/<\/em>/gi, ''); - } + insertAfter : function(n, r){ + if (r.nextSibling) + r.parentNode.insertBefore(n, r.nextSibling); + else + r.parentNode.appendChild(n); + }, - if (tinyMCE.isRealIE) { - // Since MSIE handles invalid HTML better that valid XHTML we - // need to make some things invalid.


gets converted to
. - h = h.replace(/\s\/>/g, '>'); + setInnerHTML : function(e, h) { + var i, nl, n; - // Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones - h = h.replace(/]*)>\u00A0?<\/p>/gi, ' 

'); // Keep empty paragraphs - h = h.replace(/]*)>\s* \s*<\/p>/gi, ' 

'); // Keep empty paragraphs - h = h.replace(/]*)>\s+<\/p>/gi, ' 

'); // Keep empty paragraphs + // Convert all strong/em to b/i in Gecko + if (tinyMCE.isGecko) { + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/]*)>/gi, ''); + h = h.replace(/<\/strong>/gi, '
'); + h = h.replace(/<\/em>/gi, ''); + } - // Remove first comment - e.innerHTML = tinyMCE.uniqueTag + h; - e.firstChild.removeNode(true); + if (tinyMCE.isRealIE) { + // Since MSIE handles invalid HTML better that valid XHTML we + // need to make some things invalid.
gets converted to
. + h = h.replace(/\s\/>/g, '>'); + + // Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones + h = h.replace(/]*)>\u00A0?<\/p>/gi, ' 

'); // Keep empty paragraphs + h = h.replace(/]*)>\s* \s*<\/p>/gi, ' 

'); // Keep empty paragraphs + h = h.replace(/]*)>\s+<\/p>/gi, ' 

'); // Keep empty paragraphs + + // Remove first comment + e.innerHTML = tinyMCE.uniqueTag + h; + e.firstChild.removeNode(true); + + // Remove weird auto generated empty paragraphs unless it's supposed to be there + nl = e.getElementsByTagName("p"); + for (i=nl.length-1; i>=0; i--) { + n = nl[i]; + + if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep) + n.parentNode.removeChild(n); + } + } else { + h = this.fixGeckoBaseHREFBug(1, e, h); + e.innerHTML = h; + this.fixGeckoBaseHREFBug(2, e, h); + } + }, - // Remove weird auto generated empty paragraphs unless it's supposed to be there - nl = e.getElementsByTagName("p"); - for (i=nl.length-1; i>=0; i--) { - n = nl[i]; + getOuterHTML : function(e) { + var d; - if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep) - n.parentNode.removeChild(n); - } - } else { - h = this.fixGeckoBaseHREFBug(1, e, h); - e.innerHTML = h; - this.fixGeckoBaseHREFBug(2, e, h); - } -}; + if (tinyMCE.isIE) + return e.outerHTML; -TinyMCE_Engine.prototype.getOuterHTML = function(e) { - if (tinyMCE.isIE) - return e.outerHTML; + d = e.ownerDocument.createElement("body"); + d.appendChild(e.cloneNode(true)); - var d = e.ownerDocument.createElement("body"); - d.appendChild(e.cloneNode(true)); - return d.innerHTML; -}; + return d.innerHTML; + }, -TinyMCE_Engine.prototype.setOuterHTML = function(e, h, d) { - var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t; + setOuterHTML : function(e, h, d) { + var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t; - if (tinyMCE.isIE && e.nodeType == 1) - e.outerHTML = h; - else { - t = d.createElement("body"); - t.innerHTML = h; + if (tinyMCE.isIE && e.nodeType == 1) + e.outerHTML = h; + else { + t = d.createElement("body"); + t.innerHTML = h; - for (i=0, nl=t.childNodes; i-1; i--) { - if (ar[i].specified && ar[i].nodeValue) - ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue); - } + ar = e.attributes; + for (i=ar.length-1; i>-1; i--) { + if (ar[i].specified && ar[i].nodeValue) + ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue); + } - ar = e.childNodes; - for (i=0; i= strTok2.length) { - for (var i=0; i= strTok2.length || strTok1[i] != strTok2[i]) { - breakPoint = i + 1; - break; + if (targetURL.path == '') + targetURL.path = "/"; + else + forceSlash = true; + + // Crop away last path part + base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/')); + strTok1 = base_url.split('/'); + strTok2 = targetURL.path.split('/'); + + if (strTok1.length >= strTok2.length) { + for (i=0; i= strTok2.length || strTok1[i] != strTok2[i]) { + breakPoint = i + 1; + break; + } } } - } - if (strTok1.length < strTok2.length) { - for (var i=0; i= strTok1.length || strTok1[i] != strTok2[i]) { - breakPoint = i + 1; - break; + if (strTok1.length < strTok2.length) { + for (i=0; i= strTok1.length || strTok1[i] != strTok2[i]) { + breakPoint = i + 1; + break; + } } } - } - if (breakPoint == 1) - return targetURL.path; + if (breakPoint == 1) + return targetURL.path; - for (var i=0; i<(strTok1.length-(breakPoint-1)); i++) - outPath += "../"; + for (i=0; i<(strTok1.length-(breakPoint-1)); i++) + outPath += "../"; - for (var i=breakPoint-1; i=0; i--) { - if (baseURLParts[i].length == 0) - continue; + // Remove empty chunks + newBaseURLParts = []; + for (i=baseURLParts.length-1; i>=0; i--) { + if (baseURLParts[i].length == 0) + continue; - newBaseURLParts[newBaseURLParts.length] = baseURLParts[i]; - } - baseURLParts = newBaseURLParts.reverse(); + newBaseURLParts[newBaseURLParts.length] = baseURLParts[i]; + } + baseURLParts = newBaseURLParts.reverse(); - // Merge relURLParts chunks - var newRelURLParts = new Array(); - var numBack = 0; - for (var i=relURLParts.length-1; i>=0; i--) { - if (relURLParts[i].length == 0 || relURLParts[i] == ".") - continue; + // Merge relURLParts chunks + newRelURLParts = []; + numBack = 0; + for (i=relURLParts.length-1; i>=0; i--) { + if (relURLParts[i].length == 0 || relURLParts[i] == ".") + continue; - if (relURLParts[i] == '..') { - numBack++; - continue; - } + if (relURLParts[i] == '..') { + numBack++; + continue; + } - if (numBack > 0) { - numBack--; - continue; - } + if (numBack > 0) { + numBack--; + continue; + } - newRelURLParts[newRelURLParts.length] = relURLParts[i]; - } + newRelURLParts[newRelURLParts.length] = relURLParts[i]; + } - relURLParts = newRelURLParts.reverse(); + relURLParts = newRelURLParts.reverse(); - // Remove end from absolute path - var len = baseURLParts.length-numBack; - var absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/'); - var start = "", end = ""; + // Remove end from absolute path + len = baseURLParts.length-numBack; + absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/'); + start = ""; + end = ""; - // Build output URL - relURL.protocol = baseURL.protocol; - relURL.host = baseURL.host; - relURL.port = baseURL.port; + // Build output URL + relURL.protocol = baseURL.protocol; + relURL.host = baseURL.host; + relURL.port = baseURL.port; - // Re-add trailing slash if it's removed - if (relURL.path.charAt(relURL.path.length-1) == "/") - absPath += "/"; + // Re-add trailing slash if it's removed + if (relURL.path.charAt(relURL.path.length-1) == "/") + absPath += "/"; - relURL.path = absPath; + relURL.path = absPath; - return this.serializeURL(relURL); -}; + return this.serializeURL(relURL); + }, -TinyMCE_Engine.prototype.convertURL = function(url, node, on_save) { - var prot = document.location.protocol; - var host = document.location.hostname; - var port = document.location.port; + convertURL : function(url, node, on_save) { + var dl = document.location, start, portPart, urlParts, baseUrlParts, tmpUrlParts, curl; + var prot = dl.protocol, host = dl.hostname, port = dl.port; - // Pass through file protocol - if (prot == "file:") - return url; + // Pass through file protocol + if (prot == "file:") + return url; - // Something is wrong, remove weirdness - url = tinyMCE.regexpReplace(url, '(http|https):///', '/'); + // Something is wrong, remove weirdness + url = tinyMCE.regexpReplace(url, '(http|https):///', '/'); - // Mailto link or anchor (Pass through) - if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || tinyMCE.regexpReplace(url,'[ \t\r\n\+]|%20','').charAt(0) == "#") - return url; + // Mailto link or anchor (Pass through) + if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || /^[ \t\r\n\+]*[#\?]/.test(url)) + return url; - // Fix relative/Mozilla - if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/') - return tinyMCE.settings['base_href'] + url; + // Fix relative/Mozilla + if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/') + return tinyMCE.settings.base_href + url; - // Handle relative URLs - if (on_save && tinyMCE.getParam('relative_urls')) { - var curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url); - if (curl.charAt(0) == '/') - curl = tinyMCE.settings['document_base_prefix'] + curl; + // Handle relative URLs + if (on_save && tinyMCE.getParam('relative_urls')) { + curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url); + if (curl.charAt(0) == '/') + curl = tinyMCE.settings.document_base_prefix + curl; - var urlParts = tinyMCE.parseURL(curl); - var tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings['document_base_url']); + urlParts = tinyMCE.parseURL(curl); + tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings.document_base_url); - // Force relative - if (urlParts['host'] == tmpUrlParts['host'] && (urlParts['port'] == tmpUrlParts['port'])) - return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings['document_base_url'], curl); - } + // Force relative + if (urlParts.host == tmpUrlParts.host && (urlParts.port == tmpUrlParts.port)) + return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url, curl); + } - // Handle absolute URLs - if (!tinyMCE.getParam('relative_urls')) { - var urlParts = tinyMCE.parseURL(url); - var baseUrlParts = tinyMCE.parseURL(tinyMCE.settings['base_href']); + // Handle absolute URLs + if (!tinyMCE.getParam('relative_urls')) { + urlParts = tinyMCE.parseURL(url); + baseUrlParts = tinyMCE.parseURL(tinyMCE.settings.base_href); - // Force absolute URLs from relative URLs - url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], url); + // Force absolute URLs from relative URLs + url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url); - // If anchor and path is the same page - if (urlParts['anchor'] && urlParts['path'] == baseUrlParts['path']) - return "#" + urlParts['anchor']; - } + // If anchor and path is the same page + if (urlParts.anchor && urlParts.path == baseUrlParts.path) + return "#" + urlParts.anchor; + } - // Remove current domain - if (tinyMCE.getParam('remove_script_host')) { - var start = "", portPart = ""; + // Remove current domain + if (tinyMCE.getParam('remove_script_host')) { + start = ""; + portPart = ""; - if (port != "") - portPart = ":" + port; + if (port !== '') + portPart = ":" + port; - start = prot + "//" + host + portPart + "/"; + start = prot + "//" + host + portPart + "/"; - if (url.indexOf(start) == 0) - url = url.substring(start.length-1); - } + if (url.indexOf(start) == 0) + url = url.substring(start.length-1); + } - return url; -}; + return url; + }, -TinyMCE_Engine.prototype.convertAllRelativeURLs = function(body) { - var i, elms, src, href, mhref, msrc; + convertAllRelativeURLs : function(body) { + var i, elms, src, href, mhref, msrc; - // Convert all image URL:s to absolute URL - elms = body.getElementsByTagName("img"); - for (i=0; i 0) rng.selectNodeContents(nodes[0]); else @@ -6706,7 +6799,7 @@ TinyMCE_Selection.prototype = { function TinyMCE_UndoRedo(inst) { this.instance = inst; - this.undoLevels = new Array(); + this.undoLevels = []; this.undoIndex = 0; this.typingUndoIndex = -1; this.undoRedo = true; @@ -6732,10 +6825,13 @@ TinyMCE_UndoRedo.prototype = { if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) { //tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content); + // Is dirty again + inst.isNotDirty = false; + tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst); // Time to compress - customUndoLevels = tinyMCE.settings['custom_undo_redo_levels']; + customUndoLevels = tinyMCE.settings.custom_undo_redo_levels; if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) { for (i=0; i 1 ? ',' : '') + 'a[' + i + ']'; - - o = s._fu; - s._fu = this; - r = eval('s._fu(' + as + ')'); - s._fu = o; - - return r; - }; -}; - /* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */ -TinyMCE_Engine.prototype.debug = function() { - var m = "", a, i, l = tinyMCE.log.length; +tinyMCE.add(TinyMCE_Engine, { + debug : function() { + var m = "", a, i, l = tinyMCE.log.length; + + for (i=0, a = this.debug.arguments; i