summaryrefslogtreecommitdiff
path: root/program/js/tiny_mce/plugins/searchreplace
diff options
context:
space:
mode:
Diffstat (limited to 'program/js/tiny_mce/plugins/searchreplace')
-rwxr-xr-xprogram/js/tiny_mce/plugins/searchreplace/css/searchreplace.css20
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/editor_plugin.js2
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js83
-rwxr-xr-xprogram/js/tiny_mce/plugins/searchreplace/images/replace_all_button_bg.gifbin0 -> 669 bytes
-rwxr-xr-xprogram/js/tiny_mce/plugins/searchreplace/images/replace_button_bg.gifbin0 -> 669 bytes
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js40
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/jscripts/search.js36
-rwxr-xr-xprogram/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js85
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/replace.htm49
-rw-r--r--program/js/tiny_mce/plugins/searchreplace/search.htm42
-rwxr-xr-xprogram/js/tiny_mce/plugins/searchreplace/searchreplace.htm104
11 files changed, 241 insertions, 220 deletions
diff --git a/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css b/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css
new file mode 100755
index 000000000..4c7bd13c4
--- /dev/null
+++ b/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css
@@ -0,0 +1,20 @@
+/* stylesheet for advsearchreplace plugin*/
+
+.panel_wrapper { height: 85px; }
+.panel_wrapper div.current { height: 85px; }
+
+/* MS IE only styles */
+* html .panel_wrapper { height: 100px; }
+* html .panel_wrapper div.current { height: 100px; }
+
+#replaceBtn, #replaceAllBtn {
+ padding-bottom: 2px;
+ font-weight: bold;
+ width: 90px;
+ height: 21px;
+ border: 0;
+ cursor: pointer;
+}
+
+#replaceBtn { background: url(../images/replace_button_bg.gif); }
+#replaceAllBtn { background: url(../images/replace_all_button_bg.gif); }
diff --git a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
index a78b35e06..2ba606647 100644
--- a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
+++ b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js
@@ -1 +1 @@
-tinyMCE.importPluginLanguagePack('searchreplace','en,tr,sv,zh_cn,fa,fr_ca,fr,de,pl,pt_br,cs,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,zh_tw,zh_tw_utf8,sk');var TinyMCE_SearchReplacePlugin={getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_searchreplace.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},initInstance:function(inst){inst.addShortcut('ctrl','f','lang_searchreplace_search_desc','mceSearch',true);},getControlHTML:function(cn){switch(cn){case"search":return tinyMCE.getButtonHTML(cn,'lang_searchreplace_search_desc','{$pluginurl}/images/search.gif','mceSearch',true);case"replace":return tinyMCE.getButtonHTML(cn,'lang_searchreplace_replace_desc','{$pluginurl}/images/replace.gif','mceSearchReplace',true);}return"";},execCommand:function(editor_id,element,command,user_interface,value){var instance=tinyMCE.getInstanceById(editor_id);function defValue(key,default_value){value[key]=typeof(value[key])=="undefined"?default_value:value[key];}function replaceSel(search_str,str,back){instance.execCommand('mceInsertContent',false,str);}if(!value)value=new Array();defValue("editor_id",editor_id);defValue("searchstring","");defValue("replacestring",null);defValue("replacemode","none");defValue("casesensitive",false);defValue("backwards",false);defValue("wrap",false);defValue("wholeword",false);defValue("inline","yes");switch(command){case"mceResetSearch":tinyMCE.lastSearchRng=null;return true;case"mceSearch":if(user_interface){var template=new Array();if(value['replacestring']!=null){template['file']='../../plugins/searchreplace/replace.htm';template['width']=320;template['height']=100+(tinyMCE.isNS7?20:0);template['width']+=tinyMCE.getLang('lang_searchreplace_replace_delta_width',0);template['height']+=tinyMCE.getLang('lang_searchreplace_replace_delta_height',0);}else{template['file']='../../plugins/searchreplace/search.htm';template['width']=310;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_searchreplace_search_delta_width',0);template['height']+=tinyMCE.getLang('lang_searchreplace_replace_delta_height',0);}instance.execCommand('SelectAll');if(tinyMCE.isMSIE){var r=instance.selection.getRng();r.collapse(true);r.select();}else instance.selection.getSel().collapseToStart();tinyMCE.openWindow(template,value);}else{var win=tinyMCE.getInstanceById(editor_id).contentWindow;var doc=tinyMCE.getInstanceById(editor_id).contentWindow.document;var body=tinyMCE.getInstanceById(editor_id).contentWindow.document.body;if(body.innerHTML==""){alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true;}if(value['replacemode']=="current"){replaceSel(value['string'],value['replacestring'],value['backwards']);value['replacemode']="none";tinyMCE.execInstanceCommand(editor_id,'mceSearch',user_interface,value,false);return true;}if(tinyMCE.isMSIE){var rng=tinyMCE.lastSearchRng?tinyMCE.lastSearchRng:doc.selection.createRange();var flags=0;if(value['wholeword'])flags=flags|2;if(value['casesensitive'])flags=flags|4;if(!rng.findText){alert('This operation is currently not supported by this browser.');return true;}if(value['replacemode']=="all"){while(rng.findText(value['string'],value['backwards']?-1:1,flags)){rng.scrollIntoView();rng.select();rng.collapse(false);replaceSel(value['string'],value['replacestring'],value['backwards']);}alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));return true;}if(rng.findText(value['string'],value['backwards']?-1:1,flags)){rng.scrollIntoView();rng.select();rng.collapse(value['backwards']);tinyMCE.lastSearchRng=rng;}else alert(tinyMCE.getLang('lang_searchreplace_notfound'));}else{if(value['replacemode']=="all"){while(win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false))replaceSel(value['string'],value['replacestring'],value['backwards']);alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));return true;}if(!win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false))alert(tinyMCE.getLang('lang_searchreplace_notfound'));}}return true;case"mceSearchReplace":value['replacestring']="";tinyMCE.execInstanceCommand(editor_id,'mceSearch',user_interface,value,false);return true;}return false;}};tinyMCE.addPlugin("searchreplace",TinyMCE_SearchReplacePlugin); \ No newline at end of file
+tinyMCE.importPluginLanguagePack('searchreplace');var TinyMCE_SearchReplacePlugin={getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_searchreplace.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){inst.addShortcut('ctrl','f','lang_searchreplace_search_desc','mceSearch',true);},getControlHTML:function(cn){switch(cn){case"search":return tinyMCE.getButtonHTML(cn,'lang_searchreplace_search_desc','{$pluginurl}/images/search.gif','mceSearch',true);case"replace":return tinyMCE.getButtonHTML(cn,'lang_searchreplace_replace_desc','{$pluginurl}/images/replace.gif','mceSearchReplace',true)}return""},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id),selectedText=inst.selection.getSelectedText(),rng;function defValue(key,default_value){value[key]=typeof(value[key])=="undefined"?default_value:value[key]}function replaceSel(search_str,str,back){inst.execCommand('mceInsertContent',false,str)}if(!value)value=[];defValue("editor_id",editor_id);defValue("searchstring",selectedText);defValue("replacestring",null);defValue("replacemode","none");defValue("casesensitive",false);defValue("backwards",false);defValue("wrap",false);defValue("wholeword",false);defValue("inline","yes");defValue("resizable","no");switch(command){case"mceResetSearch":tinyMCE.lastSearchRng=null;return true;case"mceSearch":if(user_interface){var template=new Array();template['file']='../../plugins/searchreplace/searchreplace.htm';template['width']=380;template['height']=155+(tinyMCE.isNS7?20:0)+(tinyMCE.isMSIE?15:0);template['width']+=tinyMCE.getLang('lang_searchreplace_delta_width',0);template['height']+=tinyMCE.getLang('lang_searchreplace_delta_height',0);inst.execCommand('SelectAll');if(tinyMCE.isMSIE){var r=inst.selection.getRng();r.collapse(true);r.select()}else inst.selection.getSel().collapseToStart();tinyMCE.openWindow(template,value)}else{var win=tinyMCE.getInstanceById(editor_id).contentWindow;var doc=tinyMCE.getInstanceById(editor_id).contentWindow.document;var body=tinyMCE.getInstanceById(editor_id).contentWindow.document.body;if(body.innerHTML==""){alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(value['replacemode']=="current"){replaceSel(value['string'],value['replacestring'],value['backwards']);value['replacemode']="none";tinyMCE.execInstanceCommand(editor_id,'mceSearch',user_interface,value,false);return true}if(tinyMCE.isMSIE){var rng=tinyMCE.lastSearchRng?tinyMCE.lastSearchRng:doc.selection.createRange();var flags=0;if(value['wholeword'])flags=flags|2;if(value['casesensitive'])flags=flags|4;if(!rng.findText){alert('This operation is currently not supported by this browser.');return true}if(value['replacemode']=="all"){while(rng.findText(value['string'],value['backwards']?-1:1,flags)){rng.scrollIntoView();rng.select();rng.collapse(false);replaceSel(value['string'],value['replacestring'],value['backwards'])}alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));return true}if(rng.findText(value['string'],value['backwards']?-1:1,flags)){rng.scrollIntoView();rng.select();rng.collapse(value['backwards']);tinyMCE.lastSearchRng=rng}else alert(tinyMCE.getLang('lang_searchreplace_notfound'))}else{if(value['replacemode']=="all"){while(win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false))replaceSel(value['string'],value['replacestring'],value['backwards']);alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));return true}if(!win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false))alert(tinyMCE.getLang('lang_searchreplace_notfound'))}}return true;case"mceSearchReplace":value['replacestring']="";tinyMCE.execInstanceCommand(editor_id,'mceSearch',user_interface,value,false);return true}return false}};tinyMCE.addPlugin("searchreplace",TinyMCE_SearchReplacePlugin); \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js b/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
index eed96db9e..f8aee25c6 100644
--- a/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
+++ b/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js
@@ -1,60 +1,56 @@
/**
- * $RCSfile: editor_plugin_src.js,v $
- * $Revision: 1.27 $
- * $Date: 2006/02/13 15:09:28 $
+ * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
*
* @author Moxiecode
* @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
-/* Import theme specific language pack */
-tinyMCE.importPluginLanguagePack('searchreplace', 'en,tr,sv,zh_cn,fa,fr_ca,fr,de,pl,pt_br,cs,nl,da,he,nb,hu,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,zh_tw,zh_tw_utf8,sk');
+tinyMCE.importPluginLanguagePack('searchreplace');
var TinyMCE_SearchReplacePlugin = {
getInfo : function() {
return {
longname : 'Search/Replace',
- author : 'Moxiecode Systems',
+ author : 'Moxiecode Systems AB',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_searchreplace.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
- initInstance : function(inst) {
+ initInstance : function (inst) {
inst.addShortcut('ctrl', 'f', 'lang_searchreplace_search_desc', 'mceSearch', true);
+ // No CTRL+R for "replace" because browsers will reload page instead of executing plugin
},
- getControlHTML : function(cn) {
+ getControlHTML : function (cn) {
switch (cn) {
- case "search":
- return tinyMCE.getButtonHTML(cn, 'lang_searchreplace_search_desc', '{$pluginurl}/images/search.gif', 'mceSearch', true);
- case "replace":
+ case "search" :
+ return tinyMCE.getButtonHTML(cn, 'lang_searchreplace_search_desc', '{$pluginurl}/images/search.gif','mceSearch', true);
+
+ case "replace" :
return tinyMCE.getButtonHTML(cn, 'lang_searchreplace_replace_desc', '{$pluginurl}/images/replace.gif', 'mceSearchReplace', true);
}
+
return "";
},
- /**
- * Executes the search/replace commands.
- */
- execCommand : function(editor_id, element, command, user_interface, value) {
- var instance = tinyMCE.getInstanceById(editor_id);
+ execCommand : function (editor_id, element, command, user_interface, value) {
+ var inst = tinyMCE.getInstanceById(editor_id), selectedText = inst.selection.getSelectedText(), rng;
function defValue(key, default_value) {
value[key] = typeof(value[key]) == "undefined" ? default_value : value[key];
}
function replaceSel(search_str, str, back) {
- instance.execCommand('mceInsertContent', false, str);
+ inst.execCommand('mceInsertContent', false, str);
}
if (!value)
- value = new Array();
+ value = [];
- // Setup defualt values
defValue("editor_id", editor_id);
- defValue("searchstring", "");
+ defValue("searchstring", selectedText);
defValue("replacestring", null);
defValue("replacemode", "none");
defValue("casesensitive", false);
@@ -62,68 +58,52 @@ var TinyMCE_SearchReplacePlugin = {
defValue("wrap", false);
defValue("wholeword", false);
defValue("inline", "yes");
+ defValue("resizable", "no");
- // Handle commands
switch (command) {
- case "mceResetSearch":
+ case "mceResetSearch" :
tinyMCE.lastSearchRng = null;
return true;
- case "mceSearch":
+ case "mceSearch" :
if (user_interface) {
- // Open search dialog
var template = new Array();
- if (value['replacestring'] != null) {
- template['file'] = '../../plugins/searchreplace/replace.htm'; // Relative to theme
- template['width'] = 320;
- template['height'] = 100 + (tinyMCE.isNS7 ? 20 : 0);
- template['width'] += tinyMCE.getLang('lang_searchreplace_replace_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_searchreplace_replace_delta_height', 0);
- } else {
- template['file'] = '../../plugins/searchreplace/search.htm'; // Relative to theme
- template['width'] = 310;
- template['height'] = 105 + (tinyMCE.isNS7 ? 25 : 0);
- template['width'] += tinyMCE.getLang('lang_searchreplace_search_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_searchreplace_replace_delta_height', 0);
- }
+ template['file'] = '../../plugins/searchreplace/searchreplace.htm';
+ template['width'] = 380;
+ template['height'] = 155 + (tinyMCE.isNS7 ? 20 : 0) + (tinyMCE.isMSIE ? 15 : 0);
+ template['width'] += tinyMCE.getLang('lang_searchreplace_delta_width', 0);
+ template['height'] += tinyMCE.getLang('lang_searchreplace_delta_height', 0);
- instance.execCommand('SelectAll');
+ inst.execCommand('SelectAll');
if (tinyMCE.isMSIE) {
- var r = instance.selection.getRng();
+ var r = inst.selection.getRng();
r.collapse(true);
r.select();
} else
- instance.selection.getSel().collapseToStart();
+ inst.selection.getSel().collapseToStart();
tinyMCE.openWindow(template, value);
} else {
var win = tinyMCE.getInstanceById(editor_id).contentWindow;
var doc = tinyMCE.getInstanceById(editor_id).contentWindow.document;
var body = tinyMCE.getInstanceById(editor_id).contentWindow.document.body;
-
- // Whats the point
if (body.innerHTML == "") {
alert(tinyMCE.getLang('lang_searchreplace_notfound'));
return true;
}
- // Handle replace current
if (value['replacemode'] == "current") {
replaceSel(value['string'], value['replacestring'], value['backwards']);
-
- // Search next one
value['replacemode'] = "none";
tinyMCE.execInstanceCommand(editor_id, 'mceSearch', user_interface, value, false);
-
return true;
}
if (tinyMCE.isMSIE) {
var rng = tinyMCE.lastSearchRng ? tinyMCE.lastSearchRng : doc.selection.createRange();
var flags = 0;
-
if (value['wholeword'])
flags = flags | 2;
@@ -135,7 +115,6 @@ var TinyMCE_SearchReplacePlugin = {
return true;
}
- // Handle replace all mode
if (value['replacemode'] == "all") {
while (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
rng.scrollIntoView();
@@ -155,6 +134,7 @@ var TinyMCE_SearchReplacePlugin = {
tinyMCE.lastSearchRng = rng;
} else
alert(tinyMCE.getLang('lang_searchreplace_notfound'));
+
} else {
if (value['replacemode'] == "all") {
while (win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false))
@@ -168,18 +148,17 @@ var TinyMCE_SearchReplacePlugin = {
alert(tinyMCE.getLang('lang_searchreplace_notfound'));
}
}
+
return true;
- case "mceSearchReplace":
+ case "mceSearchReplace" :
value['replacestring'] = "";
-
tinyMCE.execInstanceCommand(editor_id, 'mceSearch', user_interface, value, false);
return true;
}
- // Pass to next handler in chain
return false;
}
};
-tinyMCE.addPlugin("searchreplace", TinyMCE_SearchReplacePlugin);
+tinyMCE.addPlugin("searchreplace", TinyMCE_SearchReplacePlugin); \ No newline at end of file
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
new file mode 100755
index 000000000..123fa5bf5
--- /dev/null
+++ b/program/js/tiny_mce/plugins/searchreplace/images/replace_all_button_bg.gif
Binary files differ
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
new file mode 100755
index 000000000..cc2c56e61
--- /dev/null
+++ b/program/js/tiny_mce/plugins/searchreplace/images/replace_button_bg.gif
Binary files differ
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js
deleted file mode 100644
index 3cb417813..000000000
--- a/program/js/tiny_mce/plugins/searchreplace/jscripts/replace.js
+++ /dev/null
@@ -1,40 +0,0 @@
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
-
- formObj.searchstring.value = tinyMCE.getWindowArg("searchstring");
- formObj.replacestring.value = tinyMCE.getWindowArg("replacestring");
- formObj.casesensitivebox.checked = tinyMCE.getWindowArg("casesensitive");
-// formObj.backwards[0].checked = tinyMCE.getWindowArg("backwards");
-// formObj.backwards[1].checked = !tinyMCE.getWindowArg("backwards");
-// formObj.wrapatend.checked = tinyMCE.getWindowArg("wrap");
-// formObj.wholeword.checked = tinyMCE.getWindowArg("wholeword");
-
- tinyMCEPopup.execCommand("mceResetSearch", false, {dummy : ""}, false);
-}
-
-function searchNext(replacemode) {
- var formObj = document.forms[0];
-
- // Whats the point?
- if (formObj.searchstring.value == "" || formObj.searchstring.value == formObj.replacestring.value)
- return;
-
- // Do search
- tinyMCEPopup.execCommand('mceSearch', false, {
- string : formObj.searchstring.value,
- replacestring : formObj.replacestring.value,
- replacemode : replacemode,
- casesensitive : formObj.casesensitivebox.checked,
- backwards : false
-// wrap : formObj.wrapatend.checked,
-// wholeword : formObj.wholeword.checked
- }, false);
-
- window.focus();
-}
-
-function cancelAction() {
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/search.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/search.js
deleted file mode 100644
index 5202fdc50..000000000
--- a/program/js/tiny_mce/plugins/searchreplace/jscripts/search.js
+++ /dev/null
@@ -1,36 +0,0 @@
-function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
-
- formObj.searchstring.value = tinyMCE.getWindowArg("searchstring");
- formObj.casesensitivebox.checked = tinyMCE.getWindowArg("casesensitive");
- formObj.backwards[0].checked = tinyMCE.getWindowArg("backwards");
- formObj.backwards[1].checked = !tinyMCE.getWindowArg("backwards");
-// formObj.wrapatend.checked = tinyMCE.getWindowArg("wrap");
-// formObj.wholeword.checked = tinyMCE.getWindowArg("wholeword");
-
- tinyMCEPopup.execCommand("mceResetSearch", false, {dummy : ""}, false);
-}
-
-function searchNext() {
- var formObj = document.forms[0];
-
- if (formObj.searchstring.value == "")
- return;
-
- // Do search
- tinyMCEPopup.execCommand('mceSearch', false, {
- string : formObj.searchstring.value,
- casesensitive : formObj.casesensitivebox.checked,
- backwards : formObj.backwards[0].checked
-// wrap : formObj.wrapatend.checked,
-// wholeword : formObj.wholeword.checked
- }, false);
-
- window.focus();
-}
-
-function cancelAction() {
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js
new file mode 100755
index 000000000..2eca3ea64
--- /dev/null
+++ b/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js
@@ -0,0 +1,85 @@
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // start with appropiate tab
+ var task = (tinyMCE.getWindowArg("replacestring") != null) ? "replace" : "search";
+ mcTabs.displayTab(task + '_tab', task +'_panel');
+ manageReplaceButtons();
+
+ var formObj = document.forms[0];
+
+ formObj[task + "_panel_searchstring"].value = tinyMCE.getWindowArg("searchstring");
+ formObj["replace_panel_replacestring"].value = (tinyMCE.getWindowArg("replacestring") != null) ? tinyMCE.getWindowArg("replacestring") : "";
+ formObj[task + "_panel_casesensitivebox"].checked = tinyMCE.getWindowArg("casesensitive");
+ formObj[task + "_panel_backwardsu"].checked = tinyMCE.getWindowArg("backwards");
+ formObj[task + "_panel_backwardsd"].checked = !tinyMCE.getWindowArg("backwards");
+
+ tinyMCEPopup.execCommand("mceResetSearch", false, {dummy : ""}, false);
+}
+
+function searchNext(replacemode) {
+ // "search" or "replace" mode of operation?
+ var task = (document.getElementById("search_tab").className == "current") ? "search" : "replace";
+
+ var formObj = document.forms[0];
+
+ if (task == "replace") {
+ // Whats the point?
+ if (formObj[task + "_panel_searchstring"].value == "" || formObj[task + "_panel_searchstring"].value == formObj[task + "_panel_replacestring"].value)
+ return;
+ }
+
+ // Do search
+ tinyMCEPopup.execCommand('mceSearch', false, {
+ string : formObj[task + "_panel_searchstring"].value,
+ replacestring : formObj["replace_panel_replacestring"].value,
+ replacemode : replacemode,
+ casesensitive : formObj[task + "_panel_casesensitivebox"].checked,
+ backwards : false
+ }, false);
+
+ window.focus();
+}
+
+function cancelAction() {
+ tinyMCEPopup.close();
+}
+
+function manageReplaceButtons() {
+ // "search" or "replace" mode of operation?
+ var task = (document.getElementById("search_tab").className == "current") ? "search" : "replace";
+ document.getElementById("replace_buttons").style.visibility = (task == "replace") ? "visible" : "hidden";
+}
+
+function copyValues(link) {
+ // check if tab is already active
+ var tab = link;
+ while (tab.tagName && tab.tagName.toLowerCase() != "li") tab = tab.parentNode;
+ if (tab.className) return false; // tab is already active -> no need to copy any values!
+
+ // copy values from one panel to the other (if they exist there)
+ var from_panel_name = tab.id.match(/^search/i) ? "replace_panel" : "search_panel";
+ var to_panel_name = (from_panel_name == "search_panel") ? "replace_panel" : "search_panel";
+
+ // find all elements with IDs to copy their values
+ var elms = document.getElementById(from_panel_name).getElementsByTagName("*");
+ for (var i = 0; i < elms.length; i++) {
+ if (elms[i].id && elms[i].id != "") {
+ var checked = "undefined";
+ if (elms[i].type.toLowerCase() == "checkbox" || elms[i].type.toLowerCase() == "radio")
+ checked = elms[i].checked;
+
+ // copy values if element exists in other panel
+ var to_elm_name = to_panel_name + elms[i].id.substring(from_panel_name.length, elms[i].id.length);
+ var to_elm = document.getElementById(to_elm_name);
+ if (to_elm) {
+ if (checked != "undefined")
+ to_elm.checked = checked;
+ else
+ to_elm.value = elms[i].value;
+ }
+ }
+ }
+
+ return false;
+} \ No newline at end of file
diff --git a/program/js/tiny_mce/plugins/searchreplace/replace.htm b/program/js/tiny_mce/plugins/searchreplace/replace.htm
deleted file mode 100644
index 0629da334..000000000
--- a/program/js/tiny_mce/plugins/searchreplace/replace.htm
+++ /dev/null
@@ -1,49 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>{$lang_searchreplace_replace_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/replace.js"></script>
- <base target="_self" />
-</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none; margin: 4px;">
-<form onsubmit="searchNext('none');return false;" action="#">
- <table border="0" cellspacing="0" cellpadding="2">
- <tr>
- <td><label for="searchstring">{$lang_searchreplace_findwhat}</label></td>
- <td><input type="text" id="searchstring" name="searchstring" style="width: 200px" /></td>
- </tr>
- <tr>
- <td><label for="replacestring">{$lang_searchreplace_replacewith}</label></td>
- <td><input type="text" id="replacestring" name="replacestring" style="width: 200px" /></td>
- </tr>
- <tr>
- <td colspan="2"><!--<table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><label>{$lang_searchreplace_direction}</label></td>
- <td><input id="backwardsu" name="backwards" class="radio" type="radio" value="true" /></td>
- <td><label for="backwardsu">{$lang_searchreplace_up}</label></td>
- <td><input id="backwardsd" name="backwards" class="radio" type="radio" value="false" /></td>
- <td><label for="backwardsd">{$lang_searchreplace_down}</label></td>
- </tr>
- </table>--></td>
- </tr>
- <tr>
-<td colspan="2"><table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><input id="casesensitivebox" name="casesensitivebox" class="checkbox" type="checkbox" value="true" /></td>
- <td><label for="casesensitivebox">{$lang_searchreplace_case}</label></td>
- </tr>
-</table></td>
-</tr>
- </table>
- <table border="0" width="300" cellspacing="0" cellpadding="4">
- <tr>
- <td><input id="insertBtn" name="insertBtn" type="button" value="{$lang_searchreplace_findnext}" onclick="searchNext('none');" /></td>
- <td><input name="replaceBtn" type="button" id="replaceBtn" value="{$lang_searchreplace_replace}" onclick="searchNext('current');" /></td>
- <td><input name="replaceBtn" type="button" id="replaceAllBtn" value="{$lang_searchreplace_replaceall}" onclick="searchNext('all');" /></td>
- <td align="right"><input name="cancelBtn" type="button" id="cancelBtn" value="{$lang_searchreplace_cancel}" onclick="cancelAction();" /></td>
- </tr>
- </table>
-</form>
-</body>
-</html>
diff --git a/program/js/tiny_mce/plugins/searchreplace/search.htm b/program/js/tiny_mce/plugins/searchreplace/search.htm
deleted file mode 100644
index fe9055ed5..000000000
--- a/program/js/tiny_mce/plugins/searchreplace/search.htm
+++ /dev/null
@@ -1,42 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>{$lang_searchreplace_search_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/search.js"></script>
- <base target="_self" />
-</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none; margin: 4px;">
-<form onsubmit="searchNext();return false;" action="#">
- <table border="0" cellspacing="0" cellpadding="2">
- <tr>
- <td><label for="searchstring">{$lang_searchreplace_findwhat}</label>&nbsp;<input type="text" id="searchstring" name="searchstring" style="width: 200px" /></td>
- </tr>
- <tr>
- <td><table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><label>{$lang_searchreplace_direction}</label></td>
- <td><input id="backwardsu" name="backwards" class="radio" type="radio" value="true" /></td>
- <td><label for="backwardsu">{$lang_searchreplace_up}</label></td>
- <td><input id="backwardsd" name="backwards" class="radio" type="radio" value="false" /></td>
- <td><label for="backwardsd">{$lang_searchreplace_down}</label></td>
- </tr>
- </table></td>
- </tr>
- <tr>
-<td><table border="0" cellspacing="0" cellpadding="0">
- <tr>
- <td><input id="casesensitivebox" name="casesensitivebox" class="checkbox" type="checkbox" value="true" /></td>
- <td><label for="casesensitivebox">{$lang_searchreplace_case}</label></td>
- </tr>
-</table></td>
-</tr>
- </table>
- <table border="0" width="300" cellspacing="0" cellpadding="4">
- <tr>
- <td><input id="insert" name="insert" type="submit" value="{$lang_searchreplace_findnext}" /></td>
- <td align="right"><input id="cancel" name="cancel" type="button" value="{$lang_searchreplace_cancel}" onclick="cancelAction();" /></td>
- </tr>
- </table>
-</form>
-</body>
-</html>
diff --git a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
new file mode 100755
index 000000000..8575e2aad
--- /dev/null
+++ b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm
@@ -0,0 +1,104 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{$lang_searchreplace_replace_title}</title>
+ <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script language="javascript" type="text/javascript" src="jscripts/searchreplace.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/searchreplace.css" />
+ <base target="_self" />
+</head>
+<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none; margin: 4px;">
+<form onsubmit="return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="search_tab"><span><a href="javascript:mcTabs.displayTab('search_tab','search_panel');manageReplaceButtons();" onmousedown="return copyValues(this);">{$lang_searchreplace_search_desc}</a></span></li>
+ <li id="replace_tab"><span><a href="javascript:mcTabs.displayTab('replace_tab','replace_panel');manageReplaceButtons();" onmousedown="return copyValues(this);">{$lang_searchreplace_replace}</a></span></li>
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+
+ <div id="search_panel" class="panel">
+ <table border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td><label for="search_panel_searchstring">{$lang_searchreplace_findwhat}</label></td>
+ <td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" /></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table border="0" cellspacing="0" cellpadding="0" class="direction">
+ <tr>
+ <td><label>{$lang_searchreplace_direction}</label></td>
+ <td><input id="search_panel_backwardsu" name="search_panel_backwards" class="radio" type="radio" /></td>
+ <td><label for="search_panel_backwardsu">{$lang_searchreplace_up}</label></td>
+ <td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" /></td>
+ <td><label for="search_panel_backwardsd">{$lang_searchreplace_down}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input id="search_panel_casesensitivebox" name="search_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>
+ <td><label for="search_panel_casesensitivebox">{$lang_searchreplace_case}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <div id="replace_panel" class="panel">
+ <table border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td><label for="replace_panel_searchstring">{$lang_searchreplace_findwhat}</label></td>
+ <td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" /></td>
+ </tr>
+ <tr>
+ <td><label for="replace_panel_replacestring">{$lang_searchreplace_replacewith}</label></td>
+ <td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" /></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table border="0" cellspacing="0" cellpadding="0" class="direction">
+ <tr>
+ <td><label>{$lang_searchreplace_direction}</label></td>
+ <td><input id="replace_panel_backwardsu" name="replace_panel_backwards" class="radio" type="radio" /></td>
+ <td><label for="replace_panel_backwardsu">{$lang_searchreplace_up}</label></td>
+ <td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" /></td>
+ <td><label for="replace_panel_backwardsd">{$lang_searchreplace_down}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input id="replace_panel_casesensitivebox" name="replace_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>
+ <td><label for="replace_panel_casesensitivebox">{$lang_searchreplace_case}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ </div>
+
+ <div class="mceActionPanel">
+ <div style="text-align: center;">
+ <input type="button" id="insert" name="insert" value="{$lang_searchreplace_findnext}" onclick="searchNext('none');" />
+ <span id="replace_buttons">
+ <input type="button" id="replaceBtn" name="replaceBtn" value="{$lang_searchreplace_replace}" onclick="searchNext('current');" />
+ <input type="button" id="replaceAllBtn" name="replaceAllBtn" value="{$lang_searchreplace_replaceall}" onclick="searchNext('all');;" />
+ </span>
+ <input type="button" id="cancel" name="cancel" value="{$lang_searchreplace_cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+</form>
+</body>
+</html>