diff options
author | svncommit <devs@roundcube.net> | 2008-04-15 21:22:00 +0000 |
---|---|---|
committer | svncommit <devs@roundcube.net> | 2008-04-15 21:22:00 +0000 |
commit | d9344fc349e8c5765898c90bf5061e56cd21c8a0 (patch) | |
tree | a5916f5f3f88df8d6336b43dde8cdbb49cb47bdc /program/js/tiny_mce/plugins | |
parent | d7a411f099596cbc8e749e1f0802ac2bb2c6289e (diff) |
HTML editing fixes, upgrade to TinyMCE v3.0.6
Diffstat (limited to 'program/js/tiny_mce/plugins')
146 files changed, 6642 insertions, 4402 deletions
diff --git a/program/js/tiny_mce/plugins/cleanup/editor_plugin.js b/program/js/tiny_mce/plugins/cleanup/editor_plugin.js deleted file mode 100644 index e69de29bb..000000000 --- a/program/js/tiny_mce/plugins/cleanup/editor_plugin.js +++ /dev/null diff --git a/program/js/tiny_mce/plugins/cleanup/editor_plugin_src.js b/program/js/tiny_mce/plugins/cleanup/editor_plugin_src.js deleted file mode 100644 index 8e1312fa0..000000000 --- a/program/js/tiny_mce/plugins/cleanup/editor_plugin_src.js +++ /dev/null @@ -1,10 +0,0 @@ -/**
- * $Id: editor_plugin_src.js 162 2007-01-03 16:16:52Z spocke $
- *
- * Experimental plugin for new Cleanup routine, this logic will be moved into the core ones it's stable enougth.
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
- */
-
-/* Dummy file since cleanup is now moved to core */
diff --git a/program/js/tiny_mce/plugins/cleanup/readme.txt b/program/js/tiny_mce/plugins/cleanup/readme.txt deleted file mode 100644 index d1a646663..000000000 --- a/program/js/tiny_mce/plugins/cleanup/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Dummy plugin since cleanup is now moved into core.
diff --git a/program/js/tiny_mce/plugins/compat2x/editor_plugin.js b/program/js/tiny_mce/plugins/compat2x/editor_plugin.js new file mode 100644 index 000000000..090c94b0b --- /dev/null +++ b/program/js/tiny_mce/plugins/compat2x/editor_plugin.js @@ -0,0 +1 @@ +(function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.Compat2x',{getInfo:function(){return{longname:'Compat2x',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};}});(function(){tinymce.extend(tinyMCE,{addToLang:function(p,l){each(l,function(v,k){tinyMCE.i18n[(tinyMCE.settings.language||'en')+'.'+(p?p+'_':'')+k]=v;});},getInstanceById:function(n){return this.get(n);}});})();(function(){var EditorManager=tinymce.EditorManager;tinyMCE.instances={};tinyMCE.plugins={};tinymce.PluginManager.onAdd.add(function(pm,n,p){tinyMCE.plugins[n]=p;});tinyMCE.majorVersion=tinymce.majorVersion;tinyMCE.minorVersion=tinymce.minorVersion;tinyMCE.releaseDate=tinymce.releaseDate;tinyMCE.baseURL=tinymce.baseURL;tinyMCE.isIE=tinyMCE.isMSIE=tinymce.isIE||tinymce.isOpera;tinyMCE.isMSIE5=tinymce.isIE;tinyMCE.isMSIE5_0=tinymce.isIE;tinyMCE.isMSIE7=tinymce.isIE;tinyMCE.isGecko=tinymce.isGecko;tinyMCE.isSafari=tinymce.isWebKit;tinyMCE.isOpera=tinymce.isOpera;tinyMCE.isMac=false;tinyMCE.isNS7=false;tinyMCE.isNS71=false;tinyMCE.compat=true;TinyMCE_Engine=tinyMCE;tinymce.extend(tinyMCE,{getParam:function(n,dv){return this.activeEditor.getParam(n,dv);},addEvent:function(e,na,f,sc){tinymce.dom.Event.add(e,na,f,sc||this);},getControlHTML:function(n){return EditorManager.activeEditor.controlManager.createControl(n);},loadCSS:function(u){tinymce.DOM.loadCSS(u);},importCSS:function(doc,u){if(doc==document)this.loadCSS(u);else new tinymce.dom.DOMUtils(doc).loadCSS(u);},log:function(){console.debug.apply(console,arguments);},getLang:function(n,dv){var v=EditorManager.activeEditor.getLang(n.replace(/^lang_/g,''),dv);if(/^[0-9\-.]+$/g.test(v))return parseInt(v);return v;},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.execCommand;},triggerNodeChange:function(){EditorManager.activeEditor.nodeChanged();},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);},trim:function(s){return tinymce.trim(s);},xmlEncode:function(s){return tinymce.DOM.encode(s);},explode:function(s,d){var o=[];tinymce.each(s.split(d),function(v){if(v!='')o.push(v);});return o;},switchClass:function(id,cls){var b;if(/^mceButton/.test(cls)){b=EditorManager.activeEditor.controlManager.get(id);if(!b)return;switch(cls){case"mceButtonNormal":b.setDisabled(false);b.setActive(false);return;case"mceButtonDisabled":b.setDisabled(true);return;case"mceButtonSelected":b.setActive(true);b.setDisabled(false);return;}}},addCSSClass:function(e,n,b){return tinymce.DOM.addClass(e,n,b);},hasCSSClass:function(e,n){return tinymce.DOM.hasClass(e,n);},removeCSSClass:function(e,n){return tinymce.DOM.removeClass(e,n);},getCSSClasses:function(){var cl=EditorManager.activeEditor.dom.getClasses(),o=[];each(cl,function(c){o.push(c['class']);});return o;},setWindowArg:function(n,v){EditorManager.activeEditor.windowManager.params[n]=v;},getWindowArg:function(n,dv){var wm=EditorManager.activeEditor.windowManager,v;v=wm.getParam(n);if(v==='')return'';return v||wm.getFeature(n)||dv;},getParentNode:function(n,f){return this._getDOM().getParent(n,f);},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a;},getNodeTree:function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn);},na?na:[]);},getAttrib:function(e,n,dv){return this._getDOM().getAttrib(e,n,dv);},setAttrib:function(e,n,v){return this._getDOM().setAttrib(e,n,v);},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i];}return o;},selectNodes:function(n,f,a){var i;if(!a)a=[];if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a);}return a;},getContent:function(){return EditorManager.activeEditor.getContent();},getParentElement:function(n,na,f){if(na)na=new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$','g');return this._getDOM().getParent(n,function(n){return n.nodeType==1&&(!na||na.test(n.nodeName))&&(!f||f(n));},this.activeEditor.getBody());},importPluginLanguagePack:function(n){tinymce.PluginManager.requireLangPack(n);},getButtonHTML:function(cn,lang,img,c,u,v){var ed=EditorManager.activeEditor;img=img.replace(/\{\$pluginurl\}/g,tinyMCE.pluginURL);img=img.replace(/\{\$themeurl\}/g,tinyMCE.themeURL);lang=lang.replace(/^lang_/g,'');return ed.controlManager.createButton(cn,{title:lang,command:c,ui:u,value:v,scope:this,'class':'compat',image:img});},addSelectAccessibility:function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w;}return false;},accessibleEventHandler:function(e){var elm,win=this._win;e=tinymce.isIE?win.event:e;elm=tinymce.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null;}return true;}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false;}return true;},cancelEvent:function(e){return tinymce.dom.Event.cancel(e);},handleVisualAid:function(e){EditorManager.activeEditor.addVisual(e);},getAbsPosition:function(n,r){return tinymce.DOM.getPos(n,r);},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s;},getVisualAidClass:function(s){return s;},parseStyle:function(s){return this._getDOM().parseStyle(s);},serializeStyle:function(s){return this._getDOM().serializeStyle(s);},openWindow:function(tpl,args){var ed=EditorManager.activeEditor,o={},n;for(n in tpl)o[n]=tpl[n];tpl=o;args=args||{};tpl.url=new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file);tpl.inline=tpl.inline||args.inline;ed.windowManager.open(tpl,args);},closeWindow:function(win){EditorManager.activeEditor.windowManager.close(win);},getOuterHTML:function(e){return tinymce.DOM.getOuterHTML(e);},setOuterHTML:function(e,h,d){return tinymce.DOM.setOuterHTML(e,h,d);},hasPlugin:function(n){return tinymce.PluginManager.get(n)!=null;},_setEventsEnabled:function(){},addPlugin:function(pn,f){var t=this;function PluginWrapper(ed){tinyMCE.selectedInstance=ed;ed.onInit.add(function(){t.settings=ed.settings;t.settings['base_href']=tinyMCE.documentBasePath;tinyMCE.settings=t.settings;tinyMCE.documentBasePath=ed.documentBasePath;if(f.initInstance)f.initInstance(ed);ed.contentDocument=ed.getDoc();ed.contentWindow=ed.getWin();ed.undoRedo=ed.undoManager;ed.startContent=ed.getContent({format:'raw'});tinyMCE.instances[ed.id]=ed;tinyMCE.loadedFiles=[];});ed.onActivate.add(function(){tinyMCE.settings=ed.settings;tinyMCE.selectedInstance=ed;});if(f.handleNodeChange){ed.onNodeChange.add(function(ed,cm,n){f.handleNodeChange(ed.id,n,0,0,false,!ed.selection.isCollapsed());});}if(f.onChange){ed.onChange.add(function(ed,n){return f.onChange(ed);});}if(f.cleanup){ed.onGetContent.add(function(){});}this.getInfo=function(){return f.getInfo();};this.createControl=function(n){tinyMCE.pluginURL=tinymce.baseURL+'/plugins/'+pn;tinyMCE.themeURL=tinymce.baseURL+'/themes/'+tinyMCE.activeEditor.settings.theme;if(f.getControlHTML)return f.getControlHTML(n);return null;};this.execCommand=function(cmd,ui,val){if(f.execCommand)return f.execCommand(ed.id,ed.getBody(),cmd,ui,val);return false;};};tinymce.PluginManager.add(pn,PluginWrapper);},_getDOM:function(){return tinyMCE.activeEditor?tinyMCE.activeEditor.dom:tinymce.DOM;},convertRelativeToAbsoluteURL:function(b,u){return new tinymce.util.URI(b).toAbsolute(u);},convertAbsoluteURLToRelativeURL:function(b,u){return new tinymce.util.URI(b).toRelative(u);}});tinymce.extend(tinymce.Editor.prototype,{getFocusElement:function(){return this.selection.getNode();},getData:function(n){if(!this.data)this.data=[];if(!this.data[n])this.data[n]=[];return this.data[n];},hasPlugin:function(n){return this.plugins[n]!=null;},getContainerWin:function(){return window;},getHTML:function(raw){return this.getContent({format:raw?'raw':'html'});},setHTML:function(h){this.setContent(h);},getSel:function(){return this.selection.getSel();},getRng:function(){return this.selection.getRng();},isHidden:function(){var s;if(!tinymce.isGecko)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},translate:function(s){var c=this.settings.language,o;o=tinymce.EditorManager.i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return tinymce.EditorManager.i18n[c+'.'+b]||'{#'+b+'}';});o=o.replace(/{\$lang_([^}]+)\}/g,function(a,b){return tinymce.EditorManager.i18n[c+'.'+b]||'{$lang_'+b+'}';});return o;},repaint:function(){this.execCommand('mceRepaint');}});tinymce.extend(tinymce.dom.Selection.prototype,{getSelectedText:function(){return this.getContent({format:'text'});},getSelectedHTML:function(){return this.getContent({format:'html'});},getFocusElement:function(){return this.getNode();},selectNode:function(node,collapse,select_text_node,to_start){var t=this;t.select(node,select_text_node||0);if(!is(collapse))collapse=true;if(collapse){if(!is(to_start))to_start=true;t.collapse(to_start);}}});}).call(this);tinymce.PluginManager.add('compat2x',tinymce.plugins.Compat2x);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/compat2x/editor_plugin_src.js b/program/js/tiny_mce/plugins/compat2x/editor_plugin_src.js new file mode 100644 index 000000000..afad77c2f --- /dev/null +++ b/program/js/tiny_mce/plugins/compat2x/editor_plugin_src.js @@ -0,0 +1,613 @@ +/**
+ * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+ var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
+
+ tinymce.create('tinymce.plugins.Compat2x', {
+ getInfo : function() {
+ return {
+ longname : 'Compat2x',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x',
+ version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
+ };
+ }
+ });
+
+ (function() {
+ // Extend tinyMCE/EditorManager
+ tinymce.extend(tinyMCE, {
+ addToLang : function(p, l) {
+ each(l, function(v, k) {
+ tinyMCE.i18n[(tinyMCE.settings.language || 'en') + '.' + (p ? p + '_' : '') + k] = v;
+ });
+ },
+
+ getInstanceById : function(n) {
+ return this.get(n);
+ }
+ });
+ })();
+
+ (function() {
+ var EditorManager = tinymce.EditorManager;
+
+ tinyMCE.instances = {};
+ tinyMCE.plugins = {};
+ tinymce.PluginManager.onAdd.add(function(pm, n, p) {
+ tinyMCE.plugins[n] = p;
+ });
+
+ tinyMCE.majorVersion = tinymce.majorVersion;
+ tinyMCE.minorVersion = tinymce.minorVersion;
+ tinyMCE.releaseDate = tinymce.releaseDate;
+ tinyMCE.baseURL = tinymce.baseURL;
+ tinyMCE.isIE = tinyMCE.isMSIE = tinymce.isIE || tinymce.isOpera;
+ tinyMCE.isMSIE5 = tinymce.isIE;
+ tinyMCE.isMSIE5_0 = tinymce.isIE;
+ tinyMCE.isMSIE7 = tinymce.isIE;
+ tinyMCE.isGecko = tinymce.isGecko;
+ tinyMCE.isSafari = tinymce.isWebKit;
+ tinyMCE.isOpera = tinymce.isOpera;
+ tinyMCE.isMac = false;
+ tinyMCE.isNS7 = false;
+ tinyMCE.isNS71 = false;
+ tinyMCE.compat = true;
+
+ // Extend tinyMCE class
+ TinyMCE_Engine = tinyMCE;
+ tinymce.extend(tinyMCE, {
+ getParam : function(n, dv) {
+ return this.activeEditor.getParam(n, dv);
+ },
+
+ addEvent : function(e, na, f, sc) {
+ tinymce.dom.Event.add(e, na, f, sc || this);
+ },
+
+ getControlHTML : function(n) {
+ return EditorManager.activeEditor.controlManager.createControl(n);
+ },
+
+ loadCSS : function(u) {
+ tinymce.DOM.loadCSS(u);
+ },
+
+ importCSS : function(doc, u) {
+ if (doc == document)
+ this.loadCSS(u);
+ else
+ new tinymce.dom.DOMUtils(doc).loadCSS(u);
+ },
+
+ log : function() {
+ console.debug.apply(console, arguments);
+ },
+
+ getLang : function(n, dv) {
+ var v = EditorManager.activeEditor.getLang(n.replace(/^lang_/g, ''), dv);
+
+ // Is number
+ if (/^[0-9\-.]+$/g.test(v))
+ return parseInt(v);
+
+ return v;
+ },
+
+ isInstance : function(o) {
+ return o != null && typeof(o) == "object" && o.execCommand;
+ },
+
+ triggerNodeChange : function() {
+ EditorManager.activeEditor.nodeChanged();
+ },
+
+ regexpReplace : function(in_str, reg_exp, replace_str, opts) {
+ var re;
+
+ if (in_str == null)
+ return in_str;
+
+ if (typeof(opts) == "undefined")
+ opts = 'g';
+
+ re = new RegExp(reg_exp, opts);
+
+ return in_str.replace(re, replace_str);
+ },
+
+ trim : function(s) {
+ return tinymce.trim(s);
+ },
+
+ xmlEncode : function(s) {
+ return tinymce.DOM.encode(s);
+ },
+
+ explode : function(s, d) {
+ var o = [];
+
+ tinymce.each(s.split(d), function(v) {
+ if (v != '')
+ o.push(v);
+ });
+
+ return o;
+ },
+
+ switchClass : function(id, cls) {
+ var b;
+
+ if (/^mceButton/.test(cls)) {
+ b = EditorManager.activeEditor.controlManager.get(id);
+
+ if (!b)
+ return;
+
+ switch (cls) {
+ case "mceButtonNormal":
+ b.setDisabled(false);
+ b.setActive(false);
+ return;
+
+ case "mceButtonDisabled":
+ b.setDisabled(true);
+ return;
+
+ case "mceButtonSelected":
+ b.setActive(true);
+ b.setDisabled(false);
+ return;
+ }
+ }
+ },
+
+ addCSSClass : function(e, n, b) {
+ return tinymce.DOM.addClass(e, n, b);
+ },
+
+ hasCSSClass : function(e, n) {
+ return tinymce.DOM.hasClass(e, n);
+ },
+
+ removeCSSClass : function(e, n) {
+ return tinymce.DOM.removeClass(e, n);
+ },
+
+ getCSSClasses : function() {
+ var cl = EditorManager.activeEditor.dom.getClasses(), o = [];
+
+ each(cl, function(c) {
+ o.push(c['class']);
+ });
+
+ return o;
+ },
+
+ setWindowArg : function(n, v) {
+ EditorManager.activeEditor.windowManager.params[n] = v;
+ },
+
+ getWindowArg : function(n, dv) {
+ var wm = EditorManager.activeEditor.windowManager, v;
+
+ v = wm.getParam(n);
+ if (v === '')
+ return '';
+
+ return v || wm.getFeature(n) || dv;
+ },
+
+ getParentNode : function(n, f) {
+ return this._getDOM().getParent(n, f);
+ },
+
+ selectElements : function(n, na, f) {
+ var i, a = [], nl, x;
+
+ for (x=0, na = na.split(','); x<na.length; x++)
+ for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
+ (!f || f(nl[i])) && a.push(nl[i]);
+
+ return a;
+ },
+
+ getNodeTree : function(n, na, t, nn) {
+ return this.selectNodes(n, function(n) {
+ return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
+ }, na ? na : []);
+ },
+
+ getAttrib : function(e, n, dv) {
+ return this._getDOM().getAttrib(e, n, dv);
+ },
+
+ setAttrib : function(e, n, v) {
+ return this._getDOM().setAttrib(e, n, v);
+ },
+
+ getElementsByAttributeValue : function(n, e, a, v) {
+ var i, nl = n.getElementsByTagName(e), o = [];
+
+ for (i=0; i<nl.length; i++) {
+ if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
+ o[o.length] = nl[i];
+ }
+
+ return o;
+ },
+
+ selectNodes : function(n, f, a) {
+ var i;
+
+ if (!a)
+ a = [];
+
+ if (f(n))
+ a[a.length] = n;
+
+ if (n.hasChildNodes()) {
+ for (i=0; i<n.childNodes.length; i++)
+ tinyMCE.selectNodes(n.childNodes[i], f, a);
+ }
+
+ return a;
+ },
+
+ getContent : function() {
+ return EditorManager.activeEditor.getContent();
+ },
+
+ getParentElement : function(n, na, f) {
+ if (na)
+ na = new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$', 'g');
+
+ return this._getDOM().getParent(n, function(n) {
+ return n.nodeType == 1 && (!na || na.test(n.nodeName)) && (!f || f(n));
+ }, this.activeEditor.getBody());
+ },
+
+ importPluginLanguagePack : function(n) {
+ tinymce.PluginManager.requireLangPack(n);
+ },
+
+ getButtonHTML : function(cn, lang, img, c, u, v) {
+ var ed = EditorManager.activeEditor;
+
+ img = img.replace(/\{\$pluginurl\}/g, tinyMCE.pluginURL);
+ img = img.replace(/\{\$themeurl\}/g, tinyMCE.themeURL);
+ lang = lang.replace(/^lang_/g, '');
+
+ return ed.controlManager.createButton(cn, {
+ title : lang,
+ command : c,
+ ui : u,
+ value : v,
+ scope : this,
+ 'class' : 'compat',
+ image : img
+ });
+ },
+
+ addSelectAccessibility : function(e, s, w) {
+ // Add event handlers
+ if (!s._isAccessible) {
+ s.onkeydown = tinyMCE.accessibleEventHandler;
+ s.onblur = tinyMCE.accessibleEventHandler;
+ s._isAccessible = true;
+ s._win = w;
+ }
+
+ return false;
+ },
+
+ accessibleEventHandler : function(e) {
+ var elm, win = this._win;
+
+ e = tinymce.isIE ? win.event : e;
+ elm = tinymce.isIE ? e.srcElement : e.target;
+
+ // Unpiggyback onchange on blur
+ if (e.type == "blur") {
+ if (elm.oldonchange) {
+ elm.onchange = elm.oldonchange;
+ elm.oldonchange = null;
+ }
+
+ return true;
+ }
+
+ // Piggyback onchange
+ if (elm.nodeName == "SELECT" && !elm.oldonchange) {
+ elm.oldonchange = elm.onchange;
+ elm.onchange = null;
+ }
+
+ // Execute onchange and remove piggyback
+ if (e.keyCode == 13 || e.keyCode == 32) {
+ elm.onchange = elm.oldonchange;
+ elm.onchange();
+ elm.oldonchange = null;
+
+ tinyMCE.cancelEvent(e);
+ return false;
+ }
+
+ return true;
+ },
+
+ cancelEvent : function(e) {
+ return tinymce.dom.Event.cancel(e);
+ },
+
+ handleVisualAid : function(e) {
+ EditorManager.activeEditor.addVisual(e);
+ },
+
+ getAbsPosition : function(n, r) {
+ return tinymce.DOM.getPos(n, r);
+ },
+
+ cleanupEventStr : function(s) {
+ s = "" + s;
+ s = s.replace('function anonymous()\n{\n', '');
+ s = s.replace('\n}', '');
+ s = s.replace(/^return true;/gi, ''); // Remove event blocker
+
+ return s;
+ },
+
+ getVisualAidClass : function(s) {
+ // TODO: Implement
+ return s;
+ },
+
+ parseStyle : function(s) {
+ return this._getDOM().parseStyle(s);
+ },
+
+ serializeStyle : function(s) {
+ return this._getDOM().serializeStyle(s);
+ },
+
+ openWindow : function(tpl, args) {
+ var ed = EditorManager.activeEditor, o = {}, n;
+
+ // Convert name/value array to object
+ for (n in tpl)
+ o[n] = tpl[n];
+
+ tpl = o;
+
+ args = args || {};
+ tpl.url = new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file);
+ tpl.inline = tpl.inline || args.inline;
+
+ ed.windowManager.open(tpl, args);
+ },
+
+ closeWindow : function(win) {
+ EditorManager.activeEditor.windowManager.close(win);
+ },
+
+ getOuterHTML : function(e) {
+ return tinymce.DOM.getOuterHTML(e);
+ },
+
+ setOuterHTML : function(e, h, d) {
+ return tinymce.DOM.setOuterHTML(e, h, d);
+ },
+
+ hasPlugin : function(n) {
+ return tinymce.PluginManager.get(n) != null;
+ },
+
+ _setEventsEnabled : function() {
+ // Ignore it!!
+ },
+
+ addPlugin : function(pn, f) {
+ var t = this;
+
+ function PluginWrapper(ed) {
+ tinyMCE.selectedInstance = ed;
+
+ ed.onInit.add(function() {
+ t.settings = ed.settings;
+ t.settings['base_href'] = tinyMCE.documentBasePath;
+ tinyMCE.settings = t.settings;
+ tinyMCE.documentBasePath = ed.documentBasePath;
+ //ed.formElement = DOM.get(ed.id);
+
+ if (f.initInstance)
+ f.initInstance(ed);
+
+ ed.contentDocument = ed.getDoc();
+ ed.contentWindow = ed.getWin();
+ ed.undoRedo = ed.undoManager;
+ ed.startContent = ed.getContent({format : 'raw'});
+
+ tinyMCE.instances[ed.id] = ed;
+ tinyMCE.loadedFiles = [];
+ });
+
+ ed.onActivate.add(function() {
+ tinyMCE.settings = ed.settings;
+ tinyMCE.selectedInstance = ed;
+ });
+
+ /* if (f.removeInstance) {
+ ed.onDestroy.add(function() {
+ return f.removeInstance(ed.id);
+ });
+ }*/
+
+ if (f.handleNodeChange) {
+ ed.onNodeChange.add(function(ed, cm, n) {
+ f.handleNodeChange(ed.id, n, 0, 0, false, !ed.selection.isCollapsed());
+ });
+ }
+
+ if (f.onChange) {
+ ed.onChange.add(function(ed, n) {
+ return f.onChange(ed);
+ });
+ }
+
+ if (f.cleanup) {
+ ed.onGetContent.add(function() {
+ //f.cleanup(type, content, inst);
+ });
+ }
+
+ this.getInfo = function() {
+ return f.getInfo();
+ };
+
+ this.createControl = function(n) {
+ tinyMCE.pluginURL = tinymce.baseURL + '/plugins/' + pn;
+ tinyMCE.themeURL = tinymce.baseURL + '/themes/' + tinyMCE.activeEditor.settings.theme;
+
+ if (f.getControlHTML)
+ return f.getControlHTML(n);
+
+ return null;
+ };
+
+ this.execCommand = function(cmd, ui, val) {
+ if (f.execCommand)
+ return f.execCommand(ed.id, ed.getBody(), cmd, ui, val);
+
+ return false;
+ };
+ };
+
+ tinymce.PluginManager.add(pn, PluginWrapper);
+ },
+
+ _getDOM : function() {
+ return tinyMCE.activeEditor ? tinyMCE.activeEditor.dom : tinymce.DOM;
+ },
+
+ convertRelativeToAbsoluteURL : function(b, u) {
+ return new tinymce.util.URI(b).toAbsolute(u);
+ },
+
+ convertAbsoluteURLToRelativeURL : function(b, u) {
+ return new tinymce.util.URI(b).toRelative(u);
+ }
+ });
+
+ // Extend Editor class
+ tinymce.extend(tinymce.Editor.prototype, {
+ getFocusElement : function() {
+ return this.selection.getNode();
+ },
+
+ getData : function(n) {
+ if (!this.data)
+ this.data = [];
+
+ if (!this.data[n])
+ this.data[n] = [];
+
+ return this.data[n];
+ },
+
+ hasPlugin : function(n) {
+ return this.plugins[n] != null;
+ },
+
+ getContainerWin : function() {
+ return window;
+ },
+
+ getHTML : function(raw) {
+ return this.getContent({ format : raw ? 'raw' : 'html'});
+ },
+
+ setHTML : function(h) {
+ this.setContent(h);
+ },
+
+ getSel : function() {
+ return this.selection.getSel();
+ },
+
+ getRng : function() {
+ return this.selection.getRng();
+ },
+
+ isHidden : function() {
+ var s;
+
+ if (!tinymce.isGecko)
+ return false;
+
+ s = this.getSel();
+
+ // Weird, wheres that cursor selection?
+ return (!s || !s.rangeCount || s.rangeCount == 0);
+ },
+
+ translate : function(s) {
+ var c = this.settings.language, o;
+
+ o = tinymce.EditorManager.i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
+ return tinymce.EditorManager.i18n[c + '.' + b] || '{#' + b + '}';
+ });
+
+ o = o.replace(/{\$lang_([^}]+)\}/g, function(a, b) {
+ return tinymce.EditorManager.i18n[c + '.' + b] || '{$lang_' + b + '}';
+ });
+
+ return o;
+ },
+
+ repaint : function() {
+ this.execCommand('mceRepaint');
+ }
+ });
+
+ // Extend selection
+ tinymce.extend(tinymce.dom.Selection.prototype, {
+ getSelectedText : function() {
+ return this.getContent({format : 'text'});
+ },
+
+ getSelectedHTML : function() {
+ return this.getContent({format : 'html'});
+ },
+
+ getFocusElement : function() {
+ return this.getNode();
+ },
+
+ selectNode : function(node, collapse, select_text_node, to_start) {
+ var t = this;
+
+ t.select(node, select_text_node || 0);
+
+ if (!is(collapse))
+ collapse = true;
+
+ if (collapse) {
+ if (!is(to_start))
+ to_start = true;
+
+ t.collapse(to_start);
+ }
+ }
+ });
+ }).call(this);
+
+ // Register plugin
+ tinymce.PluginManager.add('compat2x', tinymce.plugins.Compat2x);
+})();
+
diff --git a/program/js/tiny_mce/plugins/contextmenu/editor_plugin.js b/program/js/tiny_mce/plugins/contextmenu/editor_plugin.js new file mode 100644 index 000000000..7dc3438e7 --- /dev/null +++ b/program/js/tiny_mce/plugins/contextmenu/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.ContextMenu',{init:function(ed){var t=this;t.editor=ed;t.onContextMenu=new tinymce.util.Dispatcher(this);ed.onContextMenu.add(function(ed,e){if(!e.ctrlKey){t._getMenu(ed).showMenu(e.clientX,e.clientY);Event.add(document,'click',hide);Event.cancel(e);}});function hide(){if(t._menu){t._menu.removeAll();t._menu.destroy();Event.remove(document,'click',hide);}};ed.onMouseDown.add(hide);ed.onKeyDown.add(hide);},getInfo:function(){return{longname:'Contextmenu',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_getMenu:function(ed){var t=this,m=t._menu,se=ed.selection,col=se.isCollapsed(),el=se.getNode()||ed.getBody(),am,p1,p2;if(m){m.removeAll();m.destroy();}p1=DOM.getPos(ed.getContentAreaContainer());p2=DOM.getPos(ed.getContainer());m=ed.controlManager.createDropMenu('contextmenu',{offset_x:p1.x,offset_y:p1.y,constrain:1});t._menu=m;m.add({title:'advanced.cut_desc',icon:'cut',cmd:'Cut'}).setDisabled(col);m.add({title:'advanced.copy_desc',icon:'copy',cmd:'Copy'}).setDisabled(col);m.add({title:'advanced.paste_desc',icon:'paste',cmd:'Paste'});if((el.nodeName=='A'&&!ed.dom.getAttrib(el,'name'))||!col){m.addSeparator();m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});}m.addSeparator();m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();am=m.addMenu({title:'contextmenu.align'});am.add({title:'contextmenu.left',icon:'justifyleft',cmd:'JustifyLeft'});am.add({title:'contextmenu.center',icon:'justifycenter',cmd:'JustifyCenter'});am.add({title:'contextmenu.right',icon:'justifyright',cmd:'JustifyRight'});am.add({title:'contextmenu.full',icon:'justifyfull',cmd:'JustifyFull'});t.onContextMenu.dispatch(t,m,el,col);return m;}});tinymce.PluginManager.add('contextmenu',tinymce.plugins.ContextMenu);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js b/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js new file mode 100644 index 000000000..649264141 --- /dev/null +++ b/program/js/tiny_mce/plugins/contextmenu/editor_plugin_src.js @@ -0,0 +1,97 @@ +/**
+ * $Id: editor_plugin_src.js 755 2008-03-29 19:14:42Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+ var Event = tinymce.dom.Event, each = tinymce.each, DOM = tinymce.DOM;
+
+ tinymce.create('tinymce.plugins.ContextMenu', {
+ init : function(ed) {
+ var t = this;
+
+ t.editor = ed;
+ t.onContextMenu = new tinymce.util.Dispatcher(this);
+
+ ed.onContextMenu.add(function(ed, e) {
+ if (!e.ctrlKey) {
+ t._getMenu(ed).showMenu(e.clientX, e.clientY);
+ Event.add(document, 'click', hide);
+ Event.cancel(e);
+ }
+ });
+
+ function hide() {
+ if (t._menu) {
+ t._menu.removeAll();
+ t._menu.destroy();
+ Event.remove(document, 'click', hide);
+ }
+ };
+
+ ed.onMouseDown.add(hide);
+ ed.onKeyDown.add(hide);
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Contextmenu',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/contextmenu',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ _getMenu : function(ed) {
+ var t = this, m = t._menu, se = ed.selection, col = se.isCollapsed(), el = se.getNode() || ed.getBody(), am, p1, p2;
+
+ if (m) {
+ m.removeAll();
+ m.destroy();
+ }
+
+ p1 = DOM.getPos(ed.getContentAreaContainer());
+ p2 = DOM.getPos(ed.getContainer());
+
+ m = ed.controlManager.createDropMenu('contextmenu', {
+ offset_x : p1.x,
+ offset_y : p1.y,
+/* vp_offset_x : p2.x,
+ vp_offset_y : p2.y,*/
+ constrain : 1
+ });
+
+ t._menu = m;
+
+ m.add({title : 'advanced.cut_desc', icon : 'cut', cmd : 'Cut'}).setDisabled(col);
+ m.add({title : 'advanced.copy_desc', icon : 'copy', cmd : 'Copy'}).setDisabled(col);
+ m.add({title : 'advanced.paste_desc', icon : 'paste', cmd : 'Paste'});
+
+ if ((el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) || !col) {
+ m.addSeparator();
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+ }
+
+ m.addSeparator();
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+
+ m.addSeparator();
+ am = m.addMenu({title : 'contextmenu.align'});
+ am.add({title : 'contextmenu.left', icon : 'justifyleft', cmd : 'JustifyLeft'});
+ am.add({title : 'contextmenu.center', icon : 'justifycenter', cmd : 'JustifyCenter'});
+ am.add({title : 'contextmenu.right', icon : 'justifyright', cmd : 'JustifyRight'});
+ am.add({title : 'contextmenu.full', icon : 'justifyfull', cmd : 'JustifyFull'});
+
+ t.onContextMenu.dispatch(t, m, el, col);
+
+ return m;
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('contextmenu', tinymce.plugins.ContextMenu);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/directionality/editor_plugin.js b/program/js/tiny_mce/plugins/directionality/editor_plugin.js new file mode 100644 index 000000000..6966d80af --- /dev/null +++ b/program/js/tiny_mce/plugins/directionality/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.Directionality',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceDirectionLTR',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="ltr")ed.dom.setAttrib(e,"dir","ltr");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addCommand('mceDirectionRTL',function(){var e=ed.dom.getParent(ed.selection.getNode(),ed.dom.isBlock);if(e){if(ed.dom.getAttrib(e,"dir")!="rtl")ed.dom.setAttrib(e,"dir","rtl");else ed.dom.setAttrib(e,"dir","");}ed.nodeChanged();});ed.addButton('ltr',{title:'directionality.ltr_desc',cmd:'mceDirectionLTR'});ed.addButton('rtl',{title:'directionality.rtl_desc',cmd:'mceDirectionRTL'});ed.onNodeChange.add(t._nodeChange,t);},getInfo:function(){return{longname:'Directionality',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_nodeChange:function(ed,cm,n){var dom=ed.dom,dir;n=dom.getParent(n,dom.isBlock);if(!n){cm.setDisabled('ltr',1);cm.setDisabled('rtl',1);return;}dir=dom.getAttrib(n,'dir');cm.setActive('ltr',dir=="ltr");cm.setDisabled('ltr',0);cm.setActive('rtl',dir=="rtl");cm.setDisabled('rtl',0);}});tinymce.PluginManager.add('directionality',tinymce.plugins.Directionality);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js b/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js new file mode 100644 index 000000000..81818e37c --- /dev/null +++ b/program/js/tiny_mce/plugins/directionality/editor_plugin_src.js @@ -0,0 +1,79 @@ +/**
+ * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.Directionality', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ ed.addCommand('mceDirectionLTR', function() {
+ var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+
+ if (e) {
+ if (ed.dom.getAttrib(e, "dir") != "ltr")
+ ed.dom.setAttrib(e, "dir", "ltr");
+ else
+ ed.dom.setAttrib(e, "dir", "");
+ }
+
+ ed.nodeChanged();
+ });
+
+ ed.addCommand('mceDirectionRTL', function() {
+ var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+
+ if (e) {
+ if (ed.dom.getAttrib(e, "dir") != "rtl")
+ ed.dom.setAttrib(e, "dir", "rtl");
+ else
+ ed.dom.setAttrib(e, "dir", "");
+ }
+
+ ed.nodeChanged();
+ });
+
+ ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
+ ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
+
+ ed.onNodeChange.add(t._nodeChange, t);
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Directionality',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ // Private methods
+
+ _nodeChange : function(ed, cm, n) {
+ var dom = ed.dom, dir;
+
+ n = dom.getParent(n, dom.isBlock);
+ if (!n) {
+ cm.setDisabled('ltr', 1);
+ cm.setDisabled('rtl', 1);
+ return;
+ }
+
+ dir = dom.getAttrib(n, 'dir');
+ cm.setActive('ltr', dir == "ltr");
+ cm.setDisabled('ltr', 0);
+ cm.setActive('rtl', dir == "rtl");
+ cm.setDisabled('rtl', 0);
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/emotions/editor_plugin.js b/program/js/tiny_mce/plugins/emotions/editor_plugin.js index 4d81e5a86..87fac106d 100644 --- a/program/js/tiny_mce/plugins/emotions/editor_plugin.js +++ b/program/js/tiny_mce/plugins/emotions/editor_plugin.js @@ -1 +1 @@ -tinyMCE.importPluginLanguagePack('emotions');var TinyMCE_EmotionsPlugin={getInfo:function(){return{longname:'Emotions',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"emotions":return tinyMCE.getButtonHTML(cn,'lang_emotions_desc','{$pluginurl}/images/emotions.gif','mceEmotion')}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceEmotion":var template=new Array();template['file']='../../plugins/emotions/emotions.htm';template['width']=250;template['height']=160;template['width']+=tinyMCE.getLang('lang_emotions_delta_width',0);template['height']+=tinyMCE.getLang('lang_emotions_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true}return false}};tinyMCE.addPlugin('emotions',TinyMCE_EmotionsPlugin);
\ No newline at end of file +(function(){tinymce.create('tinymce.plugins.EmotionsPlugin',{init:function(ed,url){ed.addCommand('mceEmotion',function(){ed.windowManager.open({file:url+'/emotions.htm',width:250+parseInt(ed.getLang('emotions.delta_width',0)),height:160+parseInt(ed.getLang('emotions.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('emotions',{title:'emotions.emotions_desc',cmd:'mceEmotion'});},getInfo:function(){return{longname:'Emotions',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('emotions',tinymce.plugins.EmotionsPlugin);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js b/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js index c7d60cf3f..df0d370ae 100644 --- a/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/emotions/editor_plugin_src.js @@ -1,63 +1,40 @@ /**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('emotions');
-
-// Plucin static class
-var TinyMCE_EmotionsPlugin = {
- getInfo : function() {
- return {
- longname : 'Emotions',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- /**
- * Returns the HTML contents of the emotions control.
- */
- getControlHTML : function(cn) {
- switch (cn) {
- case "emotions":
- return tinyMCE.getButtonHTML(cn, 'lang_emotions_desc', '{$pluginurl}/images/emotions.gif', 'mceEmotion');
- }
-
- return "";
- },
-
- /**
- * Executes the mceEmotion command.
- */
- execCommand : function(editor_id, element, command, user_interface, value) {
- // Handle commands
- switch (command) {
- case "mceEmotion":
- var template = new Array();
-
- template['file'] = '../../plugins/emotions/emotions.htm'; // Relative to theme
- template['width'] = 250;
- template['height'] = 160;
-
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_emotions_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_emotions_delta_height', 0);
-
- tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
-
- return true;
+(function() {
+ tinymce.create('tinymce.plugins.EmotionsPlugin', {
+ init : function(ed, url) {
+ // Register commands
+ ed.addCommand('mceEmotion', function() {
+ ed.windowManager.open({
+ file : url + '/emotions.htm',
+ width : 250 + parseInt(ed.getLang('emotions.delta_width', 0)),
+ height : 160 + parseInt(ed.getLang('emotions.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'});
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Emotions',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
}
+ });
- // Pass to next handler in chain
- return false;
- }
-};
-
-// Register plugin
-tinyMCE.addPlugin('emotions', TinyMCE_EmotionsPlugin);
+ // Register plugin
+ tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/emotions/emotions.htm b/program/js/tiny_mce/plugins/emotions/emotions.htm index fca8ffa08..8110ee029 100644 --- a/program/js/tiny_mce/plugins/emotions/emotions.htm +++ b/program/js/tiny_mce/plugins/emotions/emotions.htm @@ -1,38 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_emotions_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/functions.js"></script>
+ <title>{#emotions_dlg.title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="js/emotions.js"></script>
<base target="_self" />
</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body style="display: none">
<div align="center">
- <div class="title">{$lang_emotions_title}:<br /><br /></div>
+ <div class="title">{#emotions_dlg.title}:<br /><br /></div>
<table border="0" cellspacing="0" cellpadding="4">
<tr>
- <td><a href="javascript:insertEmotion('smiley-cool.gif','lang_emotions_cool');"><img src="images/smiley-cool.gif" width="18" height="18" border="0" alt="{$lang_emotions_cool}" title="{$lang_emotions_cool}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-cry.gif','lang_emotions_cry');"><img src="images/smiley-cry.gif" width="18" height="18" border="0" alt="{$lang_emotions_cry}" title="{$lang_emotions_cry}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-embarassed.gif','lang_emotions_embarassed');"><img src="images/smiley-embarassed.gif" width="18" height="18" border="0" alt="{$lang_emotions_embarassed}" title="{$lang_emotions_embarassed}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-foot-in-mouth.gif','lang_emotions_foot_in_mouth');"><img src="images/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{$lang_emotions_foot_in_mouth}" title="{$lang_emotions_foot_in_mouth}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-cool.gif','emotions_dlg.cool');"><img src="img/smiley-cool.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cool}" title="{#emotions_dlg.cool}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-cry.gif','emotions_dlg.cry');"><img src="img/smiley-cry.gif" width="18" height="18" border="0" alt="{#emotions_dlg.cry}" title="{#emotions_dlg.cry}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-embarassed.gif','emotions_dlg.embarassed');"><img src="img/smiley-embarassed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.embarassed}" title="{#emotions_dlg.embarassed}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-foot-in-mouth.gif','emotions_dlg.foot_in_mouth');"><img src="img/smiley-foot-in-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.foot_in_mouth}" title="{#emotions_dlg.foot_in_mouth}" /></a></td>
</tr>
<tr>
- <td><a href="javascript:insertEmotion('smiley-frown.gif','lang_emotions_frown');"><img src="images/smiley-frown.gif" width="18" height="18" border="0" alt="{$lang_emotions_frown}" title="{$lang_emotions_frown}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-innocent.gif','lang_emotions_innocent');"><img src="images/smiley-innocent.gif" width="18" height="18" border="0" alt="{$lang_emotions_innocent}" title="{$lang_emotions_innocent}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-kiss.gif','lang_emotions_kiss');"><img src="images/smiley-kiss.gif" width="18" height="18" border="0" alt="{$lang_emotions_kiss}" title="{$lang_emotions_kiss}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-laughing.gif','lang_emotions_laughing');"><img src="images/smiley-laughing.gif" width="18" height="18" border="0" alt="{$lang_emotions_laughing}" title="{$lang_emotions_laughing}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-frown.gif','emotions_dlg.frown');"><img src="img/smiley-frown.gif" width="18" height="18" border="0" alt="{#emotions_dlg.frown}" title="{#emotions_dlg.frown}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-innocent.gif','emotions_dlg.innocent');"><img src="img/smiley-innocent.gif" width="18" height="18" border="0" alt="{#emotions_dlg.innocent}" title="{#emotions_dlg.innocent}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-kiss.gif','emotions_dlg.kiss');"><img src="img/smiley-kiss.gif" width="18" height="18" border="0" alt="{#emotions_dlg.kiss}" title="{#emotions_dlg.kiss}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-laughing.gif','emotions_dlg.laughing');"><img src="img/smiley-laughing.gif" width="18" height="18" border="0" alt="{#emotions_dlg.laughing}" title="{#emotions_dlg.laughing}" /></a></td>
</tr>
<tr>
- <td><a href="javascript:insertEmotion('smiley-money-mouth.gif','lang_emotions_money_mouth');"><img src="images/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{$lang_emotions_money_mouth}" title="{$lang_emotions_money_mouth}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-sealed.gif','lang_emotions_sealed');"><img src="images/smiley-sealed.gif" width="18" height="18" border="0" alt="{$lang_emotions_sealed}" title="{$lang_emotions_sealed}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-smile.gif','lang_emotions_smile');"><img src="images/smiley-smile.gif" width="18" height="18" border="0" alt="{$lang_emotions_smile}" title="{$lang_emotions_smile}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-surprised.gif','lang_emotions_surprised');"><img src="images/smiley-surprised.gif" width="18" height="18" border="0" alt="{$lang_emotions_surprised}" title="{$lang_emotions_surprised}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-money-mouth.gif','emotions_dlg.money_mouth');"><img src="img/smiley-money-mouth.gif" width="18" height="18" border="0" alt="{#emotions_dlg.money_mouth}" title="{#emotions_dlg.money_mouth}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-sealed.gif','emotions_dlg.sealed');"><img src="img/smiley-sealed.gif" width="18" height="18" border="0" alt="{#emotions_dlg.sealed}" title="{#emotions_dlg.sealed}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-smile.gif','emotions_dlg.smile');"><img src="img/smiley-smile.gif" width="18" height="18" border="0" alt="{#emotions_dlg.smile}" title="{#emotions_dlg.smile}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-surprised.gif','emotions_dlg.surprised');"><img src="img/smiley-surprised.gif" width="18" height="18" border="0" alt="{#emotions_dlg.surprised}" title="{#emotions_dlg.surprised}" /></a></td>
</tr>
<tr>
- <td><a href="javascript:insertEmotion('smiley-tongue-out.gif','lang_emotions_tongue_out');"><img src="images/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{$lang_emotions_tongue-out}" title="{$lang_emotions_tongue_out}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-undecided.gif','lang_emotions_undecided');"><img src="images/smiley-undecided.gif" width="18" height="18" border="0" alt="{$lang_emotions_undecided}" title="{$lang_emotions_undecided}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-wink.gif','lang_emotions_wink');"><img src="images/smiley-wink.gif" width="18" height="18" border="0" alt="{$lang_emotions_wink}" title="{$lang_emotions_wink}" /></a></td>
- <td><a href="javascript:insertEmotion('smiley-yell.gif','lang_emotions_yell');"><img src="images/smiley-yell.gif" width="18" height="18" border="0" alt="{$lang_emotions_yell}" title="{$lang_emotions_yell}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-tongue-out.gif','emotions_dlg.tongue_out');"><img src="img/smiley-tongue-out.gif" width="18" height="18" border="0" alt="{#emotions_dlg.tongue-out}" title="{#emotions_dlg.tongue_out}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-undecided.gif','emotions_dlg.undecided');"><img src="img/smiley-undecided.gif" width="18" height="18" border="0" alt="{#emotions_dlg.undecided}" title="{#emotions_dlg.undecided}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-wink.gif','emotions_dlg.wink');"><img src="img/smiley-wink.gif" width="18" height="18" border="0" alt="{#emotions_dlg.wink}" title="{#emotions_dlg.wink}" /></a></td>
+ <td><a href="javascript:EmotionsDialog.insert('smiley-yell.gif','emotions_dlg.yell');"><img src="img/smiley-yell.gif" width="18" height="18" border="0" alt="{#emotions_dlg.yell}" title="{#emotions_dlg.yell}" /></a></td>
</tr>
</table>
</div>
diff --git a/program/js/tiny_mce/plugins/emotions/images/emotions.gif b/program/js/tiny_mce/plugins/emotions/images/emotions.gif Binary files differdeleted file mode 100644 index a39ed8ec3..000000000 --- a/program/js/tiny_mce/plugins/emotions/images/emotions.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/emotions/images/readme.txt b/program/js/tiny_mce/plugins/emotions/images/readme.txt deleted file mode 100644 index a3cea1b68..000000000 --- a/program/js/tiny_mce/plugins/emotions/images/readme.txt +++ /dev/null @@ -1,2 +0,0 @@ -These emotions where taken from Mozilla Thunderbird.
-I hope they don't get angry if I use them here after all this is a open source project aswell.
diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-cool.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-cool.gif Binary files differindex ba90cc36f..ba90cc36f 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-cool.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-cool.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-cry.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif Binary files differindex 74d897a4f..74d897a4f 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-cry.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-cry.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-embarassed.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-embarassed.gif Binary files differindex 963a96b8a..963a96b8a 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-embarassed.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-embarassed.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-foot-in-mouth.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif Binary files differindex 16f68cc1e..16f68cc1e 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-foot-in-mouth.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-frown.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-frown.gif Binary files differindex 716f55e16..716f55e16 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-frown.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-frown.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-innocent.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-innocent.gif Binary files differindex 334d49e0e..334d49e0e 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-innocent.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-innocent.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-kiss.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-kiss.gif Binary files differindex 4efd549ed..4efd549ed 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-kiss.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-kiss.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-laughing.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-laughing.gif Binary files differindex 1606c119e..1606c119e 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-laughing.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-laughing.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-money-mouth.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif Binary files differindex ca2451e10..ca2451e10 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-money-mouth.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-sealed.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-sealed.gif Binary files differindex b33d3cca1..b33d3cca1 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-sealed.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-sealed.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-smile.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-smile.gif Binary files differindex e6a9e60d5..e6a9e60d5 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-smile.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-smile.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-surprised.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-surprised.gif Binary files differindex cb99cdd91..cb99cdd91 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-surprised.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-surprised.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-tongue-out.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif Binary files differindex 2075dc160..2075dc160 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-tongue-out.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-undecided.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-undecided.gif Binary files differindex bef7e2573..bef7e2573 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-undecided.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-undecided.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-wink.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-wink.gif Binary files differindex 9faf1aff8..9faf1aff8 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-wink.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-wink.gif diff --git a/program/js/tiny_mce/plugins/emotions/images/smiley-yell.gif b/program/js/tiny_mce/plugins/emotions/img/smiley-yell.gif Binary files differindex 648e6e879..648e6e879 100644 --- a/program/js/tiny_mce/plugins/emotions/images/smiley-yell.gif +++ b/program/js/tiny_mce/plugins/emotions/img/smiley-yell.gif diff --git a/program/js/tiny_mce/plugins/emotions/js/emotions.js b/program/js/tiny_mce/plugins/emotions/js/emotions.js new file mode 100644 index 000000000..c54936709 --- /dev/null +++ b/program/js/tiny_mce/plugins/emotions/js/emotions.js @@ -0,0 +1,22 @@ +tinyMCEPopup.requireLangPack();
+
+var EmotionsDialog = {
+ init : function(ed) {
+ tinyMCEPopup.resizeToInnerSize();
+ },
+
+ insert : function(file, title) {
+ var ed = tinyMCEPopup.editor, dom = ed.dom;
+
+ tinyMCEPopup.execCommand('mceInsertContent', false, dom.createHTML('img', {
+ src : tinyMCEPopup.getWindowArg('plugin_url') + '/img/' + file,
+ alt : ed.getLang(title),
+ title : ed.getLang(title),
+ border : 0
+ }));
+
+ tinyMCEPopup.close();
+ }
+};
+
+tinyMCEPopup.onInit.add(EmotionsDialog.init, EmotionsDialog);
diff --git a/program/js/tiny_mce/plugins/emotions/jscripts/functions.js b/program/js/tiny_mce/plugins/emotions/jscripts/functions.js deleted file mode 100644 index 95a9eafe8..000000000 --- a/program/js/tiny_mce/plugins/emotions/jscripts/functions.js +++ /dev/null @@ -1,21 +0,0 @@ -function init() {
- tinyMCEPopup.resizeToInnerSize();
-}
-
-function insertEmotion(file_name, title) {
- title = tinyMCE.getLang(title);
-
- if (title == null)
- title = "";
-
- // XML encode
- title = title.replace(/&/g, '&');
- title = title.replace(/\"/g, '"');
- title = title.replace(/</g, '<');
- title = title.replace(/>/g, '>');
-
- var html = '<img src="' + tinyMCE.baseURL + "/plugins/emotions/images/" + file_name + '" mce_src="' + tinyMCE.baseURL + "/plugins/emotions/images/" + file_name + '" border="0" alt="' + title + '" title="' + title + '" />';
-
- tinyMCE.execCommand('mceInsertContent', false, html);
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/emotions/langs/en.js b/program/js/tiny_mce/plugins/emotions/langs/en.js deleted file mode 100644 index 3cdd67517..000000000 --- a/program/js/tiny_mce/plugins/emotions/langs/en.js +++ /dev/null @@ -1,22 +0,0 @@ -// UK lang variables
-
-tinyMCE.addToLang('emotions',{
-title : 'Insert emotion',
-desc : 'Emotions',
-cool : 'Cool',
-cry : 'Cry',
-embarassed : 'Embarassed',
-foot_in_mouth : 'Foot in mouth',
-frown : 'Frown',
-innocent : 'Innocent',
-kiss : 'Kiss',
-laughing : 'Laughing',
-money_mouth : 'Money mouth',
-sealed : 'Sealed',
-smile : 'Smile',
-surprised : 'Surprised',
-tongue_out : 'Tongue out',
-undecided : 'Undecided',
-wink : 'Wink',
-yell : 'Yell'
-});
diff --git a/program/js/tiny_mce/plugins/emotions/langs/en_dlg.js b/program/js/tiny_mce/plugins/emotions/langs/en_dlg.js new file mode 100644 index 000000000..3b57ad9e3 --- /dev/null +++ b/program/js/tiny_mce/plugins/emotions/langs/en_dlg.js @@ -0,0 +1,20 @@ +tinyMCE.addI18n('en.emotions_dlg',{
+title:"Insert emotion",
+desc:"Emotions",
+cool:"Cool",
+cry:"Cry",
+embarassed:"Embarassed",
+foot_in_mouth:"Foot in mouth",
+frown:"Frown",
+innocent:"Innocent",
+kiss:"Kiss",
+laughing:"Laughing",
+money_mouth:"Money mouth",
+sealed:"Sealed",
+smile:"Smile",
+surprised:"Surprised",
+tongue_out:"Tongue out",
+undecided:"Undecided",
+wink:"Wink",
+yell:"Yell"
+});
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/emotions/readme.txt b/program/js/tiny_mce/plugins/emotions/readme.txt deleted file mode 100644 index 4fdb78aec..000000000 --- a/program/js/tiny_mce/plugins/emotions/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Check the TinyMCE documentation for details on this plugin.
diff --git a/program/js/tiny_mce/plugins/media/css/content.css b/program/js/tiny_mce/plugins/media/css/content.css index 7873235e7..1bf6a7586 100644 --- a/program/js/tiny_mce/plugins/media/css/content.css +++ b/program/js/tiny_mce/plugins/media/css/content.css @@ -1,26 +1,6 @@ -.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia { - border: 1px dotted #cc0000; - background-position: center; - background-repeat: no-repeat; - background-color: #ffffcc; -} - -.mceItemShockWave { - background-image: url('../images/shockwave.gif'); -} - -.mceItemFlash { - background-image: url('../images/flash.gif'); -} - -.mceItemQuickTime { - background-image: url('../images/quicktime.gif'); -} - -.mceItemWindowsMedia { - background-image: url('../images/windowsmedia.gif'); -} - -.mceItemRealMedia { - background-image: url('../images/realmedia.gif'); -} +.mceItemFlash, .mceItemShockWave, .mceItemQuickTime, .mceItemWindowsMedia, .mceItemRealMedia {border:1px dotted #cc0000; background-position:center; background-repeat:no-repeat; background-color:#ffffcc;}
+.mceItemShockWave {background-image: url(../img/shockwave.gif);}
+.mceItemFlash {background-image:url(../img/flash.gif);}
+.mceItemQuickTime {background-image:url(../img/quicktime.gif);}
+.mceItemWindowsMedia {background-image:url(../img/windowsmedia.gif);}
+.mceItemRealMedia {background-image:url(../img/realmedia.gif);}
diff --git a/program/js/tiny_mce/plugins/media/css/media.css b/program/js/tiny_mce/plugins/media/css/media.css index 62d666a5f..89c6bd5a0 100644 --- a/program/js/tiny_mce/plugins/media/css/media.css +++ b/program/js/tiny_mce/plugins/media/css/media.css @@ -1,68 +1,68 @@ -#id, #name, #hspace, #vspace, #class_name, #align { - width: 100px; -} - -#hspace, #vspace { - width: 50px; -} - -#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode { - width: 100px; -} - -#flash_base, #flash_flashvars { - width: 240px; -} - -#width, #height { - width: 40px; -} - -#src, #media_type { - width: 250px; -} - -#class { - width: 120px; -} - -#prev { - margin: 0; - border: 1px solid black; - width: 99%; - height: 230px; - overflow: auto; -} - -.panel_wrapper div.current { - height: 390px; - overflow: auto; -} - -#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options { - display: none; -} - -.mceAddSelectValue { - background-color: #DDDDDD; -} - -#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume { - width: 70px; -} - -#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume { - width: 70px; -} - -#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks { - width: 70px; -} - -#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle { - width: 90px; -} - -#qt_qtsrc { - width: 200px; -} +#id, #name, #hspace, #vspace, #class_name, #align {
+ width: 100px;
+}
+
+#hspace, #vspace {
+ width: 50px;
+}
+
+#flash_quality, #flash_align, #flash_scale, #flash_salign, #flash_wmode {
+ width: 100px;
+}
+
+#flash_base, #flash_flashvars {
+ width: 240px;
+}
+
+#width, #height {
+ width: 40px;
+}
+
+#src, #media_type {
+ width: 250px;
+}
+
+#class {
+ width: 120px;
+}
+
+#prev {
+ margin: 0;
+ border: 1px solid black;
+ width: 99%;
+ height: 230px;
+ overflow: auto;
+}
+
+.panel_wrapper div.current {
+ height: 390px;
+ overflow: auto;
+}
+
+#flash_options, #shockwave_options, #qt_options, #wmp_options, #rmp_options {
+ display: none;
+}
+
+.mceAddSelectValue {
+ background-color: #DDDDDD;
+}
+
+#qt_starttime, #qt_endtime, #qt_fov, #qt_href, #qt_moveid, #qt_moviename, #qt_node, #qt_pan, #qt_qtsrc, #qt_qtsrcchokespeed, #qt_target, #qt_tilt, #qt_urlsubstituten, #qt_volume {
+ width: 70px;
+}
+
+#wmp_balance, #wmp_baseurl, #wmp_captioningid, #wmp_currentmarker, #wmp_currentposition, #wmp_defaultframe, #wmp_playcount, #wmp_rate, #wmp_uimode, #wmp_volume {
+ width: 70px;
+}
+
+#rmp_console, #rmp_numloop, #rmp_controls, #rmp_scriptcallbacks {
+ width: 70px;
+}
+
+#shockwave_swvolume, #shockwave_swframe, #shockwave_swurl, #shockwave_swstretchvalign, #shockwave_swstretchhalign, #shockwave_swstretchstyle {
+ width: 90px;
+}
+
+#qt_qtsrc {
+ width: 200px;
+}
diff --git a/program/js/tiny_mce/plugins/media/editor_plugin.js b/program/js/tiny_mce/plugins/media/editor_plugin.js index f0cbaee78..4591be7a4 100644 --- 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(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,'<img class="mceItem$1" title="$2" src="'+img+'" />');content=content.replace(/<object([^>]*)>/gi,'<div class="mceItemObject" $1>');content=content.replace(/<embed([^>]*)>/gi,'<div class="mceItemObjectEmbed" $1>');content=content.replace(/<\/(object|embed)([^>]*)>/gi,'</div>');content=content.replace(/<param([^>]*)>/gi,'<div $1 class="mceItemParam"></div>');content=content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>','gi'),'class="mceItemParam"></div>');break;case"insert_to_editor_dom":d=inst.getDoc();nl=content.getElementsByTagName("img");for(i=0;i<nl.length;i++){if(/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)){nl[i].width=nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g,'$1');nl[i].height=nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g,'$1');}}nl=tinyMCE.selectElements(content,'DIV',function(n){return tinyMCE.hasCSSClass(n,'mceItemObject')});for(i=0;i<nl.length;i++){ci=tinyMCE.getAttrib(nl[i],"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash',d,nl[i]),nl[i]);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave',d,nl[i]),nl[i]);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia',d,nl[i]),nl[i]);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime',d,nl[i]),nl[i]);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia',d,nl[i]),nl[i]);break}}nl=tinyMCE.selectNodes(content,function(n){return n.className=='mceItemObjectEmbed'});for(i=0;i<nl.length;i++){switch(tinyMCE.getAttrib(nl[i],'type')){case'application/x-shockwave-flash':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemFlash');break;case'application/x-director':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemShockWave');break;case'application/x-mplayer2':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemWindowsMedia');break;case'video/quicktime':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemQuickTime');break;case'audio/x-pn-realaudio-plugin':TinyMCE_MediaPlugin._createImgFromEmbed(nl[i],d,'mceItemRealMedia');break}}break;case"get_from_editor":var startPos=-1,endPos,attribs,chunkBefore,chunkAfter,embedHTML,at,pl,cb,mt,ex;while((startPos=content.indexOf('<img',startPos+1))!=-1){endPos=content.indexOf('/>',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}pl.src=tinyMCE.convertURL(pl.src,null,true);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+"'");pl.src=tinyMCE.convertURL(pl.src,null,true);at=at.replace(new RegExp("src:'[^']*'","g"),"src:'"+pl.src+"'");embedHTML='<script type="text/javascript">'+s+'({'+at+'});</script>'}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;i<at.length;i++){if(at[i].specified&&at[i].nodeValue){an=at[i].nodeName.toLowerCase();if(an=='src')continue;if(an=='mce_src')an='src';if(an.indexOf('mce_')==-1&&!new RegExp('^(class|type)$').test(an))ti+=an.toLowerCase()+':\''+at[i].nodeValue+"',"}}ti=ti.length>0?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;i<nl.length;i++){av=tinyMCE.getAttrib(nl[i],'value');av=av.replace(new RegExp('\\\\','g'),'\\\\');av=av.replace(new RegExp('"','g'),'\\"');av=av.replace(new RegExp("'",'g'),"\\'");an=tinyMCE.getAttrib(nl[i],'name');al[an]=av}if(al.movie){al.src=al.movie;al.movie=null}for(an in al){if(al[an]!=null&&typeof(al[an])!="function"&&al[an]!='')ti+=an.toLowerCase()+':\''+al[an]+"',"}ti=ti.length>0?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+='<object classid="clsid:'+cls+'" codebase="'+cb+'"';h+=typeof(p.id)!="undefined"?' id="'+p.id+'"':'';h+=typeof(p.name)!="undefined"?' name="'+p.name+'"':'';h+=typeof(p.width)!="undefined"?' width="'+p.width+'"':'';h+=typeof(p.height)!="undefined"?' height="'+p.height+'"':'';h+=typeof(p.align)!="undefined"?' align="'+p.align+'"':'';h+='>';for(n in p){if(typeof(p[n])!="undefined"&&typeof(p[n])!="function"){h+='<param name="'+n+'" value="'+p[n]+'" />';if(n=='src'&&p[n].indexOf('://')!=-1&&mt=='application/x-mplayer2')h+='<param name="url" value="'+p[n]+'" />'}}h+='<embed type="'+mt+'"';for(n in p){if(typeof(p[n])=="function")continue;if(!(n=='url'&&mt=='application/x-mplayer2'))h+=' '+n+'="'+p[n]+'"'}h+='></embed></object>';return h},_parseAttributes:function(attribute_string){var attributeName="",endChr='"';var attributeValue="";var withInName;var withInValue;var attributes=new Array();var whiteSpaceRegExp=new RegExp('^[ \n\r\t]+','g');if(attribute_string==null||attribute_string.length<2)return null;withInName=withInValue=false;for(var i=0;i<attribute_string.length;i++){var chr=attribute_string.charAt(i);if((chr=='"'||chr=="'")&&!withInValue){withInValue=true;endChr=chr}else if(chr==endChr&&withInValue){withInValue=false;var pos=attributeName.lastIndexOf(' ');if(pos!=-1)attributeName=attributeName.substring(pos+1);attributes[attributeName.toLowerCase()]=attributeValue.substring(1);attributeName="";attributeValue=""}else if(!whiteSpaceRegExp.test(chr)&&!withInName&&!withInValue)withInName=true;if(chr=='='&&withInName)withInName=false;if(withInName)attributeName+=chr;if(withInValue)attributeValue+=chr}return attributes}};tinyMCE.addPlugin("media",TinyMCE_MediaPlugin);
\ No newline at end of file +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.MediaPlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;function isMediaElm(n){return/^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);};ed.addCommand('mceMedia',function(){ed.windowManager.open({file:url+'/media.htm',width:430+parseInt(ed.getLang('media.delta_width',0)),height:470+parseInt(ed.getLang('media.delta_height',0)),inline:1},{plugin_url:url});});ed.addButton('media',{title:'media.desc',cmd:'mceMedia'});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('media',n.nodeName=='IMG'&&isMediaElm(n));});ed.onInit.add(function(){var lo={mceItemFlash:'flash',mceItemShockWave:'shockwave',mceItemWindowsMedia:'windowsmedia',mceItemQuickTime:'quicktime',mceItemRealMedia:'realmedia'};if(ed.settings.content_css!==false)ed.dom.loadCSS(url+"/css/content.css");if(ed.theme.onResolveName){ed.theme.onResolveName.add(function(th,o){if(o.name=='img'){each(lo,function(v,k){if(ed.dom.hasClass(o.node,k)){o.name=v;o.title=ed.dom.getAttrib(o.node,'title');return false;}});}});}if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){if(e.nodeName=='IMG'&&/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)){m.add({title:'media.edit',icon:'media',cmd:'mceMedia'});}});}});ed.onBeforeSetContent.add(function(ed,o){var h=o.content;h=h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi,function(a,b,c){var o=t._parse(c);return'<img class="mceItem'+b+'" title="'+ed.dom.encode(c)+'" src="'+url+'/img/trans.gif" width="'+o.width+'" height="'+o.height+'" />'});h=h.replace(/<object([^>]*)>/gi,'<span class="mceItemObject" $1>');h=h.replace(/<embed([^>]*)>/gi,'<span class="mceItemEmbed" $1>');h=h.replace(/<\/(object|embed)([^>]*)>/gi,'</span>');h=h.replace(/<param([^>]*)>/gi,function(a,b){return'<span '+b.replace(/value=/gi,'_value=')+' class="mceItemParam"></span>'});h=h.replace(/\/ class=\"mceItemParam\"><\/span>/gi,'class="mceItemParam"></span>');o.content=h;});ed.onSetContent.add(function(){t._spansToImgs(ed.getBody());});ed.onPreProcess.add(function(ed,o){var dom=ed.dom;if(o.set){t._spansToImgs(o.node);each(dom.select('IMG',o.node),function(n){var p;if(isMediaElm(n)){p=t._parse(n.title);dom.setAttrib(n,'width',dom.getAttrib(n,'width',p.width||100));dom.setAttrib(n,'height',dom.getAttrib(n,'height',p.height||100));}});}if(o.get){each(dom.select('IMG',o.node),function(n){var ci,cb,mt;if(ed.getParam('media_use_script')){if(isMediaElm(n))n.className=n.className.replace(/mceItem/g,'mceTemp');return;}switch(n.className){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=ed.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(ci){dom.replace(t._buildObj({classid:ci,codebase:cb,type:mt},n),n);}});}});ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/_value=/g,'value=');});if(ed.getParam('media_use_script')){function getAttr(s,n){n=new RegExp(n+'=\"([^\"]+)\"','g').exec(s);return n?ed.dom.decode(n[1]):'';};ed.onPostProcess.add(function(ed,o){o.content=o.content.replace(/<img[^>]+>/g,function(im){var cl=getAttr(im,'class');if(/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)){at=t._parse(getAttr(im,'title'));at.width=getAttr(im,'width');at.height=getAttr(im,'height');im='<script type="text/javascript">write'+cl.substring(7)+'({'+t._serialize(at)+'});</script>';}return im;});});}},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};},_buildObj:function(o,n){var ob,ed=this.editor,dom=ed.dom,p=this._parse(n.title);p.width=o.width=dom.getAttrib(n,'width')||100;p.height=o.height=dom.getAttrib(n,'height')||100;ob=dom.create('span',{mce_name:'object',classid:"clsid:"+o.classid,codebase:o.codebase,width:o.width,height:o.height});if(p.src)p.src=ed.convertURL(p.src,'src',n);each(p,function(v,k){if(!/^(width|height|codebase|classid)$/.test(k)){if(o.type=='application/x-mplayer2'&&k=='src')k='url';dom.add(ob,'span',{mce_name:'param',name:k,'_value':v});}});dom.add(ob,'span',tinymce.extend({mce_name:'embed',type:o.type},p));return ob;},_spansToImgs:function(p){var t=this,dom=t.editor.dom,im,ci;each(dom.select('span',p),function(n){if(dom.getAttrib(n,'class')=='mceItemObject'){ci=dom.getAttrib(n,"classid").toLowerCase().replace(/\s+/g,'');switch(ci){case'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':dom.replace(t._createImg('mceItemFlash',n),n);break;case'clsid:166b1bca-3f9c-11cf-8075-444553540000':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':case'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':case'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}return;}if(dom.getAttrib(n,'class')=='mceItemEmbed'){switch(dom.getAttrib(n,'type')){case'application/x-shockwave-flash':dom.replace(t._createImg('mceItemFlash',n),n);break;case'application/x-director':dom.replace(t._createImg('mceItemShockWave',n),n);break;case'application/x-mplayer2':dom.replace(t._createImg('mceItemWindowsMedia',n),n);break;case'video/quicktime':dom.replace(t._createImg('mceItemQuickTime',n),n);break;case'audio/x-pn-realaudio-plugin':dom.replace(t._createImg('mceItemRealMedia',n),n);break;default:dom.replace(t._createImg('mceItemFlash',n),n);}}});},_createImg:function(cl,n){var im,dom=this.editor.dom,pa={},ti='';im=dom.create('img',{src:this.url+'/img/trans.gif',width:dom.getAttrib(n,'width')||100,height:dom.getAttrib(n,'height')||100,'class':cl});each(['id','name','width','height','bgcolor','align','flashvars','src','wmode'],function(na){var v=dom.getAttrib(n,na);if(v)pa[na]=v;});each(dom.select('span',n),function(n){if(dom.hasClass(n,'mceItemParam'))pa[dom.getAttrib(n,'name')]=dom.getAttrib(n,'_value');});if(pa.movie){pa.src=pa.movie;delete pa.movie;}delete pa.width;delete pa.height;im.title=this._serialize(pa);return im;},_parse:function(s){return tinymce.util.JSON.parse('{'+s+'}');},_serialize:function(o){return tinymce.util.JSON.serialize(o).replace(/[{}]/g,'');}});tinymce.PluginManager.add('media',tinymce.plugins.MediaPlugin);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/media/editor_plugin_src.js b/program/js/tiny_mce/plugins/media/editor_plugin_src.js index ee7e13427..d9df5b534 100644 --- a/program/js/tiny_mce/plugins/media/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/media/editor_plugin_src.js @@ -1,432 +1,359 @@ -/** - * $Id: editor_plugin_src.js 296 2007-08-21 10:36:35Z spocke $ - * - * @author Moxiecode - * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved. - */ - -/* Import plugin specific language pack */ -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) { - // Warn if user has flash plugin and media plugin at the same time - 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) { - // Handle commands - 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; - } - - // Pass to next handler in chain - 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(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, '<img class="mceItem$1" title="$2" src="' + img + '" />'); - content = content.replace(/<object([^>]*)>/gi, '<div class="mceItemObject" $1>'); - content = content.replace(/<embed([^>]*)>/gi, '<div class="mceItemObjectEmbed" $1>'); - content = content.replace(/<\/(object|embed)([^>]*)>/gi, '</div>'); - content = content.replace(/<param([^>]*)>/gi, '<div $1 class="mceItemParam"></div>'); - content = content.replace(new RegExp('\\/ class="mceItemParam"><\\/div>', 'gi'), 'class="mceItemParam"></div>'); - break; - - case "insert_to_editor_dom": - d = inst.getDoc(); - nl = content.getElementsByTagName("img"); - for (i=0; i<nl.length; i++) { - if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(nl[i].className)) { - nl[i].width = nl[i].title.replace(/.*width:[^0-9]?([0-9]+)%?.*/g, '$1'); - nl[i].height = nl[i].title.replace(/.*height:[^0-9]?([0-9]+)%?.*/g, '$1'); - //nl[i].align = nl[i].title.replace(/.*align:([a-z]+).*/gi, '$1'); - } - } - - nl = tinyMCE.selectElements(content, 'DIV', function (n) {return tinyMCE.hasCSSClass(n, 'mceItemObject');}); - for (i=0; i<nl.length; i++) { - ci = tinyMCE.getAttrib(nl[i], "classid").toLowerCase().replace(/\s+/g, ''); - - switch (ci) { - case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000': - nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemFlash', d, nl[i]), nl[i]); - break; - - case 'clsid:166b1bca-3f9c-11cf-8075-444553540000': - nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemShockWave', d, nl[i]), nl[i]); - break; - - case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6': - case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95': - case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a': - nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemWindowsMedia', d, nl[i]), nl[i]); - break; - - case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b': - nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemQuickTime', d, nl[i]), nl[i]); - break; - - case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa': - nl[i].parentNode.replaceChild(TinyMCE_MediaPlugin._createImg('mceItemRealMedia', d, nl[i]), nl[i]); - break; - } - } - - // Handle embed (if any) - nl = tinyMCE.selectNodes(content, function (n) {return n.className == 'mceItemObjectEmbed';}); - for (i=0; i<nl.length; i++) { - switch (tinyMCE.getAttrib(nl[i], 'type')) { - case 'application/x-shockwave-flash': - TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemFlash'); - break; - - case 'application/x-director': - TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemShockWave'); - break; - - case 'application/x-mplayer2': - TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemWindowsMedia'); - break; - - case 'video/quicktime': - TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemQuickTime'); - break; - - case 'audio/x-pn-realaudio-plugin': - TinyMCE_MediaPlugin._createImgFromEmbed(nl[i], d, 'mceItemRealMedia'); - break; - } - } - break; - - case "get_from_editor": - var startPos = -1, endPos, attribs, chunkBefore, chunkAfter, embedHTML, at, pl, cb, mt, ex; - - while ((startPos = content.indexOf('<img', startPos+1)) != -1) { - endPos = content.indexOf('/>', startPos); - attribs = TinyMCE_MediaPlugin._parseAttributes(content.substring(startPos + 4, endPos)); - - // Is not flash, skip it - if (!/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(attribs['class'])) - continue; - - endPos += 2; - - // Parse attributes - at = attribs['title']; - if (at) { - at = at.replace(/&(#39|apos);/g, "'"); - at = at.replace(/&#quot;/g, '"'); - - try { - pl = eval('x={' + at + '};'); - } catch (ex) { - pl = {}; - } - } - - // Use object/embed - 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; - } - - // Convert the URL - pl.src = tinyMCE.convertURL(pl.src, null, true); - - embedHTML = TinyMCE_MediaPlugin._getEmbed(ci, cb, mt, pl, attribs); - } else { - // Use script version - 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 + "'"); - - // Force absolute URL - pl.src = tinyMCE.convertURL(pl.src, null, true); - at = at.replace(new RegExp("src:'[^']*'", "g"), "src:'" + pl.src + "'"); - - embedHTML = '<script type="text/javascript">' + s + '({' + at + '});</script>'; - } - - // Insert embed/object chunk - 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; i<at.length; i++) { - if (at[i].specified && at[i].nodeValue) { - an = at[i].nodeName.toLowerCase(); - - if (an == 'src') - continue; - - if (an == 'mce_src') - an = 'src'; - - if (an.indexOf('mce_') == -1 && !new RegExp('^(class|type)$').test(an)) - ti += an.toLowerCase() + ':\'' + at[i].nodeValue + "',"; - } - } - - ti = ti.length > 0 ? 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; i<nl.length; i++) { - av = tinyMCE.getAttrib(nl[i], 'value'); - av = av.replace(new RegExp('\\\\', 'g'), '\\\\'); - av = av.replace(new RegExp('"', 'g'), '\\"'); - av = av.replace(new RegExp("'", 'g'), "\\'"); - an = tinyMCE.getAttrib(nl[i], 'name'); - al[an] = av; - } - - if (al.movie) { - al.src = al.movie; - al.movie = null; - } - - for (an in al) { - if (al[an] != null && typeof(al[an]) != "function" && al[an] != '') - ti += an.toLowerCase() + ':\'' + al[an] + "',"; - } - - ti = ti.length > 0 ? 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 += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; - h += typeof(p.id) != "undefined" ? ' id="' + p.id + '"' : ''; - h += typeof(p.name) != "undefined" ? ' name="' + p.name + '"' : ''; - h += typeof(p.width) != "undefined" ? ' width="' + p.width + '"' : ''; - h += typeof(p.height) != "undefined" ? ' height="' + p.height + '"' : ''; - h += typeof(p.align) != "undefined" ? ' align="' + p.align + '"' : ''; - h += '>'; - - for (n in p) { - if (typeof(p[n]) != "undefined" && typeof(p[n]) != "function") { - h += '<param name="' + n + '" value="' + p[n] + '" />'; - - // Add extra url parameter if it's an absolute URL on WMP - if (n == 'src' && p[n].indexOf('://') != -1 && mt == 'application/x-mplayer2') - h += '<param name="url" value="' + p[n] + '" />'; - } - } - - h += '<embed type="' + mt + '"'; - - for (n in p) { - if (typeof(p[n]) == "function") - continue; - - // Skip url parameter for embed tag on WMP - if (!(n == 'url' && mt == 'application/x-mplayer2')) - h += ' ' + n + '="' + p[n] + '"'; - } - - h += '></embed></object>'; - - return h; - }, - - _parseAttributes : function(attribute_string) { - var attributeName = "", endChr = '"'; - var attributeValue = ""; - var withInName; - var withInValue; - var attributes = new Array(); - var whiteSpaceRegExp = new RegExp('^[ \n\r\t]+', 'g'); - - if (attribute_string == null || attribute_string.length < 2) - return null; - - withInName = withInValue = false; - - for (var i=0; i<attribute_string.length; i++) { - var chr = attribute_string.charAt(i); - - if ((chr == '"' || chr == "'") && !withInValue) { - withInValue = true; - endChr = chr; - } else if (chr == endChr && withInValue) { - withInValue = false; - - var pos = attributeName.lastIndexOf(' '); - if (pos != -1) - attributeName = attributeName.substring(pos+1); - - attributes[attributeName.toLowerCase()] = attributeValue.substring(1); - - attributeName = ""; - attributeValue = ""; - } else if (!whiteSpaceRegExp.test(chr) && !withInName && !withInValue) - withInName = true; - - if (chr == '=' && withInName) - withInName = false; - - if (withInName) - attributeName += chr; - - if (withInValue) - attributeValue += chr; - } - - return attributes; - } -}; - -tinyMCE.addPlugin("media", TinyMCE_MediaPlugin); +/**
+ * $Id: editor_plugin_src.js 763 2008-04-03 13:25:45Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+ var each = tinymce.each;
+
+ tinymce.create('tinymce.plugins.MediaPlugin', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+ t.url = url;
+
+ function isMediaElm(n) {
+ return /^(mceItemFlash|mceItemShockWave|mceItemWindowsMedia|mceItemQuickTime|mceItemRealMedia)$/.test(n.className);
+ };
+
+ // Register commands
+ ed.addCommand('mceMedia', function() {
+ ed.windowManager.open({
+ file : url + '/media.htm',
+ width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
+ height : 470 + parseInt(ed.getLang('media.delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
+
+ ed.onNodeChange.add(function(ed, cm, n) {
+ cm.setActive('media', n.nodeName == 'IMG' && isMediaElm(n));
+ });
+
+ ed.onInit.add(function() {
+ var lo = {
+ mceItemFlash : 'flash',
+ mceItemShockWave : 'shockwave',
+ mceItemWindowsMedia : 'windowsmedia',
+ mceItemQuickTime : 'quicktime',
+ mceItemRealMedia : 'realmedia'
+ };
+
+ if (ed.settings.content_css !== false)
+ ed.dom.loadCSS(url + "/css/content.css");
+
+ if (ed.theme.onResolveName) {
+ ed.theme.onResolveName.add(function(th, o) {
+ if (o.name == 'img') {
+ each(lo, function(v, k) {
+ if (ed.dom.hasClass(o.node, k)) {
+ o.name = v;
+ o.title = ed.dom.getAttrib(o.node, 'title');
+ return false;
+ }
+ });
+ }
+ });
+ }
+
+ if (ed && ed.plugins.contextmenu) {
+ ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+ if (e.nodeName == 'IMG' && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(e.className)) {
+ m.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
+ }
+ });
+ }
+ });
+
+ ed.onBeforeSetContent.add(function(ed, o) {
+ var h = o.content;
+
+ h = h.replace(/<script[^>]*>\s*write(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)\(\{([^\)]*)\}\);\s*<\/script>/gi, function(a, b, c) {
+ var o = t._parse(c);
+
+ return '<img class="mceItem' + b + '" title="' + ed.dom.encode(c) + '" src="' + url + '/img/trans.gif" width="' + o.width + '" height="' + o.height + '" />'
+ });
+
+ h = h.replace(/<object([^>]*)>/gi, '<span class="mceItemObject" $1>');
+ h = h.replace(/<embed([^>]*)>/gi, '<span class="mceItemEmbed" $1>');
+ h = h.replace(/<\/(object|embed)([^>]*)>/gi, '</span>');
+ h = h.replace(/<param([^>]*)>/gi, function(a, b) {return '<span ' + b.replace(/value=/gi, '_value=') + ' class="mceItemParam"></span>'});
+ h = h.replace(/\/ class=\"mceItemParam\"><\/span>/gi, 'class="mceItemParam"></span>');
+
+ o.content = h;
+ });
+
+ ed.onSetContent.add(function() {
+ t._spansToImgs(ed.getBody());
+ });
+
+ ed.onPreProcess.add(function(ed, o) {
+ var dom = ed.dom;
+
+ if (o.set) {
+ t._spansToImgs(o.node);
+
+ each(dom.select('IMG', o.node), function(n) {
+ var p;
+
+ if (isMediaElm(n)) {
+ p = t._parse(n.title);
+ dom.setAttrib(n, 'width', dom.getAttrib(n, 'width', p.width || 100));
+ dom.setAttrib(n, 'height', dom.getAttrib(n, 'height', p.height || 100));
+ }
+ });
+ }
+
+ if (o.get) {
+ each(dom.select('IMG', o.node), function(n) {
+ var ci, cb, mt;
+
+ if (ed.getParam('media_use_script')) {
+ if (isMediaElm(n))
+ n.className = n.className.replace(/mceItem/g, 'mceTemp');
+
+ return;
+ }
+
+ switch (n.className) {
+ 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 = ed.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 (ci) {
+ dom.replace(t._buildObj({
+ classid : ci,
+ codebase : cb,
+ type : mt
+ }, n), n);
+ }
+ });
+ }
+ });
+
+ ed.onPostProcess.add(function(ed, o) {
+ o.content = o.content.replace(/_value=/g, 'value=');
+ });
+
+ if (ed.getParam('media_use_script')) {
+ function getAttr(s, n) {
+ n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
+
+ return n ? ed.dom.decode(n[1]) : '';
+ };
+
+ ed.onPostProcess.add(function(ed, o) {
+ o.content = o.content.replace(/<img[^>]+>/g, function(im) {
+ var cl = getAttr(im, 'class');
+
+ if (/^(mceTempFlash|mceTempShockWave|mceTempWindowsMedia|mceTempQuickTime|mceTempRealMedia)$/.test(cl)) {
+ at = t._parse(getAttr(im, 'title'));
+ at.width = getAttr(im, 'width');
+ at.height = getAttr(im, 'height');
+ im = '<script type="text/javascript">write' + cl.substring(7) + '({' + t._serialize(at) + '});</script>';
+ }
+
+ return im;
+ });
+ });
+ }
+ },
+
+ 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
+ };
+ },
+
+ // Private methods
+
+ _buildObj : function(o, n) {
+ var ob, ed = this.editor, dom = ed.dom, p = this._parse(n.title);
+
+ p.width = o.width = dom.getAttrib(n, 'width') || 100;
+ p.height = o.height = dom.getAttrib(n, 'height') || 100;
+
+ ob = dom.create('span', {
+ mce_name : 'object',
+ classid : "clsid:" + o.classid,
+ codebase : o.codebase,
+ width : o.width,
+ height : o.height
+ });
+
+ if (p.src)
+ p.src = ed.convertURL(p.src, 'src', n);
+
+ each (p, function(v, k) {
+ if (!/^(width|height|codebase|classid)$/.test(k)) {
+ // Use url instead of src in IE for Windows media
+ if (o.type == 'application/x-mplayer2' && k == 'src')
+ k = 'url';
+
+ dom.add(ob, 'span', {mce_name : 'param', name : k, '_value' : v});
+ }
+ });
+
+ dom.add(ob, 'span', tinymce.extend({mce_name : 'embed', type : o.type}, p));
+
+ return ob;
+ },
+
+ _spansToImgs : function(p) {
+ var t = this, dom = t.editor.dom, im, ci;
+
+ each(dom.select('span', p), function(n) {
+ // Convert object into image
+ if (dom.getAttrib(n, 'class') == 'mceItemObject') {
+ ci = dom.getAttrib(n, "classid").toLowerCase().replace(/\s+/g, '');
+
+ switch (ci) {
+ case 'clsid:d27cdb6e-ae6d-11cf-96b8-444553540000':
+ dom.replace(t._createImg('mceItemFlash', n), n);
+ break;
+
+ case 'clsid:166b1bca-3f9c-11cf-8075-444553540000':
+ dom.replace(t._createImg('mceItemShockWave', n), n);
+ break;
+
+ case 'clsid:6bf52a52-394a-11d3-b153-00c04f79faa6':
+ case 'clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95':
+ case 'clsid:05589fa1-c356-11ce-bf01-00aa0055595a':
+ dom.replace(t._createImg('mceItemWindowsMedia', n), n);
+ break;
+
+ case 'clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b':
+ dom.replace(t._createImg('mceItemQuickTime', n), n);
+ break;
+
+ case 'clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa':
+ dom.replace(t._createImg('mceItemRealMedia', n), n);
+ break;
+
+ default:
+ dom.replace(t._createImg('mceItemFlash', n), n);
+ }
+
+ return;
+ }
+
+ // Convert embed into image
+ if (dom.getAttrib(n, 'class') == 'mceItemEmbed') {
+ switch (dom.getAttrib(n, 'type')) {
+ case 'application/x-shockwave-flash':
+ dom.replace(t._createImg('mceItemFlash', n), n);
+ break;
+
+ case 'application/x-director':
+ dom.replace(t._createImg('mceItemShockWave', n), n);
+ break;
+
+ case 'application/x-mplayer2':
+ dom.replace(t._createImg('mceItemWindowsMedia', n), n);
+ break;
+
+ case 'video/quicktime':
+ dom.replace(t._createImg('mceItemQuickTime', n), n);
+ break;
+
+ case 'audio/x-pn-realaudio-plugin':
+ dom.replace(t._createImg('mceItemRealMedia', n), n);
+ break;
+
+ default:
+ dom.replace(t._createImg('mceItemFlash', n), n);
+ }
+ }
+ });
+ },
+
+ _createImg : function(cl, n) {
+ var im, dom = this.editor.dom, pa = {}, ti = '';
+
+ // Create image
+ im = dom.create('img', {
+ src : this.url + '/img/trans.gif',
+ width : dom.getAttrib(n, 'width') || 100,
+ height : dom.getAttrib(n, 'height') || 100,
+ 'class' : cl
+ });
+
+ // Setup base parameters
+ each(['id', 'name', 'width', 'height', 'bgcolor', 'align', 'flashvars', 'src', 'wmode'], function(na) {
+ var v = dom.getAttrib(n, na);
+
+ if (v)
+ pa[na] = v;
+ });
+
+ // Add optional parameters
+ each(dom.select('span', n), function(n) {
+ if (dom.hasClass(n, 'mceItemParam'))
+ pa[dom.getAttrib(n, 'name')] = dom.getAttrib(n, '_value');
+ });
+
+ // Use src not movie
+ if (pa.movie) {
+ pa.src = pa.movie;
+ delete pa.movie;
+ }
+
+ delete pa.width;
+ delete pa.height;
+
+ im.title = this._serialize(pa);
+
+ return im;
+ },
+
+ _parse : function(s) {
+ return tinymce.util.JSON.parse('{' + s + '}');
+ },
+
+ _serialize : function(o) {
+ return tinymce.util.JSON.serialize(o).replace(/[{}]/g, '');
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/media/images/media.gif b/program/js/tiny_mce/plugins/media/images/media.gif Binary files differdeleted file mode 100644 index 856df5237..000000000 --- a/program/js/tiny_mce/plugins/media/images/media.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/media/images/flash.gif b/program/js/tiny_mce/plugins/media/img/flash.gif Binary files differindex cb192e6ce..cb192e6ce 100644 --- a/program/js/tiny_mce/plugins/media/images/flash.gif +++ b/program/js/tiny_mce/plugins/media/img/flash.gif diff --git a/program/js/tiny_mce/plugins/media/img/flv_player.swf b/program/js/tiny_mce/plugins/media/img/flv_player.swf Binary files differnew file mode 100644 index 000000000..042c2ab96 --- /dev/null +++ b/program/js/tiny_mce/plugins/media/img/flv_player.swf diff --git a/program/js/tiny_mce/plugins/media/images/quicktime.gif b/program/js/tiny_mce/plugins/media/img/quicktime.gif Binary files differindex 3b0499145..3b0499145 100644 --- a/program/js/tiny_mce/plugins/media/images/quicktime.gif +++ b/program/js/tiny_mce/plugins/media/img/quicktime.gif diff --git a/program/js/tiny_mce/plugins/media/images/realmedia.gif b/program/js/tiny_mce/plugins/media/img/realmedia.gif Binary files differindex fdfe0b9ac..fdfe0b9ac 100644 --- a/program/js/tiny_mce/plugins/media/images/realmedia.gif +++ b/program/js/tiny_mce/plugins/media/img/realmedia.gif diff --git a/program/js/tiny_mce/plugins/media/images/shockwave.gif b/program/js/tiny_mce/plugins/media/img/shockwave.gif Binary files differindex 5f235dfc7..5f235dfc7 100644 --- a/program/js/tiny_mce/plugins/media/images/shockwave.gif +++ b/program/js/tiny_mce/plugins/media/img/shockwave.gif diff --git a/program/js/tiny_mce/plugins/media/img/trans.gif b/program/js/tiny_mce/plugins/media/img/trans.gif Binary files differnew file mode 100644 index 000000000..388486517 --- /dev/null +++ b/program/js/tiny_mce/plugins/media/img/trans.gif diff --git a/program/js/tiny_mce/plugins/media/images/windowsmedia.gif b/program/js/tiny_mce/plugins/media/img/windowsmedia.gif Binary files differindex ab50f2d88..ab50f2d88 100644 --- a/program/js/tiny_mce/plugins/media/images/windowsmedia.gif +++ b/program/js/tiny_mce/plugins/media/img/windowsmedia.gif diff --git a/program/js/tiny_mce/plugins/media/jscripts/embed.js b/program/js/tiny_mce/plugins/media/js/embed.js index 6fe25de09..f8dc81052 100644 --- a/program/js/tiny_mce/plugins/media/jscripts/embed.js +++ b/program/js/tiny_mce/plugins/media/js/embed.js @@ -1,73 +1,73 @@ -/** - * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose. - */ - -function writeFlash(p) { - writeEmbed( - 'D27CDB6E-AE6D-11cf-96B8-444553540000', - 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', - 'application/x-shockwave-flash', - p - ); -} - -function writeShockWave(p) { - writeEmbed( - '166B1BCA-3F9C-11CF-8075-444553540000', - 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0', - 'application/x-director', - p - ); -} - -function writeQuickTime(p) { - writeEmbed( - '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B', - 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0', - 'video/quicktime', - p - ); -} - -function writeRealMedia(p) { - writeEmbed( - 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA', - 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0', - 'audio/x-pn-realaudio-plugin', - p - ); -} - -function writeWindowsMedia(p) { - p.url = p.src; - writeEmbed( - '6BF52A52-394A-11D3-B153-00C04F79FAA6', - 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701', - 'application/x-mplayer2', - p - ); -} - -function writeEmbed(cls, cb, mt, p) { - var h = '', n; - - h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"'; - h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : ''; - h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : ''; - h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : ''; - h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : ''; - h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : ''; - h += '>'; - - for (n in p) - h += '<param name="' + n + '" value="' + p[n] + '">'; - - h += '<embed type="' + mt + '"'; - - for (n in p) - h += n + '="' + p[n] + '" '; - - h += '></embed></object>'; - - document.write(h); -} +/**
+ * This script contains embed functions for common plugins. This scripts are complety free to use for any purpose.
+ */
+
+function writeFlash(p) {
+ writeEmbed(
+ 'D27CDB6E-AE6D-11cf-96B8-444553540000',
+ 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+ 'application/x-shockwave-flash',
+ p
+ );
+}
+
+function writeShockWave(p) {
+ writeEmbed(
+ '166B1BCA-3F9C-11CF-8075-444553540000',
+ 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0',
+ 'application/x-director',
+ p
+ );
+}
+
+function writeQuickTime(p) {
+ writeEmbed(
+ '02BF25D5-8C17-4B23-BC80-D3488ABDDC6B',
+ 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0',
+ 'video/quicktime',
+ p
+ );
+}
+
+function writeRealMedia(p) {
+ writeEmbed(
+ 'CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA',
+ 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0',
+ 'audio/x-pn-realaudio-plugin',
+ p
+ );
+}
+
+function writeWindowsMedia(p) {
+ p.url = p.src;
+ writeEmbed(
+ '6BF52A52-394A-11D3-B153-00C04F79FAA6',
+ 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701',
+ 'application/x-mplayer2',
+ p
+ );
+}
+
+function writeEmbed(cls, cb, mt, p) {
+ var h = '', n;
+
+ h += '<object classid="clsid:' + cls + '" codebase="' + cb + '"';
+ h += typeof(p.id) != "undefined" ? 'id="' + p.id + '"' : '';
+ h += typeof(p.name) != "undefined" ? 'name="' + p.name + '"' : '';
+ h += typeof(p.width) != "undefined" ? 'width="' + p.width + '"' : '';
+ h += typeof(p.height) != "undefined" ? 'height="' + p.height + '"' : '';
+ h += typeof(p.align) != "undefined" ? 'align="' + p.align + '"' : '';
+ h += '>';
+
+ for (n in p)
+ h += '<param name="' + n + '" value="' + p[n] + '">';
+
+ h += '<embed type="' + mt + '"';
+
+ for (n in p)
+ h += n + '="' + p[n] + '" ';
+
+ h += '></embed></object>';
+
+ document.write(h);
+}
diff --git a/program/js/tiny_mce/plugins/media/jscripts/media.js b/program/js/tiny_mce/plugins/media/js/media.js index 2b9a4f02c..2877d16b1 100644 --- a/program/js/tiny_mce/plugins/media/jscripts/media.js +++ b/program/js/tiny_mce/plugins/media/js/media.js @@ -1,594 +1,621 @@ -var oldWidth, oldHeight; -var url = tinyMCE.getParam("media_external_list_url"); -if (url != null) { - // Fix relative - if (url.charAt(0) != '/' && url.indexOf('://') == -1) - url = tinyMCE.documentBasePath + "/" + url; - - document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>'); -} - -function init() { - var pl = "", f, val; - var type = "flash", fe, i; - - tinyMCEPopup.resizeToInnerSize(); - f = document.forms[0] - - fe = tinyMCE.selectedInstance.getFocusElement(); - if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) { - pl = "x={" + fe.title + "};"; - - switch (tinyMCE.getAttrib(fe, 'class')) { - case 'mceItemFlash': - type = 'flash'; - break; - - case 'mceItemShockWave': - type = 'shockwave'; - break; - - case 'mceItemWindowsMedia': - type = 'wmp'; - break; - - case 'mceItemQuickTime': - type = 'qt'; - break; - - case 'mceItemRealMedia': - type = 'rmp'; - break; - } - - document.forms[0].insert.value = tinyMCE.getLang('lang_update', 'Insert', true); - } - - document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media'); - document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media'); - document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor'); - - var html = getMediaListHTML('filebrowser','src','media','media'); - if (html == "") - document.getElementById("linklistrow").style.display = 'none'; - else - document.getElementById("linklistcontainer").innerHTML = html; - - // Resize some elements - if (isVisible('filebrowsercontainer')) - document.getElementById('src').style.width = '230px'; - - // Setup form - if (pl != "") { - pl = eval(pl); - - switch (type) { - case "flash": - setBool(pl, 'flash', 'play'); - setBool(pl, 'flash', 'loop'); - setBool(pl, 'flash', 'menu'); - setBool(pl, 'flash', 'swliveconnect'); - setStr(pl, 'flash', 'quality'); - setStr(pl, 'flash', 'scale'); - setStr(pl, 'flash', 'salign'); - setStr(pl, 'flash', 'wmode'); - setStr(pl, 'flash', 'base'); - setStr(pl, 'flash', 'flashvars'); - break; - - case "qt": - setBool(pl, 'qt', 'loop'); - setBool(pl, 'qt', 'autoplay'); - setBool(pl, 'qt', 'cache'); - setBool(pl, 'qt', 'controller'); - setBool(pl, 'qt', 'correction'); - setBool(pl, 'qt', 'enablejavascript'); - setBool(pl, 'qt', 'kioskmode'); - setBool(pl, 'qt', 'autohref'); - setBool(pl, 'qt', 'playeveryframe'); - setBool(pl, 'qt', 'tarsetcache'); - setStr(pl, 'qt', 'scale'); - setStr(pl, 'qt', 'starttime'); - setStr(pl, 'qt', 'endtime'); - setStr(pl, 'qt', 'tarset'); - setStr(pl, 'qt', 'qtsrcchokespeed'); - setStr(pl, 'qt', 'volume'); - setStr(pl, 'qt', 'qtsrc'); - break; - - case "shockwave": - setBool(pl, 'shockwave', 'sound'); - setBool(pl, 'shockwave', 'progress'); - setBool(pl, 'shockwave', 'autostart'); - setBool(pl, 'shockwave', 'swliveconnect'); - setStr(pl, 'shockwave', 'swvolume'); - setStr(pl, 'shockwave', 'swstretchstyle'); - setStr(pl, 'shockwave', 'swstretchhalign'); - setStr(pl, 'shockwave', 'swstretchvalign'); - break; - - case "wmp": - setBool(pl, 'wmp', 'autostart'); - setBool(pl, 'wmp', 'enabled'); - setBool(pl, 'wmp', 'enablecontextmenu'); - setBool(pl, 'wmp', 'fullscreen'); - setBool(pl, 'wmp', 'invokeurls'); - setBool(pl, 'wmp', 'mute'); - setBool(pl, 'wmp', 'stretchtofit'); - setBool(pl, 'wmp', 'windowlessvideo'); - setStr(pl, 'wmp', 'balance'); - setStr(pl, 'wmp', 'baseurl'); - setStr(pl, 'wmp', 'captioningid'); - setStr(pl, 'wmp', 'currentmarker'); - setStr(pl, 'wmp', 'currentposition'); - setStr(pl, 'wmp', 'defaultframe'); - setStr(pl, 'wmp', 'playcount'); - setStr(pl, 'wmp', 'rate'); - setStr(pl, 'wmp', 'uimode'); - setStr(pl, 'wmp', 'volume'); - break; - - case "rmp": - setBool(pl, 'rmp', 'autostart'); - setBool(pl, 'rmp', 'loop'); - setBool(pl, 'rmp', 'autogotourl'); - setBool(pl, 'rmp', 'center'); - setBool(pl, 'rmp', 'imagestatus'); - setBool(pl, 'rmp', 'maintainaspect'); - setBool(pl, 'rmp', 'nojava'); - setBool(pl, 'rmp', 'prefetch'); - setBool(pl, 'rmp', 'shuffle'); - setStr(pl, 'rmp', 'console'); - setStr(pl, 'rmp', 'controls'); - setStr(pl, 'rmp', 'numloop'); - setStr(pl, 'rmp', 'scriptcallbacks'); - break; - } - - setStr(pl, null, 'src'); - setStr(pl, null, 'id'); - setStr(pl, null, 'name'); - setStr(pl, null, 'vspace'); - setStr(pl, null, 'hspace'); - setStr(pl, null, 'bgcolor'); - setStr(pl, null, 'align'); - setStr(pl, null, 'width'); - setStr(pl, null, 'height'); - - if ((val = tinyMCE.getAttrib(fe, "width")) != "") - pl.width = f.width.value = val; - - if ((val = tinyMCE.getAttrib(fe, "height")) != "") - pl.height = f.height.value = val; - - oldWidth = pl.width ? parseInt(pl.width) : 0; - oldHeight = pl.height ? parseInt(pl.height) : 0; - } else - oldWidth = oldHeight = 0; - - selectByValue(f, 'media_type', type); - changedType(type); - updateColor('bgcolor_pick', 'bgcolor'); - - TinyMCE_EditableSelects.init(); - generatePreview(); -} - -function insertMedia() { - var fe, f = document.forms[0], h; - - if (!AutoValidator.validate(f)) { - alert(tinyMCE.getLang('lang_invalid_data')); - return false; - } - - f.width.value = f.width.value == "" ? 100 : f.width.value; - f.height.value = f.height.value == "" ? 100 : f.height.value; - - fe = tinyMCE.selectedInstance.getFocusElement(); - if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(tinyMCE.getAttrib(fe, 'class'))) { - switch (f.media_type.options[f.media_type.selectedIndex].value) { - case "flash": - fe.className = "mceItemFlash"; - break; - - case "shockwave": - fe.className = "mceItemShockWave"; - break; - - case "qt": - fe.className = "mceItemQuickTime"; - break; - - case "wmp": - fe.className = "mceItemWindowsMedia"; - break; - - case "rmp": - fe.className = "mceItemRealMedia"; - break; - } - - if (fe.width != f.width.value || fe.height != f.height.height) - tinyMCE.selectedInstance.repaint(); - - fe.title = serializeParameters(); - fe.width = f.width.value; - fe.height = f.height.value; - fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : ''); - fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : ''); - fe.align = f.align.options[f.align.selectedIndex].value; - } else { - h = '<img src="' + tinyMCE.getParam("theme_href") + '/images/spacer.gif"' ; - - switch (f.media_type.options[f.media_type.selectedIndex].value) { - case "flash": - h += ' class="mceItemFlash"'; - break; - - case "shockwave": - h += ' class="mceItemShockWave"'; - break; - - case "qt": - h += ' class="mceItemQuickTime"'; - break; - - case "wmp": - h += ' class="mceItemWindowsMedia"'; - break; - - case "rmp": - h += ' class="mceItemRealMedia"'; - break; - } - - h += ' title="' + serializeParameters() + '"'; - h += ' width="' + f.width.value + '"'; - h += ' height="' + f.height.value + '"'; - h += ' align="' + f.align.options[f.align.selectedIndex].value + '"'; - - h += ' />'; - - tinyMCE.selectedInstance.execCommand('mceInsertContent', false, h); - } - - tinyMCEPopup.close(); -} - -function getMediaListHTML() { - if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) { - var html = ""; - - html += '<select id="linklist" name="linklist" style="width: 250px" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="this.form.src.value=this.options[this.selectedIndex].value;">'; - html += '<option value="">---</option>'; - - for (var i=0; i<tinyMCEMediaList.length; i++) - html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>'; - - html += '</select>'; - - return html; - } - - return ""; -} - -function getType(v) { - 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 || v.indexOf('http://youtube.com/watch?v=') == 0) { - f.width.value = '425'; - f.height.value = '350'; - - v = v.replace('http://youtube.com/watch?v=', ''); - v = v.replace('http://www.youtube.com/watch?v=', ''); - - f.src.value = 'http://www.youtube.com/v/' + v; - 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<fo.length; i++) { - c = fo[i].split('='); - - el = c[1].split(','); - for (x=0; x<el.length; x++) - if (v.indexOf('.' + el[x]) != -1) - return c[0]; - } - - return null; -} - -function switchType(v) { - var t = getType(v), d = document, f = d.forms[0]; - - if (!t) - return; - - selectByValue(d.forms[0], 'media_type', t); - changedType(t); - - // Update qtsrc also - if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) { - alert(tinyMCE.getLang("lang_media_qt_stream_warn")); - - if (f.qt_qtsrc.value == '') - f.qt_qtsrc.value = f.src.value; - } -} - -function changedType(t) { - var d = document; - - d.getElementById('flash_options').style.display = 'none'; - d.getElementById('qt_options').style.display = 'none'; - d.getElementById('shockwave_options').style.display = 'none'; - d.getElementById('wmp_options').style.display = 'none'; - d.getElementById('rmp_options').style.display = 'none'; - d.getElementById(t + '_options').style.display = 'block'; -} - -function serializeParameters() { - var d = document, f = d.forms[0], s = ''; - - switch (f.media_type.options[f.media_type.selectedIndex].value) { - case "flash": - s += getBool('flash', 'play', true); - s += getBool('flash', 'loop', true); - s += getBool('flash', 'menu', true); - s += getBool('flash', 'swliveconnect', false); - s += getStr('flash', 'quality'); - s += getStr('flash', 'scale'); - s += getStr('flash', 'salign'); - s += getStr('flash', 'wmode'); - s += getStr('flash', 'base'); - s += getStr('flash', 'flashvars'); - break; - - case "qt": - s += getBool('qt', 'loop', false); - s += getBool('qt', 'autoplay', true); - s += getBool('qt', 'cache', false); - s += getBool('qt', 'controller', true); - s += getBool('qt', 'correction', false, 'none', 'full'); - s += getBool('qt', 'enablejavascript', false); - s += getBool('qt', 'kioskmode', false); - s += getBool('qt', 'autohref', false); - s += getBool('qt', 'playeveryframe', false); - s += getBool('qt', 'targetcache', false); - s += getStr('qt', 'scale'); - s += getStr('qt', 'starttime'); - s += getStr('qt', 'endtime'); - s += getStr('qt', 'target'); - s += getStr('qt', 'qtsrcchokespeed'); - s += getStr('qt', 'volume'); - s += getStr('qt', 'qtsrc'); - break; - - case "shockwave": - s += getBool('shockwave', 'sound'); - s += getBool('shockwave', 'progress'); - s += getBool('shockwave', 'autostart'); - s += getBool('shockwave', 'swliveconnect'); - s += getStr('shockwave', 'swvolume'); - s += getStr('shockwave', 'swstretchstyle'); - s += getStr('shockwave', 'swstretchhalign'); - s += getStr('shockwave', 'swstretchvalign'); - break; - - case "wmp": - s += getBool('wmp', 'autostart', true); - s += getBool('wmp', 'enabled', false); - s += getBool('wmp', 'enablecontextmenu', true); - s += getBool('wmp', 'fullscreen', false); - s += getBool('wmp', 'invokeurls', true); - s += getBool('wmp', 'mute', false); - s += getBool('wmp', 'stretchtofit', false); - s += getBool('wmp', 'windowlessvideo', false); - s += getStr('wmp', 'balance'); - s += getStr('wmp', 'baseurl'); - s += getStr('wmp', 'captioningid'); - s += getStr('wmp', 'currentmarker'); - s += getStr('wmp', 'currentposition'); - s += getStr('wmp', 'defaultframe'); - s += getStr('wmp', 'playcount'); - s += getStr('wmp', 'rate'); - s += getStr('wmp', 'uimode'); - s += getStr('wmp', 'volume'); - break; - - case "rmp": - s += getBool('rmp', 'autostart', false); - s += getBool('rmp', 'loop', false); - s += getBool('rmp', 'autogotourl', true); - s += getBool('rmp', 'center', false); - s += getBool('rmp', 'imagestatus', true); - s += getBool('rmp', 'maintainaspect', false); - s += getBool('rmp', 'nojava', false); - s += getBool('rmp', 'prefetch', false); - s += getBool('rmp', 'shuffle', false); - s += getStr('rmp', 'console'); - s += getStr('rmp', 'controls'); - s += getStr('rmp', 'numloop'); - s += getStr('rmp', 'scriptcallbacks'); - break; - } - - s += getStr(null, 'id'); - s += getStr(null, 'name'); - s += getStr(null, 'src'); - s += getStr(null, 'align'); - s += getStr(null, 'bgcolor'); - s += getInt(null, 'vspace'); - s += getInt(null, 'hspace'); - s += getStr(null, 'width'); - s += getStr(null, 'height'); - - s = s.length > 0 ? s.substring(0, s.length - 1) : s; - - return s; -} - -function setBool(pl, p, n) { - if (typeof(pl[n]) == "undefined") - return; - - document.forms[0].elements[p + "_" + n].checked = pl[n]; -} - -function setStr(pl, p, n) { - var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n]; - - if (typeof(pl[n]) == "undefined") - return; - - if (e.type == "text") - e.value = pl[n]; - else - selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]); -} - -function getBool(p, n, d, tv, fv) { - var v = document.forms[0].elements[p + "_" + n].checked; - - tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'"; - fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'"; - - return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ','); -} - -function getStr(p, n, d) { - var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; - var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; - - return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',"); -} - -function getInt(p, n, d) { - var e = document.forms[0].elements[(p != null ? p + "_" : "") + n]; - var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value; - - return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ","); -} - -function jsEncode(s) { - s = s.replace(new RegExp('\\\\', 'g'), '\\\\'); - s = s.replace(new RegExp('"', 'g'), '\\"'); - s = s.replace(new RegExp("'", 'g'), "\\'"); - - return s; -} - -function generatePreview(c) { - var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh; - - p.innerHTML = '<!-- x --->'; - - nw = parseInt(f.width.value); - nh = parseInt(f.height.value); - - if (f.width.value != "" && f.height.value != "") { - if (f.constrain.checked) { - if (c == 'width' && oldWidth != 0) { - wp = nw / oldWidth; - nh = Math.round(wp * nh); - f.height.value = nh; - } else if (c == 'height' && oldHeight != 0) { - hp = nh / oldHeight; - nw = Math.round(hp * nw); - f.width.value = nw; - } - } - } - - if (f.width.value != "") - oldWidth = nw; - - if (f.height.value != "") - oldHeight = nh; - - // After constrain - pl = serializeParameters(); - - switch (f.media_type.options[f.media_type.selectedIndex].value) { - case "flash": - cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000'; - codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0'; - type = 'application/x-shockwave-flash'; - break; - - case "shockwave": - cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000'; - codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0'; - type = 'application/x-director'; - break; - - case "qt": - cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B'; - codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0'; - type = 'video/quicktime'; - break; - - case "wmp": - cls = tinyMCE.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6'; - codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; - type = 'application/x-mplayer2'; - break; - - case "rmp": - cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA'; - codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701'; - type = 'audio/x-pn-realaudio-plugin'; - break; - } - - if (pl == '') { - p.innerHTML = ''; - return; - } - - pl = eval('x={' + pl + '};'); - - if (!pl.src) { - p.innerHTML = ''; - return; - } - - pl.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], pl.src); - pl.width = !pl.width ? 100 : pl.width; - pl.height = !pl.height ? 100 : pl.height; - pl.id = !pl.id ? 'obj' : pl.id; - pl.name = !pl.name ? 'eobj' : pl.name; - pl.align = !pl.align ? '' : pl.align; - - h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">'; - - for (n in pl) { - h += '<param name="' + n + '" value="' + pl[n] + '">'; - - // Add extra url parameter if it's an absolute URL - if (n == 'src' && pl[n].indexOf('://') != -1) - h += '<param name="url" value="' + pl[n] + '" />'; - } - - h += '<embed type="' + type + '" '; - - for (n in pl) - h += n + '="' + pl[n] + '" '; - - h += '></embed></object>'; - - p.innerHTML = "<!-- x --->" + h; -} +tinyMCEPopup.requireLangPack();
+
+var oldWidth, oldHeight, ed, url;
+
+if (url = tinyMCEPopup.getParam("media_external_list_url"))
+ document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+
+function init() {
+ var pl = "", f, val;
+ var type = "flash", fe, i;
+
+ ed = tinyMCEPopup.editor;
+
+ tinyMCEPopup.resizeToInnerSize();
+ f = document.forms[0]
+
+ fe = ed.selection.getNode();
+ if (/mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
+ pl = fe.title;
+
+ switch (ed.dom.getAttrib(fe, 'class')) {
+ case 'mceItemFlash':
+ type = 'flash';
+ break;
+
+ case 'mceItemFlashVideo':
+ type = 'flv';
+ break;
+
+ case 'mceItemShockWave':
+ type = 'shockwave';
+ break;
+
+ case 'mceItemWindowsMedia':
+ type = 'wmp';
+ break;
+
+ case 'mceItemQuickTime':
+ type = 'qt';
+ break;
+
+ case 'mceItemRealMedia':
+ type = 'rmp';
+ break;
+ }
+
+ document.forms[0].insert.value = ed.getLang('update', 'Insert', true);
+ }
+
+ document.getElementById('filebrowsercontainer').innerHTML = getBrowserHTML('filebrowser','src','media','media');
+ document.getElementById('qtsrcfilebrowsercontainer').innerHTML = getBrowserHTML('qtsrcfilebrowser','qt_qtsrc','media','media');
+ document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
+
+ var html = getMediaListHTML('medialist','src','media','media');
+ if (html == "")
+ document.getElementById("linklistrow").style.display = 'none';
+ else
+ document.getElementById("linklistcontainer").innerHTML = html;
+
+ // Resize some elements
+ if (isVisible('filebrowser'))
+ document.getElementById('src').style.width = '230px';
+
+ // Setup form
+ if (pl != "") {
+ pl = tinyMCEPopup.editor.plugins.media._parse(pl);
+
+ switch (type) {
+ case "flash":
+ setBool(pl, 'flash', 'play');
+ setBool(pl, 'flash', 'loop');
+ setBool(pl, 'flash', 'menu');
+ setBool(pl, 'flash', 'swliveconnect');
+ setStr(pl, 'flash', 'quality');
+ setStr(pl, 'flash', 'scale');
+ setStr(pl, 'flash', 'salign');
+ setStr(pl, 'flash', 'wmode');
+ setStr(pl, 'flash', 'base');
+ setStr(pl, 'flash', 'flashvars');
+ break;
+
+ case "qt":
+ setBool(pl, 'qt', 'loop');
+ setBool(pl, 'qt', 'autoplay');
+ setBool(pl, 'qt', 'cache');
+ setBool(pl, 'qt', 'controller');
+ setBool(pl, 'qt', 'correction');
+ setBool(pl, 'qt', 'enablejavascript');
+ setBool(pl, 'qt', 'kioskmode');
+ setBool(pl, 'qt', 'autohref');
+ setBool(pl, 'qt', 'playeveryframe');
+ setBool(pl, 'qt', 'tarsetcache');
+ setStr(pl, 'qt', 'scale');
+ setStr(pl, 'qt', 'starttime');
+ setStr(pl, 'qt', 'endtime');
+ setStr(pl, 'qt', 'tarset');
+ setStr(pl, 'qt', 'qtsrcchokespeed');
+ setStr(pl, 'qt', 'volume');
+ setStr(pl, 'qt', 'qtsrc');
+ break;
+
+ case "shockwave":
+ setBool(pl, 'shockwave', 'sound');
+ setBool(pl, 'shockwave', 'progress');
+ setBool(pl, 'shockwave', 'autostart');
+ setBool(pl, 'shockwave', 'swliveconnect');
+ setStr(pl, 'shockwave', 'swvolume');
+ setStr(pl, 'shockwave', 'swstretchstyle');
+ setStr(pl, 'shockwave', 'swstretchhalign');
+ setStr(pl, 'shockwave', 'swstretchvalign');
+ break;
+
+ case "wmp":
+ setBool(pl, 'wmp', 'autostart');
+ setBool(pl, 'wmp', 'enabled');
+ setBool(pl, 'wmp', 'enablecontextmenu');
+ setBool(pl, 'wmp', 'fullscreen');
+ setBool(pl, 'wmp', 'invokeurls');
+ setBool(pl, 'wmp', 'mute');
+ setBool(pl, 'wmp', 'stretchtofit');
+ setBool(pl, 'wmp', 'windowlessvideo');
+ setStr(pl, 'wmp', 'balance');
+ setStr(pl, 'wmp', 'baseurl');
+ setStr(pl, 'wmp', 'captioningid');
+ setStr(pl, 'wmp', 'currentmarker');
+ setStr(pl, 'wmp', 'currentposition');
+ setStr(pl, 'wmp', 'defaultframe');
+ setStr(pl, 'wmp', 'playcount');
+ setStr(pl, 'wmp', 'rate');
+ setStr(pl, 'wmp', 'uimode');
+ setStr(pl, 'wmp', 'volume');
+ break;
+
+ case "rmp":
+ setBool(pl, 'rmp', 'autostart');
+ setBool(pl, 'rmp', 'loop');
+ setBool(pl, 'rmp', 'autogotourl');
+ setBool(pl, 'rmp', 'center');
+ setBool(pl, 'rmp', 'imagestatus');
+ setBool(pl, 'rmp', 'maintainaspect');
+ setBool(pl, 'rmp', 'nojava');
+ setBool(pl, 'rmp', 'prefetch');
+ setBool(pl, 'rmp', 'shuffle');
+ setStr(pl, 'rmp', 'console');
+ setStr(pl, 'rmp', 'controls');
+ setStr(pl, 'rmp', 'numloop');
+ setStr(pl, 'rmp', 'scriptcallbacks');
+ break;
+ }
+
+ setStr(pl, null, 'src');
+ setStr(pl, null, 'id');
+ setStr(pl, null, 'name');
+ setStr(pl, null, 'vspace');
+ setStr(pl, null, 'hspace');
+ setStr(pl, null, 'bgcolor');
+ setStr(pl, null, 'align');
+ setStr(pl, null, 'width');
+ setStr(pl, null, 'height');
+
+ if ((val = ed.dom.getAttrib(fe, "width")) != "")
+ pl.width = f.width.value = val;
+
+ if ((val = ed.dom.getAttrib(fe, "height")) != "")
+ pl.height = f.height.value = val;
+
+ oldWidth = pl.width ? parseInt(pl.width) : 0;
+ oldHeight = pl.height ? parseInt(pl.height) : 0;
+ } else
+ oldWidth = oldHeight = 0;
+
+ selectByValue(f, 'media_type', type);
+ changedType(type);
+ updateColor('bgcolor_pick', 'bgcolor');
+
+ TinyMCE_EditableSelects.init();
+ generatePreview();
+}
+
+function insertMedia() {
+ var fe, f = document.forms[0], h;
+
+ tinyMCEPopup.restoreSelection();
+
+ if (!AutoValidator.validate(f)) {
+ alert(ed.getLang('invalid_data'));
+ return false;
+ }
+
+ f.width.value = f.width.value == "" ? 100 : f.width.value;
+ f.height.value = f.height.value == "" ? 100 : f.height.value;
+
+ fe = ed.selection.getNode();
+ if (fe != null && /mceItem(Flash|ShockWave|WindowsMedia|QuickTime|RealMedia)/.test(ed.dom.getAttrib(fe, 'class'))) {
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ fe.className = "mceItemFlash";
+ break;
+
+ case "flv":
+ fe.className = "mceItemFlashVideo";
+ break;
+
+ case "shockwave":
+ fe.className = "mceItemShockWave";
+ break;
+
+ case "qt":
+ fe.className = "mceItemQuickTime";
+ break;
+
+ case "wmp":
+ fe.className = "mceItemWindowsMedia";
+ break;
+
+ case "rmp":
+ fe.className = "mceItemRealMedia";
+ break;
+ }
+
+ if (fe.width != f.width.value || fe.height != f.height.height)
+ ed.execCommand('mceRepaint');
+
+ fe.title = serializeParameters();
+ fe.width = f.width.value;
+ fe.height = f.height.value;
+ fe.style.width = f.width.value + (f.width.value.indexOf('%') == -1 ? 'px' : '');
+ fe.style.height = f.height.value + (f.height.value.indexOf('%') == -1 ? 'px' : '');
+ fe.align = f.align.options[f.align.selectedIndex].value;
+ } else {
+ h = '<img src="' + tinyMCEPopup.getWindowArg("plugin_url") + '/img/trans.gif"' ;
+
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ h += ' class="mceItemFlash"';
+ break;
+
+ case "flv":
+ h += ' class="mceItemFlashVideo"';
+ break;
+
+ case "shockwave":
+ h += ' class="mceItemShockWave"';
+ break;
+
+ case "qt":
+ h += ' class="mceItemQuickTime"';
+ break;
+
+ case "wmp":
+ h += ' class="mceItemWindowsMedia"';
+ break;
+
+ case "rmp":
+ h += ' class="mceItemRealMedia"';
+ break;
+ }
+
+ h += ' title="' + serializeParameters() + '"';
+ h += ' width="' + f.width.value + '"';
+ h += ' height="' + f.height.value + '"';
+ h += ' align="' + f.align.options[f.align.selectedIndex].value + '"';
+
+ h += ' />';
+
+ ed.execCommand('mceInsertContent', false, h);
+ }
+
+ tinyMCEPopup.close();
+}
+
+function updatePreview() {
+ var f = document.forms[0], type;
+
+ f.width.value = f.width.value || '320';
+ f.height.value = f.height.value || '240';
+
+ type = getType(f.src.value);
+ selectByValue(f, 'media_type', type);
+ changedType(type);
+ generatePreview();
+}
+
+function getMediaListHTML() {
+ if (typeof(tinyMCEMediaList) != "undefined" && tinyMCEMediaList.length > 0) {
+ var html = "";
+
+ html += '<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;updatePreview();">';
+ html += '<option value="">---</option>';
+
+ for (var i=0; i<tinyMCEMediaList.length; i++)
+ html += '<option value="' + tinyMCEMediaList[i][1] + '">' + tinyMCEMediaList[i][0] + '</option>';
+
+ html += '</select>';
+
+ return html;
+ }
+
+ return "";
+}
+
+function getType(v) {
+ var fo, i, c, el, x, f = document.forms[0];
+
+ fo = ed.getParam("media_types", "flash=swf;flv=flv;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.match(/watch\?v=(.+)(.*)/)) {
+ f.width.value = '425';
+ f.height.value = '350';
+ f.src.value = 'http://www.youtube.com/v/' + v.match(/v=(.*)(.*)/)[0].split('=')[1];
+ 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<fo.length; i++) {
+ c = fo[i].split('=');
+
+ el = c[1].split(',');
+ for (x=0; x<el.length; x++)
+ if (v.indexOf('.' + el[x]) != -1)
+ return c[0];
+ }
+
+ return null;
+}
+
+function switchType(v) {
+ var t = getType(v), d = document, f = d.forms[0];
+
+ if (!t)
+ return;
+
+ selectByValue(d.forms[0], 'media_type', t);
+ changedType(t);
+
+ // Update qtsrc also
+ if (t == 'qt' && f.src.value.toLowerCase().indexOf('rtsp://') != -1) {
+ alert(ed.getLang("media_qt_stream_warn"));
+
+ if (f.qt_qtsrc.value == '')
+ f.qt_qtsrc.value = f.src.value;
+ }
+}
+
+function changedType(t) {
+ var d = document;
+
+ d.getElementById('flash_options').style.display = 'none';
+ d.getElementById('flv_options').style.display = 'none';
+ d.getElementById('qt_options').style.display = 'none';
+ d.getElementById('shockwave_options').style.display = 'none';
+ d.getElementById('wmp_options').style.display = 'none';
+ d.getElementById('rmp_options').style.display = 'none';
+ d.getElementById(t + '_options').style.display = 'block';
+}
+
+function serializeParameters() {
+ var d = document, f = d.forms[0], s = '';
+
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ s += getBool('flash', 'play', true);
+ s += getBool('flash', 'loop', true);
+ s += getBool('flash', 'menu', true);
+ s += getBool('flash', 'swliveconnect', false);
+ s += getStr('flash', 'quality');
+ s += getStr('flash', 'scale');
+ s += getStr('flash', 'salign');
+ s += getStr('flash', 'wmode');
+ s += getStr('flash', 'base');
+ s += getStr('flash', 'flashvars');
+ break;
+
+ case "qt":
+ s += getBool('qt', 'loop', false);
+ s += getBool('qt', 'autoplay', true);
+ s += getBool('qt', 'cache', false);
+ s += getBool('qt', 'controller', true);
+ s += getBool('qt', 'correction', false, 'none', 'full');
+ s += getBool('qt', 'enablejavascript', false);
+ s += getBool('qt', 'kioskmode', false);
+ s += getBool('qt', 'autohref', false);
+ s += getBool('qt', 'playeveryframe', false);
+ s += getBool('qt', 'targetcache', false);
+ s += getStr('qt', 'scale');
+ s += getStr('qt', 'starttime');
+ s += getStr('qt', 'endtime');
+ s += getStr('qt', 'target');
+ s += getStr('qt', 'qtsrcchokespeed');
+ s += getStr('qt', 'volume');
+ s += getStr('qt', 'qtsrc');
+ break;
+
+ case "shockwave":
+ s += getBool('shockwave', 'sound');
+ s += getBool('shockwave', 'progress');
+ s += getBool('shockwave', 'autostart');
+ s += getBool('shockwave', 'swliveconnect');
+ s += getStr('shockwave', 'swvolume');
+ s += getStr('shockwave', 'swstretchstyle');
+ s += getStr('shockwave', 'swstretchhalign');
+ s += getStr('shockwave', 'swstretchvalign');
+ break;
+
+ case "wmp":
+ s += getBool('wmp', 'autostart', true);
+ s += getBool('wmp', 'enabled', false);
+ s += getBool('wmp', 'enablecontextmenu', true);
+ s += getBool('wmp', 'fullscreen', false);
+ s += getBool('wmp', 'invokeurls', true);
+ s += getBool('wmp', 'mute', false);
+ s += getBool('wmp', 'stretchtofit', false);
+ s += getBool('wmp', 'windowlessvideo', false);
+ s += getStr('wmp', 'balance');
+ s += getStr('wmp', 'baseurl');
+ s += getStr('wmp', 'captioningid');
+ s += getStr('wmp', 'currentmarker');
+ s += getStr('wmp', 'currentposition');
+ s += getStr('wmp', 'defaultframe');
+ s += getStr('wmp', 'playcount');
+ s += getStr('wmp', 'rate');
+ s += getStr('wmp', 'uimode');
+ s += getStr('wmp', 'volume');
+ break;
+
+ case "rmp":
+ s += getBool('rmp', 'autostart', false);
+ s += getBool('rmp', 'loop', false);
+ s += getBool('rmp', 'autogotourl', true);
+ s += getBool('rmp', 'center', false);
+ s += getBool('rmp', 'imagestatus', true);
+ s += getBool('rmp', 'maintainaspect', false);
+ s += getBool('rmp', 'nojava', false);
+ s += getBool('rmp', 'prefetch', false);
+ s += getBool('rmp', 'shuffle', false);
+ s += getStr('rmp', 'console');
+ s += getStr('rmp', 'controls');
+ s += getStr('rmp', 'numloop');
+ s += getStr('rmp', 'scriptcallbacks');
+ break;
+ }
+
+ s += getStr(null, 'id');
+ s += getStr(null, 'name');
+ s += getStr(null, 'src');
+ s += getStr(null, 'align');
+ s += getStr(null, 'bgcolor');
+ s += getInt(null, 'vspace');
+ s += getInt(null, 'hspace');
+ s += getStr(null, 'width');
+ s += getStr(null, 'height');
+
+ s = s.length > 0 ? s.substring(0, s.length - 1) : s;
+
+ return s;
+}
+
+function setBool(pl, p, n) {
+ if (typeof(pl[n]) == "undefined")
+ return;
+
+ document.forms[0].elements[p + "_" + n].checked = pl[n];
+}
+
+function setStr(pl, p, n) {
+ var f = document.forms[0], e = f.elements[(p != null ? p + "_" : '') + n];
+
+ if (typeof(pl[n]) == "undefined")
+ return;
+
+ if (e.type == "text")
+ e.value = pl[n];
+ else
+ selectByValue(f, (p != null ? p + "_" : '') + n, pl[n]);
+}
+
+function getBool(p, n, d, tv, fv) {
+ var v = document.forms[0].elements[p + "_" + n].checked;
+
+ tv = typeof(tv) == 'undefined' ? 'true' : "'" + jsEncode(tv) + "'";
+ fv = typeof(fv) == 'undefined' ? 'false' : "'" + jsEncode(fv) + "'";
+
+ return (v == d) ? '' : n + (v ? ':' + tv + ',' : ':' + fv + ',');
+}
+
+function getStr(p, n, d) {
+ var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+ var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+ if (n == 'src')
+ v = tinyMCEPopup.editor.convertURL(v, 'src', null);
+
+ return ((n == d || v == '') ? '' : n + ":'" + jsEncode(v) + "',");
+}
+
+function getInt(p, n, d) {
+ var e = document.forms[0].elements[(p != null ? p + "_" : "") + n];
+ var v = e.type == "text" ? e.value : e.options[e.selectedIndex].value;
+
+ return ((n == d || v == '') ? '' : n + ":" + v.replace(/[^0-9]+/g, '') + ",");
+}
+
+function jsEncode(s) {
+ s = s.replace(new RegExp('\\\\', 'g'), '\\\\');
+ s = s.replace(new RegExp('"', 'g'), '\\"');
+ s = s.replace(new RegExp("'", 'g'), "\\'");
+
+ return s;
+}
+
+function generatePreview(c) {
+ var f = document.forms[0], p = document.getElementById('prev'), h = '', cls, pl, n, type, codebase, wp, hp, nw, nh;
+
+ p.innerHTML = '<!-- x --->';
+
+ nw = parseInt(f.width.value);
+ nh = parseInt(f.height.value);
+
+ if (f.width.value != "" && f.height.value != "") {
+ if (f.constrain.checked) {
+ if (c == 'width' && oldWidth != 0) {
+ wp = nw / oldWidth;
+ nh = Math.round(wp * nh);
+ f.height.value = nh;
+ } else if (c == 'height' && oldHeight != 0) {
+ hp = nh / oldHeight;
+ nw = Math.round(hp * nw);
+ f.width.value = nw;
+ }
+ }
+ }
+
+ if (f.width.value != "")
+ oldWidth = nw;
+
+ if (f.height.value != "")
+ oldHeight = nh;
+
+ // After constrain
+ pl = serializeParameters();
+
+ switch (f.media_type.options[f.media_type.selectedIndex].value) {
+ case "flash":
+ cls = 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000';
+ codebase = 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0';
+ type = 'application/x-shockwave-flash';
+ break;
+
+ case "shockwave":
+ cls = 'clsid:166B1BCA-3F9C-11CF-8075-444553540000';
+ codebase = 'http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0';
+ type = 'application/x-director';
+ break;
+
+ case "qt":
+ cls = 'clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B';
+ codebase = 'http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0';
+ type = 'video/quicktime';
+ break;
+
+ case "wmp":
+ cls = ed.getParam('media_wmp6_compatible') ? 'clsid:05589FA1-C356-11CE-BF01-00AA0055595A' : 'clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6';
+ codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+ type = 'application/x-mplayer2';
+ break;
+
+ case "rmp":
+ cls = 'clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA';
+ codebase = 'http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701';
+ type = 'audio/x-pn-realaudio-plugin';
+ break;
+ }
+
+ if (pl == '') {
+ p.innerHTML = '';
+ return;
+ }
+
+ pl = tinyMCEPopup.editor.plugins.media._parse(pl);
+
+ if (!pl.src) {
+ p.innerHTML = '';
+ return;
+ }
+
+ pl.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(pl.src);
+ pl.width = !pl.width ? 100 : pl.width;
+ pl.height = !pl.height ? 100 : pl.height;
+ pl.id = !pl.id ? 'obj' : pl.id;
+ pl.name = !pl.name ? 'eobj' : pl.name;
+ pl.align = !pl.align ? '' : pl.align;
+
+ h += '<object classid="clsid:' + cls + '" codebase="' + codebase + '" width="' + pl.width + '" height="' + pl.height + '" id="' + pl.id + '" name="' + pl.name + '" align="' + pl.align + '">';
+
+ for (n in pl) {
+ h += '<param name="' + n + '" value="' + pl[n] + '">';
+
+ // Add extra url parameter if it's an absolute URL
+ if (n == 'src' && pl[n].indexOf('://') != -1)
+ h += '<param name="url" value="' + pl[n] + '" />';
+ }
+
+ h += '<embed type="' + type + '" ';
+
+ for (n in pl)
+ h += n + '="' + pl[n] + '" ';
+
+ h += '></embed></object>';
+
+ p.innerHTML = "<!-- x --->" + h;
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/media/langs/en.js b/program/js/tiny_mce/plugins/media/langs/en.js deleted file mode 100644 index 177438d7c..000000000 --- a/program/js/tiny_mce/plugins/media/langs/en.js +++ /dev/null @@ -1,94 +0,0 @@ -// UK lang variables - -tinyMCE.addToLang('media',{ -title : 'Insert / edit embedded media', -desc : 'Insert / edit embedded media', -general : 'General', -advanced : 'Advanced', -file : 'File/URL', -list : 'List', -size : 'Dimensions', -preview : 'Preview', -constrain_proportions : 'Constrain proportions', -type : 'Type', -id : 'Id', -name : 'Name', -class_name : 'Class', -vspace : 'V-Space', -hspace : 'H-Space', -play : 'Auto play', -loop : 'Loop', -menu : 'Show menu', -quality : 'Quality', -scale : 'Scale', -align : 'Align', -salign : 'SAlign', -wmode : 'WMode', -bgcolor : 'Background', -base : 'Base', -flashvars : 'Flashvars', -liveconnect : 'SWLiveConnect', -autohref : 'AutoHREF', -cache : 'Cache', -hidden : 'Hidden', -controller : 'Controller', -kioskmode : 'Kiosk mode', -playeveryframe : 'Play every frame', -targetcache : 'Target cache', -correction : 'No correction', -enablejavascript : 'Enable JavaScript', -starttime : 'Start time', -endtime : 'End time', -href : 'Href', -qtsrcchokespeed : 'Choke speed', -target : 'Target', -volume : 'Volume', -autostart : 'Auto start', -enabled : 'Enabled', -fullscreen : 'Fullscreen', -invokeurls : 'Invoke URLs', -mute : 'Mute', -stretchtofit : 'Stretch to fit', -windowlessvideo : 'Windowless video', -balance : 'Balance', -baseurl : 'Base URL', -captioningid : 'Captioning id', -currentmarker : 'Current marker', -currentposition : 'Current position', -defaultframe : 'Default frame', -playcount : 'Play count', -rate : 'Rate', -uimode : 'UI Mode', -flash_options : 'Flash options', -qt_options : 'Quicktime options', -wmp_options : 'Windows media player options', -rmp_options : 'Real media player options', -shockwave_options : 'Shockwave options', -autogotourl : 'Auto goto URL', -center : 'Center', -imagestatus : 'Image status', -maintainaspect : 'Maintain aspect', -nojava : 'No java', -prefetch : 'Prefetch', -shuffle : 'Shuffle', -console : 'Console', -numloop : 'Num loops', -controls : 'Controls', -scriptcallbacks : 'Script callbacks', -swstretchstyle : 'Stretch style', -swstretchhalign : 'Stretch H-Align', -swstretchvalign : 'Stretch V-Align', -sound : 'Sound', -progress : 'Progress', -qtsrc : 'QT Src', -qt_stream_warn : 'Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..', -align_top : 'Top', -align_right : 'Right', -align_bottom : 'Bottom', -align_left : 'Left', -align_center : 'Center', -align_top_left : 'Top left', -align_top_right : 'Top right', -align_bottom_left : 'Bottom left', -align_bottom_right : 'Bottom right' -});
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/media/langs/en_dlg.js b/program/js/tiny_mce/plugins/media/langs/en_dlg.js new file mode 100644 index 000000000..6d0a996f7 --- /dev/null +++ b/program/js/tiny_mce/plugins/media/langs/en_dlg.js @@ -0,0 +1,103 @@ +tinyMCE.addI18n('en.media_dlg',{
+title:"Insert / edit embedded media",
+general:"General",
+advanced:"Advanced",
+file:"File/URL",
+list:"List",
+size:"Dimensions",
+preview:"Preview",
+constrain_proportions:"Constrain proportions",
+type:"Type",
+id:"Id",
+name:"Name",
+class_name:"Class",
+vspace:"V-Space",
+hspace:"H-Space",
+play:"Auto play",
+loop:"Loop",
+menu:"Show menu",
+quality:"Quality",
+scale:"Scale",
+align:"Align",
+salign:"SAlign",
+wmode:"WMode",
+bgcolor:"Background",
+base:"Base",
+flashvars:"Flashvars",
+liveconnect:"SWLiveConnect",
+autohref:"AutoHREF",
+cache:"Cache",
+hidden:"Hidden",
+controller:"Controller",
+kioskmode:"Kiosk mode",
+playeveryframe:"Play every frame",
+targetcache:"Target cache",
+correction:"No correction",
+enablejavascript:"Enable JavaScript",
+starttime:"Start time",
+endtime:"End time",
+href:"Href",
+qtsrcchokespeed:"Choke speed",
+target:"Target",
+volume:"Volume",
+autostart:"Auto start",
+enabled:"Enabled",
+fullscreen:"Fullscreen",
+invokeurls:"Invoke URLs",
+mute:"Mute",
+stretchtofit:"Stretch to fit",
+windowlessvideo:"Windowless video",
+balance:"Balance",
+baseurl:"Base URL",
+captioningid:"Captioning id",
+currentmarker:"Current marker",
+currentposition:"Current position",
+defaultframe:"Default frame",
+playcount:"Play count",
+rate:"Rate",
+uimode:"UI Mode",
+flash_options:"Flash options",
+qt_options:"Quicktime options",
+wmp_options:"Windows media player options",
+rmp_options:"Real media player options",
+shockwave_options:"Shockwave options",
+autogotourl:"Auto goto URL",
+center:"Center",
+imagestatus:"Image status",
+maintainaspect:"Maintain aspect",
+nojava:"No java",
+prefetch:"Prefetch",
+shuffle:"Shuffle",
+console:"Console",
+numloop:"Num loops",
+controls:"Controls",
+scriptcallbacks:"Script callbacks",
+swstretchstyle:"Stretch style",
+swstretchhalign:"Stretch H-Align",
+swstretchvalign:"Stretch V-Align",
+sound:"Sound",
+progress:"Progress",
+qtsrc:"QT Src",
+qt_stream_warn:"Streamed rtsp resources should be added to the QT Src field under the advanced tab.\nYou should also add a non streamed version to the Src field..",
+align_top:"Top",
+align_right:"Right",
+align_bottom:"Bottom",
+align_left:"Left",
+align_center:"Center",
+align_top_left:"Top left",
+align_top_right:"Top right",
+align_bottom_left:"Bottom left",
+align_bottom_right:"Bottom right",
+flv_options:"Flash video options",
+flv_scalemode:"Scale mode",
+flv_buffer:"Buffer",
+flv_startimage:"Start image",
+flv_starttime:"Start time",
+flv_defaultvolume:"Default volumne",
+flv_hiddengui:"Hidden GUI",
+flv_autostart:"Auto start",
+flv_loop:"Loop",
+flv_showscalemodes:"Show scale modes",
+flv_smoothvideo:"Smooth video",
+flv_jscallback:"JS Callback"
+});
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/media/media.htm b/program/js/tiny_mce/plugins/media/media.htm index 2b1ef80e3..8b3bc1d6b 100644 --- a/program/js/tiny_mce/plugins/media/media.htm +++ b/program/js/tiny_mce/plugins/media/media.htm @@ -1,35 +1,37 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_media_title}</title>
- <script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/media.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
- <script language="javascript" type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <title>{#media_dlg.title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="js/media.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/validate.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
<link href="css/media.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body style="display: none">
<form onsubmit="insertMedia();return false;" action="#">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{$lang_media_general}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_media_advanced}</a></span></li>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');generatePreview();" onmousedown="return false;">{#media_dlg.general}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#media_dlg.advanced}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_media_general}</legend>
+ <legend>{#media_dlg.general}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="media_type">{$lang_media_type}</label></td>
+ <td><label for="media_type">{#media_dlg.type}</label></td>
<td>
<select id="media_type" name="media_type" onchange="changedType(this.value);generatePreview();">
<option value="flash">Flash</option>
+ <!-- <option value="flv">Flash video (FLV)</option> -->
<option value="qt">Quicktime</option>
<option value="shockwave">Shockwave</option>
<option value="wmp">Windows Media</option>
@@ -38,65 +40,66 @@ </td>
</tr>
<tr>
- <td><label for="src">{$lang_media_file}</label></td>
+ <td><label for="src">{#media_dlg.file}</label></td>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
- <td><input id="src" name="src" type="text" value="" onchange="switchType(this.value);generatePreview();" /></td>
+ <td><input id="src" name="src" type="text" value="" class="mceFocus" onchange="switchType(this.value);generatePreview();" /></td>
<td id="filebrowsercontainer"> </td>
</tr>
</table>
</td>
</tr>
<tr id="linklistrow">
- <td><label for="linklist">{$lang_media_list}</label></td>
+ <td><label for="linklist">{#media_dlg.list}</label></td>
<td id="linklistcontainer"> </td>
</tr>
<tr>
- <td><label for="width">{$lang_media_size}</label></td>
+ <td><label for="width">{#media_dlg.size}</label></td>
<td>
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size" onchange="generatePreview('height');" /></td>
- <td> <input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
- <td><label id="constrainlabel" for="constrain">{$lang_media_constrain_proportions}</label></td>
- </tr>
- </table>
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="text" id="width" name="width" value="" class="size" onchange="generatePreview('width');" /> x <input type="text" id="height" name="height" value="" class="size" onchange="generatePreview('height');" /></td>
+ <td> <input id="constrain" type="checkbox" name="constrain" class="checkbox" /></td>
+ <td><label id="constrainlabel" for="constrain">{#media_dlg.constrain_proportions}</label></td>
+ </tr>
+ </table>
+ </td>
</tr>
</table>
</fieldset>
<fieldset>
- <legend>{$lang_media_preview}</legend>
+ <legend>{#media_dlg.preview}</legend>
<div id="prev"></div>
</fieldset>
</div>
<div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_media_advanced}</legend>
+ <legend>{#media_dlg.advanced}</legend>
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tr>
- <td><label for="id">{$lang_media_id}</label></td>
+ <td><label for="id">{#media_dlg.id}</label></td>
<td><input type="text" id="id" name="id" onchange="generatePreview();" /></td>
- <td><label for="name">{$lang_media_name}</label></td>
+ <td><label for="name">{#media_dlg.name}</label></td>
<td><input type="text" id="name" name="name" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="align">{$lang_media_align}</label></td>
+ <td><label for="align">{#media_dlg.align}</label></td>
<td>
<select id="align" name="align" onchange="generatePreview();">
- <option value="">{$lang_not_set}</option>
- <option value="top">{$lang_media_align_top}</option>
- <option value="right">{$lang_media_align_right}</option>
- <option value="bottom">{$lang_media_align_bottom}</option>
- <option value="left">{$lang_media_align_left}</option>
+ <option value="">{#not_set}</option>
+ <option value="top">{#media_dlg.align_top}</option>
+ <option value="right">{#media_dlg.align_right}</option>
+ <option value="bottom">{#media_dlg.align_bottom}</option>
+ <option value="left">{#media_dlg.align_left}</option>
</select>
</td>
- <td><label for="bgcolor">{$lang_media_bgcolor}</label></td>
+ <td><label for="bgcolor">{#media_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -108,23 +111,23 @@ </tr>
<tr>
- <td><label for="vspace">{$lang_media_vspace}</label></td>
+ <td><label for="vspace">{#media_dlg.vspace}</label></td>
<td><input type="text" id="vspace" name="vspace" class="number" onchange="generatePreview();" /></td>
- <td><label for="hspace">{$lang_media_hspace}</label></td>
+ <td><label for="hspace">{#media_dlg.hspace}</label></td>
<td><input type="text" id="hspace" name="hspace" class="number" onchange="generatePreview();" /></td>
</tr>
</table>
</fieldset>
<fieldset id="flash_options">
- <legend>{$lang_media_flash_options}</legend>
+ <legend>{#media_dlg.flash_options}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="flash_quality">{$lang_media_quality}</label></td>
+ <td><label for="flash_quality">{#media_dlg.quality}</label></td>
<td>
<select id="flash_quality" name="flash_quality" onchange="generatePreview();">
- <option value="">{$lang_not_set}</option>
+ <option value="">{#not_set}</option>
<option value="high">high</option>
<option value="low">low</option>
<option value="autolow">autolow</option>
@@ -133,40 +136,41 @@ </select>
</td>
- <td><label for="flash_scale">{$lang_media_scale}</label></td>
+ <td><label for="flash_scale">{#media_dlg.scale}</label></td>
<td>
<select id="flash_scale" name="flash_scale" onchange="generatePreview();">
- <option value="">{$lang_not_set}</option>
+ <option value="">{#not_set}</option>
<option value="showall">showall</option>
<option value="noborder">noborder</option>
<option value="exactfit">exactfit</option>
+ <option value="noscale">noscale</option>
</select>
</td>
</tr>
<tr>
- <td><label for="flash_wmode">{$lang_media_wmode}</label></td>
+ <td><label for="flash_wmode">{#media_dlg.wmode}</label></td>
<td>
<select id="flash_wmode" name="flash_wmode" onchange="generatePreview();">
- <option value="">{$lang_not_set}</option>
+ <option value="">{#not_set}</option>
<option value="window">window</option>
<option value="opaque">opaque</option>
<option value="transparent">transparent</option>
</select>
</td>
- <td><label for="flash_salign">{$lang_media_salign}</label></td>
+ <td><label for="flash_salign">{#media_dlg.salign}</label></td>
<td>
<select id="flash_salign" name="flash_salign" onchange="generatePreview();">
- <option value="">{$lang_not_set}</option>
- <option value="l">{$lang_media_align_left}</option>
- <option value="t">{$lang_media_align_top}</option>
- <option value="r">{$lang_media_align_right}</option>
- <option value="b">{$lang_media_align_bottom}</option>
- <option value="tl">{$lang_media_align_top_left}</option>
- <option value="tr">{$lang_media_align_top_right}</option>
- <option value="bl">{$lang_media_align_bottom_left}</option>
- <option value="br">{$lang_media_align_bottom_right}</option>
+ <option value="">{#not_set}</option>
+ <option value="l">{#media_dlg.align_left}</option>
+ <option value="t">{#media_dlg.align_top}</option>
+ <option value="r">{#media_dlg.align_right}</option>
+ <option value="b">{#media_dlg.align_bottom}</option>
+ <option value="tl">{#media_dlg.align_top_left}</option>
+ <option value="tr">{#media_dlg.align_top_right}</option>
+ <option value="bl">{#media_dlg.align_bottom_left}</option>
+ <option value="br">{#media_dlg.align_bottom_right}</option>
</select>
</td>
</tr>
@@ -176,7 +180,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_play" name="flash_play" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="flash_play">{$lang_media_play}</label></td>
+ <td><label for="flash_play">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
@@ -185,7 +189,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_loop" name="flash_loop" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="flash_loop">{$lang_media_loop}</label></td>
+ <td><label for="flash_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
@@ -196,7 +200,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_menu" name="flash_menu" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="flash_menu">{$lang_media_menu}</label></td>
+ <td><label for="flash_menu">{#media_dlg.menu}</label></td>
</tr>
</table>
</td>
@@ -205,7 +209,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="flash_swliveconnect" name="flash_swliveconnect" onchange="generatePreview();" /></td>
- <td><label for="flash_swliveconnect">{$lang_media_liveconnect}</label></td>
+ <td><label for="flash_swliveconnect">{#media_dlg.liveconnect}</label></td>
</tr>
</table>
</td>
@@ -214,19 +218,116 @@ <table>
<tr>
- <td><label for="flash_base">{$lang_media_base}</label></td>
+ <td><label for="flash_base">{#media_dlg.base}</label></td>
<td><input type="text" id="flash_base" name="flash_base" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="flash_flashvars">{$lang_media_flashvars}</label></td>
+ <td><label for="flash_flashvars">{#media_dlg.flashvars}</label></td>
<td><input type="text" id="flash_flashvars" name="flash_flashvars" onchange="generatePreview();" /></td>
</tr>
</table>
</fieldset>
+ <fieldset id="flv_options">
+ <legend>{#media_dlg.flv_options}</legend>
+
+ <table border="0" cellpadding="4" cellspacing="0">
+ <tr>
+ <td><label for="flv_scalemode">{#media_dlg.flv_scalemode}</label></td>
+ <td>
+ <select id="flv_scalemode" name="flv_scalemode" onchange="generatePreview();">
+ <option value="">{#not_set}</option>
+ <option value="none">none</option>
+ <option value="double">double</option>
+ <option value="full">full</option>
+ </select>
+ </td>
+
+ <td><label for="flv_buffer">{#media_dlg.flv_buffer}</label></td>
+ <td><input type="text" id="flv_buffer" name="flv_buffer" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="flv_startimage">{#media_dlg.flv_startimage}</label></td>
+ <td><input type="text" id="flv_startimage" name="flv_startimage" onchange="generatePreview();" /></td>
+
+ <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
+ <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td><label for="flv_defaultvolume">{#media_dlg.flv_defaultvolume}</label></td>
+ <td><input type="text" id="flv_defaultvolume" name="flv_defaultvolume" onchange="generatePreview();" /></td>
+
+ <td><label for="flv_starttime">{#media_dlg.flv_starttime}</label></td>
+ <td><input type="text" id="flv_starttime" name="flv_starttime" onchange="generatePreview();" /></td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_hiddengui" name="flv_hiddengui" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_hiddengui">{#media_dlg.flv_hiddengui}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_autostart" name="flv_autostart" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_autostart">{#media_dlg.flv_autostart}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_loop" name="flv_loop" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_loop">{#media_dlg.flv_loop}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_showscalemodes" name="flv_showscalemodes" onchange="generatePreview();" /></td>
+ <td><label for="flv_showscalemodes">{#media_dlg.flv_showscalemodes}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_smoothvideo" name="flash_flv_flv_smoothvideosmoothvideo" checked="checked" onchange="generatePreview();" /></td>
+ <td><label for="flv_smoothvideo">{#media_dlg.flv_smoothvideo}</label></td>
+ </tr>
+ </table>
+ </td>
+
+ <td colspan="2">
+ <table border="0" cellpadding="0" cellspacing="0">
+ <tr>
+ <td><input type="checkbox" class="checkbox" id="flv_jscallback" name="flv_jscallback" onchange="generatePreview();" /></td>
+ <td><label for="flv_jscallback">{#media_dlg.flv_jscallback}</label></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+
<fieldset id="qt_options">
- <legend>{$lang_media_qt_options}</legend>
+ <legend>{#media_dlg.qt_options}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
@@ -234,7 +335,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_loop" name="qt_loop" onchange="generatePreview();" /></td>
- <td><label for="qt_loop">{$lang_media_loop}</label></td>
+ <td><label for="qt_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
@@ -243,7 +344,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_autoplay" name="qt_autoplay" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="qt_autoplay">{$lang_media_play}</label></td>
+ <td><label for="qt_autoplay">{#media_dlg.play}</label></td>
</tr>
</table>
</td>
@@ -254,7 +355,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_cache" name="qt_cache" onchange="generatePreview();" /></td>
- <td><label for="qt_cache">{$lang_media_cache}</label></td>
+ <td><label for="qt_cache">{#media_dlg.cache}</label></td>
</tr>
</table>
</td>
@@ -263,7 +364,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_controller" name="qt_controller" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="qt_controller">{$lang_media_controller}</label></td>
+ <td><label for="qt_controller">{#media_dlg.controller}</label></td>
</tr>
</table>
</td>
@@ -274,7 +375,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_correction" name="qt_correction" onchange="generatePreview();" /></td>
- <td><label for="qt_correction">{$lang_media_correction}</label></td>
+ <td><label for="qt_correction">{#media_dlg.correction}</label></td>
</tr>
</table>
</td>
@@ -283,7 +384,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_enablejavascript" name="qt_enablejavascript" onchange="generatePreview();" /></td>
- <td><label for="qt_enablejavascript">{$lang_media_enablejavascript}</label></td>
+ <td><label for="qt_enablejavascript">{#media_dlg.enablejavascript}</label></td>
</tr>
</table>
</td>
@@ -294,7 +395,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_kioskmode" name="qt_kioskmode" onchange="generatePreview();" /></td>
- <td><label for="qt_kioskmode">{$lang_media_kioskmode}</label></td>
+ <td><label for="qt_kioskmode">{#media_dlg.kioskmode}</label></td>
</tr>
</table>
</td>
@@ -303,7 +404,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_autohref" name="qt_autohref" onchange="generatePreview();" /></td>
- <td><label for="qt_autohref">{$lang_media_autohref}</label></td>
+ <td><label for="qt_autohref">{#media_dlg.autohref}</label></td>
</tr>
</table>
</td>
@@ -314,7 +415,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_playeveryframe" name="qt_playeveryframe" onchange="generatePreview();" /></td>
- <td><label for="qt_playeveryframe">{$lang_media_playeveryframe}</label></td>
+ <td><label for="qt_playeveryframe">{#media_dlg.playeveryframe}</label></td>
</tr>
</table>
</td>
@@ -323,16 +424,16 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="qt_targetcache" name="qt_targetcache" onchange="generatePreview();" /></td>
- <td><label for="qt_targetcache">{$lang_media_targetcache}</label></td>
+ <td><label for="qt_targetcache">{#media_dlg.targetcache}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
- <td><label for="qt_scale">{$lang_media_scale}</label></td>
+ <td><label for="qt_scale">{#media_dlg.scale}</label></td>
<td><select id="qt_scale" name="qt_scale" class="mceEditableSelect" onchange="generatePreview();">
- <option value="">{$lang_not_set}</option>
+ <option value="">{#not_set}</option>
<option value="tofit">tofit</option>
<option value="aspect">aspect</option>
</select>
@@ -342,31 +443,31 @@ </tr>
<tr>
- <td><label for="qt_starttime">{$lang_media_starttime}</label></td>
+ <td><label for="qt_starttime">{#media_dlg.starttime}</label></td>
<td><input type="text" id="qt_starttime" name="qt_starttime" onchange="generatePreview();" /></td>
- <td><label for="qt_endtime">{$lang_media_endtime}</label></td>
+ <td><label for="qt_endtime">{#media_dlg.endtime}</label></td>
<td><input type="text" id="qt_endtime" name="qt_endtime" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="qt_target">{$lang_media_target}</label></td>
+ <td><label for="qt_target">{#media_dlg.target}</label></td>
<td><input type="text" id="qt_target" name="qt_target" onchange="generatePreview();" /></td>
- <td><label for="qt_href">{$lang_media_href}</label></td>
+ <td><label for="qt_href">{#media_dlg.href}</label></td>
<td><input type="text" id="qt_href" name="qt_href" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="qt_qtsrcchokespeed">{$lang_media_qtsrcchokespeed}</label></td>
+ <td><label for="qt_qtsrcchokespeed">{#media_dlg.qtsrcchokespeed}</label></td>
<td><input type="text" id="qt_qtsrcchokespeed" name="qt_qtsrcchokespeed" onchange="generatePreview();" /></td>
- <td><label for="qt_volume">{$lang_media_volume}</label></td>
+ <td><label for="qt_volume">{#media_dlg.volume}</label></td>
<td><input type="text" id="qt_volume" name="qt_volume" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="qt_qtsrc">{$lang_media_qtsrc}</label></td>
+ <td><label for="qt_qtsrc">{#media_dlg.qtsrc}</label></td>
<td colspan="4">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
@@ -380,7 +481,7 @@ </fieldset>
<fieldset id="wmp_options">
- <legend>{$lang_media_wmp_options}</legend>
+ <legend>{#media_dlg.wmp_options}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
@@ -388,7 +489,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_autostart" name="wmp_autostart" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="wmp_autostart">{$lang_media_autostart}</label></td>
+ <td><label for="wmp_autostart">{#media_dlg.autostart}</label></td>
</tr>
</table>
</td>
@@ -397,7 +498,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_enabled" name="wmp_enabled" onchange="generatePreview();" /></td>
- <td><label for="wmp_enabled">{$lang_media_enabled}</label></td>
+ <td><label for="wmp_enabled">{#media_dlg.enabled}</label></td>
</tr>
</table>
</td>
@@ -408,7 +509,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_enablecontextmenu" name="wmp_enablecontextmenu" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="wmp_enablecontextmenu">{$lang_media_menu}</label></td>
+ <td><label for="wmp_enablecontextmenu">{#media_dlg.menu}</label></td>
</tr>
</table>
</td>
@@ -417,7 +518,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_fullscreen" name="wmp_fullscreen" onchange="generatePreview();" /></td>
- <td><label for="wmp_fullscreen">{$lang_media_fullscreen}</label></td>
+ <td><label for="wmp_fullscreen">{#media_dlg.fullscreen}</label></td>
</tr>
</table>
</td>
@@ -428,7 +529,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_invokeurls" name="wmp_invokeurls" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="wmp_invokeurls">{$lang_media_invokeurls}</label></td>
+ <td><label for="wmp_invokeurls">{#media_dlg.invokeurls}</label></td>
</tr>
</table>
</td>
@@ -437,7 +538,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_mute" name="wmp_mute" onchange="generatePreview();" /></td>
- <td><label for="wmp_mute">{$lang_media_mute}</label></td>
+ <td><label for="wmp_mute">{#media_dlg.mute}</label></td>
</tr>
</table>
</td>
@@ -448,7 +549,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_stretchtofit" name="wmp_stretchtofit" onchange="generatePreview();" /></td>
- <td><label for="wmp_stretchtofit">{$lang_media_stretchtofit}</label></td>
+ <td><label for="wmp_stretchtofit">{#media_dlg.stretchtofit}</label></td>
</tr>
</table>
</td>
@@ -457,49 +558,49 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="wmp_windowlessvideo" name="wmp_windowlessvideo" onchange="generatePreview();" /></td>
- <td><label for="wmp_windowlessvideo">{$lang_media_windowlessvideo}</label></td>
+ <td><label for="wmp_windowlessvideo">{#media_dlg.windowlessvideo}</label></td>
</tr>
</table>
</td>
</tr>
<tr>
- <td><label for="wmp_balance">{$lang_media_balance}</label></td>
+ <td><label for="wmp_balance">{#media_dlg.balance}</label></td>
<td><input type="text" id="wmp_balance" name="wmp_balance" onchange="generatePreview();" /></td>
- <td><label for="wmp_baseurl">{$lang_media_baseurl}</label></td>
+ <td><label for="wmp_baseurl">{#media_dlg.baseurl}</label></td>
<td><input type="text" id="wmp_baseurl" name="wmp_baseurl" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="wmp_captioningid">{$lang_media_captioningid}</label></td>
+ <td><label for="wmp_captioningid">{#media_dlg.captioningid}</label></td>
<td><input type="text" id="wmp_captioningid" name="wmp_captioningid" onchange="generatePreview();" /></td>
- <td><label for="wmp_currentmarker">{$lang_media_currentmarker}</label></td>
+ <td><label for="wmp_currentmarker">{#media_dlg.currentmarker}</label></td>
<td><input type="text" id="wmp_currentmarker" name="wmp_currentmarker" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="wmp_currentposition">{$lang_media_currentposition}</label></td>
+ <td><label for="wmp_currentposition">{#media_dlg.currentposition}</label></td>
<td><input type="text" id="wmp_currentposition" name="wmp_currentposition" onchange="generatePreview();" /></td>
- <td><label for="wmp_defaultframe">{$lang_media_defaultframe}</label></td>
+ <td><label for="wmp_defaultframe">{#media_dlg.defaultframe}</label></td>
<td><input type="text" id="wmp_defaultframe" name="wmp_defaultframe" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="wmp_playcount">{$lang_media_playcount}</label></td>
+ <td><label for="wmp_playcount">{#media_dlg.playcount}</label></td>
<td><input type="text" id="wmp_playcount" name="wmp_playcount" onchange="generatePreview();" /></td>
- <td><label for="wmp_rate">{$lang_media_rate}</label></td>
+ <td><label for="wmp_rate">{#media_dlg.rate}</label></td>
<td><input type="text" id="wmp_rate" name="wmp_rate" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="wmp_uimode">{$lang_media_uimode}</label></td>
+ <td><label for="wmp_uimode">{#media_dlg.uimode}</label></td>
<td><input type="text" id="wmp_uimode" name="wmp_uimode" onchange="generatePreview();" /></td>
- <td><label for="wmp_volume">{$lang_media_volume}</label></td>
+ <td><label for="wmp_volume">{#media_dlg.volume}</label></td>
<td><input type="text" id="wmp_volume" name="wmp_volume" onchange="generatePreview();" /></td>
</tr>
@@ -507,7 +608,7 @@ </fieldset>
<fieldset id="rmp_options">
- <legend>{$lang_media_rmp_options}</legend>
+ <legend>{#media_dlg.rmp_options}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
@@ -515,7 +616,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_autostart" name="rmp_autostart" onchange="generatePreview();" /></td>
- <td><label for="rmp_autostart">{$lang_media_autostart}</label></td>
+ <td><label for="rmp_autostart">{#media_dlg.autostart}</label></td>
</tr>
</table>
</td>
@@ -524,7 +625,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_loop" name="rmp_loop" onchange="generatePreview();" /></td>
- <td><label for="rmp_loop">{$lang_media_loop}</label></td>
+ <td><label for="rmp_loop">{#media_dlg.loop}</label></td>
</tr>
</table>
</td>
@@ -535,7 +636,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_autogotourl" name="rmp_autogotourl" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="rmp_autogotourl">{$lang_media_autogotourl}</label></td>
+ <td><label for="rmp_autogotourl">{#media_dlg.autogotourl}</label></td>
</tr>
</table>
</td>
@@ -544,7 +645,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_center" name="rmp_center" onchange="generatePreview();" /></td>
- <td><label for="rmp_center">{$lang_media_center}</label></td>
+ <td><label for="rmp_center">{#media_dlg.center}</label></td>
</tr>
</table>
</td>
@@ -555,7 +656,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_imagestatus" name="rmp_imagestatus" checked="checked" onchange="generatePreview();" /></td>
- <td><label for="rmp_imagestatus">{$lang_media_imagestatus}</label></td>
+ <td><label for="rmp_imagestatus">{#media_dlg.imagestatus}</label></td>
</tr>
</table>
</td>
@@ -564,7 +665,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_maintainaspect" name="rmp_maintainaspect" onchange="generatePreview();" /></td>
- <td><label for="rmp_maintainaspect">{$lang_media_maintainaspect}</label></td>
+ <td><label for="rmp_maintainaspect">{#media_dlg.maintainaspect}</label></td>
</tr>
</table>
</td>
@@ -575,7 +676,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_nojava" name="rmp_nojava" onchange="generatePreview();" /></td>
- <td><label for="rmp_nojava">{$lang_media_nojava}</label></td>
+ <td><label for="rmp_nojava">{#media_dlg.nojava}</label></td>
</tr>
</table>
</td>
@@ -584,7 +685,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_prefetch" name="rmp_prefetch" onchange="generatePreview();" /></td>
- <td><label for="rmp_prefetch">{$lang_media_prefetch}</label></td>
+ <td><label for="rmp_prefetch">{#media_dlg.prefetch}</label></td>
</tr>
</table>
</td>
@@ -595,7 +696,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="rmp_shuffle" name="rmp_shuffle" onchange="generatePreview();" /></td>
- <td><label for="rmp_shuffle">{$lang_media_shuffle}</label></td>
+ <td><label for="rmp_shuffle">{#media_dlg.shuffle}</label></td>
</tr>
</table>
</td>
@@ -606,57 +707,57 @@ </tr>
<tr>
- <td><label for="rmp_console">{$lang_media_console}</label></td>
+ <td><label for="rmp_console">{#media_dlg.console}</label></td>
<td><input type="text" id="rmp_console" name="rmp_console" onchange="generatePreview();" /></td>
- <td><label for="rmp_controls">{$lang_media_controls}</label></td>
+ <td><label for="rmp_controls">{#media_dlg.controls}</label></td>
<td><input type="text" id="rmp_controls" name="rmp_controls" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="rmp_numloop">{$lang_media_numloop}</label></td>
+ <td><label for="rmp_numloop">{#media_dlg.numloop}</label></td>
<td><input type="text" id="rmp_numloop" name="rmp_numloop" onchange="generatePreview();" /></td>
- <td><label for="rmp_scriptcallbacks">{$lang_media_scriptcallbacks}</label></td>
+ <td><label for="rmp_scriptcallbacks">{#media_dlg.scriptcallbacks}</label></td>
<td><input type="text" id="rmp_scriptcallbacks" name="rmp_scriptcallbacks" onchange="generatePreview();" /></td>
</tr>
</table>
</fieldset>
<fieldset id="shockwave_options">
- <legend>{$lang_media_shockwave_options}</legend>
+ <legend>{#media_dlg.shockwave_options}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="shockwave_swstretchstyle">{$lang_media_swstretchstyle}</label></td>
+ <td><label for="shockwave_swstretchstyle">{#media_dlg.swstretchstyle}</label></td>
<td>
<select id="shockwave_swstretchstyle" name="shockwave_swstretchstyle" onchange="generatePreview();">
- <option value="none">{$lang_not_set}</option>
+ <option value="none">{#not_set}</option>
<option value="meet">Meet</option>
<option value="fill">Fill</option>
<option value="stage">Stage</option>
</select>
</td>
- <td><label for="shockwave_swvolume">{$lang_media_volume}</label></td>
+ <td><label for="shockwave_swvolume">{#media_dlg.volume}</label></td>
<td><input type="text" id="shockwave_swvolume" name="shockwave_swvolume" onchange="generatePreview();" /></td>
</tr>
<tr>
- <td><label for="shockwave_swstretchhalign">{$lang_media_swstretchhalign}</label></td>
+ <td><label for="shockwave_swstretchhalign">{#media_dlg.swstretchhalign}</label></td>
<td>
<select id="shockwave_swstretchhalign" name="shockwave_swstretchhalign" onchange="generatePreview();">
- <option value="none">{$lang_not_set}</option>
- <option value="left">{$lang_media_align_left}</option>
- <option value="center">{$lang_media_align_center}</option>
- <option value="right">{$lang_media_align_right}</option>
+ <option value="none">{#not_set}</option>
+ <option value="left">{#media_dlg.align_left}</option>
+ <option value="center">{#media_dlg.align_center}</option>
+ <option value="right">{#media_dlg.align_right}</option>
</select>
</td>
- <td><label for="shockwave_swstretchvalign">{$lang_media_swstretchvalign}</label></td>
+ <td><label for="shockwave_swstretchvalign">{#media_dlg.swstretchvalign}</label></td>
<td>
<select id="shockwave_swstretchvalign" name="shockwave_swstretchvalign" onchange="generatePreview();">
- <option value="none">{$lang_not_set}</option>
+ <option value="none">{#not_set}</option>
<option value="meet">Meet</option>
<option value="fill">Fill</option>
<option value="stage">Stage</option>
@@ -669,7 +770,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_autostart" name="shockwave_autostart" onchange="generatePreview();" checked="checked" /></td>
- <td><label for="shockwave_autostart">{$lang_media_autostart}</label></td>
+ <td><label for="shockwave_autostart">{#media_dlg.autostart}</label></td>
</tr>
</table>
</td>
@@ -678,7 +779,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_sound" name="shockwave_sound" onchange="generatePreview();" checked="checked" /></td>
- <td><label for="shockwave_sound">{$lang_media_sound}</label></td>
+ <td><label for="shockwave_sound">{#media_dlg.sound}</label></td>
</tr>
</table>
</td>
@@ -690,7 +791,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_swliveconnect" name="shockwave_swliveconnect" onchange="generatePreview();" /></td>
- <td><label for="shockwave_swliveconnect">{$lang_media_liveconnect}</label></td>
+ <td><label for="shockwave_swliveconnect">{#media_dlg.liveconnect}</label></td>
</tr>
</table>
</td>
@@ -699,7 +800,7 @@ <table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><input type="checkbox" class="checkbox" id="shockwave_progress" name="shockwave_progress" onchange="generatePreview();" checked="checked" /></td>
- <td><label for="shockwave_progress">{$lang_media_progress}</label></td>
+ <td><label for="shockwave_progress">{#media_dlg.progress}</label></td>
</tr>
</table>
</td>
@@ -711,11 +812,11 @@ <div class="mceActionPanel">
<div style="float: left">
- <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertMedia();" />
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js index 5b1279720..4fce503c1 100644 --- a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js +++ b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin.js @@ -1 +1 @@ -tinyMCE.importPluginLanguagePack('nonbreaking');var TinyMCE_NonBreakingPlugin={getInfo:function(){return{longname:'Nonbreaking space',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},getControlHTML:function(cn){switch(cn){case"nonbreaking":return tinyMCE.getButtonHTML(cn,'lang_nonbreaking_desc','{$pluginurl}/images/nonbreaking.gif','mceNonBreaking',false)}return""},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id),h;switch(command){case"mceNonBreaking":h=(inst.visualChars&&inst.visualChars.state)?'<span class="mceItemHiddenVisualChar">·</span>':' ';tinyMCE.execInstanceCommand(editor_id,'mceInsertContent',false,h);return true}return false},handleEvent:function(e){var inst,h;if(!tinyMCE.isOpera&&e.type=='keydown'&&e.keyCode==9&&tinyMCE.getParam('nonbreaking_force_tab',false)){inst=tinyMCE.selectedInstance;h=(inst.visualChars&&inst.visualChars.state)?'<span class="mceItemHiddenVisualChar">···</span>':' ';tinyMCE.execInstanceCommand(inst.editorId,'mceInsertContent',false,h);tinyMCE.cancelEvent(e);return false}return true}};tinyMCE.addPlugin("nonbreaking",TinyMCE_NonBreakingPlugin);
\ No newline at end of file +(function(){tinymce.create('tinymce.plugins.Nonbreaking',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceNonBreaking',function(){ed.execCommand('mceInsertContent',false,(ed.plugins.visualchars&&ed.plugins.visualchars.state)?'<span class="mceItemHidden mceVisualNbsp">·</span>':' ');});ed.addButton('nonbreaking',{title:'nonbreaking.nonbreaking_desc',cmd:'mceNonBreaking'});if(ed.getParam('nonbreaking_force_tab')){ed.onKeyDown.add(function(ed,e){if(tinymce.isIE&&e.keyCode==9){ed.execCommand('mceNonBreaking');ed.execCommand('mceNonBreaking');ed.execCommand('mceNonBreaking');tinymce.dom.Event.cancel(e);}});}},getInfo:function(){return{longname:'Nonbreaking space',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('nonbreaking',tinymce.plugins.Nonbreaking);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js index 73d547855..b72375660 100644 --- a/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/nonbreaking/editor_plugin_src.js @@ -1,62 +1,50 @@ /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('nonbreaking');
-
-var TinyMCE_NonBreakingPlugin = {
- getInfo : function() {
- return {
- longname : 'Nonbreaking space',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- getControlHTML : function(cn) {
- switch (cn) {
- case "nonbreaking":
- return tinyMCE.getButtonHTML(cn, 'lang_nonbreaking_desc', '{$pluginurl}/images/nonbreaking.gif', 'mceNonBreaking', false);
+(function() {
+ tinymce.create('tinymce.plugins.Nonbreaking', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ // Register commands
+ ed.addCommand('mceNonBreaking', function() {
+ ed.execCommand('mceInsertContent', false, (ed.plugins.visualchars && ed.plugins.visualchars.state) ? '<span class="mceItemHidden mceVisualNbsp">·</span>' : ' ');
+ });
+
+ // Register buttons
+ ed.addButton('nonbreaking', {title : 'nonbreaking.nonbreaking_desc', cmd : 'mceNonBreaking'});
+
+ if (ed.getParam('nonbreaking_force_tab')) {
+ ed.onKeyDown.add(function(ed, e) {
+ if (tinymce.isIE && e.keyCode == 9) {
+ ed.execCommand('mceNonBreaking');
+ ed.execCommand('mceNonBreaking');
+ ed.execCommand('mceNonBreaking');
+ tinymce.dom.Event.cancel(e);
+ }
+ });
+ }
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Nonbreaking space',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/nonbreaking',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
}
- return "";
- },
+ // Private methods
+ });
-
- execCommand : function(editor_id, element, command, user_interface, value) {
- var inst = tinyMCE.getInstanceById(editor_id), h;
-
- switch (command) {
- case "mceNonBreaking":
- h = (inst.visualChars && inst.visualChars.state) ? '<span class="mceItemHiddenVisualChar">·</span>' : ' ';
- tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, h);
- return true;
- }
-
- return false;
- },
-
- handleEvent : function(e) {
- var inst, h;
-
- if (!tinyMCE.isOpera && e.type == 'keydown' && e.keyCode == 9 && tinyMCE.getParam('nonbreaking_force_tab', false)) {
- inst = tinyMCE.selectedInstance;
-
- h = (inst.visualChars && inst.visualChars.state) ? '<span class="mceItemHiddenVisualChar">···</span>' : ' ';
- tinyMCE.execInstanceCommand(inst.editorId, 'mceInsertContent', false, h);
-
- tinyMCE.cancelEvent(e);
- return false;
- }
-
- return true;
- }
-};
-
-tinyMCE.addPlugin("nonbreaking", TinyMCE_NonBreakingPlugin);
+ // Register plugin
+ tinymce.PluginManager.add('nonbreaking', tinymce.plugins.Nonbreaking);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/nonbreaking/images/nonbreaking.gif b/program/js/tiny_mce/plugins/nonbreaking/images/nonbreaking.gif Binary files differdeleted file mode 100644 index a731fc91a..000000000 --- a/program/js/tiny_mce/plugins/nonbreaking/images/nonbreaking.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/nonbreaking/langs/en.js b/program/js/tiny_mce/plugins/nonbreaking/langs/en.js deleted file mode 100644 index fd49a646c..000000000 --- a/program/js/tiny_mce/plugins/nonbreaking/langs/en.js +++ /dev/null @@ -1,5 +0,0 @@ -// UK lang variables
-
-tinyMCE.addToLang('nonbreaking',{
-desc : 'Insert non-breaking space character'
-});
diff --git a/program/js/tiny_mce/plugins/paste/blank.htm b/program/js/tiny_mce/plugins/paste/blank.htm new file mode 100644 index 000000000..7ba26bd65 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/blank.htm @@ -0,0 +1,22 @@ +<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>blank_page</title>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+<link href="css/blank.css" rel="stylesheet" type="text/css" />
+<base target="_self" />
+<script type="text/javascript">
+function init() {
+ if (parent.tinymce.isIE)
+ document.body.contentEditable = true;
+ else
+ document.designMode = 'on';
+
+ parent.initIframe(document);
+ window.focus();
+}
+</script>
+</head>
+<body onload="init();">
+
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/paste/css/blank.css b/program/js/tiny_mce/plugins/paste/css/blank.css new file mode 100644 index 000000000..6b16bac25 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/css/blank.css @@ -0,0 +1,14 @@ +html, body {height:98%}
+body {
+background-color: #FFFFFF;
+font-family: Verdana, Arial, Helvetica, sans-serif;
+font-size: 10px;
+scrollbar-3dlight-color: #F0F0EE;
+scrollbar-arrow-color: #676662;
+scrollbar-base-color: #F0F0EE;
+scrollbar-darkshadow-color: #DDDDDD;
+scrollbar-face-color: #E0E0DD;
+scrollbar-highlight-color: #F0F0EE;
+scrollbar-shadow-color: #F0F0EE;
+scrollbar-track-color: #F5F5F5;
+}
diff --git a/program/js/tiny_mce/plugins/paste/css/pasteword.css b/program/js/tiny_mce/plugins/paste/css/pasteword.css new file mode 100644 index 000000000..b3be6270b --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/css/pasteword.css @@ -0,0 +1,3 @@ +.sourceIframe {
+ border: 1px solid #808080;
+}
diff --git a/program/js/tiny_mce/plugins/paste/editor_plugin.js b/program/js/tiny_mce/plugins/paste/editor_plugin.js new file mode 100644 index 000000000..b317ed2c1 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/editor_plugin.js @@ -0,0 +1 @@ +(function(){var Event=tinymce.dom.Event;tinymce.create('tinymce.plugins.PastePlugin',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mcePasteText',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pastetext.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(clipboardData.getData("Text"),true);}else t._insertText(v.html,v.linebreaks);});ed.addCommand('mcePasteWord',function(ui,v){if(ui){if((ed.getParam('paste_use_dialog',true))||(!tinymce.isIE)){ed.windowManager.open({file:url+'/pasteword.htm',width:450,height:400,inline:1},{plugin_url:url});}else t._insertText(t._clipboardHTML());}else t._insertWordContent(v);});ed.addCommand('mceSelectAll',function(){ed.execCommand('selectall');});ed.addButton('pastetext',{title:'paste.paste_text_desc',cmd:'mcePasteText',ui:true});ed.addButton('pasteword',{title:'paste.paste_word_desc',cmd:'mcePasteWord',ui:true});ed.addButton('selectall',{title:'paste.selectall_desc',cmd:'mceSelectAll'});if(ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onPaste.add(function(ed,e){return t._handlePasteEvent(e)});}if(!tinymce.isIE&&ed.getParam("paste_auto_cleanup_on_paste",false)){ed.onKeyDown.add(function(ed,e){if(e.ctrlKey&&e.keyCode==86){window.setTimeout(function(){ed.execCommand("mcePasteText",true);},1);Event.cancel(e);}});}},getInfo:function(){return{longname:'Paste text/word',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_handlePasteEvent:function(e){var html=this._clipboardHTML(),ed=this.editor,sel=ed.selection,r;if(ed&&(r=sel.getRng())&&r.text.length>0)ed.execCommand('delete');if(html&&html.length>0)ed.execCommand('mcePasteWord',false,html);return Event.cancel(e);},_insertText:function(content,bLinebreaks){if(content&&content.length>0){if(bLinebreaks){if(this.editor.getParam("paste_create_paragraphs",true)){var rl=this.editor.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);content=content.replace(/\r\n\r\n/g,'</p><p>');content=content.replace(/\r\r/g,'</p><p>');content=content.replace(/\n\n/g,'</p><p>');if((pos=content.indexOf('</p><p>'))!=-1){this.editor.execCommand("Delete");var node=this.editor.selection.getNode();var breakElms=[];do{if(node.nodeType==1){if(node.nodeName=="TD"||node.nodeName=="BODY")break;breakElms[breakElms.length]=node;}}while(node=node.parentNode);var before="",after="</p>";before+=content.substring(0,pos);for(var i=0;i<breakElms.length;i++){before+="</"+breakElms[i].nodeName+">";after+="<"+breakElms[(breakElms.length-1)-i].nodeName+">";}before+="<p>";content=before+content.substring(pos+7)+after;}}if(this.editor.getParam("paste_create_linebreaks",true)){content=content.replace(/\r\n/g,'<br />');content=content.replace(/\r/g,'<br />');content=content.replace(/\n/g,'<br />');}}this.editor.execCommand("mceInsertRawHTML",false,content);}},_insertWordContent:function(content){var t=this,ed=t.editor;if(content&&content.length>0){var bull=String.fromCharCode(8226);var middot=String.fromCharCode(183);if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','before',content);var rl=ed.getParam("paste_replace_list",'\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');for(var i=0;i<rl.length;i+=2)content=content.replace(new RegExp(rl[i],'gi'),rl[i+1]);if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>','gi'),'<p><b>$1</b></p>');}content=content.replace(new RegExp('tab-stops: list [0-9]+.0pt">','gi'),'">'+"--list--");content=content.replace(new RegExp(bull+"(.*?)<BR>","gi"),"<p>"+middot+"$1</p>");content=content.replace(new RegExp('<SPAN style="mso-list: Ignore">','gi'),"<span>"+bull);content=content.replace(/<o:p><\/o:p>/gi,"");content=content.replace(new RegExp('<br style="page-break-before: always;.*>','gi'),'-- page break --');content=content.replace(new RegExp('<(!--)([^>]*)(--)>','g'),"");if(this.editor.getParam("paste_remove_spans",true))content=content.replace(/<\/?span[^>]*>/gi,"");if(this.editor.getParam("paste_remove_styles",true))content=content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)','gi'),"<$1$3");content=content.replace(/<\/?font[^>]*>/gi,"");switch(this.editor.getParam("paste_strip_class_attributes","all")){case"all":content=content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi,"<$1$3");break;case"mso":content=content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)','gi'),"<$1$3");break;}content=content.replace(new RegExp('href="?'+this._reEscape(""+document.location)+'','gi'),'href="'+this.editor.documentBaseURI.getURI());content=content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi,"<$1$3");content=content.replace(/<\\?\?xml[^>]*>/gi,"");content=content.replace(/<\/?\w+:[^>]*>/gi,"");content=content.replace(/-- page break --\s*<p> <\/p>/gi,"");content=content.replace(/-- page break --/gi,"");if(!this.editor.getParam('force_p_newlines')){content=content.replace('','','gi');content=content.replace('</p>','<br /><br />','gi');}if(!tinymce.isIE&&!this.editor.getParam('force_p_newlines')){content=content.replace(/<\/?p[^>]*>/gi,"");}content=content.replace(/<\/?div[^>]*>/gi,"");if(this.editor.getParam("paste_convert_middot_lists",true)){var div=ed.dom.create("div",null,content);var className=this.editor.getParam("paste_unindented_list_class","unIndentedList");while(this._convertMiddots(div,"--list--"));while(this._convertMiddots(div,middot,className));while(this._convertMiddots(div,bull));content=div.innerHTML;}if(this.editor.getParam("paste_convert_headers_to_strong",false)){content=content.replace(/<h[1-6]> <\/h[1-6]>/gi,'<p> </p>');content=content.replace(/<h[1-6]>/gi,'<p><b>');content=content.replace(/<\/h[1-6]>/gi,'</b></p>');content=content.replace(/<b> <\/b>/gi,'<b> </b>');content=content.replace(/^( )*/gi,'');}content=content.replace(/--list--/gi,"");if(ed.getParam('paste_insert_word_content_callback'))content=ed.execCallback('paste_insert_word_content_callback','after',content);this.editor.execCommand("mceInsertContent",false,content);if(this.editor.getParam('paste_force_cleanup_wordpaste',true)){var ed=this.editor;window.setTimeout(function(){ed.execCommand("mceCleanup");},1);}}},_reEscape:function(s){var l="?.\\*[](){}+^$:";var o="";for(var i=0;i<s.length;i++){var c=s.charAt(i);if(l.indexOf(c)!=-1)o+='\\'+c;else o+=c;}return o;},_convertMiddots:function(div,search,class_name){var ed=this.editor,mdot=String.fromCharCode(183),bull=String.fromCharCode(8226);var nodes,prevul,i,p,ul,li,np,cp,li;nodes=div.getElementsByTagName("p");for(i=0;i<nodes.length;i++){p=nodes[i];if(p.innerHTML.indexOf(search)==0){ul=ed.dom.create("ul");if(class_name)ul.className=class_name;li=ed.dom.create("li");li.innerHTML=p.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');ul.appendChild(li);np=p.nextSibling;while(np){if(np.nodeType==3&&new RegExp('^\\s$','m').test(np.nodeValue)){np=np.nextSibling;continue;}if(search==mdot){if(np.nodeType==1&&new RegExp('^o(\\s+| )').test(np.innerHTML)){if(!prevul){prevul=ul;ul=ed.dom.create("ul");prevul.appendChild(ul);}np.innerHTML=np.innerHTML.replace(/^o/,'');}else{if(prevul){ul=prevul;prevul=null;}if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}}else{if(np.nodeType!=1||np.innerHTML.indexOf(search)!=0)break;}cp=np.nextSibling;li=ed.dom.create("li");li.innerHTML=np.innerHTML.replace(new RegExp(''+mdot+'|'+bull+'|--list--| ',"gi"),'');np.parentNode.removeChild(np);ul.appendChild(li);np=cp;}p.parentNode.replaceChild(ul,p);return true;}}return false;},_clipboardHTML:function(){var div=document.getElementById('_TinyMCE_clipboardHTML');if(!div){var div=document.createElement('DIV');div.id='_TinyMCE_clipboardHTML';with(div.style){visibility='hidden';overflow='hidden';position='absolute';width=1;height=1;}document.body.appendChild(div);}div.innerHTML='';var rng=document.body.createTextRange();rng.moveToElementText(div);rng.execCommand('Paste');var html=div.innerHTML;div.innerHTML='';return html;}});tinymce.PluginManager.add('paste',tinymce.plugins.PastePlugin);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/paste/editor_plugin_src.js b/program/js/tiny_mce/plugins/paste/editor_plugin_src.js new file mode 100644 index 000000000..b1e963261 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/editor_plugin_src.js @@ -0,0 +1,387 @@ +/**
+ * $Id: editor_plugin_src.js 738 2008-03-20 20:00:48Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+ var Event = tinymce.dom.Event;
+
+ tinymce.create('tinymce.plugins.PastePlugin', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ // Register commands
+ ed.addCommand('mcePasteText', function(ui, v) {
+ if (ui) {
+ if ((ed.getParam('paste_use_dialog', true)) || (!tinymce.isIE)) {
+ ed.windowManager.open({
+ file : url + '/pastetext.htm',
+ width : 450,
+ height : 400,
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ } else
+ t._insertText(clipboardData.getData("Text"), true);
+ } else
+ t._insertText(v.html, v.linebreaks);
+ });
+
+ ed.addCommand('mcePasteWord', function(ui, v) {
+ if (ui) {
+ if ((ed.getParam('paste_use_dialog', true)) || (!tinymce.isIE)) {
+ ed.windowManager.open({
+ file : url + '/pasteword.htm',
+ width : 450,
+ height : 400,
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ } else
+ t._insertText(t._clipboardHTML());
+ } else
+ t._insertWordContent(v);
+ });
+
+ ed.addCommand('mceSelectAll', function() {
+ ed.execCommand('selectall');
+ });
+
+ // Register buttons
+ ed.addButton('pastetext', {title : 'paste.paste_text_desc', cmd : 'mcePasteText', ui : true});
+ ed.addButton('pasteword', {title : 'paste.paste_word_desc', cmd : 'mcePasteWord', ui : true});
+ ed.addButton('selectall', {title : 'paste.selectall_desc', cmd : 'mceSelectAll'});
+
+ if (ed.getParam("paste_auto_cleanup_on_paste", false)) {
+ ed.onPaste.add(function(ed, e) {
+ return t._handlePasteEvent(e)
+ });
+ }
+
+ if (!tinymce.isIE && ed.getParam("paste_auto_cleanup_on_paste", false)) {
+ // Force paste dialog if non IE browser
+ ed.onKeyDown.add(function(ed, e) {
+ if (e.ctrlKey && e.keyCode == 86) {
+ window.setTimeout(function() {
+ ed.execCommand("mcePasteText", true);
+ }, 1);
+
+ Event.cancel(e);
+ }
+ });
+ }
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Paste text/word',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ // Private methods
+
+ _handlePasteEvent : function(e) {
+ var html = this._clipboardHTML(), ed = this.editor, sel = ed.selection, r;
+
+ // Removes italic, strong etc, the if was needed due to bug #1437114
+ if (ed && (r = sel.getRng()) && r.text.length > 0)
+ ed.execCommand('delete');
+
+ if (html && html.length > 0)
+ ed.execCommand('mcePasteWord', false, html);
+
+ return Event.cancel(e);
+ },
+
+ _insertText : function(content, bLinebreaks) {
+ if (content && content.length > 0) {
+ if (bLinebreaks) {
+ // Special paragraph treatment
+ if (this.editor.getParam("paste_create_paragraphs", true)) {
+ var rl = this.editor.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+ for (var i=0; i<rl.length; i+=2)
+ content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
+
+ content = content.replace(/\r\n\r\n/g, '</p><p>');
+ content = content.replace(/\r\r/g, '</p><p>');
+ content = content.replace(/\n\n/g, '</p><p>');
+
+ // Has paragraphs
+ if ((pos = content.indexOf('</p><p>')) != -1) {
+ this.editor.execCommand("Delete");
+
+ var node = this.editor.selection.getNode();
+
+ // Get list of elements to break
+ var breakElms = [];
+
+ do {
+ if (node.nodeType == 1) {
+ // Don't break tables and break at body
+ if (node.nodeName == "TD" || node.nodeName == "BODY")
+ break;
+
+ breakElms[breakElms.length] = node;
+ }
+ } while(node = node.parentNode);
+
+ var before = "", after = "</p>";
+ before += content.substring(0, pos);
+
+ for (var i=0; i<breakElms.length; i++) {
+ before += "</" + breakElms[i].nodeName + ">";
+ after += "<" + breakElms[(breakElms.length-1)-i].nodeName + ">";
+ }
+
+ before += "<p>";
+ content = before + content.substring(pos+7) + after;
+ }
+ }
+
+ if (this.editor.getParam("paste_create_linebreaks", true)) {
+ content = content.replace(/\r\n/g, '<br />');
+ content = content.replace(/\r/g, '<br />');
+ content = content.replace(/\n/g, '<br />');
+ }
+ }
+
+ this.editor.execCommand("mceInsertRawHTML", false, content);
+ }
+ },
+
+ _insertWordContent : function(content) {
+ var t = this, ed = t.editor;
+
+ if (content && content.length > 0) {
+ // Cleanup Word content
+ var bull = String.fromCharCode(8226);
+ var middot = String.fromCharCode(183);
+
+ if (ed.getParam('paste_insert_word_content_callback'))
+ content = ed.execCallback('paste_insert_word_content_callback', 'before', content);
+
+ var rl = ed.getParam("paste_replace_list", '\u2122,<sup>TM</sup>,\u2026,...,\u201c|\u201d,",\u2019,\',\u2013|\u2014|\u2015|\u2212,-').split(',');
+ for (var i=0; i<rl.length; i+=2)
+ content = content.replace(new RegExp(rl[i], 'gi'), rl[i+1]);
+
+ if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
+ content = content.replace(new RegExp('<p class=MsoHeading.*?>(.*?)<\/p>', 'gi'), '<p><b>$1</b></p>');
+ }
+
+ content = content.replace(new RegExp('tab-stops: list [0-9]+.0pt">', 'gi'), '">' + "--list--");
+ content = content.replace(new RegExp(bull + "(.*?)<BR>", "gi"), "<p>" + middot + "$1</p>");
+ content = content.replace(new RegExp('<SPAN style="mso-list: Ignore">', 'gi'), "<span>" + bull); // Covert to bull list
+ content = content.replace(/<o:p><\/o:p>/gi, "");
+ content = content.replace(new RegExp('<br style="page-break-before: always;.*>', 'gi'), '-- page break --'); // Replace pagebreaks
+ content = content.replace(new RegExp('<(!--)([^>]*)(--)>', 'g'), ""); // Word comments
+
+ if (this.editor.getParam("paste_remove_spans", true))
+ content = content.replace(/<\/?span[^>]*>/gi, "");
+
+ if (this.editor.getParam("paste_remove_styles", true))
+ content = content.replace(new RegExp('<(\\w[^>]*) style="([^"]*)"([^>]*)', 'gi'), "<$1$3");
+
+ content = content.replace(/<\/?font[^>]*>/gi, "");
+
+ // Strips class attributes.
+ switch (this.editor.getParam("paste_strip_class_attributes", "all")) {
+ case "all":
+ content = content.replace(/<(\w[^>]*) class=([^ |>]*)([^>]*)/gi, "<$1$3");
+ break;
+
+ case "mso":
+ content = content.replace(new RegExp('<(\\w[^>]*) class="?mso([^ |>]*)([^>]*)', 'gi'), "<$1$3");
+ break;
+ }
+
+ content = content.replace(new RegExp('href="?' + this._reEscape("" + document.location) + '', 'gi'), 'href="' + this.editor.documentBaseURI.getURI());
+ content = content.replace(/<(\w[^>]*) lang=([^ |>]*)([^>]*)/gi, "<$1$3");
+ content = content.replace(/<\\?\?xml[^>]*>/gi, "");
+ content = content.replace(/<\/?\w+:[^>]*>/gi, "");
+ content = content.replace(/-- page break --\s*<p> <\/p>/gi, ""); // Remove pagebreaks
+ content = content.replace(/-- page break --/gi, ""); // Remove pagebreaks
+
+ // content = content.replace(/\/? */gi, "");
+ // content = content.replace(/<p> <\/p>/gi, '');
+
+ if (!this.editor.getParam('force_p_newlines')) {
+ content = content.replace('', '' ,'gi');
+ content = content.replace('</p>', '<br /><br />' ,'gi');
+ }
+
+ if (!tinymce.isIE && !this.editor.getParam('force_p_newlines')) {
+ content = content.replace(/<\/?p[^>]*>/gi, "");
+ }
+
+ content = content.replace(/<\/?div[^>]*>/gi, "");
+
+ // Convert all middlot lists to UL lists
+ if (this.editor.getParam("paste_convert_middot_lists", true)) {
+ var div = ed.dom.create("div", null, content);
+
+ // Convert all middot paragraphs to li elements
+ var className = this.editor.getParam("paste_unindented_list_class", "unIndentedList");
+
+ while (this._convertMiddots(div, "--list--")) ; // bull
+ while (this._convertMiddots(div, middot, className)) ; // Middot
+ while (this._convertMiddots(div, bull)) ; // bull
+
+ content = div.innerHTML;
+ }
+
+ // Replace all headers with strong and fix some other issues
+ if (this.editor.getParam("paste_convert_headers_to_strong", false)) {
+ content = content.replace(/<h[1-6]> <\/h[1-6]>/gi, '<p> </p>');
+ content = content.replace(/<h[1-6]>/gi, '<p><b>');
+ content = content.replace(/<\/h[1-6]>/gi, '</b></p>');
+ content = content.replace(/<b> <\/b>/gi, '<b> </b>');
+ content = content.replace(/^( )*/gi, '');
+ }
+
+ content = content.replace(/--list--/gi, ""); // Remove --list--
+
+ if (ed.getParam('paste_insert_word_content_callback'))
+ content = ed.execCallback('paste_insert_word_content_callback', 'after', content);
+
+ // Insert cleaned content
+ this.editor.execCommand("mceInsertContent", false, content);
+
+ if (this.editor.getParam('paste_force_cleanup_wordpaste', true)) {
+ var ed = this.editor;
+
+ window.setTimeout(function() {
+ ed.execCommand("mceCleanup");
+ }, 1); // Do normal cleanup detached from this thread
+ }
+ }
+ },
+
+ _reEscape : function(s) {
+ var l = "?.\\*[](){}+^$:";
+ var o = "";
+
+ for (var i=0; i<s.length; i++) {
+ var c = s.charAt(i);
+
+ if (l.indexOf(c) != -1)
+ o += '\\' + c;
+ else
+ o += c;
+ }
+
+ return o;
+ },
+
+ _convertMiddots : function(div, search, class_name) {
+ var ed = this.editor, mdot = String.fromCharCode(183), bull = String.fromCharCode(8226);
+ var nodes, prevul, i, p, ul, li, np, cp, li;
+
+ nodes = div.getElementsByTagName("p");
+ for (i=0; i<nodes.length; i++) {
+ p = nodes[i];
+
+ // Is middot
+ if (p.innerHTML.indexOf(search) == 0) {
+ ul = ed.dom.create("ul");
+
+ if (class_name)
+ ul.className = class_name;
+
+ // Add the first one
+ li = ed.dom.create("li");
+ li.innerHTML = p.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
+ ul.appendChild(li);
+
+ // Add the rest
+ np = p.nextSibling;
+ while (np) {
+ // If the node is whitespace, then
+ // ignore it and continue on.
+ if (np.nodeType == 3 && new RegExp('^\\s$', 'm').test(np.nodeValue)) {
+ np = np.nextSibling;
+ continue;
+ }
+
+ if (search == mdot) {
+ if (np.nodeType == 1 && new RegExp('^o(\\s+| )').test(np.innerHTML)) {
+ // Second level of nesting
+ if (!prevul) {
+ prevul = ul;
+ ul = ed.dom.create("ul");
+ prevul.appendChild(ul);
+ }
+ np.innerHTML = np.innerHTML.replace(/^o/, '');
+ } else {
+ // Pop the stack if we're going back up to the first level
+ if (prevul) {
+ ul = prevul;
+ prevul = null;
+ }
+ // Not element or middot paragraph
+ if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
+ break;
+ }
+ } else {
+ // Not element or middot paragraph
+ if (np.nodeType != 1 || np.innerHTML.indexOf(search) != 0)
+ break;
+ }
+
+ cp = np.nextSibling;
+ li = ed.dom.create("li");
+ li.innerHTML = np.innerHTML.replace(new RegExp('' + mdot + '|' + bull + '|--list--| ', "gi"), '');
+ np.parentNode.removeChild(np);
+ ul.appendChild(li);
+ np = cp;
+ }
+
+ p.parentNode.replaceChild(ul, p);
+
+ return true;
+ }
+ }
+
+ return false;
+ },
+
+ _clipboardHTML : function() {
+ var div = document.getElementById('_TinyMCE_clipboardHTML');
+
+ if (!div) {
+ var div = document.createElement('DIV');
+ div.id = '_TinyMCE_clipboardHTML';
+
+ with (div.style) {
+ visibility = 'hidden';
+ overflow = 'hidden';
+ position = 'absolute';
+ width = 1;
+ height = 1;
+ }
+
+ document.body.appendChild(div);
+ }
+
+ div.innerHTML = '';
+ var rng = document.body.createTextRange();
+ rng.moveToElementText(div);
+ rng.execCommand('Paste');
+ var html = div.innerHTML;
+ div.innerHTML = '';
+ return html;
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('paste', tinymce.plugins.PastePlugin);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/paste/js/pastetext.js b/program/js/tiny_mce/plugins/paste/js/pastetext.js new file mode 100644 index 000000000..326bb16a2 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/js/pastetext.js @@ -0,0 +1,42 @@ +tinyMCEPopup.requireLangPack();
+
+function saveContent() {
+ if (document.forms[0].htmlSource.value == '') {
+ tinyMCEPopup.close();
+ return false;
+ }
+
+ tinyMCEPopup.execCommand('mcePasteText', false, {
+ html : document.forms[0].htmlSource.value,
+ linebreaks : document.forms[0].linebreaks.checked
+ });
+
+ tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // Remove Gecko spellchecking
+ if (tinymce.isGecko)
+ document.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
+
+ resizeInputs();
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function resizeInputs() {
+ if (!tinymce.isIE) {
+ wHeight = self.innerHeight-80;
+ wWidth = self.innerWidth-17;
+ } else {
+ wHeight = document.body.clientHeight-80;
+ wWidth = document.body.clientWidth-17;
+ }
+
+ document.forms[0].htmlSource.style.height = Math.abs(wHeight) + 'px';
+ document.forms[0].htmlSource.style.width = Math.abs(wWidth) + 'px';
+}
+
+tinyMCEPopup.onInit.add(onLoadInit);
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/paste/js/pasteword.js b/program/js/tiny_mce/plugins/paste/js/pasteword.js new file mode 100644 index 000000000..6701b99fc --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/js/pasteword.js @@ -0,0 +1,56 @@ +tinyMCEPopup.requireLangPack();
+
+function saveContent() {
+ var html = document.getElementById("frmData").contentWindow.document.body.innerHTML;
+
+ if (html == ''){
+ tinyMCEPopup.close();
+ return false;
+ }
+
+ tinyMCEPopup.execCommand('mcePasteWord', false, html);
+ tinyMCEPopup.close();
+}
+
+function onLoadInit() {
+ tinyMCEPopup.resizeToInnerSize();
+
+ // Fix for endless reloading in FF
+ window.setTimeout(createIFrame, 10);
+}
+
+function createIFrame() {
+ document.getElementById('iframecontainer').innerHTML = '<iframe id="frmData" name="frmData" class="sourceIframe" src="blank.htm" height="280" width="400" frameborder="0" style="background-color:#FFFFFF; width:100%;" dir="ltr" wrap="soft"></iframe>';
+}
+
+var wHeight=0, wWidth=0, owHeight=0, owWidth=0;
+
+function initIframe(doc) {
+ var dir = tinyMCEPopup.editor.settings.directionality;
+
+ doc.body.dir = dir;
+
+ // Remove Gecko spellchecking
+ if (tinymce.isGecko)
+ doc.body.spellcheck = tinyMCEPopup.getParam("gecko_spellcheck");
+
+ resizeInputs();
+}
+
+function resizeInputs() {
+ if (!tinymce.isIE) {
+ wHeight = self.innerHeight - 80;
+ wWidth = self.innerWidth - 18;
+ } else {
+ wHeight = document.body.clientHeight - 80;
+ wWidth = document.body.clientWidth - 18;
+ }
+
+ var elm = document.getElementById('frmData');
+ if (elm) {
+ elm.style.height = Math.abs(wHeight) + 'px';
+ elm.style.width = Math.abs(wWidth) + 'px';
+ }
+}
+
+tinyMCEPopup.onInit.add(onLoadInit);
diff --git a/program/js/tiny_mce/plugins/paste/langs/en_dlg.js b/program/js/tiny_mce/plugins/paste/langs/en_dlg.js new file mode 100644 index 000000000..eeac77896 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/langs/en_dlg.js @@ -0,0 +1,5 @@ +tinyMCE.addI18n('en.paste_dlg',{
+text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
+text_linebreaks:"Keep linebreaks",
+word_title:"Use CTRL+V on your keyboard to paste the text into the window."
+});
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/paste/pastetext.htm b/program/js/tiny_mce/plugins/paste/pastetext.htm new file mode 100644 index 000000000..2f2b341a1 --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/pastetext.htm @@ -0,0 +1,34 @@ +<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#paste.paste_text_desc}</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="js/pastetext.js"></script>
+ <base target="_self" />
+</head>
+<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
+<form name="source" onsubmit="saveContent();return false;" action="#">
+ <div style="float: left" class="title">{#paste.paste_text_desc}</div>
+
+ <div style="float: right">
+ <input type="checkbox" name="linebreaks" id="linebreaks" class="wordWrapCode" checked="checked" /><label for="linebreaks">{#paste_dlg.text_linebreaks}</label>
+ </div>
+
+ <br style="clear: both" />
+
+ <div>{#paste_dlg.text_title}</div>
+
+ <textarea name="htmlSource" id="htmlSource" rows="15" cols="100" style="width: 100%; height: 100%; font-family: 'Courier New',Courier,mono; font-size: 12px;" dir="ltr" wrap="soft" class="mceFocus"></textarea>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" name="insert" value="{#insert}" id="insert" />
+ </div>
+
+ <div style="float: right">
+ <input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
+ </div>
+ </div>
+</form>
+</body>
+</html>
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/paste/pasteword.htm b/program/js/tiny_mce/plugins/paste/pasteword.htm new file mode 100644 index 000000000..9e5ab1b5b --- /dev/null +++ b/program/js/tiny_mce/plugins/paste/pasteword.htm @@ -0,0 +1,29 @@ +<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <title>{#paste.paste_word_desc}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="js/pasteword.js"></script>
+ <link href="css/pasteword.css" rel="stylesheet" type="text/css" />
+ <base target="_self" />
+</head>
+<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
+ <form name="source" onsubmit="saveContent();" action="#">
+ <div class="title">{#paste.paste_word_desc}</div>
+
+ <div>{#paste_dlg.word_title}</div>
+
+ <div id="iframecontainer"></div>
+
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="button" id="insert" name="insert" value="{#insert}" onclick="saveContent();" />
+ </div>
+
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+ </form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/readme.txt b/program/js/tiny_mce/plugins/readme.txt deleted file mode 100644 index 9192b26a5..000000000 --- a/program/js/tiny_mce/plugins/readme.txt +++ /dev/null @@ -1 +0,0 @@ -This is the location you place TinyMCE plugins. diff --git a/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css b/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css index 4c7bd13c4..ecdf58c7b 100644 --- a/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css +++ b/program/js/tiny_mce/plugins/searchreplace/css/searchreplace.css @@ -1,20 +1,6 @@ -/* stylesheet for advsearchreplace plugin*/
+.panel_wrapper {height:85px;}
+.panel_wrapper div.current {height:85px;}
-.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); }
+/* IE */
+* html .panel_wrapper {height:100px;}
+* html .panel_wrapper div.current {height:100px;}
diff --git a/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js b/program/js/tiny_mce/plugins/searchreplace/editor_plugin.js index 959e9cc5c..7fd913b2b 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');var TinyMCE_SearchReplacePlugin={getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',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){if(!inst.selection.isCollapsed()){if(tinyMCE.isRealIE)inst.selection.getRng().duplicate().pasteHTML(str);else 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"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.selection.collapse(true);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;var awin=value.win,found;if(body.innerHTML==""){awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(value['replacemode']=="current"){replaceSel(value['string'],value['replacestring'],value['backwards']);value['replacemode']="none";}inst.selection.collapse(value['backwards']);if(tinyMCE.isMSIE){var rng=inst.selection.getRng();var flags=0;if(value['wholeword'])flags=flags|2;if(value['casesensitive'])flags=flags|4;if(!rng.findText){awin.alert('This operation is currently not supported by this browser.');return true}if(value['replacemode']=="all"){found=false;while(rng.findText(value['string'],value['backwards']?-1:1,flags)){found=true;rng.scrollIntoView();rng.select();replaceSel(value['string'],value['replacestring'],value['backwards'])}if(found)awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));else awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(rng.findText(value['string'],value['backwards']?-1:1,flags)){rng.scrollIntoView();rng.select()}else awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'))}else{if(value['replacemode']=="all"){found=false;while(win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false)){found=true;replaceSel(value['string'],value['replacestring'],value['backwards'])}if(found)awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));else awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));return true}if(!win.find(value['string'],value['casesensitive'],value['backwards'],value['wrap'],value['wholeword'],false,false))awin.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 +(function(){tinymce.create('tinymce.plugins.SearchReplacePlugin',{init:function(ed,url){function open(m){ed.windowManager.open({file:url+'/searchreplace.htm',width:420+parseInt(ed.getLang('searchreplace.delta_width',0)),height:160+parseInt(ed.getLang('searchreplace.delta_height',0)),inline:1,auto_focus:0},{mode:m,search_string:ed.selection.getContent({format:'text'}),plugin_url:url});};ed.addCommand('mceSearch',function(){open('search');});ed.addCommand('mceReplace',function(){open('replace');});ed.addButton('search',{title:'searchreplace.search_desc',cmd:'mceSearch'});ed.addButton('replace',{title:'searchreplace.replace_desc',cmd:'mceReplace'});ed.addShortcut('ctrl+f','searchreplace.search_desc','mceSearch');},getInfo:function(){return{longname:'Search/Replace',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('searchreplace',tinymce.plugins.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 cd2f3a85c..59edc3b25 100644 --- a/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/searchreplace/editor_plugin_src.js @@ -1,173 +1,54 @@ /**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * $Id: editor_plugin_src.js 686 2008-03-09 18:13:49Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-tinyMCE.importPluginLanguagePack('searchreplace');
-
-var TinyMCE_SearchReplacePlugin = {
- getInfo : function() {
- return {
- longname : 'Search/Replace',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- 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) {
- 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) {
- if (!inst.selection.isCollapsed()) {
- if (tinyMCE.isRealIE)
- inst.selection.getRng().duplicate().pasteHTML(str); // Needs to be duplicated due to selection bug in IE
- else
- inst.execCommand('mceInsertContent', false, str);
- }
+(function() {
+ tinymce.create('tinymce.plugins.SearchReplacePlugin', {
+ init : function(ed, url) {
+ function open(m) {
+ ed.windowManager.open({
+ file : url + '/searchreplace.htm',
+ width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
+ height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
+ inline : 1,
+ auto_focus : 0
+ }, {
+ mode : m,
+ search_string : ed.selection.getContent({format : 'text'}),
+ plugin_url : url
+ });
+ };
+
+ // Register commands
+ ed.addCommand('mceSearch', function() {
+ open('search');
+ });
+
+ ed.addCommand('mceReplace', function() {
+ open('replace');
+ });
+
+ // Register buttons
+ ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
+ ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
+
+ ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Search/Replace',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
}
+ });
- 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 "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.selection.collapse(true);
-
- 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;
- var awin = value.win, found;
-
- if (body.innerHTML == "") {
- awin.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);
- //return true;
- }
-
- inst.selection.collapse(value['backwards']);
-
- if (tinyMCE.isMSIE) {
- var rng = inst.selection.getRng();
- var flags = 0;
- if (value['wholeword'])
- flags = flags | 2;
-
- if (value['casesensitive'])
- flags = flags | 4;
-
- if (!rng.findText) {
- awin.alert('This operation is currently not supported by this browser.');
- return true;
- }
-
- if (value['replacemode'] == "all") {
- found = false;
-
- while (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
- found = true;
- rng.scrollIntoView();
- rng.select();
- replaceSel(value['string'], value['replacestring'], value['backwards']);
- }
-
- if (found)
- awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));
- else
- awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
-
- return true;
- }
-
- if (rng.findText(value['string'], value['backwards'] ? -1 : 1, flags)) {
- rng.scrollIntoView();
- rng.select();
- } else
- awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
- } else {
- if (value['replacemode'] == "all") {
- found = false;
-
- while (win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false)) {
- found = true;
- replaceSel(value['string'], value['replacestring'], value['backwards']);
- }
-
- if (found)
- awin.alert(tinyMCE.getLang('lang_searchreplace_allreplaced'));
- else
- awin.alert(tinyMCE.getLang('lang_searchreplace_notfound'));
-
- return true;
- }
-
- if (!win.find(value['string'], value['casesensitive'], value['backwards'], value['wrap'], value['wholeword'], false, false))
- awin.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 + // Register plugin
+ tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/searchreplace/images/replace.gif b/program/js/tiny_mce/plugins/searchreplace/images/replace.gif Binary files differdeleted file mode 100644 index 784c73e2a..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/images/replace.gif +++ /dev/null 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 Binary files differdeleted file mode 100644 index 123fa5bf5..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/images/replace_all_button_bg.gif +++ /dev/null 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 Binary files differdeleted file mode 100644 index cc2c56e61..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/images/replace_button_bg.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/searchreplace/images/search.gif b/program/js/tiny_mce/plugins/searchreplace/images/search.gif Binary files differdeleted file mode 100644 index cfe76b5d5..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/images/search.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js new file mode 100644 index 000000000..890eb37f1 --- /dev/null +++ b/program/js/tiny_mce/plugins/searchreplace/js/searchreplace.js @@ -0,0 +1,117 @@ +tinyMCEPopup.requireLangPack();
+
+var SearchReplaceDialog = {
+ init : function(ed) {
+ var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");
+
+ this.switchMode(m);
+
+ f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");
+
+ // Focus input field
+ f[m + '_panel_searchstring'].focus();
+ },
+
+ switchMode : function(m) {
+ var f, lm = this.lastMode;
+
+ if (lm != m) {
+ f = document.forms[0];
+
+ if (lm) {
+ f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value;
+ f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked;
+ f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked;
+ f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked;
+ }
+
+ mcTabs.displayTab(m + '_tab', m + '_panel');
+ document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none";
+ document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none";
+ this.lastMode = m;
+ }
+ },
+
+ searchNext : function(a) {
+ var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
+
+ // Get input
+ f = document.forms[0];
+ s = f[m + '_panel_searchstring'].value;
+ b = f[m + '_panel_backwardsu'].checked;
+ ca = f[m + '_panel_casesensitivebox'].checked;
+ rs = f['replace_panel_replacestring'].value;
+
+ function fix() {
+ // Correct Firefox graphics glitches
+ r = se.getRng().cloneRange();
+ ed.getDoc().execCommand('SelectAll', false, null);
+ se.setRng(r);
+ };
+
+ function replace() {
+ if (tinymce.isIE)
+ ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE
+ else
+ ed.getDoc().execCommand('InsertHTML', false, rs);
+ };
+
+ // IE flags
+ if (ca)
+ fl = fl | 4;
+
+ switch (a) {
+ case 'all':
+ if (tinymce.isIE) {
+ while (r.findText(s, b ? -1 : 1, fl)) {
+ r.scrollIntoView();
+ r.select();
+ replace();
+ fo = 1;
+ }
+
+ tinyMCEPopup.storeSelection();
+ } else {
+ while (w.find(s, ca, b, false, false, false, false)) {
+ replace();
+ fo = 1;
+ }
+ }
+
+ if (fo)
+ wm.alert(ed.getLang('searchreplace_dlg.allreplaced'));
+ else
+ wm.alert(ed.getLang('searchreplace_dlg.notfound'));
+
+ return;
+
+ case 'current':
+ replace();
+ break;
+ }
+
+ se.collapse(b);
+ r = se.getRng();
+
+ // Whats the point
+ if (!s)
+ return;
+
+ if (tinymce.isIE) {
+ if (r.findText(s, b ? -1 : 1, fl)) {
+ r.scrollIntoView();
+ r.select();
+ } else
+ wm.alert(ed.getLang('searchreplace_dlg.notfound'));
+
+ tinyMCEPopup.storeSelection();
+ } else {
+ if (!w.find(s, ca, b, false, false, false, false))
+ wm.alert(ed.getLang('searchreplace_dlg.notfound'));
+ else
+ fix();
+ }
+ }
+};
+
+tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog);
diff --git a/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js b/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js deleted file mode 100644 index ac6cdf6fc..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/jscripts/searchreplace.js +++ /dev/null @@ -1,86 +0,0 @@ -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");
-}
-
-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 false;
- }
-
- // 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 : formObj[task + "_panel_backwardsu"].checked,
- win : window
- }, false);
-
- window.focus();
-
- return false;
-}
-
-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/langs/en.js b/program/js/tiny_mce/plugins/searchreplace/langs/en.js deleted file mode 100644 index 32af8282e..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/langs/en.js +++ /dev/null @@ -1,21 +0,0 @@ -// UK lang variables
-
-tinyMCE.addToLang('',{
-searchreplace_search_desc : 'Find',
-searchreplace_searchnext_desc : 'Find again',
-searchreplace_replace_desc : 'Find/Replace',
-searchreplace_notfound : 'The search has been completed. The search string could not be found.',
-searchreplace_search_title : 'Find',
-searchreplace_replace_title : 'Find/Replace',
-searchreplace_allreplaced : 'All occurrences of the search string were replaced.',
-searchreplace_findwhat : 'Find what',
-searchreplace_replacewith : 'Replace with',
-searchreplace_direction : 'Direction',
-searchreplace_up : 'Up',
-searchreplace_down : 'Down',
-searchreplace_case : 'Match case',
-searchreplace_findnext : 'Find next',
-searchreplace_replace : 'Replace',
-searchreplace_replaceall : 'Replace all',
-searchreplace_cancel : 'Cancel'
-});
diff --git a/program/js/tiny_mce/plugins/searchreplace/langs/en_dlg.js b/program/js/tiny_mce/plugins/searchreplace/langs/en_dlg.js new file mode 100644 index 000000000..370959afa --- /dev/null +++ b/program/js/tiny_mce/plugins/searchreplace/langs/en_dlg.js @@ -0,0 +1,16 @@ +tinyMCE.addI18n('en.searchreplace_dlg',{
+searchnext_desc:"Find again",
+notfound:"The search has been completed. The search string could not be found.",
+search_title:"Find",
+replace_title:"Find/Replace",
+allreplaced:"All occurrences of the search string were replaced.",
+findwhat:"Find what",
+replacewith:"Replace with",
+direction:"Direction",
+up:"Up",
+down:"Down",
+mcase:"Match case",
+findnext:"Find next",
+replace:"Replace",
+replaceall:"Replace all"
+});
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/searchreplace/readme.txt b/program/js/tiny_mce/plugins/searchreplace/readme.txt deleted file mode 100644 index 4fdb78aec..000000000 --- a/program/js/tiny_mce/plugins/searchreplace/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Check the TinyMCE documentation for details on this plugin.
diff --git a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm index 192e0cbc6..9c95a6a30 100644 --- a/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm +++ b/program/js/tiny_mce/plugins/searchreplace/searchreplace.htm @@ -1,39 +1,39 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<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>
+ <title>{#searchreplace_dlg.replace_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="js/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="#">
+<body style="display:none;">
+<form onsubmit="SearchReplaceDialog.searchNext('none');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>
+ <li id="search_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li>
+ <li id="replace_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.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><label for="search_panel_searchstring">{#searchreplace_dlg.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><label>{#searchreplace_dlg.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>
+ <td><label for="search_panel_backwardsu">{#searchreplace_dlg.up}</label></td>
+ <td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" checked="checked" /></td>
+ <td><label for="search_panel_backwardsd">{#searchreplace_dlg.down}</label></td>
</tr>
</table>
</td>
@@ -43,7 +43,7 @@ <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>
+ <td><label for="search_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>
</tr>
</table>
</td>
@@ -54,22 +54,22 @@ <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><label for="replace_panel_searchstring">{#searchreplace_dlg.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><label for="replace_panel_replacestring">{#searchreplace_dlg.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><label>{#searchreplace_dlg.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>
+ <td><label for="replace_panel_backwardsu">{#searchreplace_dlg.up}</label></td>
+ <td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" checked="checked" /></td>
+ <td><label for="replace_panel_backwardsd">{#searchreplace_dlg.down}</label></td>
</tr>
</table>
</td>
@@ -79,7 +79,7 @@ <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>
+ <td><label for="replace_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>
</tr>
</table>
</td>
@@ -91,15 +91,13 @@ <div class="mceActionPanel">
<div style="float: left">
- <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="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
+ <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
+ <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_searchreplace_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/spellchecker/changelog b/program/js/tiny_mce/plugins/spellchecker/changelog deleted file mode 100644 index 608fcd56d..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/changelog +++ /dev/null @@ -1,11 +0,0 @@ -Version 1.0.2 (2006-08-02)
- Added new spellchecker_report_mispellings option, contributed by Jeremy B.
- Fixed various regexp bugs and issues. Some where contributed by Jeremy B.
- Fixed the Google speller class so it uses curl, patch contributed by Yuriy Kramar.
- Fixed encoding issues with language specific characters, patch contributed by codepit.
- Fixed bug where the spellchecker wasn't working in MSIE if the editor was placed in a P tag.
-Version 1.0.1 (2006-05-05)
- Since sourceforge has a serious bug when it comes to replacing files with the same name this release was necessary.
- Goggle spellchecker class was added.
-Version 1.0 (2006-05-03)
- Official first release.
diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php deleted file mode 100644 index 7be929731..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyGoogleSpell.class.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php
-
-/* *
- * Tiny Spelling Interface for TinyMCE Spell Checking.
- *
- * Copyright © 2006 Moxiecode Systems AB
- */
-
-class TinyGoogleSpell {
- var $lang;
- var $spellurl;
-
- function TinyGoogleSpell(& $config, $lang, $mode, $spelling, $jargon, $encoding) {
- $this->lang = $lang;
- $this->spellurl = $config['googlespell.url'];
- }
-
- // Returns array with bad words or false if failed.
- function checkWords($word_array) {
- $words = array ();
- $wordstr = implode(' ', $word_array);
-
- $matches = $this->_getMatches($wordstr);
-
- for ($i = 0; $i < count($matches); $i++)
- $words[] = $this->unhtmlentities(mb_substr($wordstr, $matches[$i][1], $matches[$i][2], "UTF-8"));
-
- return $words;
- }
-
- function unhtmlentities($string) {
- $string = preg_replace('~&#x([0-9a-f]+);~ei', 'chr(hexdec("\\1"))', $string);
- $string = preg_replace('~&#([0-9]+);~e', 'chr(\\1)', $string);
-
- $trans_tbl = get_html_translation_table(HTML_ENTITIES);
- $trans_tbl = array_flip($trans_tbl);
-
- return strtr($string, $trans_tbl);
- }
-
- // Returns array with suggestions or false if failed.
- function getSuggestion($word) {
- $sug = array ();
-
- $matches = $this->_getMatches($word);
-
- if (count($matches) > 0)
- $sug = explode("\t", utf8_encode($this->unhtmlentities($matches[0][4])));
-
- return $sug;
- }
-
- function _xmlChars($string) {
- $trans = get_html_translation_table(HTML_ENTITIES, ENT_QUOTES);
-
- foreach ($trans as $k => $v)
- $trans[$k] = "&#" . ord($k) . ";";
-
- return strtr($string, $trans);
- }
-
- function _getMatches($word_list) {
- $url = $this->spellurl . "&" . $this->lang;
-
- $path = preg_replace("/^https?:\/\//i", "", $url);
-
- // Setup XML request
- $xml = '<?xml version="1.0" encoding="utf-8" ?><spellrequest textalreadyclipped="0" ignoredups="0" ignoredigits="1" ignoreallcaps="1"><text>' . $word_list . '</text></spellrequest>';
-
- $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);
-
- //$this->_debugData($xml);
-
- // Grab and parse content
- preg_match_all('/<c o="([^"]*)" l="([^"]*)" s="([^"]*)">([^<]*)<\/c>/', $xml, $matches, PREG_SET_ORDER);
-
- return $matches;
- }
-
- function _debugData($data) {
- $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/classes/TinyPspell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspell.class.php deleted file mode 100644 index 21fb19448..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspell.class.php +++ /dev/null @@ -1,64 +0,0 @@ -<?php
-/* *
- * Tiny Spelling Interface for TinyMCE Spell Checking.
- *
- * Copyright © 2006 Moxiecode Systems AB
- *
- */
-
-class TinyPSpell {
- var $lang;
- var $mode;
- var $string;
- var $plink;
- var $errorMsg;
-
- var $jargon;
- var $spelling;
- var $encoding;
-
- function TinyPSpell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
- $this->lang = $lang;
- $this->mode = $mode;
- $this->plink = false;
- $this->errorMsg = array();
-
- if (!function_exists("pspell_new")) {
- $this->errorMsg[] = "PSpell not found.";
- return;
- }
-
- $this->plink = pspell_new($this->lang, $this->spelling, $this->jargon, $this->encoding, $this->mode);
- }
-
- // Returns array with bad words or false if failed.
- function checkWords($wordArray) {
- if (!$this->plink) {
- $this->errorMsg[] = "No PSpell link found for checkWords.";
- return array();
- }
-
- $wordError = array();
- foreach($wordArray as $word) {
- if(!pspell_check($this->plink, trim($word)))
- $wordError[] = $word;
- }
-
- return $wordError;
- }
-
- // Returns array with suggestions or false if failed.
- function getSuggestion($word) {
- if (!$this->plink) {
- $this->errorMsg[] = "No PSpell link found for getSuggestion.";
- return array();
- }
-
- return pspell_suggest($this->plink, $word);
- }
-}
-
-// Setup classname, should be the same as the name of the spellchecker class
-$spellCheckerConfig['class'] = "TinyPspell";
-
-?>
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php b/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php deleted file mode 100644 index 348cac3d8..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/classes/TinyPspellShell.class.php +++ /dev/null @@ -1,121 +0,0 @@ -<?php
-/* *
- * Tiny Spelling Interface for TinyMCE Spell Checking.
- *
- * Copyright © 2006 Moxiecode Systems AB
- *
- */
-
-
-class TinyPspellShell {
- var $lang;
- var $mode;
- var $string;
- var $error;
- var $errorMsg;
-
- var $cmd;
- var $tmpfile;
-
- var $jargon;
- var $spelling;
- var $encoding;
-
- function TinyPspellShell(&$config, $lang, $mode, $spelling, $jargon, $encoding) {
- $this->lang = $lang;
- $this->mode = $mode;
- $this->error = false;
- $this->errorMsg = array();
-
- $this->tmpfile = tempnam($config['tinypspellshell.tmp'], "tinyspell");
-
- if(preg_match("#win#i",php_uname()))
- $this->cmd = $config['tinypspellshell.aspell'] . " -a --lang=". $this->lang." --encoding=utf-8 -H < $this->tmpfile 2>&1";
- else
- $this->cmd = "cat ". $this->tmpfile ." | " . $config['tinypspellshell.aspell'] . " -a --encoding=utf-8 -H --lang=". $this->lang;
- }
-
- // Returns array with bad words or false if failed.
- function checkWords($wordArray) {
- if ($fh = fopen($this->tmpfile, "w")) {
- fwrite($fh, "!\n");
- foreach($wordArray as $key => $value)
- fwrite($fh, "^" . $value . "\n");
- fclose($fh);
- } else {
- $this->errorMsg[] = "PSpell not found.";
- return array();
- }
-
- $data = shell_exec($this->cmd);
- @unlink($this->tmpfile);
-
- $returnData = array();
- $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
-
- foreach($dataArr as $dstr) {
- $matches = array();
-
- // Skip this line.
- if (strpos($dstr, "@") === 0)
- continue;
-
- preg_match("/\& (.*) .* .*: .*/i", $dstr, $matches);
-
- if (!empty($matches[1]))
- $returnData[] = $matches[1];
- }
-
- return $returnData;
- }
-
- // Returns array with suggestions or false if failed.
- function getSuggestion($word) {
- if (function_exists("mb_convert_encoding"))
- $word = mb_convert_encoding($word, "ISO-8859-1", mb_detect_encoding($word, "UTF-8"));
- else
- $word = utf8_encode($word);
-
- if ($fh = fopen($this->tmpfile, "w")) {
- fwrite($fh, "!\n");
- fwrite($fh, "^$word\n");
- fclose($fh);
- } else
- die("Error opening tmp file.");
-
- $data = shell_exec($this->cmd);
-
- @unlink($this->tmpfile);
-
- $returnData = array();
- $dataArr = preg_split("/\n/", $data, -1, PREG_SPLIT_NO_EMPTY);
-
- foreach($dataArr as $dstr) {
- $matches = array();
-
- // Skip this line.
- if (strpos($dstr, "@") === 0)
- continue;
-
- preg_match("/\& .* .* .*: (.*)/i", $dstr, $matches);
-
- if (!empty($matches[1])) {
- // For some reason, the exec version seems to add commas?
- $returnData[] = str_replace(",", "", $matches[1]);
- }
- }
- return $returnData;
- }
-
- function _debugData($data) {
- $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'] = "TinyPspellShell";
-
-?>
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/spellchecker/config.php b/program/js/tiny_mce/plugins/spellchecker/config.php deleted file mode 100644 index 6622248c0..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/config.php +++ /dev/null @@ -1,26 +0,0 @@ -<?php
- $spellCheckerConfig = array();
-
- // Spellchecker class use
- // require_once("classes/TinyPspellShell.class.php"); // Command line pspell
- require_once("classes/TinyGoogleSpell.class.php"); // Google web service
- // require_once("classes/TinyPspell.class.php"); // Internal PHP version
-
- // General settings
- $spellCheckerConfig['enabled'] = true;
-
- // Default settings
- $spellCheckerConfig['default.language'] = 'en';
- $spellCheckerConfig['default.mode'] = PSPELL_FAST;
-
- // Normaly not required to configure
- $spellCheckerConfig['default.spelling'] = "";
- $spellCheckerConfig['default.jargon'] = "";
- $spellCheckerConfig['default.encoding'] = "";
-
- // 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/spellchecker/css/content.css b/program/js/tiny_mce/plugins/spellchecker/css/content.css index fb82733cd..24efa0217 100644 --- a/program/js/tiny_mce/plugins/spellchecker/css/content.css +++ b/program/js/tiny_mce/plugins/spellchecker/css/content.css @@ -1,5 +1 @@ -.mceItemHiddenSpellWord {
- background: url('../images/wline.gif') repeat-x bottom left;
- bo2rder-bottom: 1px dashed red;
- cursor: default;
-}
+.mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
diff --git a/program/js/tiny_mce/plugins/spellchecker/css/spellchecker.css b/program/js/tiny_mce/plugins/spellchecker/css/spellchecker.css deleted file mode 100644 index aa4a8ea3b..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/css/spellchecker.css +++ /dev/null @@ -1,34 +0,0 @@ -.mceMsgBox {
- border: 1px solid gray;
- padding: 8px;
-}
-
-.mceMsgBox span {
- vertical-align: top;
- color: #555555;
-}
-
-/* Misc */
-
-.mceBlockBox {
- display: none;
- position: absolute;
- left: 0;
- top: 0;
- z-index: 100;
- filter:progid:DXImageTransform.Microsoft.Alpha(style=0, opacity=60);
- -moz-opacity:0.6;
- opacity: 0.6;
- background-color: white;
-}
-
-.mceMsgBox {
- display: none;
- z-index: 101;
- position: absolute;
- left: 0;
- top: 0;
- font-family: Arial, Verdana, Tahoma, Helvetica;
- font-weight: bold;
- font-size: 11px;
-}
diff --git a/program/js/tiny_mce/plugins/spellchecker/editor_plugin.js b/program/js/tiny_mce/plugins/spellchecker/editor_plugin.js index dbcda6a56..9cb679961 100644 --- a/program/js/tiny_mce/plugins/spellchecker/editor_plugin.js +++ b/program/js/tiny_mce/plugins/spellchecker/editor_plugin.js @@ -1 +1 @@ -tinyMCE.importPluginLanguagePack('spellchecker','en,fr,sv,nn,nb');var TinyMCE_SpellCheckerPlugin={_contextMenu:new TinyMCE_Menu(),_menu:new TinyMCE_Menu(),_counter:0,_ajaxPage:'/tinyspell.php',getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},handleEvent:function(e){var elm=tinyMCE.isMSIE?e.srcElement:e.target;var inst=tinyMCE.selectedInstance,args='';var self=TinyMCE_SpellCheckerPlugin;var cm=self._contextMenu;var p,p2,x,y,sx,sy,h,elm;if((e.type=="click"||e.type=="contextmenu")&&elm){do{if(tinyMCE.getAttrib(elm,'class')=="mceItemHiddenSpellWord"){inst.spellCheckerElm=elm;args+='id='+inst.editorId+"|"+(++self._counter);args+='&cmd=suggest&check='+encodeURIComponent(elm.innerHTML);args+='&lang='+escape(inst.spellCheckerLang);elm=inst.spellCheckerElm;p=tinyMCE.getAbsPosition(inst.iframeElement);p2=tinyMCE.getAbsPosition(elm);h=parseInt(elm.offsetHeight);sx=inst.getBody().scrollLeft;sy=inst.getBody().scrollTop;x=p.absLeft+p2.absLeft-sx;y=p.absTop+p2.absTop-sy+h;cm.clear();cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait','',true));cm.show();cm.moveTo(x,y);inst.selection.selectNode(elm,false,false);self._sendAjax(self.baseURL+self._ajaxPage,self._ajaxResponse,'post',args);tinyMCE.cancelEvent(e);return false;}}while((elm=elm.parentNode));}return true;},initInstance:function(inst){var self=TinyMCE_SpellCheckerPlugin,m=self._menu,cm=self._contextMenu,e;tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/plugins/spellchecker/css/content.css");if(!tinyMCE.hasMenu('spellcheckercontextmenu')){tinyMCE.importCSS(document,tinyMCE.baseURL+"/plugins/spellchecker/css/spellchecker.css");cm.init({drop_menu:false});tinyMCE.addMenu('spellcheckercontextmenu',cm);}if(!tinyMCE.hasMenu('spellcheckermenu')){m.init({});tinyMCE.addMenu('spellcheckermenu',m);}inst.spellCheckerLang='en';self._buildSettingsMenu(inst,null);e=self._getBlockBoxLayer(inst).create('div','mceBlockBox',document.getElementById(inst.editorId+'_parent'));self._getMsgBoxLayer(inst).create('div','mceMsgBox',document.getElementById(inst.editorId+'_parent'));},_getMsgBoxLayer:function(inst){if(!inst.spellCheckerMsgBoxL)inst.spellCheckerMsgBoxL=new TinyMCE_Layer(inst.editorId+'_spellcheckerMsgBox',false);return inst.spellCheckerMsgBoxL;},_getBlockBoxLayer:function(inst){if(!inst.spellCheckerBoxL)inst.spellCheckerBoxL=new TinyMCE_Layer(inst.editorId+'_spellcheckerBlockBox',false);return inst.spellCheckerBoxL;},_buildSettingsMenu:function(inst,lang){var i,ar=tinyMCE.getParam('spellchecker_languages','+English=en').split(','),p;var self=TinyMCE_SpellCheckerPlugin,m=self._menu,c;m.clear();m.addTitle(tinyMCE.getLang('lang_spellchecker_langs','',true));for(i=0;i<ar.length;i++){if(ar[i]!=''){p=ar[i].split('=');c='mceMenuCheckItem';if(p[0].charAt(0)=='+'){p[0]=p[0].substring(1);if(lang==null){c='mceMenuSelectedItem';inst.spellCheckerLang=p[1];}}if(lang==p[1])c='mceMenuSelectedItem';m.add({text:p[0],js:"tinyMCE.execInstanceCommand('"+inst.editorId+"','mceSpellCheckerSetLang',false,'"+p[1]+"');",class_name:c});}}},setupContent:function(editor_id,body,doc){TinyMCE_SpellCheckerPlugin._removeWords(doc);},getControlHTML:function(cn){switch(cn){case"spellchecker":return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn,'lang_spellchecker_desc','{$pluginurl}/images/spellchecker.gif','lang_spellchecker_desc','mceSpellCheckerMenu','mceSpellCheck');}return"";},_getMenuButtonHTML:function(id,lang,img,mlang,mid,cmd,ui,val){var h='',m,x;cmd='tinyMCE.hideMenus();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.isMSIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" title="{$'+lang+'}" />';h+='<img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" onclick="'+mcmd+'return false;" />';h+='</a>';}else{if(tinyMCE.isMSIE&&!tinyMCE.isOpera)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\''+mid+'\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>';}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.*$/,'');},_toggleMenu:function(editor_id,id){var self=TinyMCE_SpellCheckerPlugin;var e=document.getElementById(editor_id+'_spellchecker');var inst=tinyMCE.getInstanceById(editor_id);if(self._menu.isVisible()){tinyMCE.hideMenus();return;}tinyMCE.lastMenuBtnClass=e.className.replace(/\s.*$/,'');tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButtonFocus');self._menu.moveRelativeTo(e,'bl');self._menu.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?0:1,-1);if(tinyMCE.isOpera)self._menu.moveBy(0,-2);self._onMenuEvent(inst,self._menu,'show');self._menu.show();tinyMCE.lastSelectedMenuBtn=editor_id+'_spellchecker';},_onMenuEvent:function(inst,m,n){TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst,inst.spellCheckerLang);},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id),self=TinyMCE_SpellCheckerPlugin,args='',co,bb,mb,nl,i,e;switch(command){case"mceSpellCheck":if(!inst.spellcheckerOn){inst.spellCheckerBookmark=inst.selection.getBookmark();args+='id='+inst.editorId+"|"+(++self._counter);args+='&cmd=spell&check='+encodeURIComponent(self._getWordList(inst.getBody())).replace(/\'/g,'%27');args+='&lang='+escape(inst.spellCheckerLang);co=document.getElementById(inst.editorId+'_parent').firstChild;bb=self._getBlockBoxLayer(inst);bb.moveRelativeTo(co,'tl');bb.resizeTo(co.offsetWidth,co.offsetHeight);bb.show();mb=self._getMsgBoxLayer(inst);e=mb.getElement();e.innerHTML='<span>'+tinyMCE.getLang('lang_spellchecker_swait','',true)+'</span>';mb.show();mb.moveRelativeTo(co,'cc');if(tinyMCE.isMSIE&&!tinyMCE.isOpera){nl=co.getElementsByTagName('select');for(i=0;i<nl.length;i++)nl[i].disabled=true;}inst.spellcheckerOn=true;tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButtonSelected');self._sendAjax(self.baseURL+self._ajaxPage,self._ajaxResponse,'post',args);}else{self._removeWords(inst.getDoc());inst.spellcheckerOn=false;tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButton');}return true;case"mceSpellCheckReplace":if(inst.spellCheckerElm)tinyMCE.setOuterHTML(inst.spellCheckerElm,value);self._checkDone(inst);self._contextMenu.hide();self._menu.hide();return true;case"mceSpellCheckIgnore":if(inst.spellCheckerElm)self._removeWord(inst.spellCheckerElm);self._checkDone(inst);self._contextMenu.hide();self._menu.hide();return true;case"mceSpellCheckIgnoreAll":if(inst.spellCheckerElm)self._removeWords(inst.getDoc(),inst.spellCheckerElm.innerHTML);self._checkDone(inst);self._contextMenu.hide();self._menu.hide();return true;case"mceSpellCheckerSetLang":tinyMCE.hideMenus();inst.spellCheckerLang=value;self._removeWords(inst.getDoc());inst.spellcheckerOn=false;tinyMCE.switchClass(editor_id+'_spellchecker','mceMenuButton');return true;}return false;},cleanup:function(type,content,inst){switch(type){case"get_from_editor_dom":TinyMCE_SpellCheckerPlugin._removeWords(content);inst.spellcheckerOn=false;break;}return content;},_displayUI:function(inst){var self=TinyMCE_SpellCheckerPlugin;var bb=self._getBlockBoxLayer(inst);var mb=self._getMsgBoxLayer(inst);var nl,i;var co=document.getElementById(inst.editorId+'_parent').firstChild;if(tinyMCE.isMSIE&&!tinyMCE.isOpera){nl=co.getElementsByTagName('select');for(i=0;i<nl.length;i++)nl[i].disabled=false;}bb.hide();mb.hide();},_ajaxResponse:function(xml){var el=xml?xml.documentElement:null;var inst=tinyMCE.selectedInstance,self=TinyMCE_SpellCheckerPlugin;var cmd=el?el.getAttribute("cmd"):null,err,id=el?el.getAttribute("id"):null;if(id)inst=tinyMCE.getInstanceById(id.substring(0,id.indexOf('|')));self._displayUI(inst);if(cmd=="suggest"&&id!=inst.editorId+"|"+self._counter)return;if(!el){inst.spellcheckerOn=false;tinyMCE.switchClass(inst.editorId+'_spellchecker','mceMenuButton');alert("Could not execute AJAX call, server didn't return valid a XML.");return;}err=el.getAttribute("error");if(err=="true"){inst.spellcheckerOn=false;tinyMCE.switchClass(inst.editorId+'_spellchecker','mceMenuButton');alert(el.getAttribute("msg"));return;}switch(cmd){case"spell":if(xml.documentElement.firstChild){self._markWords(inst.getDoc(),inst.getBody(),decodeURIComponent(el.firstChild.nodeValue).split('+'));inst.selection.moveToBookmark(inst.spellCheckerBookmark);if(tinyMCE.getParam('spellchecker_report_mispellings',false))alert(tinyMCE.getLang('lang_spellchecker_mpell_found','',true,{words:self._countWords(inst)}));}else alert(tinyMCE.getLang('lang_spellchecker_no_mpell','',true));self._checkDone(inst);break;case"suggest":self._buildMenu(el.firstChild?decodeURIComponent(el.firstChild.nodeValue).split('+'):null,10);self._contextMenu.show();break;}},_getWordSeparators:function(){var i,re='',ch=tinyMCE.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}\u201d\u201c');for(i=0;i<ch.length;i++)re+='\\'+ch.charAt(i);return re;},_getWordList:function(n){var i,x,s,nv='',nl=tinyMCE.getNodeTree(n,new Array(),3),wl=new Array();var re=TinyMCE_SpellCheckerPlugin._getWordSeparators();for(i=0;i<nl.length;i++){if(!new RegExp('/SCRIPT|STYLE/').test(nl[i].parentNode.nodeName))nv+=nl[i].nodeValue+" ";}nv=nv.replace(new RegExp('([0-9]|['+re+'])','g'),' ');nv=tinyMCE.trim(nv.replace(/(\s+)/g,' '));nl=nv.split(/\s+/);for(i=0;i<nl.length;i++){s=false;for(x=0;x<wl.length;x++){if(wl[x]==nl[i]){s=true;break;}}if(!s&&nl[i].length>0)wl[wl.length]=nl[i];}return wl.join(' ');},_removeWords:function(doc,word){var i,c,nl=doc.getElementsByTagName("span");var self=TinyMCE_SpellCheckerPlugin;var inst=tinyMCE.selectedInstance,b=inst?inst.selection.getBookmark():null;word=typeof(word)=='undefined'?null:word;for(i=nl.length-1;i>=0;i--){c=tinyMCE.getAttrib(nl[i],'class');if((c=='mceItemHiddenSpellWord'||c=='mceItemHidden')&&(word==null||nl[i].innerHTML==word))self._removeWord(nl[i]);}if(b)inst.selection.moveToBookmark(b);},_checkDone:function(inst){var self=TinyMCE_SpellCheckerPlugin;var w=self._countWords(inst);if(w==0){self._removeWords(inst.getDoc());inst.spellcheckerOn=false;tinyMCE.switchClass(inst.editorId+'_spellchecker','mceMenuButton');}},_countWords:function(inst){var i,w=0,nl=inst.getDoc().getElementsByTagName("span"),c;var self=TinyMCE_SpellCheckerPlugin;for(i=nl.length-1;i>=0;i--){c=tinyMCE.getAttrib(nl[i],'class');if(c=='mceItemHiddenSpellWord')w++;}return w;},_removeWord:function(e){if(e!=null)tinyMCE.setOuterHTML(e,e.innerHTML);},_markWords:function(doc,n,wl){var i,nv,nn,nl=tinyMCE.getNodeTree(n,new Array(),3);var r1,r2,r3,r4,r5,w='';var re=TinyMCE_SpellCheckerPlugin._getWordSeparators();for(i=0;i<wl.length;i++){if(wl[i].length>0)w+=wl[i]+((i==wl.length-1)?'':'|');}for(i=0;i<nl.length;i++){nv=nl[i].nodeValue;r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');if(r1.test(nv)||r2.test(nv)||r3.test(nv)||r4.test(nv)){nv=tinyMCE.xmlEncode(nv);nv=nv.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');nv=nv.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');nn=doc.createElement('span');nn.className="mceItemHidden";nn.innerHTML=nv;nl[i].parentNode.replaceChild(nn,nl[i]);}}},_buildMenu:function(sg,max){var i,self=TinyMCE_SpellCheckerPlugin,cm=self._contextMenu;cm.clear();if(sg!=null){cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug','',true));for(i=0;i<sg.length&&i<max;i++)cm.addItem(sg[i],'tinyMCE.execCommand("mceSpellCheckReplace",false,"'+sg[i]+'");');cm.addSeparator();}else cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug','',true));cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word','',true),'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words','',true),'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');cm.update();},_getAjaxHTTP:function(){try{return new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{return new ActiveXObject('Microsoft.XMLHTTP')}catch(e){return new XMLHttpRequest();}}},_sendAjax:function(u,f,m,a){var x=TinyMCE_SpellCheckerPlugin._getAjaxHTTP();x.open(m,u,true);x.onreadystatechange=function(){if(x.readyState==4)f(x.responseXML);};if(m=='post')x.setRequestHeader('Content-type','application/x-www-form-urlencoded');x.send(a);}};tinyMCE.addPlugin('spellchecker',TinyMCE_SpellCheckerPlugin);
\ No newline at end of file +(function(){var JSONRequest=tinymce.util.JSONRequest,each=tinymce.each,DOM=tinymce.DOM;tinymce.create('tinymce.plugins.SpellcheckerPlugin',{getInfo:function(){return{longname:'Spellchecker',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',version:tinymce.majorVersion+"."+tinymce.minorVersion};},init:function(ed,url){var t=this,cm;t.url=url;t.editor=ed;ed.addCommand('mceSpellCheck',function(){if(!t.active){ed.setProgressState(1);t._sendRPC('checkWords',[t.selectedLang,t._getWords()],function(r){if(r.length>0){t.active=1;t._markWords(r);ed.setProgressState(0);ed.nodeChanged();}else{ed.setProgressState(0);ed.windowManager.alert('spellchecker.no_mpell');}});}else t._done();});ed.onInit.add(function(){if(ed.settings.content_css!==false)ed.dom.loadCSS(url+'/css/content.css');});ed.onClick.add(t._showMenu,t);ed.onContextMenu.add(t._showMenu,t);ed.onBeforeGetContent.add(function(){if(t.active)t._removeWords();});ed.onNodeChange.add(function(ed,cm){cm.setActive('spellchecker',t.active);});ed.onSetContent.add(function(){t._done();});ed.onBeforeGetContent.add(function(){t._done();});ed.onBeforeExecCommand.add(function(ed,cmd){if(cmd=='mceFullScreen')t._done();});t.languages={};each(ed.getParam('spellchecker_languages','+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv','hash'),function(v,k){if(k.indexOf('+')===0){k=k.substring(1);t.selectedLang=v;}t.languages[k]=v;});},createControl:function(n,cm){var t=this,c,ed=t.editor;if(n=='spellchecker'){c=cm.createSplitButton(n,{title:'spellchecker.desc',cmd:'mceSpellCheck',scope:t});c.onRenderMenu.add(function(c,m){m.add({title:'spellchecker.langs','class':'mceMenuItemTitle'}).setDisabled(1);each(t.languages,function(v,k){var o={icon:1},mi;o.onclick=function(){mi.setSelected(1);t.selectedItem.setSelected(0);t.selectedItem=mi;t.selectedLang=v;};o.title=k;mi=m.add(o);mi.setSelected(v==t.selectedLang);if(v==t.selectedLang)t.selectedItem=mi;})});return c;}},_walk:function(n,f){var d=this.editor.getDoc(),w;if(d.createTreeWalker){w=d.createTreeWalker(n,NodeFilter.SHOW_TEXT,null,false);while((n=w.nextNode())!=null)f.call(this,n);}else tinymce.walk(n,f,'childNodes');},_getSeparators:function(){var re='',i,str=this.editor.getParam('spellchecker_word_separator_chars','\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c');for(i=0;i<str.length;i++)re+='\\'+str.charAt(i);return re;},_getWords:function(){var ed=this.editor,wl=[],tx='',lo={};this._walk(ed.getBody(),function(n){if(n.nodeType==3)tx+=n.nodeValue+' ';});tx=tx.replace(new RegExp('([0-9]|['+this._getSeparators()+'])','g'),' ');tx=tinymce.trim(tx.replace(/(\s+)/g,' '));each(tx.split(' '),function(v){if(!lo[v]){wl.push(v);lo[v]=1;}});return wl;},_removeWords:function(w){var ed=this.editor,dom=ed.dom,se=ed.selection,b=se.getBookmark();each(dom.select('span').reverse(),function(n){if(n&&(dom.hasClass(n,'mceItemHiddenSpellWord')||dom.hasClass(n,'mceItemHidden'))){if(!w||dom.decode(n.innerHTML)==w)dom.remove(n,1);}});se.moveToBookmark(b);},_markWords:function(wl){var r1,r2,r3,r4,r5,w='',ed=this.editor,re=this._getSeparators(),dom=ed.dom,nl=[];var se=ed.selection,b=se.getBookmark();each(wl,function(v){w+=(w?'|':'')+v;});r1=new RegExp('(['+re+'])('+w+')(['+re+'])','g');r2=new RegExp('^('+w+')','g');r3=new RegExp('('+w+')(['+re+']?)$','g');r4=new RegExp('^('+w+')(['+re+']?)$','g');r5=new RegExp('('+w+')(['+re+'])','g');this._walk(this.editor.getBody(),function(n){if(n.nodeType==3){nl.push(n);}});each(nl,function(n){var v;if(n.nodeType==3){v=n.nodeValue;if(r1.test(v)||r2.test(v)||r3.test(v)||r4.test(v)){v=dom.encode(v);v=v.replace(r5,'<span class="mceItemHiddenSpellWord">$1</span>$2');v=v.replace(r3,'<span class="mceItemHiddenSpellWord">$1</span>$2');dom.replace(dom.create('span',{'class':'mceItemHidden'},v),n);}}});se.moveToBookmark(b);},_showMenu:function(ed,e){var t=this,ed=t.editor,m=t._menu,p1,dom=ed.dom,vp=dom.getViewPort(ed.getWin());if(!m){p1=DOM.getPos(ed.getContentAreaContainer());m=ed.controlManager.createDropMenu('spellcheckermenu',{offset_x:p1.x,offset_y:p1.y,'class':'mceNoIcons'});t._menu=m;}if(dom.hasClass(e.target,'mceItemHiddenSpellWord')){m.removeAll();m.add({title:'spellchecker.wait','class':'mceMenuItemTitle'}).setDisabled(1);t._sendRPC('getSuggestions',[t.selectedLang,dom.decode(e.target.innerHTML)],function(r){m.removeAll();if(r.length>0){m.add({title:'spellchecker.sug','class':'mceMenuItemTitle'}).setDisabled(1);each(r,function(v){m.add({title:v,onclick:function(){dom.replace(ed.getDoc().createTextNode(v),e.target);t._checkDone();}});});m.addSeparator();}else m.add({title:'spellchecker.no_sug','class':'mceMenuItemTitle'}).setDisabled(1);m.add({title:'spellchecker.ignore_word',onclick:function(){dom.remove(e.target,1);t._checkDone();}});m.add({title:'spellchecker.ignore_words',onclick:function(){t._removeWords(dom.decode(e.target.innerHTML));t._checkDone();}});m.update();});ed.selection.select(e.target);p1=dom.getPos(e.target);m.showMenu(p1.x,p1.y+e.target.offsetHeight-vp.y);return tinymce.dom.Event.cancel(e);}else m.hideMenu();},_checkDone:function(){var t=this,ed=t.editor,dom=ed.dom,o;each(dom.select('span'),function(n){if(n&&dom.hasClass(n,'mceItemHiddenSpellWord')){o=true;return false;}});if(!o)t._done();},_done:function(){var t=this,la=t.active;if(t.active){t.active=0;t._removeWords();if(t._menu)t._menu.hideMenu();if(la)t.editor.nodeChanged();}},_sendRPC:function(m,p,cb){var t=this,url=t.editor.getParam("spellchecker_rpc_url","{backend}");if(url=='{backend}'){t.editor.setProgressState(0);alert('Please specify: spellchecker_rpc_url');return;}JSONRequest.sendRPC({url:url,method:m,params:p,success:cb,error:function(e,x){t.editor.setProgressState(0);t.editor.windowManager.alert(e.errstr||('Error response: '+x.responseText));}});}});tinymce.PluginManager.add('spellchecker',tinymce.plugins.SpellcheckerPlugin);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js b/program/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js index 196d24640..c913c4603 100644 --- a/program/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/spellchecker/editor_plugin_src.js @@ -1,588 +1,338 @@ /**
- * $Id: editor_plugin_src.js 28 2006-08-01 16:02:56Z spocke $
+ * $Id: editor_plugin_src.js 425 2007-11-21 15:17:39Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-tinyMCE.importPluginLanguagePack('spellchecker', 'en,fr,sv,nn,nb');
-
-// Plucin static class
-var TinyMCE_SpellCheckerPlugin = {
- _contextMenu : new TinyMCE_Menu(),
- _menu : new TinyMCE_Menu(),
- _counter : 0,
- _ajaxPage : '/tinyspell.php',
-
- getInfo : function() {
- return {
- longname : 'Spellchecker',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_spellchecker.html',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- handleEvent : function(e) {
- var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
- var inst = tinyMCE.selectedInstance, args = '';
- var self = TinyMCE_SpellCheckerPlugin;
- var cm = self._contextMenu;
- var p, p2, x, y, sx, sy, h, elm;
-
- // Handle click on word
- if ((e.type == "click" || e.type == "contextmenu") && elm) {
- do {
- if (tinyMCE.getAttrib(elm, 'class') == "mceItemHiddenSpellWord") {
- inst.spellCheckerElm = elm;
-
- // Setup arguments
- args += 'id=' + inst.editorId + "|" + (++self._counter);
- args += '&cmd=suggest&check=' + encodeURIComponent(elm.innerHTML);
- args += '&lang=' + escape(inst.spellCheckerLang);
-
- elm = inst.spellCheckerElm;
- p = tinyMCE.getAbsPosition(inst.iframeElement);
- p2 = tinyMCE.getAbsPosition(elm);
- h = parseInt(elm.offsetHeight);
- sx = inst.getBody().scrollLeft;
- sy = inst.getBody().scrollTop;
- x = p.absLeft + p2.absLeft - sx;
- y = p.absTop + p2.absTop - sy + h;
-
- cm.clear();
- cm.addTitle(tinyMCE.getLang('lang_spellchecker_wait', '', true));
- cm.show();
- cm.moveTo(x, y);
-
- inst.selection.selectNode(elm, false, false);
-
- self._sendAjax(self.baseURL + self._ajaxPage, self._ajaxResponse, 'post', args);
-
- tinyMCE.cancelEvent(e);
- return false;
+(function() {
+ var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
+
+ tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
+ getInfo : function() {
+ return {
+ longname : 'Spellchecker',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ init : function(ed, url) {
+ var t = this, cm;
+
+ t.url = url;
+ t.editor = ed;
+
+ // Register commands
+ ed.addCommand('mceSpellCheck', function() {
+ if (!t.active) {
+ ed.setProgressState(1);
+ t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
+ if (r.length > 0) {
+ t.active = 1;
+ t._markWords(r);
+ ed.setProgressState(0);
+ ed.nodeChanged();
+ } else {
+ ed.setProgressState(0);
+ ed.windowManager.alert('spellchecker.no_mpell');
+ }
+ });
+ } else
+ t._done();
+ });
+
+ ed.onInit.add(function() {
+ if (ed.settings.content_css !== false)
+ ed.dom.loadCSS(url + '/css/content.css');
+ });
+
+ ed.onClick.add(t._showMenu, t);
+ ed.onContextMenu.add(t._showMenu, t);
+ ed.onBeforeGetContent.add(function() {
+ if (t.active)
+ t._removeWords();
+ });
+
+ ed.onNodeChange.add(function(ed, cm) {
+ cm.setActive('spellchecker', t.active);
+ });
+
+ ed.onSetContent.add(function() {
+ t._done();
+ });
+
+ ed.onBeforeGetContent.add(function() {
+ t._done();
+ });
+
+ ed.onBeforeExecCommand.add(function(ed, cmd) {
+ if (cmd == 'mceFullScreen')
+ t._done();
+ });
+
+ // Find selected language
+ t.languages = {};
+ each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
+ if (k.indexOf('+') === 0) {
+ k = k.substring(1);
+ t.selectedLang = v;
}
- } while ((elm = elm.parentNode));
- }
-
- return true;
- },
-
- initInstance : function(inst) {
- var self = TinyMCE_SpellCheckerPlugin, m = self._menu, cm = self._contextMenu, e;
-
- tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/plugins/spellchecker/css/content.css");
-
- if (!tinyMCE.hasMenu('spellcheckercontextmenu')) {
- tinyMCE.importCSS(document, tinyMCE.baseURL + "/plugins/spellchecker/css/spellchecker.css");
-
- cm.init({drop_menu : false});
- tinyMCE.addMenu('spellcheckercontextmenu', cm);
- }
-
- if (!tinyMCE.hasMenu('spellcheckermenu')) {
- m.init({});
- tinyMCE.addMenu('spellcheckermenu', m);
- }
-
- inst.spellCheckerLang = 'en';
- self._buildSettingsMenu(inst, null);
-
- e = self._getBlockBoxLayer(inst).create('div', 'mceBlockBox', document.getElementById(inst.editorId + '_parent'));
- self._getMsgBoxLayer(inst).create('div', 'mceMsgBox', document.getElementById(inst.editorId + '_parent'));
- },
-
- _getMsgBoxLayer : function(inst) {
- if (!inst.spellCheckerMsgBoxL)
- inst.spellCheckerMsgBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerMsgBox', false);
- return inst.spellCheckerMsgBoxL;
- },
+ t.languages[k] = v;
+ });
+ },
- _getBlockBoxLayer : function(inst) {
- if (!inst.spellCheckerBoxL)
- inst.spellCheckerBoxL = new TinyMCE_Layer(inst.editorId + '_spellcheckerBlockBox', false);
+ createControl : function(n, cm) {
+ var t = this, c, ed = t.editor;
- return inst.spellCheckerBoxL;
- },
+ if (n == 'spellchecker') {
+ c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
- _buildSettingsMenu : function(inst, lang) {
- var i, ar = tinyMCE.getParam('spellchecker_languages', '+English=en').split(','), p;
- var self = TinyMCE_SpellCheckerPlugin, m = self._menu, c;
+ c.onRenderMenu.add(function(c, m) {
+ m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+ each(t.languages, function(v, k) {
+ var o = {icon : 1}, mi;
- m.clear();
- m.addTitle(tinyMCE.getLang('lang_spellchecker_langs', '', true));
+ o.onclick = function() {
+ mi.setSelected(1);
+ t.selectedItem.setSelected(0);
+ t.selectedItem = mi;
+ t.selectedLang = v;
+ };
- for (i=0; i<ar.length; i++) {
- if (ar[i] != '') {
- p = ar[i].split('=');
- c = 'mceMenuCheckItem';
+ o.title = k;
+ mi = m.add(o);
+ mi.setSelected(v == t.selectedLang);
- if (p[0].charAt(0) == '+') {
- p[0] = p[0].substring(1);
+ if (v == t.selectedLang)
+ t.selectedItem = mi;
+ })
+ });
- if (lang == null) {
- c = 'mceMenuSelectedItem';
- inst.spellCheckerLang = p[1];
- }
- }
-
- if (lang == p[1])
- c = 'mceMenuSelectedItem';
-
- m.add({text : p[0], js : "tinyMCE.execInstanceCommand('" + inst.editorId + "','mceSpellCheckerSetLang',false,'" + p[1] + "');", class_name : c});
+ return c;
}
- }
- },
-
- setupContent : function(editor_id, body, doc) {
- TinyMCE_SpellCheckerPlugin._removeWords(doc);
- },
-
- getControlHTML : function(cn) {
- switch (cn) {
- case "spellchecker":
- return TinyMCE_SpellCheckerPlugin._getMenuButtonHTML(cn, 'lang_spellchecker_desc', '{$pluginurl}/images/spellchecker.gif', 'lang_spellchecker_desc', 'mceSpellCheckerMenu', 'mceSpellCheck');
- }
-
- return "";
- },
-
- /**
- * Returns the HTML code for a normal button control.
- *
- * @param {string} id Button control id, this will be the suffix for the element id, the prefix is the editor id.
- * @param {string} lang Language variable key name to insert as the title/alt of the button image.
- * @param {string} img Image URL to insert, {$themeurl} and {$pluginurl} will be replaced.
- * @param {string} mlang Language variable key name to insert as the title/alt of the menu button image.
- * @param {string} mid Menu by id to display when the menu button is pressed.
- * @param {string} cmd Command to execute when the user clicks the button.
- * @param {string} ui Optional user interface boolean for command.
- * @param {string} val Optional value for command.
- * @return HTML code for a normal button based in input information.
- * @type string
- */
- _getMenuButtonHTML : function(id, lang, img, mlang, mid, cmd, ui, val) {
- var h = '', m, x;
-
- cmd = 'tinyMCE.hideMenus();tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
-
- if (typeof(ui) != "undefined" && ui != null)
- cmd += ',' + ui;
-
- if (typeof(val) != "undefined" && val != null)
- cmd += ",'" + val + "'";
-
- cmd += ');';
-
- // Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
- if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isMSIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
- // Tiled button
- x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
- h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceButtonNormal" target="_self">';
- h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" title="{$' + lang + '}" />';
- h += '<img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" onclick="' + mcmd + 'return false;" />';
- h += '</a>';
- } else {
- if (tinyMCE.isMSIE && !tinyMCE.isOpera)
- h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE.plugins.spellchecker._menuButtonEvent(\'over\',this);" onmouseout="tinyMCE.plugins.spellchecker._menuButtonEvent(\'out\',this);">';
- else
- h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
-
- h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
- h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
- h += '<a href="#" onclick="tinyMCE.plugins.spellchecker._toggleMenu(\'{$editor_id}\',\'' + mid + '\');return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
- h += '</a></span>';
- }
-
- 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.*$/, '');
- },
+ },
- _toggleMenu : function(editor_id, id) {
- var self = TinyMCE_SpellCheckerPlugin;
- var e = document.getElementById(editor_id + '_spellchecker');
- var inst = tinyMCE.getInstanceById(editor_id);
+ // Internal functions
- if (self._menu.isVisible()) {
- tinyMCE.hideMenus();
- return;
- }
-
- tinyMCE.lastMenuBtnClass = e.className.replace(/\s.*$/, '');
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonFocus');
-
- self._menu.moveRelativeTo(e, 'bl');
- self._menu.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? 0 : 1, -1);
-
- if (tinyMCE.isOpera)
- self._menu.moveBy(0, -2);
-
- self._onMenuEvent(inst, self._menu, 'show');
-
- self._menu.show();
-
- tinyMCE.lastSelectedMenuBtn = editor_id + '_spellchecker';
- },
+ _walk : function(n, f) {
+ var d = this.editor.getDoc(), w;
- _onMenuEvent : function(inst, m, n) {
- TinyMCE_SpellCheckerPlugin._buildSettingsMenu(inst, inst.spellCheckerLang);
- },
+ if (d.createTreeWalker) {
+ w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
- execCommand : function(editor_id, element, command, user_interface, value) {
- var inst = tinyMCE.getInstanceById(editor_id), self = TinyMCE_SpellCheckerPlugin, args = '', co, bb, mb, nl, i, e;
+ while ((n = w.nextNode()) != null)
+ f.call(this, n);
+ } else
+ tinymce.walk(n, f, 'childNodes');
+ },
- // Handle commands
- switch (command) {
- case "mceSpellCheck":
- if (!inst.spellcheckerOn) {
- inst.spellCheckerBookmark = inst.selection.getBookmark();
+ _getSeparators : function() {
+ var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
- // Setup arguments
- args += 'id=' + inst.editorId + "|" + (++self._counter);
- args += '&cmd=spell&check=' + encodeURIComponent(self._getWordList(inst.getBody())).replace( /\'/g, '%27' );
- args += '&lang=' + escape(inst.spellCheckerLang);
+ // Build word separator regexp
+ for (i=0; i<str.length; i++)
+ re += '\\' + str.charAt(i);
- co = document.getElementById(inst.editorId + '_parent').firstChild;
- bb = self._getBlockBoxLayer(inst);
- bb.moveRelativeTo(co, 'tl');
- bb.resizeTo(co.offsetWidth, co.offsetHeight);
- bb.show();
+ return re;
+ },
- // Setup message box
- mb = self._getMsgBoxLayer(inst);
- e = mb.getElement();
- e.innerHTML = '<span>' + tinyMCE.getLang('lang_spellchecker_swait', '', true) + '</span>';
- mb.show();
- mb.moveRelativeTo(co, 'cc');
+ _getWords : function() {
+ var ed = this.editor, wl = [], tx = '', lo = {};
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
- nl = co.getElementsByTagName('select');
- for (i=0; i<nl.length; i++)
- nl[i].disabled = true;
- }
+ // Get area text
+ this._walk(ed.getBody(), function(n) {
+ if (n.nodeType == 3)
+ tx += n.nodeValue + ' ';
+ });
- inst.spellcheckerOn = true;
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButtonSelected');
+ // Split words by separator
+ tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
+ tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
- self._sendAjax(self.baseURL + self._ajaxPage, self._ajaxResponse, 'post', args);
- } else {
- self._removeWords(inst.getDoc());
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
+ // Build word array and remove duplicates
+ each(tx.split(' '), function(v) {
+ if (!lo[v]) {
+ wl.push(v);
+ lo[v] = 1;
}
+ });
- return true;
-
- case "mceSpellCheckReplace":
- if (inst.spellCheckerElm)
- tinyMCE.setOuterHTML(inst.spellCheckerElm, value);
-
- self._checkDone(inst);
- self._contextMenu.hide();
- self._menu.hide();
-
- return true;
-
- case "mceSpellCheckIgnore":
- if (inst.spellCheckerElm)
- self._removeWord(inst.spellCheckerElm);
-
- self._checkDone(inst);
- self._contextMenu.hide();
- self._menu.hide();
- return true;
-
- case "mceSpellCheckIgnoreAll":
- if (inst.spellCheckerElm)
- self._removeWords(inst.getDoc(), inst.spellCheckerElm.innerHTML);
-
- self._checkDone(inst);
- self._contextMenu.hide();
- self._menu.hide();
- return true;
-
- case "mceSpellCheckerSetLang":
- tinyMCE.hideMenus();
- inst.spellCheckerLang = value;
- self._removeWords(inst.getDoc());
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(editor_id + '_spellchecker', 'mceMenuButton');
- return true;
- }
-
- // Pass to next handler in chain
- return false;
- },
-
- cleanup : function(type, content, inst) {
- switch (type) {
- case "get_from_editor_dom":
- TinyMCE_SpellCheckerPlugin._removeWords(content);
- inst.spellcheckerOn = false;
- break;
- }
-
- return content;
- },
-
- // Private plugin specific methods
-
- _displayUI : function(inst) {
- var self = TinyMCE_SpellCheckerPlugin;
- var bb = self._getBlockBoxLayer(inst);
- var mb = self._getMsgBoxLayer(inst);
- var nl, i;
- var co = document.getElementById(inst.editorId + '_parent').firstChild;
-
- if (tinyMCE.isMSIE && !tinyMCE.isOpera) {
- nl = co.getElementsByTagName('select');
- for (i=0; i<nl.length; i++)
- nl[i].disabled = false;
- }
-
- bb.hide();
- mb.hide();
- },
-
- _ajaxResponse : function(xml) {
- var el = xml ? xml.documentElement : null;
- var inst = tinyMCE.selectedInstance, self = TinyMCE_SpellCheckerPlugin;
- var cmd = el ? el.getAttribute("cmd") : null, err, id = el ? el.getAttribute("id") : null;
+ return wl;
+ },
- if (id)
- inst = tinyMCE.getInstanceById(id.substring(0, id.indexOf('|')));
+ _removeWords : function(w) {
+ var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
- self._displayUI(inst);
-
- // Ignore suggestions for other ajax responses
- if (cmd == "suggest" && id != inst.editorId + "|" + self._counter)
- return;
-
- if (!el) {
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
- alert("Could not execute AJAX call, server didn't return valid a XML.");
- return;
- }
-
- err = el.getAttribute("error");
-
- if (err == "true") {
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
- alert(el.getAttribute("msg"));
- return;
- }
-
- switch (cmd) {
- case "spell":
- if (xml.documentElement.firstChild) {
- self._markWords(inst.getDoc(), inst.getBody(), decodeURIComponent(el.firstChild.nodeValue).split('+'));
- inst.selection.moveToBookmark(inst.spellCheckerBookmark);
-
- if(tinyMCE.getParam('spellchecker_report_mispellings', false))
- alert(tinyMCE.getLang('lang_spellchecker_mpell_found', '', true, {words : self._countWords(inst)}));
- } else
- alert(tinyMCE.getLang('lang_spellchecker_no_mpell', '', true));
-
- self._checkDone(inst);
-
- break;
-
- case "suggest":
- self._buildMenu(el.firstChild ? decodeURIComponent(el.firstChild.nodeValue).split('+') : null, 10);
- self._contextMenu.show();
- break;
- }
- },
-
- _getWordSeparators : function() {
- var i, re = '', ch = tinyMCE.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
-
- for (i=0; i<ch.length; i++)
- re += '\\' + ch.charAt(i);
-
- return re;
- },
-
- _getWordList : function(n) {
- var i, x, s, nv = '', nl = tinyMCE.getNodeTree(n, new Array(), 3), wl = new Array();
- var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
-
- for (i=0; i<nl.length; i++) {
- if (!new RegExp('/SCRIPT|STYLE/').test(nl[i].parentNode.nodeName))
- nv += nl[i].nodeValue + " ";
- }
-
- nv = nv.replace(new RegExp('([0-9]|[' + re + '])', 'g'), ' ');
- nv = tinyMCE.trim(nv.replace(/(\s+)/g, ' '));
-
- nl = nv.split(/\s+/);
- for (i=0; i<nl.length; i++) {
- s = false;
- for (x=0; x<wl.length; x++) {
- if (wl[x] == nl[i]) {
- s = true;
- break;
+ each(dom.select('span').reverse(), function(n) {
+ if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
+ if (!w || dom.decode(n.innerHTML) == w)
+ dom.remove(n, 1);
}
- }
-
- if (!s && nl[i].length > 0)
- wl[wl.length] = nl[i];
- }
+ });
- return wl.join(' ');
- },
+ se.moveToBookmark(b);
+ },
- _removeWords : function(doc, word) {
- var i, c, nl = doc.getElementsByTagName("span");
- var self = TinyMCE_SpellCheckerPlugin;
- var inst = tinyMCE.selectedInstance, b = inst ? inst.selection.getBookmark() : null;
+ _markWords : function(wl) {
+ var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = [];
+ var se = ed.selection, b = se.getBookmark();
- word = typeof(word) == 'undefined' ? null : word;
-
- for (i=nl.length-1; i>=0; i--) {
- c = tinyMCE.getAttrib(nl[i], 'class');
-
- if ((c == 'mceItemHiddenSpellWord' || c == 'mceItemHidden') && (word == null || nl[i].innerHTML == word))
- self._removeWord(nl[i]);
- }
+ each(wl, function(v) {
+ w += (w ? '|' : '') + v;
+ });
- if (b)
- inst.selection.moveToBookmark(b);
- },
-
- _checkDone : function(inst) {
- var self = TinyMCE_SpellCheckerPlugin;
- var w = self._countWords(inst);
-
- if (w == 0) {
- self._removeWords(inst.getDoc());
- inst.spellcheckerOn = false;
- tinyMCE.switchClass(inst.editorId + '_spellchecker', 'mceMenuButton');
- }
- },
-
- _countWords : function(inst) {
- var i, w = 0, nl = inst.getDoc().getElementsByTagName("span"), c;
- var self = TinyMCE_SpellCheckerPlugin;
+ r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
+ r2 = new RegExp('^(' + w + ')', 'g');
+ r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
+ r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
+ r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
- for (i=nl.length-1; i>=0; i--) {
- c = tinyMCE.getAttrib(nl[i], 'class');
+ // Collect all text nodes
+ this._walk(this.editor.getBody(), function(n) {
+ if (n.nodeType == 3) {
+ nl.push(n);
+ }
+ });
- if (c == 'mceItemHiddenSpellWord')
- w++;
- }
+ // Wrap incorrect words in spans
+ each(nl, function(n) {
+ var v;
- return w;
- },
+ if (n.nodeType == 3) {
+ v = n.nodeValue;
- _removeWord : function(e) {
- if (e != null)
- tinyMCE.setOuterHTML(e, e.innerHTML);
- },
+ if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) {
+ v = dom.encode(v);
+ v = v.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
+ v = v.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
- _markWords : function(doc, n, wl) {
- var i, nv, nn, nl = tinyMCE.getNodeTree(n, new Array(), 3);
- var r1, r2, r3, r4, r5, w = '';
- var re = TinyMCE_SpellCheckerPlugin._getWordSeparators();
+ dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n);
+ }
+ }
+ });
- for (i=0; i<wl.length; i++) {
- if (wl[i].length > 0)
- w += wl[i] + ((i == wl.length-1) ? '' : '|');
- }
+ se.moveToBookmark(b);
+ },
- for (i=0; i<nl.length; i++) {
- nv = nl[i].nodeValue;
- r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
- r2 = new RegExp('^(' + w + ')', 'g');
- r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
- r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
- r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
+ _showMenu : function(ed, e) {
+ var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin());
- if (r1.test(nv) || r2.test(nv) || r3.test(nv) || r4.test(nv)) {
- nv = tinyMCE.xmlEncode(nv);
- nv = nv.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
- nv = nv.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
+ if (!m) {
+ p1 = DOM.getPos(ed.getContentAreaContainer());
+ //p2 = DOM.getPos(ed.getContainer());
- nn = doc.createElement('span');
- nn.className = "mceItemHidden";
- nn.innerHTML = nv;
+ m = ed.controlManager.createDropMenu('spellcheckermenu', {
+ offset_x : p1.x,
+ offset_y : p1.y,
+ 'class' : 'mceNoIcons'
+ });
- // Remove old text node
- nl[i].parentNode.replaceChild(nn, nl[i]);
+ t._menu = m;
}
- }
- },
- _buildMenu : function(sg, max) {
- var i, self = TinyMCE_SpellCheckerPlugin, cm = self._contextMenu;
+ if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) {
+ m.removeAll();
+ m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+
+ t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) {
+ m.removeAll();
+
+ if (r.length > 0) {
+ m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+ each(r, function(v) {
+ m.add({title : v, onclick : function() {
+ dom.replace(ed.getDoc().createTextNode(v), e.target);
+ t._checkDone();
+ }});
+ });
+
+ m.addSeparator();
+ } else
+ m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+
+ m.add({
+ title : 'spellchecker.ignore_word',
+ onclick : function() {
+ dom.remove(e.target, 1);
+ t._checkDone();
+ }
+ });
+
+ m.add({
+ title : 'spellchecker.ignore_words',
+ onclick : function() {
+ t._removeWords(dom.decode(e.target.innerHTML));
+ t._checkDone();
+ }
+ });
+
+ m.update();
+ });
+
+ ed.selection.select(e.target);
+ p1 = dom.getPos(e.target);
+ m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
+
+ return tinymce.dom.Event.cancel(e);
+ } else
+ m.hideMenu();
+ },
+
+ _checkDone : function() {
+ var t = this, ed = t.editor, dom = ed.dom, o;
+
+ each(dom.select('span'), function(n) {
+ if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
+ o = true;
+ return false;
+ }
+ });
- cm.clear();
+ if (!o)
+ t._done();
+ },
- if (sg != null) {
- cm.addTitle(tinyMCE.getLang('lang_spellchecker_sug', '', true));
+ _done : function() {
+ var t = this, la = t.active;
- for (i=0; i<sg.length && i<max; i++)
- cm.addItem(sg[i], 'tinyMCE.execCommand("mceSpellCheckReplace",false,"' + sg[i] + '");');
+ if (t.active) {
+ t.active = 0;
+ t._removeWords();
- cm.addSeparator();
- } else
- cm.addTitle(tinyMCE.getLang('lang_spellchecker_no_sug', '', true));
+ if (t._menu)
+ t._menu.hideMenu();
- cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_word', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnore\');');
- cm.addItem(tinyMCE.getLang('lang_spellchecker_ignore_words', '', true), 'tinyMCE.execCommand(\'mceSpellCheckIgnoreAll\');');
+ if (la)
+ t.editor.nodeChanged();
+ }
+ },
- cm.update();
- },
+ _sendRPC : function(m, p, cb) {
+ var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}");
- _getAjaxHTTP : function() {
- try {
- return new ActiveXObject('Msxml2.XMLHTTP')
- } catch (e) {
- try {
- return new ActiveXObject('Microsoft.XMLHTTP')
- } catch (e) {
- return new XMLHttpRequest();
+ if (url == '{backend}') {
+ t.editor.setProgressState(0);
+ alert('Please specify: spellchecker_rpc_url');
+ return;
}
+
+ JSONRequest.sendRPC({
+ url : url,
+ method : m,
+ params : p,
+ success : cb,
+ error : function(e, x) {
+ t.editor.setProgressState(0);
+ t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
+ }
+ });
}
- },
-
- /**
- * Perform AJAX call.
- *
- * @param {string} u URL of AJAX service.
- * @param {function} f Function to call when response arrives.
- * @param {string} m Request method post or get.
- * @param {Array} a Array with arguments to send.
- */
- _sendAjax : function(u, f, m, a) {
- var x = TinyMCE_SpellCheckerPlugin._getAjaxHTTP();
-
- x.open(m, u, true);
-
- x.onreadystatechange = function() {
- if (x.readyState == 4)
- f(x.responseXML);
- };
-
- if (m == 'post')
- x.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
-
- x.send(a);
- }
-};
-
-// Register plugin
-tinyMCE.addPlugin('spellchecker', TinyMCE_SpellCheckerPlugin);
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/spellchecker/images/spellchecker.gif b/program/js/tiny_mce/plugins/spellchecker/images/spellchecker.gif Binary files differdeleted file mode 100644 index 294a9d2ef..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/images/spellchecker.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/spellchecker/images/wline.gif b/program/js/tiny_mce/plugins/spellchecker/img/wline.gif Binary files differindex 7d0a4dbca..7d0a4dbca 100644 --- a/program/js/tiny_mce/plugins/spellchecker/images/wline.gif +++ b/program/js/tiny_mce/plugins/spellchecker/img/wline.gif diff --git a/program/js/tiny_mce/plugins/spellchecker/langs/en.js b/program/js/tiny_mce/plugins/spellchecker/langs/en.js deleted file mode 100644 index 02fdac564..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/langs/en.js +++ /dev/null @@ -1,15 +0,0 @@ -// UK lang variables
-
-tinyMCE.addToLang('spellchecker',{
- desc : 'Toggle spellchecker',
- menu : 'Spellchecker settings',
- ignore_word : 'Ignore word',
- ignore_words : 'Ignore all',
- langs : 'Languages',
- wait : 'Please wait...',
- swait : 'Spellchecking, please wait...',
- sug : 'Suggestions',
- no_sug : 'No suggestions',
- no_mpell : 'No misspellings found.',
- mpell_found : 'Found {$words} misspellings.'
-});
diff --git a/program/js/tiny_mce/plugins/spellchecker/tinyspell.php b/program/js/tiny_mce/plugins/spellchecker/tinyspell.php deleted file mode 100644 index 18345e65b..000000000 --- a/program/js/tiny_mce/plugins/spellchecker/tinyspell.php +++ /dev/null @@ -1,142 +0,0 @@ -<?php
-/**
- * $RCSfile: tinyspell.php,v $
- * $Revision: 1.1 $
- * $Date: 2006/03/14 17:33:47 $
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
- */
-
- // Ignore the Notice errors for now.
- error_reporting(E_ALL ^ E_NOTICE);
-
- require_once("config.php");
-
- $id = sanitize($_POST['id'], "loose");
-
- if (!$spellCheckerConfig['enabled']) {
- header('Content-type: text/xml; charset=utf-8');
- echo '<?xml version="1.0" encoding="utf-8" ?><res id="' . $id . '" error="true" msg="You must enable the spellchecker by modifying the config.php file." />';
- die;
- }
-
- // Basic config
- $defaultLanguage = $spellCheckerConfig['default.language'];
- $defaultMode = $spellCheckerConfig['default.mode'];
-
- // Normaly not required to configure
- $defaultSpelling = $spellCheckerConfig['default.spelling'];
- $defaultJargon = $spellCheckerConfig['default.jargon'];
- $defaultEncoding = $spellCheckerConfig['default.encoding'];
- $outputType = "xml"; // Do not change
-
- // Get input parameters.
-
- $check = urldecode($_REQUEST['check']);
- $cmd = sanitize($_REQUEST['cmd']);
- $lang = sanitize($_REQUEST['lang'], "strict");
- $mode = sanitize($_REQUEST['mode'], "strict");
- $spelling = sanitize($_REQUEST['spelling'], "strict");
- $jargon = sanitize($_REQUEST['jargon'], "strict");
- $encoding = sanitize($_REQUEST['encoding'], "strict");
- $sg = sanitize($_REQUEST['sg'], "bool");
- $words = array();
-
- $validRequest = true;
-
- if (empty($check))
- $validRequest = false;
-
- if (empty($lang))
- $lang = $defaultLanguage;
-
- if (empty($mode))
- $mode = $defaultMode;
-
- if (empty($spelling))
- $spelling = $defaultSpelling;
-
- if (empty($jargon))
- $jargon = $defaultJargon;
-
- if (empty($encoding))
- $encoding = $defaultEncoding;
-
- function sanitize($str, $type="strict") {
- switch ($type) {
- case "strict":
- $str = preg_replace("/[^a-zA-Z0-9_\-]/i", "", $str);
- break;
- case "loose":
- $str = preg_replace("/</i", ">", $str);
- $str = preg_replace("/>/i", "<", $str);
- break;
- case "bool":
- if ($str == "true" || $str == true)
- $str = true;
- else
- $str = false;
- break;
- }
-
- return $str;
- }
-
- $result = array();
- $tinyspell = new $spellCheckerConfig['class']($spellCheckerConfig, $lang, $mode, $spelling, $jargon, $encoding);
-
- if (count($tinyspell->errorMsg) == 0) {
- switch($cmd) {
- case "spell":
- // Space for non-exec version and \n for the exec version.
- $words = preg_split("/ |\n/", $check, -1, PREG_SPLIT_NO_EMPTY);
- $result = $tinyspell->checkWords($words);
- break;
-
- case "suggest":
- $result = $tinyspell->getSuggestion($check);
- break;
-
- default:
- // Just use this for now.
- $tinyspell->errorMsg[] = "No command.";
- $outputType = $outputType . "error";
- break;
- }
- } else
- $outputType = $outputType . "error";
-
- if (!$result)
- $result = array();
-
- // Output data
- switch($outputType) {
- case "xml":
- header('Content-type: text/xml; charset=utf-8');
- $body = '<?xml version="1.0" encoding="utf-8" ?>';
- $body .= "\n";
-
- if (count($result) == 0)
- $body .= '<res id="' . $id . '" cmd="'. $cmd .'" />';
- else
- $body .= '<res id="' . $id . '" cmd="'. $cmd .'">'. urlencode(implode(" ", $result)) .'</res>';
-
- echo $body;
- break;
- case "xmlerror";
- header('Content-type: text/xml; charset=utf-8');
- $body = '<?xml version="1.0" encoding="utf-8" ?>';
- $body .= "\n";
- $body .= '<res id="' . $id . '" cmd="'. $cmd .'" error="true" msg="'. implode(" ", $tinyspell->errorMsg) .'" />';
- echo $body;
- break;
- case "html":
- var_dump($result);
- break;
- case "htmlerror":
- echo "Error";
- break;
- }
-
-?>
diff --git a/program/js/tiny_mce/plugins/table/cell.htm b/program/js/tiny_mce/plugins/table/cell.htm index 7171d4faa..60264db8e 100644 --- a/program/js/tiny_mce/plugins/table/cell.htm +++ b/program/js/tiny_mce/plugins/table/cell.htm @@ -1,85 +1,87 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_cell_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/cell.js"></script>
+ <title>{#table_dlg.cell_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/cell.js"></script>
<link href="css/cell.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body id="tablecell" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="tablecell" style="display: none">
<form onsubmit="updateAction();return false;" action="#">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_table_general_props}</legend>
+ <legend>{#table_dlg.general_props}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="align">{$lang_table_align}</label></td>
+ <td><label for="align">{#table_dlg.align}</label></td>
<td>
- <select id="align" name="align">
- <option value="">{$lang_not_set}</option>
- <option value="center">{$lang_table_align_middle}</option>
- <option value="left">{$lang_table_align_left}</option>
- <option value="right">{$lang_table_align_right}</option>
+ <select id="align" name="align" class="mceFocus">
+ <option value="">{#not_set}</option>
+ <option value="center">{#table_dlg.align_middle}</option>
+ <option value="left">{#table_dlg.align_left}</option>
+ <option value="right">{#table_dlg.align_right}</option>
</select>
</td>
- <td><label for="celltype">{$lang_table_cell_type}</label></td>
+ <td><label for="celltype">{#table_dlg.cell_type}</label></td>
<td>
<select id="celltype" name="celltype">
- <option value="td">{$lang_table_td}</option>
- <option value="th">{$lang_table_th}</option>
+ <option value="td">{#table_dlg.td}</option>
+ <option value="th">{#table_dlg.th}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="valign">{$lang_table_valign}</label></td>
+ <td><label for="valign">{#table_dlg.valign}</label></td>
<td>
<select id="valign" name="valign">
- <option value="">{$lang_not_set}</option>
- <option value="top">{$lang_table_align_top}</option>
- <option value="middle">{$lang_table_align_middle}</option>
- <option value="bottom">{$lang_table_align_bottom}</option>
+ <option value="">{#not_set}</option>
+ <option value="top">{#table_dlg.align_top}</option>
+ <option value="middle">{#table_dlg.align_middle}</option>
+ <option value="bottom">{#table_dlg.align_bottom}</option>
</select>
</td>
- <td><label for="scope">{$lang_table_scope}</label></td>
+ <td><label for="scope">{#table_dlg.scope}</label></td>
<td>
<select id="scope" name="scope">
- <option value="">{$lang_not_set}</option>
- <option value="col">{$lang_table_col}</option>
- <option value="row">{$lang_table_row}</option>
- <option value="rowgroup">{$lang_table_rowgroup}</option>
- <option value="colgroup">{$lang_table_colgroup}</option>
+ <option value="">{#not_set}</option>
+ <option value="col">{#table.col}</option>
+ <option value="row">{#table.row}</option>
+ <option value="rowgroup">{#table_dlg.rowgroup}</option>
+ <option value="colgroup">{#table_dlg.colgroup}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="width">{$lang_table_width}</label></td>
+ <td><label for="width">{#table_dlg.width}</label></td>
<td><input id="width" name="width" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
- <td><label for="height">{$lang_table_height}</label></td>
+ <td><label for="height">{#table_dlg.height}</label></td>
<td><input id="height" name="height" type="text" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
</tr>
<tr id="styleSelectRow">
- <td><label for="class">{$lang_class_name}</label></td>
+ <td><label for="class">{#class_name}</label></td>
<td colspan="3">
- <select id="class" name="class">
- <option value="" selected="selected">{$lang_not_set}</option>
+ <select id="class" name="class" class="mceEditableSelect">
+ <option value="" selected="selected">{#not_set}</option>
</select>
</td>
</tr>
@@ -89,39 +91,39 @@ <div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_table_advanced_props}</legend>
+ <legend>{#table_dlg.advanced_props}</legend>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
- <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
- <td><label for="style">{$lang_table_style}</label></td>
+ <td><label for="style">{#table_dlg.style}</label></td>
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
</tr>
<tr>
- <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
<td>
<select id="dir" name="dir" style="width: 200px">
- <option value="">{$lang_not_set}</option>
- <option value="ltr">{$lang_table_ltr}</option>
- <option value="rtl">{$lang_table_rtl}</option>
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#table_dlg.ltr}</option>
+ <option value="rtl">{#table_dlg.rtl}</option>
</select>
</td>
</tr>
<tr>
- <td class="column1"><label for="lang">{$lang_table_langcode}</label></td>
+ <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
<td>
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
</td>
</tr>
<tr>
- <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -133,7 +135,7 @@ </tr>
<tr>
- <td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td>
+ <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -145,7 +147,7 @@ </tr>
<tr>
- <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -163,18 +165,18 @@ <div class="mceActionPanel">
<div>
<select id="action" name="action">
- <option value="cell">{$lang_table_cell_cell}</option>
- <option value="row">{$lang_table_cell_row}</option>
- <option value="all">{$lang_table_cell_all}</option>
+ <option value="cell">{#table_dlg.cell_cell}</option>
+ <option value="row">{#table_dlg.cell_row}</option>
+ <option value="all">{#table_dlg.cell_all}</option>
</select>
</div>
<div style="float: left">
- <div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+ <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/table/css/cell.css b/program/js/tiny_mce/plugins/table/css/cell.css index a47cc1a1e..a067ecdfe 100644 --- a/program/js/tiny_mce/plugins/table/css/cell.css +++ b/program/js/tiny_mce/plugins/table/css/cell.css @@ -1,17 +1,17 @@ -/* CSS file for cell dialog in the table plugin */ - -.panel_wrapper div.current { - height: 200px; -} - -.advfield { - width: 200px; -} - -#action { - margin-bottom: 3px; -} - -#class { - width: 150px; +/* CSS file for cell dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#class {
+ width: 150px;
}
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/table/css/row.css b/program/js/tiny_mce/plugins/table/css/row.css index 0e397db3e..1f7755daf 100644 --- a/program/js/tiny_mce/plugins/table/css/row.css +++ b/program/js/tiny_mce/plugins/table/css/row.css @@ -1,25 +1,25 @@ -/* CSS file for row dialog in the table plugin */ - -.panel_wrapper div.current { - height: 200px; -} - -.advfield { - width: 200px; -} - -#action { - margin-bottom: 3px; -} - -#rowtype,#align,#valign,#class,#height { - width: 150px; -} - -#height { - width: 50px; -} - -.col2 { - padding-left: 20px; -} +/* CSS file for row dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 200px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#action {
+ margin-bottom: 3px;
+}
+
+#rowtype,#align,#valign,#class,#height {
+ width: 150px;
+}
+
+#height {
+ width: 50px;
+}
+
+.col2 {
+ padding-left: 20px;
+}
diff --git a/program/js/tiny_mce/plugins/table/css/table.css b/program/js/tiny_mce/plugins/table/css/table.css index 82bb548ca..d11c3f69c 100644 --- a/program/js/tiny_mce/plugins/table/css/table.css +++ b/program/js/tiny_mce/plugins/table/css/table.css @@ -1,13 +1,13 @@ -/* CSS file for table dialog in the table plugin */ - -.panel_wrapper div.current { - height: 220px; -} - -.advfield { - width: 200px; -} - -#class { - width: 150px; -} +/* CSS file for table dialog in the table plugin */
+
+.panel_wrapper div.current {
+ height: 245px;
+}
+
+.advfield {
+ width: 200px;
+}
+
+#class {
+ width: 150px;
+}
diff --git a/program/js/tiny_mce/plugins/table/editor_plugin.js b/program/js/tiny_mce/plugins/table/editor_plugin.js index 2f308f868..0bf51b9d3 100644 --- a/program/js/tiny_mce/plugins/table/editor_plugin.js +++ b/program/js/tiny_mce/plugins/table/editor_plugin.js @@ -1 +1 @@ -tinyMCE.importPluginLanguagePack('table');var TinyMCE_TablePlugin={getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){if(tinyMCE.isGecko){var doc=inst.getDoc();tinyMCE.addEvent(doc,"mouseup",TinyMCE_TablePlugin._mouseDownHandler)}inst.tableRowClipboard=null},getControlHTML:function(control_name){var controls=new Array(['table','table.gif','lang_table_desc','mceInsertTable',true],['delete_table','table_delete.gif','lang_table_del','mceTableDelete'],['delete_col','table_delete_col.gif','lang_table_delete_col_desc','mceTableDeleteCol'],['delete_row','table_delete_row.gif','lang_table_delete_row_desc','mceTableDeleteRow'],['col_after','table_insert_col_after.gif','lang_table_col_after_desc','mceTableInsertColAfter'],['col_before','table_insert_col_before.gif','lang_table_col_before_desc','mceTableInsertColBefore'],['row_after','table_insert_row_after.gif','lang_table_row_after_desc','mceTableInsertRowAfter'],['row_before','table_insert_row_before.gif','lang_table_row_before_desc','mceTableInsertRowBefore'],['row_props','table_row_props.gif','lang_table_row_desc','mceTableRowProps',true],['cell_props','table_cell_props.gif','lang_table_cell_desc','mceTableCellProps',true],['split_cells','table_split_cells.gif','lang_table_split_cells_desc','mceTableSplitCells',true],['merge_cells','table_merge_cells.gif','lang_table_merge_cells_desc','mceTableMergeCells',true]);for(var i=0;i<controls.length;i++){var but=controls[i];var cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+but[3]+'\', '+(but.length>4?but[4]:false)+(but.length>5?', \''+but[5]+'\'':'')+');return false;';if(but[0]==control_name)return tinyMCE.getButtonHTML(control_name,but[2],'{$pluginurl}/images/'+but[1],but[3],(but.length>4?but[4]:false))}if(control_name=="tablecontrols"){var html="";html+=tinyMCE.getControlHTML("table");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_props");html+=tinyMCE.getControlHTML("cell_props");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("row_before");html+=tinyMCE.getControlHTML("row_after");html+=tinyMCE.getControlHTML("delete_row");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("col_before");html+=tinyMCE.getControlHTML("col_after");html+=tinyMCE.getControlHTML("delete_col");html+=tinyMCE.getControlHTML("separator");html+=tinyMCE.getControlHTML("split_cells");html+=tinyMCE.getControlHTML("merge_cells");return html}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":var inst=tinyMCE.getInstanceById(editor_id);inst.execCommand('mceBeginUndoLevel');TinyMCE_TablePlugin._doExecCommand(editor_id,element,command,user_interface,value);inst.execCommand('mceEndUndoLevel');return true}return false},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){var colspan="1",rowspan="1",tdElm;var inst=tinyMCE.getInstanceById(editor_id);tinyMCE.switchClass(editor_id+'_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_cell_props','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_row_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_before','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_col_after','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_split_cells','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonDisabled');if(tdElm=tinyMCE.getParentElement(node,"td,th")){tinyMCE.switchClass(editor_id+'_cell_props','mceButtonSelected');tinyMCE.switchClass(editor_id+'_delete_table','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_row_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_row','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_before','mceButtonNormal');tinyMCE.switchClass(editor_id+'_col_after','mceButtonNormal');tinyMCE.switchClass(editor_id+'_delete_col','mceButtonNormal');colspan=tinyMCE.getAttrib(tdElm,"colspan");rowspan=tinyMCE.getAttrib(tdElm,"rowspan");colspan=colspan==""?"1":colspan;rowspan=rowspan==""?"1":rowspan;if(colspan!="1"||rowspan!="1")tinyMCE.switchClass(editor_id+'_split_cells','mceButtonNormal')}if(tinyMCE.getParentElement(node,"tr"))tinyMCE.switchClass(editor_id+'_row_props','mceButtonSelected');if(tinyMCE.getParentElement(node,"table")){tinyMCE.switchClass(editor_id+'_table','mceButtonSelected');tinyMCE.switchClass(editor_id+'_merge_cells','mceButtonNormal')}},_mouseDownHandler:function(e){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var focusElm=tinyMCE.selectedInstance.getFocusElement();if(elm.nodeName=="BODY"&&(focusElm.nodeName=="TD"||focusElm.nodeName=="TH"||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TD")||(focusElm.parentNode&&focusElm.parentNode.nodeName=="TH"))){window.setTimeout(function(){var tableElm=tinyMCE.getParentElement(focusElm,"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance)},10)}},_doExecCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);var focusElm=inst.getFocusElement();var trElm=tinyMCE.getParentElement(focusElm,"tr");var tdElm=tinyMCE.getParentElement(focusElm,"td,th");var tableElm=tinyMCE.getParentElement(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true}return false}function makeTD(){var newTD=doc.createElement("td");newTD.innerHTML=" "}function getColRowSpan(td){var colspan=tinyMCE.getAttrib(td,"colspan");var rowspan=tinyMCE.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan}}function getCellPos(grid,td){var x,y;for(y=0;y<grid.length;y++){for(x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y}}}return null}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null}function getTableGrid(table){var grid=new Array(),rows=table.rows,x,y,td,sd,xstart,x2,y2;for(y=0;y<rows.length;y++){for(x=0;x<rows[y].cells.length;x++){td=rows[y].cells[x];sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=new Array();for(x2=xstart;x2<xstart+sd['colspan'];x2++)grid[y2][x2]=td}}}return grid}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table),cpos=getCellPos(grid,td);var cells,lastElm;if(new_tr.cells.length!=tr.childNodes.length){cells=tr.childNodes;lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td}deleteMarked(tableElm)}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node}return null}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node}}return null}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td)}while((td=nexttd)!=null)}}while((tr=next)!=null)}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");newTD.innerHTML=" ";if(tinyMCE.isMSIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR")}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=tinyMCE.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break}}}if(newTD==null){newTD=doc.createElement("td");newTD.innerHTML=" "}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm}return newTR}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/row.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_rowprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_rowprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){var template=new Array();template['file']='../../plugins/table/cell.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_cellprops_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_cellprops_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes"})}return true;case"mceInsertTable":if(user_interface){var template=new Array();template['file']='../../plugins/table/table.htm';template['width']=380;template['height']=295;template['width']+=tinyMCE.getLang('lang_table_table_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_table_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:value})}return true;case"mceTableDelete":var table=tinyMCE.getParentElement(inst.getFocusElement(),"table");if(table){table.parentNode.removeChild(table);inst.repaint()}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML=" ";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}trElm.parentNode.insertBefore(newTR,trElm);grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex+1,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");newTD.innerHTML=" ";newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD)}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR)}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD)}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true}lastTDElm=tdElm}}deleteMarked(tableElm);cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML=" ";newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex+1),tinyMCE.isGecko,true);break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);newTD.innerHTML=" ";newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD)}else tdElm.colSpan++;lastTDElm=tdElm}}grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,cpos.cellindex),tinyMCE.isGecko,true);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){tableElm=tinyMCE.getParentElement(tableElm,"table");tableElm.parentNode.removeChild(tableElm);return true}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm)}lastTDElm=tdElm}}cpos.cellindex--;if(cpos.cellindex<0)cpos.cellindex=0;grid=getTableGrid(tableElm);inst.selection.selectNode(getCell(grid,cpos.rowindex,0),tinyMCE.isGecko,true);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");newTD.innerHTML=" ";trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan)}addRows(tdElm,trElm,rowspan)}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");break;case"mceTableMergeCells":var rows=new Array();var sel=inst.getSel();var grid=getTableGrid(tableElm);if(tinyMCE.isMSIE||sel.rangeCount==1){if(user_interface){var template=new Array();var sp=getColRowSpan(tdElm);template['file']='../../plugins/table/merge_cells.htm';template['width']=250;template['height']=105+(tinyMCE.isNS7?25:0);template['width']+=tinyMCE.getLang('lang_table_merge_cells_delta_width',0);template['height']+=tinyMCE.getLang('lang_table_merge_cells_delta_height',0);tinyMCE.openWindow(template,{editor_id:inst.editorId,inline:"yes",action:"update",numcols:sp.colspan,numrows:sp.rowspan});return true}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=new Array();for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td}}if(rowCells.length>0)rows[rows.length]=rowCells}}}else{var cells=new Array();var sel=inst.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=new Array();for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td}}}if(rowCells.length>0)rows[rows.length]=rowCells}var curRow=new Array();var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y}x2=x;y2=y;grid[y][x]._selected=true}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true}lastRowSpan=sd['rowspan']}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true}lastColSpan=sd['colspan']}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","");if(chk!="<br/>"&&chk!="<br>"&&chk!=" "&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm}if(tdElm.rowSpan>1)tdElm.rowSpan--}}}}break}tableElm=tinyMCE.getParentElement(inst.getFocusElement(),"table");tinyMCE.handleVisualAid(tableElm,true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);tinyMCE.triggerNodeChange();inst.repaint()}return true}return false}};tinyMCE.addPlugin("table",TinyMCE_TablePlugin);
\ No newline at end of file +(function(){var each=tinymce.each;tinymce.create('tinymce.plugins.TablePlugin',{init:function(ed,url){var t=this;t.editor=ed;t.url=url;each([['table','table.desc','mceInsertTable',true],['delete_table','table.del','mceTableDelete'],['delete_col','table.delete_col_desc','mceTableDeleteCol'],['delete_row','table.delete_row_desc','mceTableDeleteRow'],['col_after','table.col_after_desc','mceTableInsertColAfter'],['col_before','table.col_before_desc','mceTableInsertColBefore'],['row_after','table.row_after_desc','mceTableInsertRowAfter'],['row_before','table.row_before_desc','mceTableInsertRowBefore'],['row_props','table.row_desc','mceTableRowProps',true],['cell_props','table.cell_desc','mceTableCellProps',true],['split_cells','table.split_cells_desc','mceTableSplitCells',true],['merge_cells','table.merge_cells_desc','mceTableMergeCells',true]],function(c){ed.addButton(c[0],{title:c[1],cmd:c[2],ui:c[3]});});ed.onInit.add(function(){if(ed&&ed.plugins.contextmenu){ed.plugins.contextmenu.onContextMenu.add(function(th,m,e){var sm,se=ed.selection,el=se.getNode()||ed.getBody();if(ed.dom.getParent(e,'td')||ed.dom.getParent(e,'th')){m.removeAll();if(el.nodeName=='A'&&!ed.dom.getAttrib(el,'name')){m.add({title:'advanced.link_desc',icon:'link',cmd:ed.plugins.advlink?'mceAdvLink':'mceLink',ui:true});m.add({title:'advanced.unlink_desc',icon:'unlink',cmd:'UnLink'});m.addSeparator();}if(el.nodeName=='IMG'&&el.className.indexOf('mceItem')==-1){m.add({title:'advanced.image_desc',icon:'image',cmd:ed.plugins.advimage?'mceAdvImage':'mceImage',ui:true});m.addSeparator();}m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true,value:{action:'insert'}});m.add({title:'table.props_desc',icon:'table_props',cmd:'mceInsertTable',ui:true});m.add({title:'table.del',icon:'delete_table',cmd:'mceTableDelete',ui:true});m.addSeparator();sm=m.addMenu({title:'table.cell'});sm.add({title:'table.cell_desc',icon:'cell_props',cmd:'mceTableCellProps',ui:true});sm.add({title:'table.split_cells_desc',icon:'split_cells',cmd:'mceTableSplitCells',ui:true});sm.add({title:'table.merge_cells_desc',icon:'merge_cells',cmd:'mceTableMergeCells',ui:true});sm=m.addMenu({title:'table.row'});sm.add({title:'table.row_desc',icon:'row_props',cmd:'mceTableRowProps',ui:true});sm.add({title:'table.row_before_desc',icon:'row_before',cmd:'mceTableInsertRowBefore'});sm.add({title:'table.row_after_desc',icon:'row_after',cmd:'mceTableInsertRowAfter'});sm.add({title:'table.delete_row_desc',icon:'delete_row',cmd:'mceTableDeleteRow'});sm.addSeparator();sm.add({title:'table.cut_row_desc',icon:'cut',cmd:'mceTableCutRow'});sm.add({title:'table.copy_row_desc',icon:'copy',cmd:'mceTableCopyRow'});sm.add({title:'table.paste_row_before_desc',icon:'paste',cmd:'mceTablePasteRowBefore'});sm.add({title:'table.paste_row_after_desc',icon:'paste',cmd:'mceTablePasteRowAfter'});sm=m.addMenu({title:'table.col'});sm.add({title:'table.col_before_desc',icon:'col_before',cmd:'mceTableInsertColBefore'});sm.add({title:'table.col_after_desc',icon:'col_after',cmd:'mceTableInsertColAfter'});sm.add({title:'table.delete_col_desc',icon:'delete_col',cmd:'mceTableDeleteCol'});}else m.add({title:'table.desc',icon:'table',cmd:'mceInsertTable',ui:true});});}});ed.onKeyDown.add(function(ed,e){if(e.keyCode==9&&ed.dom.getParent(ed.selection.getNode(),'TABLE'))ed.undoManager.add();});ed.onNodeChange.add(function(ed,cm,n){var p=ed.dom.getParent(n,'td,th,caption');cm.setActive('table',!!p);if(p&&p.nodeName==='CAPTION')p=null;cm.setDisabled('delete_table',!p);cm.setDisabled('delete_col',!p);cm.setDisabled('delete_table',!p);cm.setDisabled('delete_row',!p);cm.setDisabled('col_after',!p);cm.setDisabled('col_before',!p);cm.setDisabled('row_after',!p);cm.setDisabled('row_before',!p);cm.setDisabled('row_props',!p);cm.setDisabled('cell_props',!p);cm.setDisabled('split_cells',!p||(parseInt(ed.dom.getAttrib(p,'colspan','1'))<2&&parseInt(ed.dom.getAttrib(p,'rowspan','1'))<2));cm.setDisabled('merge_cells',!p);});if(!tinymce.isIE){ed.onBeforeSetContent.add(function(ed,o){if(o.initial)o.content=o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g,tinymce.isOpera?'<$1$2> </$1>':'<$1$2><br mce_bogus="1" /></$1>');});}},execCommand:function(cmd,ui,val){var ed=this.editor,b;switch(cmd){case"mceInsertTable":case"mceTableRowProps":case"mceTableCellProps":case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":case"mceTableDelete":ed.execCommand('mceBeginUndoLevel');this._doExecCommand(cmd,ui,val);ed.execCommand('mceEndUndoLevel');return true;}return false;},getInfo:function(){return{longname:'Tables',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_doExecCommand:function(command,user_interface,value){var inst=this.editor,ed=inst,url=this.url;var focusElm=inst.selection.getNode();var trElm=inst.dom.getParent(focusElm,"tr");var tdElm=inst.dom.getParent(focusElm,"td,th");var tableElm=inst.dom.getParent(focusElm,"table");var doc=inst.contentWindow.document;var tableBorder=tableElm?tableElm.getAttribute("border"):"";if(trElm&&tdElm==null)tdElm=trElm.cells[0];function inArray(ar,v){for(var i=0;i<ar.length;i++){if(ar[i].length>0&&inArray(ar[i],v))return true;if(ar[i]==v)return true;}return false;}function select(dx,dy){var td;grid=getTableGrid(tableElm);dx=dx||0;dy=dy||0;dx=Math.max(cpos.cellindex+dx,0);dy=Math.max(cpos.rowindex+dy,0);inst.execCommand('mceRepaint');td=getCell(grid,dy,dx);if(td){inst.selection.select(td.firstChild||td);inst.selection.collapse(1);}};function makeTD(){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';}function getColRowSpan(td){var colspan=inst.dom.getAttrib(td,"colspan");var rowspan=inst.dom.getAttrib(td,"rowspan");colspan=colspan==""?1:parseInt(colspan);rowspan=rowspan==""?1:parseInt(rowspan);return{colspan:colspan,rowspan:rowspan};}function getCellPos(grid,td){var x,y;for(y=0;y<grid.length;y++){for(x=0;x<grid[y].length;x++){if(grid[y][x]==td)return{cellindex:x,rowindex:y};}}return null;}function getCell(grid,row,col){if(grid[row]&&grid[row][col])return grid[row][col];return null;}function getTableGrid(table){var grid=[],rows=table.rows,x,y,td,sd,xstart,x2,y2;for(y=0;y<rows.length;y++){for(x=0;x<rows[y].cells.length;x++){td=rows[y].cells[x];sd=getColRowSpan(td);for(xstart=x;grid[y]&&grid[y][xstart];xstart++);for(y2=y;y2<y+sd['rowspan'];y2++){if(!grid[y2])grid[y2]=[];for(x2=xstart;x2<xstart+sd['colspan'];x2++)grid[y2][x2]=td;}}}return grid;}function trimRow(table,tr,td,new_tr){var grid=getTableGrid(table),cpos=getCellPos(grid,td);var cells,lastElm;if(new_tr.cells.length!=tr.childNodes.length){cells=tr.childNodes;lastElm=null;for(var x=0;td=getCell(grid,cpos.rowindex,x);x++){var remove=true;var sd=getColRowSpan(td);if(inArray(cells,td)){new_tr.childNodes[x]._delete=true;}else if((lastElm==null||td!=lastElm)&&sd.colspan>1){for(var i=x;i<x+td.colSpan;i++)new_tr.childNodes[i]._delete=true;}if((lastElm==null||td!=lastElm)&&sd.rowspan>1)td.rowSpan=sd.rowspan+1;lastElm=td;}deleteMarked(tableElm);}}function prevElm(node,name){while((node=node.previousSibling)!=null){if(node.nodeName==name)return node;}return null;}function nextElm(node,names){var namesAr=names.split(',');while((node=node.nextSibling)!=null){for(var i=0;i<namesAr.length;i++){if(node.nodeName.toLowerCase()==namesAr[i].toLowerCase())return node;}}return null;}function deleteMarked(tbl){if(tbl.rows==0)return;var tr=tbl.rows[0];do{var next=nextElm(tr,"TR");if(tr._delete){tr.parentNode.removeChild(tr);continue;}var td=tr.cells[0];if(td.cells>1){do{var nexttd=nextElm(td,"TD,TH");if(td._delete)td.parentNode.removeChild(td);}while((td=nexttd)!=null);}}while((tr=next)!=null);}function addRows(td_elm,tr_elm,rowspan){td_elm.rowSpan=1;var trNext=nextElm(tr_elm,"TR");for(var i=1;i<rowspan&&trNext;i++){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';if(tinymce.isIE)trNext.insertBefore(newTD,trNext.cells(td_elm.cellIndex));else trNext.insertBefore(newTD,trNext.cells[td_elm.cellIndex]);trNext=nextElm(trNext,"TR");}}function copyRow(doc,table,tr){var grid=getTableGrid(table);var newTR=tr.cloneNode(false);var cpos=getCellPos(grid,tr.cells[0]);var lastCell=null;var tableBorder=inst.dom.getAttrib(table,"border");var tdElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){var newTD=null;if(lastCell!=tdElm){for(var i=0;i<tr.cells.length;i++){if(tdElm==tr.cells[i]){newTD=tdElm.cloneNode(true);break;}}}if(newTD==null){newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';}newTD.colSpan=1;newTD.rowSpan=1;newTR.appendChild(newTD);lastCell=tdElm;}return newTR;}switch(command){case"mceTableRowProps":if(trElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/row.htm',width:400+parseInt(inst.getLang('table.rowprops_delta_width',0)),height:295+parseInt(inst.getLang('table.rowprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceTableCellProps":if(tdElm==null)return true;if(user_interface){inst.windowManager.open({url:url+'/cell.htm',width:400+parseInt(inst.getLang('table.cellprops_delta_width',0)),height:295+parseInt(inst.getLang('table.cellprops_delta_height',0)),inline:1},{plugin_url:url});}return true;case"mceInsertTable":if(user_interface){inst.windowManager.open({url:url+'/table.htm',width:400+parseInt(inst.getLang('table.table_delta_width',0)),height:320+parseInt(inst.getLang('table.table_delta_height',0)),inline:1},{plugin_url:url,action:value?value.action:0});}return true;case"mceTableDelete":var table=inst.dom.getParent(inst.selection.getNode(),"table");if(table){table.parentNode.removeChild(table);inst.execCommand('mceRepaint');}return true;case"mceTableSplitCells":case"mceTableMergeCells":case"mceTableInsertRowBefore":case"mceTableInsertRowAfter":case"mceTableDeleteRow":case"mceTableInsertColBefore":case"mceTableInsertColAfter":case"mceTableDeleteCol":case"mceTableCutRow":case"mceTableCopyRow":case"mceTablePasteRowBefore":case"mceTablePasteRowAfter":if(!tableElm)return true;if(trElm&&tableElm!=trElm.parentNode)tableElm=trElm.parentNode;if(tableElm&&trElm){switch(command){case"mceTableCutRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);inst.execCommand("mceTableDeleteRow");break;case"mceTableCopyRow":if(!trElm||!tdElm)return true;inst.tableRowClipboard=copyRow(doc,tableElm,trElm);break;case"mceTablePasteRowBefore":if(!trElm||!tdElm)return true;var newTR=inst.tableRowClipboard.cloneNode(true);var prevTR=prevElm(trElm,"TR");if(prevTR!=null)trimRow(tableElm,prevTR,prevTR.cells[0],newTR);trElm.parentNode.insertBefore(newTR,trElm);break;case"mceTablePasteRowAfter":if(!trElm||!tdElm)return true;var nextTR=nextElm(trElm,"TR");var newTR=inst.tableRowClipboard.cloneNode(true);trimRow(tableElm,trElm,tdElm,newTR);if(nextTR==null)trElm.parentNode.appendChild(newTR);else nextTR.parentNode.insertBefore(newTR,nextTR);break;case"mceTableInsertRowBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;cpos.rowindex--;if(cpos.rowindex<0)cpos.rowindex=0;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}trElm.parentNode.insertBefore(newTR,trElm);select(0,1);break;case"mceTableInsertRowAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var newTR=doc.createElement("tr");var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['rowspan']==1){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.colSpan=tdElm.colSpan;newTR.appendChild(newTD);}else tdElm.rowSpan=sd['rowspan']+1;lastTDElm=tdElm;}}if(newTR.hasChildNodes()){var nextTR=nextElm(trElm,"TR");if(nextTR)nextTR.parentNode.insertBefore(newTR,nextTR);else tableElm.appendChild(newTR);}select(0,1);break;case"mceTableDeleteRow":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);if(grid.length==1){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}var cells=trElm.cells;var nextTR=nextElm(trElm,"TR");for(var x=0;x<cells.length;x++){if(cells[x].rowSpan>1){var newTD=cells[x].cloneNode(true);var sd=getColRowSpan(cells[x]);newTD.rowSpan=sd.rowspan-1;var nextTD=nextTR.cells[x];if(nextTD==null)nextTR.appendChild(newTD);else nextTR.insertBefore(newTD,nextTD);}}var lastTDElm=null;for(var x=0;tdElm=getCell(grid,cpos.rowindex,x);x++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd.rowspan>1){tdElm.rowSpan=sd.rowspan-1;}else{trElm=tdElm.parentNode;if(trElm.parentNode)trElm._delete=true;}lastTDElm=tdElm;}}deleteMarked(tableElm);select(0,-1);break;case"mceTableInsertColBefore":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.rowSpan=tdElm.rowSpan;tdElm.parentNode.insertBefore(newTD,tdElm);}else tdElm.colSpan++;lastTDElm=tdElm;}}select();break;case"mceTableInsertColAfter":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']==1){var newTD=doc.createElement(tdElm.nodeName);if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';newTD.rowSpan=tdElm.rowSpan;var nextTD=nextElm(tdElm,"TD,TH");if(nextTD==null)tdElm.parentNode.appendChild(newTD);else nextTD.parentNode.insertBefore(newTD,nextTD);}else tdElm.colSpan++;lastTDElm=tdElm;}}select(1);break;case"mceTableDeleteCol":if(!trElm||!tdElm)return true;var grid=getTableGrid(tableElm);var cpos=getCellPos(grid,tdElm);var lastTDElm=null;if(grid.length>1&&grid[0].length<=1){inst.dom.remove(inst.dom.getParent(tableElm,"table"));return true;}for(var y=0;tdElm=getCell(grid,y,cpos.cellindex);y++){if(tdElm!=lastTDElm){var sd=getColRowSpan(tdElm);if(sd['colspan']>1)tdElm.colSpan=sd['colspan']-1;else{if(tdElm.parentNode)tdElm.parentNode.removeChild(tdElm);}lastTDElm=tdElm;}}select(-1);break;case"mceTableSplitCells":if(!trElm||!tdElm)return true;var spandata=getColRowSpan(tdElm);var colspan=spandata["colspan"];var rowspan=spandata["rowspan"];if(colspan>1||rowspan>1){tdElm.colSpan=1;for(var i=1;i<colspan;i++){var newTD=doc.createElement("td");if(!tinymce.isIE)newTD.innerHTML='<br mce_bogus="1"/>';trElm.insertBefore(newTD,nextElm(tdElm,"TD,TH"));if(rowspan>1)addRows(newTD,trElm,rowspan);}addRows(tdElm,trElm,rowspan);}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");break;case"mceTableMergeCells":var rows=[];var sel=inst.selection.getSel();var grid=getTableGrid(tableElm);if(tinymce.isIE||sel.rangeCount==1){if(user_interface){var sp=getColRowSpan(tdElm);inst.windowManager.open({url:url+'/merge_cells.htm',width:240+parseInt(inst.getLang('table.merge_cells_delta_width',0)),height:110+parseInt(inst.getLang('table.merge_cells_delta_height',0)),inline:1},{action:"update",numcols:sp.colspan,numrows:sp.rowspan,plugin_url:url});return true;}else{var numRows=parseInt(value['numrows']);var numCols=parseInt(value['numcols']);var cpos=getCellPos(grid,tdElm);if((""+numRows)=="NaN")numRows=1;if((""+numCols)=="NaN")numCols=1;var tRows=tableElm.rows;for(var y=cpos.rowindex;y<grid.length;y++){var rowCells=[];for(var x=cpos.cellindex;x<grid[y].length;x++){var td=getCell(grid,y,x);if(td&&!inArray(rows,td)&&!inArray(rowCells,td)){var cp=getCellPos(grid,td);if(cp.cellindex<cpos.cellindex+numCols&&cp.rowindex<cpos.rowindex+numRows)rowCells[rowCells.length]=td;}}if(rowCells.length>0)rows[rows.length]=rowCells;var td=getCell(grid,cpos.rowindex,cpos.cellindex);each(ed.dom.select('br',td),function(e,i){if(i>0&&ed.dom.getAttrib('mce_bogus'))ed.dom.remove(e);});}}}else{var cells=[];var sel=inst.selection.getSel();var lastTR=null;var curRow=null;var x1=-1,y1=-1,x2,y2;if(sel.rangeCount<2)return true;for(var i=0;i<sel.rangeCount;i++){var rng=sel.getRangeAt(i);var tdElm=rng.startContainer.childNodes[rng.startOffset];if(!tdElm)break;if(tdElm.nodeName=="TD")cells[cells.length]=tdElm;}var tRows=tableElm.rows;for(var y=0;y<tRows.length;y++){var rowCells=[];for(var x=0;x<tRows[y].cells.length;x++){var td=tRows[y].cells[x];for(var i=0;i<cells.length;i++){if(td==cells[i]){rowCells[rowCells.length]=td;}}}if(rowCells.length>0)rows[rows.length]=rowCells;}var curRow=[];var lastTR=null;for(var y=0;y<grid.length;y++){for(var x=0;x<grid[y].length;x++){grid[y][x]._selected=false;for(var i=0;i<cells.length;i++){if(grid[y][x]==cells[i]){if(x1==-1){x1=x;y1=y;}x2=x;y2=y;grid[y][x]._selected=true;}}}}for(var y=y1;y<=y2;y++){for(var x=x1;x<=x2;x++){if(!grid[y][x]._selected){alert("Invalid selection for merge.");return true;}}}}var rowSpan=1,colSpan=1;var lastRowSpan=-1;for(var y=0;y<rows.length;y++){var rowColSpan=0;for(var x=0;x<rows[y].length;x++){var sd=getColRowSpan(rows[y][x]);rowColSpan+=sd['colspan'];if(lastRowSpan!=-1&&sd['rowspan']!=lastRowSpan){alert("Invalid selection for merge.");return true;}lastRowSpan=sd['rowspan'];}if(rowColSpan>colSpan)colSpan=rowColSpan;lastRowSpan=-1;}var lastColSpan=-1;for(var x=0;x<rows[0].length;x++){var colRowSpan=0;for(var y=0;y<rows.length;y++){var sd=getColRowSpan(rows[y][x]);colRowSpan+=sd['rowspan'];if(lastColSpan!=-1&&sd['colspan']!=lastColSpan){alert("Invalid selection for merge.");return true;}lastColSpan=sd['colspan'];}if(colRowSpan>rowSpan)rowSpan=colRowSpan;lastColSpan=-1;}tdElm=rows[0][0];tdElm.rowSpan=rowSpan;tdElm.colSpan=colSpan;for(var y=0;y<rows.length;y++){for(var x=0;x<rows[y].length;x++){var html=rows[y][x].innerHTML;var chk=html.replace(/[ \t\r\n]/g,"");if(chk!="<br/>"&&chk!="<br>"&&chk!='<br mce_bogus="1"/>'&&(x+y>0))tdElm.innerHTML+=html;if(rows[y][x]!=tdElm&&!rows[y][x]._deleted){var cpos=getCellPos(grid,rows[y][x]);var tr=rows[y][x].parentNode;tr.removeChild(rows[y][x]);rows[y][x]._deleted=true;if(!tr.hasChildNodes()){tr.parentNode.removeChild(tr);var lastCell=null;for(var x=0;cellElm=getCell(grid,cpos.rowindex,x);x++){if(cellElm!=lastCell&&cellElm.rowSpan>1)cellElm.rowSpan--;lastCell=cellElm;}if(tdElm.rowSpan>1)tdElm.rowSpan--;}}}}each(ed.dom.select('br',tdElm),function(e,i){if(i>0&&ed.dom.getAttrib(e,'mce_bogus'))ed.dom.remove(e);});break;}tableElm=inst.dom.getParent(inst.selection.getNode(),"table");inst.addVisual(tableElm);inst.nodeChanged();}return true;}return false;}});tinymce.PluginManager.add('table',tinymce.plugins.TablePlugin);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/table/editor_plugin_src.js b/program/js/tiny_mce/plugins/table/editor_plugin_src.js index 75aaa4dec..0baafb1f6 100644 --- a/program/js/tiny_mce/plugins/table/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/table/editor_plugin_src.js @@ -1,879 +1,913 @@ /**
- * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ * $Id: editor_plugin_src.js 768 2008-04-04 13:52:49Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('table');
-
-var TinyMCE_TablePlugin = {
- getInfo : function() {
- return {
- longname : 'Tables',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- initInstance : function(inst) {
- if (tinyMCE.isGecko) {
- var doc = inst.getDoc();
- tinyMCE.addEvent(doc, "mouseup", TinyMCE_TablePlugin._mouseDownHandler);
- }
+(function() {
+ var each = tinymce.each;
+
+ tinymce.create('tinymce.plugins.TablePlugin', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+ t.url = url;
+
+ // Register buttons
+ each([
+ ['table', 'table.desc', 'mceInsertTable', true],
+ ['delete_table', 'table.del', 'mceTableDelete'],
+ ['delete_col', 'table.delete_col_desc', 'mceTableDeleteCol'],
+ ['delete_row', 'table.delete_row_desc', 'mceTableDeleteRow'],
+ ['col_after', 'table.col_after_desc', 'mceTableInsertColAfter'],
+ ['col_before', 'table.col_before_desc', 'mceTableInsertColBefore'],
+ ['row_after', 'table.row_after_desc', 'mceTableInsertRowAfter'],
+ ['row_before', 'table.row_before_desc', 'mceTableInsertRowBefore'],
+ ['row_props', 'table.row_desc', 'mceTableRowProps', true],
+ ['cell_props', 'table.cell_desc', 'mceTableCellProps', true],
+ ['split_cells', 'table.split_cells_desc', 'mceTableSplitCells', true],
+ ['merge_cells', 'table.merge_cells_desc', 'mceTableMergeCells', true]
+ ], function(c) {
+ ed.addButton(c[0], {title : c[1], cmd : c[2], ui : c[3]});
+ });
+
+ ed.onInit.add(function() {
+ if (ed && ed.plugins.contextmenu) {
+ ed.plugins.contextmenu.onContextMenu.add(function(th, m, e) {
+ var sm, se = ed.selection, el = se.getNode() || ed.getBody();
+
+ if (ed.dom.getParent(e, 'td') || ed.dom.getParent(e, 'th')) {
+ m.removeAll();
+
+ if (el.nodeName == 'A' && !ed.dom.getAttrib(el, 'name')) {
+ m.add({title : 'advanced.link_desc', icon : 'link', cmd : ed.plugins.advlink ? 'mceAdvLink' : 'mceLink', ui : true});
+ m.add({title : 'advanced.unlink_desc', icon : 'unlink', cmd : 'UnLink'});
+ m.addSeparator();
+ }
- inst.tableRowClipboard = null;
- },
-
- /**
- * Returns the HTML contents of the table control.
- */
- getControlHTML : function(control_name) {
- var controls = new Array(
- ['table', 'table.gif', 'lang_table_desc', 'mceInsertTable', true],
- ['delete_table', 'table_delete.gif', 'lang_table_del', 'mceTableDelete'],
- ['delete_col', 'table_delete_col.gif', 'lang_table_delete_col_desc', 'mceTableDeleteCol'],
- ['delete_row', 'table_delete_row.gif', 'lang_table_delete_row_desc', 'mceTableDeleteRow'],
- ['col_after', 'table_insert_col_after.gif', 'lang_table_col_after_desc', 'mceTableInsertColAfter'],
- ['col_before', 'table_insert_col_before.gif', 'lang_table_col_before_desc', 'mceTableInsertColBefore'],
- ['row_after', 'table_insert_row_after.gif', 'lang_table_row_after_desc', 'mceTableInsertRowAfter'],
- ['row_before', 'table_insert_row_before.gif', 'lang_table_row_before_desc', 'mceTableInsertRowBefore'],
- ['row_props', 'table_row_props.gif', 'lang_table_row_desc', 'mceTableRowProps', true],
- ['cell_props', 'table_cell_props.gif', 'lang_table_cell_desc', 'mceTableCellProps', true],
- ['split_cells', 'table_split_cells.gif', 'lang_table_split_cells_desc', 'mceTableSplitCells', true],
- ['merge_cells', 'table_merge_cells.gif', 'lang_table_merge_cells_desc', 'mceTableMergeCells', true]);
-
- // Render table control
- for (var i=0; i<controls.length; i++) {
- var but = controls[i];
- var cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + but[3] + '\', ' + (but.length > 4 ? but[4] : false) + (but.length > 5 ? ', \'' + but[5] + '\'' : '') + ');return false;';
-
- if (but[0] == control_name)
- return tinyMCE.getButtonHTML(control_name, but[2], '{$pluginurl}/images/'+ but[1], but[3], (but.length > 4 ? but[4] : false));
- }
+ if (el.nodeName == 'IMG' && el.className.indexOf('mceItem') == -1) {
+ m.add({title : 'advanced.image_desc', icon : 'image', cmd : ed.plugins.advimage ? 'mceAdvImage' : 'mceImage', ui : true});
+ m.addSeparator();
+ }
- // Special tablecontrols
- if (control_name == "tablecontrols") {
- var html = "";
-
- html += tinyMCE.getControlHTML("table");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("row_props");
- html += tinyMCE.getControlHTML("cell_props");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("row_before");
- html += tinyMCE.getControlHTML("row_after");
- html += tinyMCE.getControlHTML("delete_row");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("col_before");
- html += tinyMCE.getControlHTML("col_after");
- html += tinyMCE.getControlHTML("delete_col");
- html += tinyMCE.getControlHTML("separator");
- html += tinyMCE.getControlHTML("split_cells");
- html += tinyMCE.getControlHTML("merge_cells");
-
- return html;
- }
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true, value : {action : 'insert'}});
+ m.add({title : 'table.props_desc', icon : 'table_props', cmd : 'mceInsertTable', ui : true});
+ m.add({title : 'table.del', icon : 'delete_table', cmd : 'mceTableDelete', ui : true});
+ m.addSeparator();
+
+ // Cell menu
+ sm = m.addMenu({title : 'table.cell'});
+ sm.add({title : 'table.cell_desc', icon : 'cell_props', cmd : 'mceTableCellProps', ui : true});
+ sm.add({title : 'table.split_cells_desc', icon : 'split_cells', cmd : 'mceTableSplitCells', ui : true});
+ sm.add({title : 'table.merge_cells_desc', icon : 'merge_cells', cmd : 'mceTableMergeCells', ui : true});
+
+ // Row menu
+ sm = m.addMenu({title : 'table.row'});
+ sm.add({title : 'table.row_desc', icon : 'row_props', cmd : 'mceTableRowProps', ui : true});
+ sm.add({title : 'table.row_before_desc', icon : 'row_before', cmd : 'mceTableInsertRowBefore'});
+ sm.add({title : 'table.row_after_desc', icon : 'row_after', cmd : 'mceTableInsertRowAfter'});
+ sm.add({title : 'table.delete_row_desc', icon : 'delete_row', cmd : 'mceTableDeleteRow'});
+ sm.addSeparator();
+ sm.add({title : 'table.cut_row_desc', icon : 'cut', cmd : 'mceTableCutRow'});
+ sm.add({title : 'table.copy_row_desc', icon : 'copy', cmd : 'mceTableCopyRow'});
+ sm.add({title : 'table.paste_row_before_desc', icon : 'paste', cmd : 'mceTablePasteRowBefore'});
+ sm.add({title : 'table.paste_row_after_desc', icon : 'paste', cmd : 'mceTablePasteRowAfter'});
+
+ // Column menu
+ sm = m.addMenu({title : 'table.col'});
+ sm.add({title : 'table.col_before_desc', icon : 'col_before', cmd : 'mceTableInsertColBefore'});
+ sm.add({title : 'table.col_after_desc', icon : 'col_after', cmd : 'mceTableInsertColAfter'});
+ sm.add({title : 'table.delete_col_desc', icon : 'delete_col', cmd : 'mceTableDeleteCol'});
+ } else
+ m.add({title : 'table.desc', icon : 'table', cmd : 'mceInsertTable', ui : true});
+ });
+ }
+ });
+
+ // Add undo level when new rows are created using the tab key
+ ed.onKeyDown.add(function(ed, e) {
+ if (e.keyCode == 9 && ed.dom.getParent(ed.selection.getNode(), 'TABLE'))
+ ed.undoManager.add();
+ });
+
+ ed.onNodeChange.add(function(ed, cm, n) {
+ var p = ed.dom.getParent(n, 'td,th,caption');
+
+ cm.setActive('table', !!p);
+ if (p && p.nodeName === 'CAPTION')
+ p = null;
+
+ cm.setDisabled('delete_table', !p);
+ cm.setDisabled('delete_col', !p);
+ cm.setDisabled('delete_table', !p);
+ cm.setDisabled('delete_row', !p);
+ cm.setDisabled('col_after', !p);
+ cm.setDisabled('col_before', !p);
+ cm.setDisabled('row_after', !p);
+ cm.setDisabled('row_before', !p);
+ cm.setDisabled('row_props', !p);
+ cm.setDisabled('cell_props', !p);
+ cm.setDisabled('split_cells', !p || (parseInt(ed.dom.getAttrib(p, 'colspan', '1')) < 2 && parseInt(ed.dom.getAttrib(p, 'rowspan', '1')) < 2));
+ cm.setDisabled('merge_cells', !p);
+ });
+
+ // Padd empty table cells
+ if (!tinymce.isIE) {
+ ed.onBeforeSetContent.add(function(ed, o) {
+ if (o.initial)
+ o.content = o.content.replace(/<(td|th)([^>]+|)>\s*<\/(td|th)>/g, tinymce.isOpera ? '<$1$2> </$1>' : '<$1$2><br mce_bogus="1" /></$1>');
+ });
+ }
+ },
+
+ execCommand : function(cmd, ui, val) {
+ var ed = this.editor, b;
+
+ // Is table command
+ switch (cmd) {
+ case "mceInsertTable":
+ case "mceTableRowProps":
+ case "mceTableCellProps":
+ case "mceTableSplitCells":
+ case "mceTableMergeCells":
+ case "mceTableInsertRowBefore":
+ case "mceTableInsertRowAfter":
+ case "mceTableDeleteRow":
+ case "mceTableInsertColBefore":
+ case "mceTableInsertColAfter":
+ case "mceTableDeleteCol":
+ case "mceTableCutRow":
+ case "mceTableCopyRow":
+ case "mceTablePasteRowBefore":
+ case "mceTablePasteRowAfter":
+ case "mceTableDelete":
+ ed.execCommand('mceBeginUndoLevel');
+ this._doExecCommand(cmd, ui, val);
+ ed.execCommand('mceEndUndoLevel');
- return "";
- },
-
- /**
- * Executes the table commands.
- */
- execCommand : function(editor_id, element, command, user_interface, value) {
- // Is table command
- switch (command) {
- case "mceInsertTable":
- case "mceTableRowProps":
- case "mceTableCellProps":
- case "mceTableSplitCells":
- case "mceTableMergeCells":
- case "mceTableInsertRowBefore":
- case "mceTableInsertRowAfter":
- case "mceTableDeleteRow":
- case "mceTableInsertColBefore":
- case "mceTableInsertColAfter":
- case "mceTableDeleteCol":
- case "mceTableCutRow":
- case "mceTableCopyRow":
- case "mceTablePasteRowBefore":
- case "mceTablePasteRowAfter":
- case "mceTableDelete":
- var inst = tinyMCE.getInstanceById(editor_id);
-
- inst.execCommand('mceBeginUndoLevel');
- TinyMCE_TablePlugin._doExecCommand(editor_id, element, command, user_interface, value);
- inst.execCommand('mceEndUndoLevel');
+ return true;
+ }
- return true;
- }
+ // Pass to next handler in chain
+ return false;
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Tables',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/table',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ // Private plugin internal methods
+
+ /**
+ * Executes the table commands.
+ */
+ _doExecCommand : function(command, user_interface, value) {
+ var inst = this.editor, ed = inst, url = this.url;
+ var focusElm = inst.selection.getNode();
+ var trElm = inst.dom.getParent(focusElm, "tr");
+ var tdElm = inst.dom.getParent(focusElm, "td,th");
+ var tableElm = inst.dom.getParent(focusElm, "table");
+ var doc = inst.contentWindow.document;
+ var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
+
+ // Get first TD if no TD found
+ if (trElm && tdElm == null)
+ tdElm = trElm.cells[0];
+
+ function inArray(ar, v) {
+ for (var i=0; i<ar.length; i++) {
+ // Is array
+ if (ar[i].length > 0 && inArray(ar[i], v))
+ return true;
+
+ // Found value
+ if (ar[i] == v)
+ return true;
+ }
- // Pass to next handler in chain
- return false;
- },
-
- handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
- var colspan = "1", rowspan = "1", tdElm;
-
- var inst = tinyMCE.getInstanceById(editor_id);
-
- // Reset table controls
- tinyMCE.switchClass(editor_id + '_table', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonDisabled');
- tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonDisabled');
-
- // Within a td element
- if (tdElm = tinyMCE.getParentElement(node, "td,th")) {
- tinyMCE.switchClass(editor_id + '_cell_props', 'mceButtonSelected');
- tinyMCE.switchClass(editor_id + '_delete_table', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_row_before', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_row_after', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_delete_row', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_col_before', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_col_after', 'mceButtonNormal');
- tinyMCE.switchClass(editor_id + '_delete_col', 'mceButtonNormal');
-
- colspan = tinyMCE.getAttrib(tdElm, "colspan");
- rowspan = tinyMCE.getAttrib(tdElm, "rowspan");
-
- colspan = colspan == "" ? "1" : colspan;
- rowspan = rowspan == "" ? "1" : rowspan;
-
- if (colspan != "1" || rowspan != "1")
- tinyMCE.switchClass(editor_id + '_split_cells', 'mceButtonNormal');
- }
+ return false;
+ }
- // Within a tr element
- if (tinyMCE.getParentElement(node, "tr"))
- tinyMCE.switchClass(editor_id + '_row_props', 'mceButtonSelected');
+ function select(dx, dy) {
+ var td;
- // Within table
- if (tinyMCE.getParentElement(node, "table")) {
- tinyMCE.switchClass(editor_id + '_table', 'mceButtonSelected');
- tinyMCE.switchClass(editor_id + '_merge_cells', 'mceButtonNormal');
- }
- },
+ grid = getTableGrid(tableElm);
+ dx = dx || 0;
+ dy = dy || 0;
+ dx = Math.max(cpos.cellindex + dx, 0);
+ dy = Math.max(cpos.rowindex + dy, 0);
- // Private plugin internal methods
+ // Recalculate grid and select
+ inst.execCommand('mceRepaint');
+ td = getCell(grid, dy, dx);
- _mouseDownHandler : function(e) {
- var elm = tinyMCE.isMSIE ? event.srcElement : e.target;
- var focusElm = tinyMCE.selectedInstance.getFocusElement();
+ if (td) {
+ inst.selection.select(td.firstChild || td);
+ inst.selection.collapse(1);
+ }
+ };
- // If press on special Mozilla create TD/TR thingie
- if (elm.nodeName == "BODY" && (focusElm.nodeName == "TD" || focusElm.nodeName == "TH" || (focusElm.parentNode && focusElm.parentNode.nodeName == "TD") ||(focusElm.parentNode && focusElm.parentNode.nodeName == "TH") )) {
- window.setTimeout(function() {
- var tableElm = tinyMCE.getParentElement(focusElm, "table");
- tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
- }, 10);
- }
- },
-
- /**
- * Executes the table commands.
- */
- _doExecCommand : function(editor_id, element, command, user_interface, value) {
- var inst = tinyMCE.getInstanceById(editor_id);
- var focusElm = inst.getFocusElement();
- var trElm = tinyMCE.getParentElement(focusElm, "tr");
- var tdElm = tinyMCE.getParentElement(focusElm, "td,th");
- var tableElm = tinyMCE.getParentElement(focusElm, "table");
- var doc = inst.contentWindow.document;
- var tableBorder = tableElm ? tableElm.getAttribute("border") : "";
-
- // Get first TD if no TD found
- if (trElm && tdElm == null)
- tdElm = trElm.cells[0];
-
- // ------- Inner functions ---------
- function inArray(ar, v) {
- for (var i=0; i<ar.length; i++) {
- // Is array
- if (ar[i].length > 0 && inArray(ar[i], v))
- return true;
+ function makeTD() {
+ var newTD = doc.createElement("td");
- // Found value
- if (ar[i] == v)
- return true;
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
}
- return false;
- }
-
- function makeTD() {
- var newTD = doc.createElement("td");
- newTD.innerHTML = " ";
- }
-
- function getColRowSpan(td) {
- var colspan = tinyMCE.getAttrib(td, "colspan");
- var rowspan = tinyMCE.getAttrib(td, "rowspan");
+ function getColRowSpan(td) {
+ var colspan = inst.dom.getAttrib(td, "colspan");
+ var rowspan = inst.dom.getAttrib(td, "rowspan");
- colspan = colspan == "" ? 1 : parseInt(colspan);
- rowspan = rowspan == "" ? 1 : parseInt(rowspan);
+ colspan = colspan == "" ? 1 : parseInt(colspan);
+ rowspan = rowspan == "" ? 1 : parseInt(rowspan);
- return {colspan : colspan, rowspan : rowspan};
- }
+ return {colspan : colspan, rowspan : rowspan};
+ }
- function getCellPos(grid, td) {
- var x, y;
+ function getCellPos(grid, td) {
+ var x, y;
- for (y=0; y<grid.length; y++) {
- for (x=0; x<grid[y].length; x++) {
- if (grid[y][x] == td)
- return {cellindex : x, rowindex : y};
+ for (y=0; y<grid.length; y++) {
+ for (x=0; x<grid[y].length; x++) {
+ if (grid[y][x] == td)
+ return {cellindex : x, rowindex : y};
+ }
}
- }
- return null;
- }
+ return null;
+ }
- function getCell(grid, row, col) {
- if (grid[row] && grid[row][col])
- return grid[row][col];
+ function getCell(grid, row, col) {
+ if (grid[row] && grid[row][col])
+ return grid[row][col];
- return null;
- }
+ return null;
+ }
- function getTableGrid(table) {
- var grid = new Array(), rows = table.rows, x, y, td, sd, xstart, x2, y2;
+ function getTableGrid(table) {
+ var grid = [], rows = table.rows, x, y, td, sd, xstart, x2, y2;
- for (y=0; y<rows.length; y++) {
- for (x=0; x<rows[y].cells.length; x++) {
- td = rows[y].cells[x];
- sd = getColRowSpan(td);
+ for (y=0; y<rows.length; y++) {
+ for (x=0; x<rows[y].cells.length; x++) {
+ td = rows[y].cells[x];
+ sd = getColRowSpan(td);
- // All ready filled
- for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
+ // All ready filled
+ for (xstart = x; grid[y] && grid[y][xstart]; xstart++) ;
- // Fill box
- for (y2=y; y2<y+sd['rowspan']; y2++) {
- if (!grid[y2])
- grid[y2] = new Array();
+ // Fill box
+ for (y2=y; y2<y+sd['rowspan']; y2++) {
+ if (!grid[y2])
+ grid[y2] = [];
- for (x2=xstart; x2<xstart+sd['colspan']; x2++)
- grid[y2][x2] = td;
+ for (x2=xstart; x2<xstart+sd['colspan']; x2++)
+ grid[y2][x2] = td;
+ }
}
}
+
+ return grid;
}
- return grid;
- }
+ function trimRow(table, tr, td, new_tr) {
+ var grid = getTableGrid(table), cpos = getCellPos(grid, td);
+ var cells, lastElm;
+
+ // Time to crop away some
+ if (new_tr.cells.length != tr.childNodes.length) {
+ cells = tr.childNodes;
+ lastElm = null;
+
+ for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
+ var remove = true;
+ var sd = getColRowSpan(td);
+
+ // Remove due to rowspan
+ if (inArray(cells, td)) {
+ new_tr.childNodes[x]._delete = true;
+ } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
+ for (var i=x; i<x+td.colSpan; i++)
+ new_tr.childNodes[i]._delete = true;
+ }
- function trimRow(table, tr, td, new_tr) {
- var grid = getTableGrid(table), cpos = getCellPos(grid, td);
- var cells, lastElm;
-
- // Time to crop away some
- if (new_tr.cells.length != tr.childNodes.length) {
- cells = tr.childNodes;
- lastElm = null;
-
- for (var x=0; td = getCell(grid, cpos.rowindex, x); x++) {
- var remove = true;
- var sd = getColRowSpan(td);
-
- // Remove due to rowspan
- if (inArray(cells, td)) {
- new_tr.childNodes[x]._delete = true;
- } else if ((lastElm == null || td != lastElm) && sd.colspan > 1) { // Remove due to colspan
- for (var i=x; i<x+td.colSpan; i++)
- new_tr.childNodes[i]._delete = true;
- }
+ if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
+ td.rowSpan = sd.rowspan + 1;
- if ((lastElm == null || td != lastElm) && sd.rowspan > 1)
- td.rowSpan = sd.rowspan + 1;
+ lastElm = td;
+ }
- lastElm = td;
+ deleteMarked(tableElm);
}
-
- deleteMarked(tableElm);
}
- }
- function prevElm(node, name) {
- while ((node = node.previousSibling) != null) {
- if (node.nodeName == name)
- return node;
- }
+ function prevElm(node, name) {
+ while ((node = node.previousSibling) != null) {
+ if (node.nodeName == name)
+ return node;
+ }
- return null;
- }
+ return null;
+ }
- function nextElm(node, names) {
- var namesAr = names.split(',');
+ function nextElm(node, names) {
+ var namesAr = names.split(',');
- while ((node = node.nextSibling) != null) {
- for (var i=0; i<namesAr.length; i++) {
- if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
- return node;
+ while ((node = node.nextSibling) != null) {
+ for (var i=0; i<namesAr.length; i++) {
+ if (node.nodeName.toLowerCase() == namesAr[i].toLowerCase() )
+ return node;
+ }
}
+
+ return null;
}
- return null;
- }
+ function deleteMarked(tbl) {
+ if (tbl.rows == 0)
+ return;
- function deleteMarked(tbl) {
- if (tbl.rows == 0)
- return;
+ var tr = tbl.rows[0];
+ do {
+ var next = nextElm(tr, "TR");
- var tr = tbl.rows[0];
- do {
- var next = nextElm(tr, "TR");
+ // Delete row
+ if (tr._delete) {
+ tr.parentNode.removeChild(tr);
+ continue;
+ }
- // Delete row
- if (tr._delete) {
- tr.parentNode.removeChild(tr);
- continue;
- }
+ // Delete cells
+ var td = tr.cells[0];
+ if (td.cells > 1) {
+ do {
+ var nexttd = nextElm(td, "TD,TH");
- // Delete cells
- var td = tr.cells[0];
- if (td.cells > 1) {
- do {
- var nexttd = nextElm(td, "TD,TH");
+ if (td._delete)
+ td.parentNode.removeChild(td);
+ } while ((td = nexttd) != null);
+ }
+ } while ((tr = next) != null);
+ }
- if (td._delete)
- td.parentNode.removeChild(td);
- } while ((td = nexttd) != null);
- }
- } while ((tr = next) != null);
- }
+ function addRows(td_elm, tr_elm, rowspan) {
+ // Add rows
+ td_elm.rowSpan = 1;
+ var trNext = nextElm(tr_elm, "TR");
+ for (var i=1; i<rowspan && trNext; i++) {
+ var newTD = doc.createElement("td");
- function addRows(td_elm, tr_elm, rowspan) {
- // Add rows
- td_elm.rowSpan = 1;
- var trNext = nextElm(tr_elm, "TR");
- for (var i=1; i<rowspan && trNext; i++) {
- var newTD = doc.createElement("td");
- newTD.innerHTML = " ";
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- if (tinyMCE.isMSIE)
- trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
- else
- trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
+ if (tinymce.isIE)
+ trNext.insertBefore(newTD, trNext.cells(td_elm.cellIndex));
+ else
+ trNext.insertBefore(newTD, trNext.cells[td_elm.cellIndex]);
- trNext = nextElm(trNext, "TR");
+ trNext = nextElm(trNext, "TR");
+ }
}
- }
- function copyRow(doc, table, tr) {
- var grid = getTableGrid(table);
- var newTR = tr.cloneNode(false);
- var cpos = getCellPos(grid, tr.cells[0]);
- var lastCell = null;
- var tableBorder = tinyMCE.getAttrib(table, "border");
- var tdElm = null;
-
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- var newTD = null;
-
- if (lastCell != tdElm) {
- for (var i=0; i<tr.cells.length; i++) {
- if (tdElm == tr.cells[i]) {
- newTD = tdElm.cloneNode(true);
- break;
+ function copyRow(doc, table, tr) {
+ var grid = getTableGrid(table);
+ var newTR = tr.cloneNode(false);
+ var cpos = getCellPos(grid, tr.cells[0]);
+ var lastCell = null;
+ var tableBorder = inst.dom.getAttrib(table, "border");
+ var tdElm = null;
+
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ var newTD = null;
+
+ if (lastCell != tdElm) {
+ for (var i=0; i<tr.cells.length; i++) {
+ if (tdElm == tr.cells[i]) {
+ newTD = tdElm.cloneNode(true);
+ break;
+ }
}
}
- }
- if (newTD == null) {
- newTD = doc.createElement("td");
- newTD.innerHTML = " ";
- }
+ if (newTD == null) {
+ newTD = doc.createElement("td");
- // Reset col/row span
- newTD.colSpan = 1;
- newTD.rowSpan = 1;
-
- newTR.appendChild(newTD);
-
- lastCell = tdElm;
- }
-
- return newTR;
- }
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
+ }
- // ---- Commands -----
+ // Reset col/row span
+ newTD.colSpan = 1;
+ newTD.rowSpan = 1;
- // Handle commands
- switch (command) {
- case "mceTableRowProps":
- if (trElm == null)
- return true;
+ newTR.appendChild(newTD);
- if (user_interface) {
- // Setup template
- var template = new Array();
+ lastCell = tdElm;
+ }
- template['file'] = '../../plugins/table/row.htm';
- template['width'] = 380;
- template['height'] = 295;
+ return newTR;
+ }
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_rowprops_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_rowprops_delta_height', 0);
+ // ---- Commands -----
+
+ // Handle commands
+ switch (command) {
+ case "mceTableRowProps":
+ if (trElm == null)
+ return true;
+
+ if (user_interface) {
+ inst.windowManager.open({
+ url : url + '/row.htm',
+ width : 400 + parseInt(inst.getLang('table.rowprops_delta_width', 0)),
+ height : 295 + parseInt(inst.getLang('table.rowprops_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ }
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
- }
+ return true;
- return true;
+ case "mceTableCellProps":
+ if (tdElm == null)
+ return true;
+
+ if (user_interface) {
+ inst.windowManager.open({
+ url : url + '/cell.htm',
+ width : 400 + parseInt(inst.getLang('table.cellprops_delta_width', 0)),
+ height : 295 + parseInt(inst.getLang('table.cellprops_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ }
- case "mceTableCellProps":
- if (tdElm == null)
return true;
- if (user_interface) {
- // Setup template
- var template = new Array();
+ case "mceInsertTable":
+ if (user_interface) {
+ inst.windowManager.open({
+ url : url + '/table.htm',
+ width : 400 + parseInt(inst.getLang('table.table_delta_width', 0)),
+ height : 320 + parseInt(inst.getLang('table.table_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url,
+ action : value ? value.action : 0
+ });
+ }
- template['file'] = '../../plugins/table/cell.htm';
- template['width'] = 380;
- template['height'] = 295;
+ return true;
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_cellprops_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_cellprops_delta_height', 0);
+ case "mceTableDelete":
+ var table = inst.dom.getParent(inst.selection.getNode(), "table");
+ if (table) {
+ table.parentNode.removeChild(table);
+ inst.execCommand('mceRepaint');
+ }
+ return true;
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes"});
- }
+ case "mceTableSplitCells":
+ case "mceTableMergeCells":
+ case "mceTableInsertRowBefore":
+ case "mceTableInsertRowAfter":
+ case "mceTableDeleteRow":
+ case "mceTableInsertColBefore":
+ case "mceTableInsertColAfter":
+ case "mceTableDeleteCol":
+ case "mceTableCutRow":
+ case "mceTableCopyRow":
+ case "mceTablePasteRowBefore":
+ case "mceTablePasteRowAfter":
+ // No table just return (invalid command)
+ if (!tableElm)
+ return true;
+
+ // Table has a tbody use that reference
+ // Changed logic by ApTest 2005.07.12 (www.aptest.com)
+ // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
+ if (trElm && tableElm != trElm.parentNode)
+ tableElm = trElm.parentNode;
+
+ if (tableElm && trElm) {
+ switch (command) {
+ case "mceTableCutRow":
+ if (!trElm || !tdElm)
+ return true;
- return true;
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+ inst.execCommand("mceTableDeleteRow");
+ break;
- case "mceInsertTable":
- if (user_interface) {
- // Setup template
- var template = new Array();
+ case "mceTableCopyRow":
+ if (!trElm || !tdElm)
+ return true;
- template['file'] = '../../plugins/table/table.htm';
- template['width'] = 380;
- template['height'] = 295;
+ inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
+ break;
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_table_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_table_delta_height', 0);
+ case "mceTablePasteRowBefore":
+ if (!trElm || !tdElm)
+ return true;
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : value});
- }
+ var newTR = inst.tableRowClipboard.cloneNode(true);
- return true;
+ var prevTR = prevElm(trElm, "TR");
+ if (prevTR != null)
+ trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
- case "mceTableDelete":
- var table = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- if (table) {
- table.parentNode.removeChild(table);
- inst.repaint();
- }
- return true;
+ trElm.parentNode.insertBefore(newTR, trElm);
+ break;
- case "mceTableSplitCells":
- case "mceTableMergeCells":
- case "mceTableInsertRowBefore":
- case "mceTableInsertRowAfter":
- case "mceTableDeleteRow":
- case "mceTableInsertColBefore":
- case "mceTableInsertColAfter":
- case "mceTableDeleteCol":
- case "mceTableCutRow":
- case "mceTableCopyRow":
- case "mceTablePasteRowBefore":
- case "mceTablePasteRowAfter":
- // No table just return (invalid command)
- if (!tableElm)
- return true;
+ case "mceTablePasteRowAfter":
+ if (!trElm || !tdElm)
+ return true;
+
+ var nextTR = nextElm(trElm, "TR");
+ var newTR = inst.tableRowClipboard.cloneNode(true);
- // Table has a tbody use that reference
- // Changed logic by ApTest 2005.07.12 (www.aptest.com)
- // Now lookk at the focused element and take its parentNode. That will be a tbody or a table.
- if (trElm && tableElm != trElm.parentNode)
- tableElm = trElm.parentNode;
+ trimRow(tableElm, trElm, tdElm, newTR);
- if (tableElm && trElm) {
- switch (command) {
- case "mceTableCutRow":
- if (!trElm || !tdElm)
- return true;
+ if (nextTR == null)
+ trElm.parentNode.appendChild(newTR);
+ else
+ nextTR.parentNode.insertBefore(newTR, nextTR);
- inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
- inst.execCommand("mceTableDeleteRow");
- break;
+ break;
- case "mceTableCopyRow":
- if (!trElm || !tdElm)
- return true;
+ case "mceTableInsertRowBefore":
+ if (!trElm || !tdElm)
+ return true;
- inst.tableRowClipboard = copyRow(doc, tableElm, trElm);
- break;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var newTR = doc.createElement("tr");
+ var lastTDElm = null;
- case "mceTablePasteRowBefore":
- if (!trElm || !tdElm)
- return true;
+ cpos.rowindex--;
+ if (cpos.rowindex < 0)
+ cpos.rowindex = 0;
- var newTR = inst.tableRowClipboard.cloneNode(true);
+ // Create cells
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- var prevTR = prevElm(trElm, "TR");
- if (prevTR != null)
- trimRow(tableElm, prevTR, prevTR.cells[0], newTR);
+ if (sd['rowspan'] == 1) {
+ var newTD = doc.createElement("td");
- trElm.parentNode.insertBefore(newTR, trElm);
- break;
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- case "mceTablePasteRowAfter":
- if (!trElm || !tdElm)
- return true;
-
- var nextTR = nextElm(trElm, "TR");
- var newTR = inst.tableRowClipboard.cloneNode(true);
+ newTD.colSpan = tdElm.colSpan;
- trimRow(tableElm, trElm, tdElm, newTR);
+ newTR.appendChild(newTD);
+ } else
+ tdElm.rowSpan = sd['rowspan'] + 1;
- if (nextTR == null)
- trElm.parentNode.appendChild(newTR);
- else
- nextTR.parentNode.insertBefore(newTR, nextTR);
+ lastTDElm = tdElm;
+ }
+ }
+ trElm.parentNode.insertBefore(newTR, trElm);
+ select(0, 1);
break;
- case "mceTableInsertRowBefore":
- if (!trElm || !tdElm)
- return true;
+ case "mceTableInsertRowAfter":
+ if (!trElm || !tdElm)
+ return true;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var newTR = doc.createElement("tr");
- var lastTDElm = null;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var newTR = doc.createElement("tr");
+ var lastTDElm = null;
- cpos.rowindex--;
- if (cpos.rowindex < 0)
- cpos.rowindex = 0;
+ // Create cells
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- // Create cells
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (sd['rowspan'] == 1) {
+ var newTD = doc.createElement("td");
- if (sd['rowspan'] == 1) {
- var newTD = doc.createElement("td");
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- newTD.innerHTML = " ";
- newTD.colSpan = tdElm.colSpan;
+ newTD.colSpan = tdElm.colSpan;
- newTR.appendChild(newTD);
- } else
- tdElm.rowSpan = sd['rowspan'] + 1;
+ newTR.appendChild(newTD);
+ } else
+ tdElm.rowSpan = sd['rowspan'] + 1;
- lastTDElm = tdElm;
+ lastTDElm = tdElm;
+ }
}
- }
- trElm.parentNode.insertBefore(newTR, trElm);
+ if (newTR.hasChildNodes()) {
+ var nextTR = nextElm(trElm, "TR");
+ if (nextTR)
+ nextTR.parentNode.insertBefore(newTR, nextTR);
+ else
+ tableElm.appendChild(newTR);
+ }
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex + 1, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ select(0, 1);
+ break;
- case "mceTableInsertRowAfter":
- if (!trElm || !tdElm)
- return true;
+ case "mceTableDeleteRow":
+ if (!trElm || !tdElm)
+ return true;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var newTR = doc.createElement("tr");
- var lastTDElm = null;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
- // Create cells
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ // Only one row, remove whole table
+ if (grid.length == 1) {
+ inst.dom.remove(inst.dom.getParent(tableElm, "table"));
+ return true;
+ }
- if (sd['rowspan'] == 1) {
- var newTD = doc.createElement("td");
+ // Move down row spanned cells
+ var cells = trElm.cells;
+ var nextTR = nextElm(trElm, "TR");
+ for (var x=0; x<cells.length; x++) {
+ if (cells[x].rowSpan > 1) {
+ var newTD = cells[x].cloneNode(true);
+ var sd = getColRowSpan(cells[x]);
- newTD.innerHTML = " ";
- newTD.colSpan = tdElm.colSpan;
+ newTD.rowSpan = sd.rowspan - 1;
- newTR.appendChild(newTD);
- } else
- tdElm.rowSpan = sd['rowspan'] + 1;
+ var nextTD = nextTR.cells[x];
- lastTDElm = tdElm;
+ if (nextTD == null)
+ nextTR.appendChild(newTD);
+ else
+ nextTR.insertBefore(newTD, nextTD);
+ }
}
- }
- if (newTR.hasChildNodes()) {
- var nextTR = nextElm(trElm, "TR");
- if (nextTR)
- nextTR.parentNode.insertBefore(newTR, nextTR);
- else
- tableElm.appendChild(newTR);
- }
+ // Delete cells
+ var lastTDElm = null;
+ for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ if (sd.rowspan > 1) {
+ tdElm.rowSpan = sd.rowspan - 1;
+ } else {
+ trElm = tdElm.parentNode;
- case "mceTableDeleteRow":
- if (!trElm || !tdElm)
- return true;
+ if (trElm.parentNode)
+ trElm._delete = true;
+ }
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
+ lastTDElm = tdElm;
+ }
+ }
- // Only one row, remove whole table
- if (grid.length == 1) {
- tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
- tableElm.parentNode.removeChild(tableElm);
- return true;
- }
+ deleteMarked(tableElm);
- // Move down row spanned cells
- var cells = trElm.cells;
- var nextTR = nextElm(trElm, "TR");
- for (var x=0; x<cells.length; x++) {
- if (cells[x].rowSpan > 1) {
- var newTD = cells[x].cloneNode(true);
- var sd = getColRowSpan(cells[x]);
+ select(0, -1);
+ break;
- newTD.rowSpan = sd.rowspan - 1;
+ case "mceTableInsertColBefore":
+ if (!trElm || !tdElm)
+ return true;
- var nextTD = nextTR.cells[x];
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
- if (nextTD == null)
- nextTR.appendChild(newTD);
- else
- nextTR.insertBefore(newTD, nextTD);
- }
- }
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- // Delete cells
- var lastTDElm = null;
- for (var x=0; tdElm = getCell(grid, cpos.rowindex, x); x++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (sd['colspan'] == 1) {
+ var newTD = doc.createElement(tdElm.nodeName);
- if (sd.rowspan > 1) {
- tdElm.rowSpan = sd.rowspan - 1;
- } else {
- trElm = tdElm.parentNode;
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- if (trElm.parentNode)
- trElm._delete = true;
- }
+ newTD.rowSpan = tdElm.rowSpan;
- lastTDElm = tdElm;
- }
- }
+ tdElm.parentNode.insertBefore(newTD, tdElm);
+ } else
+ tdElm.colSpan++;
- deleteMarked(tableElm);
+ lastTDElm = tdElm;
+ }
+ }
- cpos.rowindex--;
- if (cpos.rowindex < 0)
- cpos.rowindex = 0;
+ select();
+ break;
- // Recalculate grid and select
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ case "mceTableInsertColAfter":
+ if (!trElm || !tdElm)
+ return true;
- case "mceTableInsertColBefore":
- if (!trElm || !tdElm)
- return true;
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ if (sd['colspan'] == 1) {
+ var newTD = doc.createElement(tdElm.nodeName);
- if (sd['colspan'] == 1) {
- var newTD = doc.createElement(tdElm.nodeName);
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- newTD.innerHTML = " ";
- newTD.rowSpan = tdElm.rowSpan;
+ newTD.rowSpan = tdElm.rowSpan;
- tdElm.parentNode.insertBefore(newTD, tdElm);
- } else
- tdElm.colSpan++;
+ var nextTD = nextElm(tdElm, "TD,TH");
+ if (nextTD == null)
+ tdElm.parentNode.appendChild(newTD);
+ else
+ nextTD.parentNode.insertBefore(newTD, nextTD);
+ } else
+ tdElm.colSpan++;
- lastTDElm = tdElm;
+ lastTDElm = tdElm;
+ }
}
- }
-
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex + 1), tinyMCE.isGecko, true); // Only collape on gecko
- break;
- case "mceTableInsertColAfter":
- if (!trElm || !tdElm)
- return true;
+ select(1);
+ break;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ case "mceTableDeleteCol":
+ if (!trElm || !tdElm)
+ return true;
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ var grid = getTableGrid(tableElm);
+ var cpos = getCellPos(grid, tdElm);
+ var lastTDElm = null;
- if (sd['colspan'] == 1) {
- var newTD = doc.createElement(tdElm.nodeName);
+ // Only one col, remove whole table
+ if (grid.length > 1 && grid[0].length <= 1) {
+ inst.dom.remove(inst.dom.getParent(tableElm, "table"));
+ return true;
+ }
- newTD.innerHTML = " ";
- newTD.rowSpan = tdElm.rowSpan;
+ // Delete cells
+ for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
+ if (tdElm != lastTDElm) {
+ var sd = getColRowSpan(tdElm);
- var nextTD = nextElm(tdElm, "TD,TH");
- if (nextTD == null)
- tdElm.parentNode.appendChild(newTD);
- else
- nextTD.parentNode.insertBefore(newTD, nextTD);
- } else
- tdElm.colSpan++;
+ if (sd['colspan'] > 1)
+ tdElm.colSpan = sd['colspan'] - 1;
+ else {
+ if (tdElm.parentNode)
+ tdElm.parentNode.removeChild(tdElm);
+ }
- lastTDElm = tdElm;
+ lastTDElm = tdElm;
+ }
}
- }
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, cpos.cellindex), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ select(-1);
+ break;
- case "mceTableDeleteCol":
+ case "mceTableSplitCells":
if (!trElm || !tdElm)
return true;
- var grid = getTableGrid(tableElm);
- var cpos = getCellPos(grid, tdElm);
- var lastTDElm = null;
+ var spandata = getColRowSpan(tdElm);
- // Only one col, remove whole table
- if (grid.length > 1 && grid[0].length <= 1) {
- tableElm = tinyMCE.getParentElement(tableElm, "table"); // Look for table instead of tbody
- tableElm.parentNode.removeChild(tableElm);
- return true;
- }
+ var colspan = spandata["colspan"];
+ var rowspan = spandata["rowspan"];
- // Delete cells
- for (var y=0; tdElm = getCell(grid, y, cpos.cellindex); y++) {
- if (tdElm != lastTDElm) {
- var sd = getColRowSpan(tdElm);
+ // Needs splitting
+ if (colspan > 1 || rowspan > 1) {
+ // Generate cols
+ tdElm.colSpan = 1;
+ for (var i=1; i<colspan; i++) {
+ var newTD = doc.createElement("td");
- if (sd['colspan'] > 1)
- tdElm.colSpan = sd['colspan'] - 1;
- else {
- if (tdElm.parentNode)
- tdElm.parentNode.removeChild(tdElm);
- }
+ if (!tinymce.isIE)
+ newTD.innerHTML = '<br mce_bogus="1"/>';
- lastTDElm = tdElm;
- }
- }
-
- cpos.cellindex--;
- if (cpos.cellindex < 0)
- cpos.cellindex = 0;
-
- // Recalculate grid and select
- grid = getTableGrid(tableElm);
- inst.selection.selectNode(getCell(grid, cpos.rowindex, 0), tinyMCE.isGecko, true); // Only collape on gecko
- break;
+ trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
- case "mceTableSplitCells":
- if (!trElm || !tdElm)
- return true;
+ if (rowspan > 1)
+ addRows(newTD, trElm, rowspan);
+ }
- var spandata = getColRowSpan(tdElm);
+ addRows(tdElm, trElm, rowspan);
+ }
- var colspan = spandata["colspan"];
- var rowspan = spandata["rowspan"];
+ // Apply visual aids
+ tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
+ break;
- // Needs splitting
- if (colspan > 1 || rowspan > 1) {
- // Generate cols
- tdElm.colSpan = 1;
- for (var i=1; i<colspan; i++) {
- var newTD = doc.createElement("td");
+ case "mceTableMergeCells":
+ var rows = [];
+ var sel = inst.selection.getSel();
+ var grid = getTableGrid(tableElm);
- newTD.innerHTML = " ";
+ if (tinymce.isIE || sel.rangeCount == 1) {
+ if (user_interface) {
+ // Setup template
+ var sp = getColRowSpan(tdElm);
+
+ inst.windowManager.open({
+ url : url + '/merge_cells.htm',
+ width : 240 + parseInt(inst.getLang('table.merge_cells_delta_width', 0)),
+ height : 110 + parseInt(inst.getLang('table.merge_cells_delta_height', 0)),
+ inline : 1
+ }, {
+ action : "update",
+ numcols : sp.colspan,
+ numrows : sp.rowspan,
+ plugin_url : url
+ });
- trElm.insertBefore(newTD, nextElm(tdElm, "TD,TH"));
+ return true;
+ } else {
+ var numRows = parseInt(value['numrows']);
+ var numCols = parseInt(value['numcols']);
+ var cpos = getCellPos(grid, tdElm);
- if (rowspan > 1)
- addRows(newTD, trElm, rowspan);
- }
+ if (("" + numRows) == "NaN")
+ numRows = 1;
- addRows(tdElm, trElm, rowspan);
- }
+ if (("" + numCols) == "NaN")
+ numCols = 1;
- // Apply visual aids
- tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- break;
+ // Get rows and cells
+ var tRows = tableElm.rows;
+ for (var y=cpos.rowindex; y<grid.length; y++) {
+ var rowCells = [];
- case "mceTableMergeCells":
- var rows = new Array();
- var sel = inst.getSel();
- var grid = getTableGrid(tableElm);
+ for (var x=cpos.cellindex; x<grid[y].length; x++) {
+ var td = getCell(grid, y, x);
- if (tinyMCE.isMSIE || sel.rangeCount == 1) {
- if (user_interface) {
- // Setup template
- var template = new Array();
- var sp = getColRowSpan(tdElm);
+ if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
+ var cp = getCellPos(grid, td);
- template['file'] = '../../plugins/table/merge_cells.htm';
- template['width'] = 250;
- template['height'] = 105 + (tinyMCE.isNS7 ? 25 : 0);
+ // Within range
+ if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+ rowCells[rowCells.length] = td;
+ }
+ }
- // Language specific width and height addons
- template['width'] += tinyMCE.getLang('lang_table_merge_cells_delta_width', 0);
- template['height'] += tinyMCE.getLang('lang_table_merge_cells_delta_height', 0);
+ if (rowCells.length > 0)
+ rows[rows.length] = rowCells;
- // Open window
- tinyMCE.openWindow(template, {editor_id : inst.editorId, inline : "yes", action : "update", numcols : sp.colspan, numrows : sp.rowspan});
+ var td = getCell(grid, cpos.rowindex, cpos.cellindex);
+ each(ed.dom.select('br', td), function(e, i) {
+ if (i > 0 && ed.dom.getAttrib('mce_bogus'))
+ ed.dom.remove(e);
+ });
+ }
- return true;
+ //return true;
+ }
} else {
- var numRows = parseInt(value['numrows']);
- var numCols = parseInt(value['numcols']);
- var cpos = getCellPos(grid, tdElm);
+ var cells = [];
+ var sel = inst.selection.getSel();
+ var lastTR = null;
+ var curRow = null;
+ var x1 = -1, y1 = -1, x2, y2;
+
+ // Only one cell selected, whats the point?
+ if (sel.rangeCount < 2)
+ return true;
+
+ // Get all selected cells
+ for (var i=0; i<sel.rangeCount; i++) {
+ var rng = sel.getRangeAt(i);
+ var tdElm = rng.startContainer.childNodes[rng.startOffset];
- if (("" + numRows) == "NaN")
- numRows = 1;
+ if (!tdElm)
+ break;
- if (("" + numCols) == "NaN")
- numCols = 1;
+ if (tdElm.nodeName == "TD")
+ cells[cells.length] = tdElm;
+ }
// Get rows and cells
var tRows = tableElm.rows;
- for (var y=cpos.rowindex; y<grid.length; y++) {
- var rowCells = new Array();
-
- for (var x=cpos.cellindex; x<grid[y].length; x++) {
- var td = getCell(grid, y, x);
+ for (var y=0; y<tRows.length; y++) {
+ var rowCells = [];
- if (td && !inArray(rows, td) && !inArray(rowCells, td)) {
- var cp = getCellPos(grid, td);
+ for (var x=0; x<tRows[y].cells.length; x++) {
+ var td = tRows[y].cells[x];
- // Within range
- if (cp.cellindex < cpos.cellindex+numCols && cp.rowindex < cpos.rowindex+numRows)
+ for (var i=0; i<cells.length; i++) {
+ if (td == cells[i]) {
rowCells[rowCells.length] = td;
+ }
}
}
@@ -881,193 +915,156 @@ var TinyMCE_TablePlugin = { rows[rows.length] = rowCells;
}
- //return true;
- }
- } else {
- var cells = new Array();
- var sel = inst.getSel();
- var lastTR = null;
- var curRow = null;
- var x1 = -1, y1 = -1, x2, y2;
-
- // Only one cell selected, whats the point?
- if (sel.rangeCount < 2)
- return true;
-
- // Get all selected cells
- for (var i=0; i<sel.rangeCount; i++) {
- var rng = sel.getRangeAt(i);
- var tdElm = rng.startContainer.childNodes[rng.startOffset];
-
- if (!tdElm)
- break;
-
- if (tdElm.nodeName == "TD")
- cells[cells.length] = tdElm;
- }
-
- // Get rows and cells
- var tRows = tableElm.rows;
- for (var y=0; y<tRows.length; y++) {
- var rowCells = new Array();
-
- for (var x=0; x<tRows[y].cells.length; x++) {
- var td = tRows[y].cells[x];
-
- for (var i=0; i<cells.length; i++) {
- if (td == cells[i]) {
- rowCells[rowCells.length] = td;
+ // Find selected cells in grid and box
+ var curRow = [];
+ var lastTR = null;
+ for (var y=0; y<grid.length; y++) {
+ for (var x=0; x<grid[y].length; x++) {
+ grid[y][x]._selected = false;
+
+ for (var i=0; i<cells.length; i++) {
+ if (grid[y][x] == cells[i]) {
+ // Get start pos
+ if (x1 == -1) {
+ x1 = x;
+ y1 = y;
+ }
+
+ // Get end pos
+ x2 = x;
+ y2 = y;
+
+ grid[y][x]._selected = true;
+ }
}
}
}
- if (rowCells.length > 0)
- rows[rows.length] = rowCells;
- }
-
- // Find selected cells in grid and box
- var curRow = new Array();
- var lastTR = null;
- for (var y=0; y<grid.length; y++) {
- for (var x=0; x<grid[y].length; x++) {
- grid[y][x]._selected = false;
-
- for (var i=0; i<cells.length; i++) {
- if (grid[y][x] == cells[i]) {
- // Get start pos
- if (x1 == -1) {
- x1 = x;
- y1 = y;
- }
-
- // Get end pos
- x2 = x;
- y2 = y;
-
- grid[y][x]._selected = true;
+ // Is there gaps, if so deny
+ for (var y=y1; y<=y2; y++) {
+ for (var x=x1; x<=x2; x++) {
+ if (!grid[y][x]._selected) {
+ alert("Invalid selection for merge.");
+ return true;
}
}
}
}
- // Is there gaps, if so deny
- for (var y=y1; y<=y2; y++) {
- for (var x=x1; x<=x2; x++) {
- if (!grid[y][x]._selected) {
- alert("Invalid selection for merge.");
- return true;
- }
- }
- }
- }
+ // Validate selection and get total rowspan and colspan
+ var rowSpan = 1, colSpan = 1;
- // Validate selection and get total rowspan and colspan
- var rowSpan = 1, colSpan = 1;
+ // Validate horizontal and get total colspan
+ var lastRowSpan = -1;
+ for (var y=0; y<rows.length; y++) {
+ var rowColSpan = 0;
- // Validate horizontal and get total colspan
- var lastRowSpan = -1;
- for (var y=0; y<rows.length; y++) {
- var rowColSpan = 0;
+ for (var x=0; x<rows[y].length; x++) {
+ var sd = getColRowSpan(rows[y][x]);
- for (var x=0; x<rows[y].length; x++) {
- var sd = getColRowSpan(rows[y][x]);
+ rowColSpan += sd['colspan'];
- rowColSpan += sd['colspan'];
+ if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
- if (lastRowSpan != -1 && sd['rowspan'] != lastRowSpan) {
- alert("Invalid selection for merge.");
- return true;
+ lastRowSpan = sd['rowspan'];
}
- lastRowSpan = sd['rowspan'];
- }
+ if (rowColSpan > colSpan)
+ colSpan = rowColSpan;
- if (rowColSpan > colSpan)
- colSpan = rowColSpan;
+ lastRowSpan = -1;
+ }
- lastRowSpan = -1;
- }
+ // Validate vertical and get total rowspan
+ var lastColSpan = -1;
+ for (var x=0; x<rows[0].length; x++) {
+ var colRowSpan = 0;
- // Validate vertical and get total rowspan
- var lastColSpan = -1;
- for (var x=0; x<rows[0].length; x++) {
- var colRowSpan = 0;
+ for (var y=0; y<rows.length; y++) {
+ var sd = getColRowSpan(rows[y][x]);
- for (var y=0; y<rows.length; y++) {
- var sd = getColRowSpan(rows[y][x]);
+ colRowSpan += sd['rowspan'];
- colRowSpan += sd['rowspan'];
+ if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
+ alert("Invalid selection for merge.");
+ return true;
+ }
- if (lastColSpan != -1 && sd['colspan'] != lastColSpan) {
- alert("Invalid selection for merge.");
- return true;
+ lastColSpan = sd['colspan'];
}
- lastColSpan = sd['colspan'];
- }
+ if (colRowSpan > rowSpan)
+ rowSpan = colRowSpan;
- if (colRowSpan > rowSpan)
- rowSpan = colRowSpan;
+ lastColSpan = -1;
+ }
- lastColSpan = -1;
- }
+ // Setup td
+ tdElm = rows[0][0];
+ tdElm.rowSpan = rowSpan;
+ tdElm.colSpan = colSpan;
- // Setup td
- tdElm = rows[0][0];
- tdElm.rowSpan = rowSpan;
- tdElm.colSpan = colSpan;
+ // Merge cells
+ for (var y=0; y<rows.length; y++) {
+ for (var x=0; x<rows[y].length; x++) {
+ var html = rows[y][x].innerHTML;
+ var chk = html.replace(/[ \t\r\n]/g, "");
- // Merge cells
- for (var y=0; y<rows.length; y++) {
- for (var x=0; x<rows[y].length; x++) {
- var html = rows[y][x].innerHTML;
- var chk = tinyMCE.regexpReplace(html, "[ \t\r\n]", "");
+ if (chk != "<br/>" && chk != "<br>" && chk != '<br mce_bogus="1"/>' && (x+y > 0))
+ tdElm.innerHTML += html;
- if (chk != "<br/>" && chk != "<br>" && chk != " " && (x+y > 0))
- tdElm.innerHTML += html;
+ // Not current cell
+ if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
+ var cpos = getCellPos(grid, rows[y][x]);
+ var tr = rows[y][x].parentNode;
- // Not current cell
- if (rows[y][x] != tdElm && !rows[y][x]._deleted) {
- var cpos = getCellPos(grid, rows[y][x]);
- var tr = rows[y][x].parentNode;
+ tr.removeChild(rows[y][x]);
+ rows[y][x]._deleted = true;
- tr.removeChild(rows[y][x]);
- rows[y][x]._deleted = true;
+ // Empty TR, remove it
+ if (!tr.hasChildNodes()) {
+ tr.parentNode.removeChild(tr);
- // Empty TR, remove it
- if (!tr.hasChildNodes()) {
- tr.parentNode.removeChild(tr);
+ var lastCell = null;
+ for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
+ if (cellElm != lastCell && cellElm.rowSpan > 1)
+ cellElm.rowSpan--;
- var lastCell = null;
- for (var x=0; cellElm = getCell(grid, cpos.rowindex, x); x++) {
- if (cellElm != lastCell && cellElm.rowSpan > 1)
- cellElm.rowSpan--;
+ lastCell = cellElm;
+ }
- lastCell = cellElm;
+ if (tdElm.rowSpan > 1)
+ tdElm.rowSpan--;
}
-
- if (tdElm.rowSpan > 1)
- tdElm.rowSpan--;
}
}
}
+
+ // Remove all but one bogus br
+ each(ed.dom.select('br', tdElm), function(e, i) {
+ if (i > 0 && ed.dom.getAttrib(e, 'mce_bogus'))
+ ed.dom.remove(e);
+ });
+
+ break;
}
- break;
+ tableElm = inst.dom.getParent(inst.selection.getNode(), "table");
+ inst.addVisual(tableElm);
+ inst.nodeChanged();
}
- tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- tinyMCE.handleVisualAid(tableElm, true, tinyMCE.settings['visual'], tinyMCE.selectedInstance);
- tinyMCE.triggerNodeChange();
- inst.repaint();
- }
+ return true;
+ }
- return true;
+ // Pass to next handler in chain
+ return false;
}
+ });
- // Pass to next handler in chain
- return false;
- }
-};
-
-tinyMCE.addPlugin("table", TinyMCE_TablePlugin);
+ // Register plugin
+ tinymce.PluginManager.add('table', tinymce.plugins.TablePlugin);
+})();
\ 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 Binary files differdeleted file mode 100644 index 56a7396b8..000000000 --- a/program/js/tiny_mce/plugins/table/images/buttons.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table.gif b/program/js/tiny_mce/plugins/table/images/table.gif Binary files differdeleted file mode 100644 index 2911830c3..000000000 --- a/program/js/tiny_mce/plugins/table/images/table.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_cell_props.gif b/program/js/tiny_mce/plugins/table/images/table_cell_props.gif Binary files differdeleted file mode 100644 index bee7ed652..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_cell_props.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_delete.gif b/program/js/tiny_mce/plugins/table/images/table_delete.gif Binary files differdeleted file mode 100644 index 2a00e6ad6..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_delete.gif +++ /dev/null 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 Binary files differdeleted file mode 100644 index 260aa04ca..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_delete_col.gif +++ /dev/null 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 Binary files differdeleted file mode 100644 index 2fb5f2bab..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_delete_row.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif b/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif Binary files differdeleted file mode 100644 index 85058080c..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_insert_col_after.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif b/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif Binary files differdeleted file mode 100644 index b669d4fa6..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_insert_col_before.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif b/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif Binary files differdeleted file mode 100644 index b9c144661..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_insert_row_after.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif b/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif Binary files differdeleted file mode 100644 index 157d37365..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_insert_row_before.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif b/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif Binary files differdeleted file mode 100644 index 6834e611e..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_merge_cells.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_row_props.gif b/program/js/tiny_mce/plugins/table/images/table_row_props.gif Binary files differdeleted file mode 100644 index e5c7cc37a..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_row_props.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/images/table_split_cells.gif b/program/js/tiny_mce/plugins/table/images/table_split_cells.gif Binary files differdeleted file mode 100644 index 8ccb1b5f8..000000000 --- a/program/js/tiny_mce/plugins/table/images/table_split_cells.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/table/jscripts/cell.js b/program/js/tiny_mce/plugins/table/js/cell.js index 436eaad17..7d7f977fa 100644 --- a/program/js/tiny_mce/plugins/table/jscripts/cell.js +++ b/program/js/tiny_mce/plugins/table/js/cell.js @@ -1,32 +1,39 @@ +tinyMCEPopup.requireLangPack();
+
+var ed;
+
function init() {
+ ed = tinyMCEPopup.editor;
tinyMCEPopup.resizeToInnerSize();
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor')
- var inst = tinyMCE.selectedInstance;
- var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), "td,th");
+ var inst = ed;
+ var tdElm = ed.dom.getParent(ed.selection.getNode(), "td,th");
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(tinyMCE.getAttrib(tdElm, "style"));
+ var st = ed.dom.parseStyle(ed.dom.getAttrib(tdElm, "style"));
// Get table cell data
var celltype = tdElm.nodeName.toLowerCase();
- var align = tinyMCE.getAttrib(tdElm, 'align');
- var valign = tinyMCE.getAttrib(tdElm, 'valign');
+ var align = ed.dom.getAttrib(tdElm, 'align');
+ var valign = ed.dom.getAttrib(tdElm, 'valign');
var width = trimSize(getStyle(tdElm, 'width', 'width'));
var height = trimSize(getStyle(tdElm, 'height', 'height'));
var bordercolor = convertRGBToHex(getStyle(tdElm, 'bordercolor', 'borderLeftColor'));
var bgcolor = convertRGBToHex(getStyle(tdElm, 'bgcolor', 'backgroundColor'));
- var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(tdElm, 'class'), false);
+ var className = ed.dom.getAttrib(tdElm, 'class');
var backgroundimage = getStyle(tdElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
- var id = tinyMCE.getAttrib(tdElm, 'id');
- var lang = tinyMCE.getAttrib(tdElm, 'lang');
- var dir = tinyMCE.getAttrib(tdElm, 'dir');
- var scope = tinyMCE.getAttrib(tdElm, 'scope');
+ var id = ed.dom.getAttrib(tdElm, 'id');
+ var lang = ed.dom.getAttrib(tdElm, 'lang');
+ var dir = ed.dom.getAttrib(tdElm, 'dir');
+ var scope = ed.dom.getAttrib(tdElm, 'scope');
// Setup form
addClassesToList('class', 'table_cell_styles');
+ TinyMCE_EditableSelects.init();
+
formObj.bordercolor.value = bordercolor;
formObj.bgcolor.value = bgcolor;
formObj.backgroundimage.value = backgroundimage;
@@ -34,10 +41,10 @@ function init() { formObj.height.value = height;
formObj.id.value = id;
formObj.lang.value = lang;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
selectByValue(formObj, 'align', align);
selectByValue(formObj, 'valign', valign);
- selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'class', className, true, true);
selectByValue(formObj, 'celltype', celltype);
selectByValue(formObj, 'dir', dir);
selectByValue(formObj, 'scope', scope);
@@ -51,24 +58,24 @@ function init() { }
function updateAction() {
- tinyMCEPopup.restoreSelection();
+ var el, inst = ed, tdElm, trElm, tableElm, formObj = document.forms[0];
- var inst = tinyMCE.selectedInstance;
- var tdElm = tinyMCE.getParentElement(inst.getFocusElement(), "td,th");
- var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
- var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- var formObj = document.forms[0];
+ tinyMCEPopup.restoreSelection();
+ el = ed.selection.getNode();
+ tdElm = ed.dom.getParent(el, "td,th");
+ trElm = ed.dom.getParent(el, "tr");
+ tableElm = ed.dom.getParent(el, "table");
- inst.execCommand('mceBeginUndoLevel');
+ ed.execCommand('mceBeginUndoLevel');
switch (getSelectValue(formObj, 'action')) {
case "cell":
var celltype = getSelectValue(formObj, 'celltype');
var scope = getSelectValue(formObj, 'scope');
- if (tinyMCE.getParam("accessibility_warnings")) {
+ if (ed.getParam("accessibility_warnings")) {
if (celltype == "th" && scope == "")
- var answer = confirm(tinyMCE.getLang('lang_table_missing_scope', '', true));
+ var answer = confirm(ed.getLang('table_dlg.missing_scope', '', true));
else
var answer = true;
@@ -108,8 +115,8 @@ function updateAction() { break;
}
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- tinyMCE.triggerNodeChange();
+ ed.addVisual();
+ ed.nodeChanged();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
@@ -124,11 +131,12 @@ function nextCell(elm) { }
function updateCell(td, skip_id) {
- var inst = tinyMCE.selectedInstance;
+ var inst = ed;
var formObj = document.forms[0];
var curCellType = td.nodeName.toLowerCase();
var celltype = getSelectValue(formObj, 'celltype');
var doc = inst.getDoc();
+ var dom = ed.dom;
if (!skip_id)
td.setAttribute('id', formObj.id.value);
@@ -137,16 +145,16 @@ function updateCell(td, skip_id) { td.setAttribute('vAlign', formObj.valign.value);
td.setAttribute('lang', formObj.lang.value);
td.setAttribute('dir', getSelectValue(formObj, 'dir'));
- td.setAttribute('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(formObj.style.value)));
+ td.setAttribute('style', ed.dom.serializeStyle(ed.dom.parseStyle(formObj.style.value)));
td.setAttribute('scope', formObj.scope.value);
- tinyMCE.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
+ ed.dom.setAttrib(td, 'class', getSelectValue(formObj, 'class'));
// Clear deprecated attributes
- tinyMCE.setAttrib(td, 'width', '');
- tinyMCE.setAttrib(td, 'height', '');
- tinyMCE.setAttrib(td, 'bgColor', '');
- tinyMCE.setAttrib(td, 'borderColor', '');
- tinyMCE.setAttrib(td, 'background', '');
+ ed.dom.setAttrib(td, 'width', '');
+ ed.dom.setAttrib(td, 'height', '');
+ ed.dom.setAttrib(td, 'bgColor', '');
+ ed.dom.setAttrib(td, 'borderColor', '');
+ ed.dom.setAttrib(td, 'background', '');
// Set styles
td.style.width = getCSSSize(formObj.width.value);
@@ -172,30 +180,30 @@ function updateCell(td, skip_id) { for (var c=0; c<td.childNodes.length; c++)
newCell.appendChild(td.childNodes[c].cloneNode(1));
- for (var a=0; a<td.attributes.length; a++) {
- var attr = td.attributes[a];
- newCell.setAttribute(attr.name, attr.value);
- }
+ for (var a=0; a<td.attributes.length; a++)
+ ed.dom.setAttrib(newCell, td.attributes[a].name, ed.dom.getAttrib(td, td.attributes[a].name));
td.parentNode.replaceChild(newCell, td);
td = newCell;
}
+ dom.setAttrib(td, 'style', dom.serializeStyle(dom.parseStyle(td.style.cssText)));
+
return td;
}
function changedBackgroundImage() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
}
function changedSize() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
var width = formObj.width.value;
if (width != "")
@@ -209,22 +217,22 @@ function changedSize() { else
st['height'] = "";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
}
function changedColor() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
st['background-color'] = formObj.bgcolor.value;
st['border-color'] = formObj.bordercolor.value;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = ed.dom.serializeStyle(st);
}
function changedStyle() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = ed.dom.parseStyle(formObj.style.value);
if (st['background-image'])
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
@@ -247,3 +255,5 @@ function changedStyle() { updateColor('bordercolor_pick','bordercolor');
}
}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/js/merge_cells.js b/program/js/tiny_mce/plugins/table/js/merge_cells.js new file mode 100644 index 000000000..4fd026b11 --- /dev/null +++ b/program/js/tiny_mce/plugins/table/js/merge_cells.js @@ -0,0 +1,29 @@ +tinyMCEPopup.requireLangPack();
+
+function init() {
+ var f = document.forms[0], v;
+
+ tinyMCEPopup.resizeToInnerSize();
+
+ f.numcols.value = tinyMCEPopup.getWindowArg('numcols', 1);
+ f.numrows.value = tinyMCEPopup.getWindowArg('numcols', 1);
+}
+
+function mergeCells() {
+ var args = [], f = document.forms[0];
+
+ tinyMCEPopup.restoreSelection();
+
+ if (!AutoValidator.validate(f)) {
+ alert(tinyMCEPopup.getLang('invalid_data'));
+ return false;
+ }
+
+ args["numcols"] = f.numcols.value;
+ args["numrows"] = f.numrows.value;
+
+ tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/jscripts/row.js b/program/js/tiny_mce/plugins/table/js/row.js index 395ddf028..d25f635f6 100644 --- a/program/js/tiny_mce/plugins/table/jscripts/row.js +++ b/program/js/tiny_mce/plugins/table/js/row.js @@ -1,37 +1,42 @@ +tinyMCEPopup.requireLangPack();
+
function init() {
tinyMCEPopup.resizeToInnerSize();
document.getElementById('backgroundimagebrowsercontainer').innerHTML = getBrowserHTML('backgroundimagebrowser','backgroundimage','image','table');
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
- var inst = tinyMCE.selectedInstance;
- var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
+ var inst = tinyMCEPopup.editor;
+ var dom = inst.dom;
+ var trElm = dom.getParent(inst.selection.getNode(), "tr");
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(tinyMCE.getAttrib(trElm, "style"));
+ var st = dom.parseStyle(dom.getAttrib(trElm, "style"));
// Get table row data
var rowtype = trElm.parentNode.nodeName.toLowerCase();
- var align = tinyMCE.getAttrib(trElm, 'align');
- var valign = tinyMCE.getAttrib(trElm, 'valign');
+ var align = dom.getAttrib(trElm, 'align');
+ var valign = dom.getAttrib(trElm, 'valign');
var height = trimSize(getStyle(trElm, 'height', 'height'));
- var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(trElm, 'class'), false);
+ var className = dom.getAttrib(trElm, 'class');
var bgcolor = convertRGBToHex(getStyle(trElm, 'bgcolor', 'backgroundColor'));
var backgroundimage = getStyle(trElm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");;
- var id = tinyMCE.getAttrib(trElm, 'id');
- var lang = tinyMCE.getAttrib(trElm, 'lang');
- var dir = tinyMCE.getAttrib(trElm, 'dir');
+ var id = dom.getAttrib(trElm, 'id');
+ var lang = dom.getAttrib(trElm, 'lang');
+ var dir = dom.getAttrib(trElm, 'dir');
// Setup form
addClassesToList('class', 'table_row_styles');
+ TinyMCE_EditableSelects.init();
+
formObj.bgcolor.value = bgcolor;
formObj.backgroundimage.value = backgroundimage;
formObj.height.value = height;
formObj.id.value = id;
formObj.lang.value = lang;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
selectByValue(formObj, 'align', align);
selectByValue(formObj, 'valign', valign);
- selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'class', className, true, true);
selectByValue(formObj, 'rowtype', rowtype);
selectByValue(formObj, 'dir', dir);
@@ -43,14 +48,13 @@ function init() { }
function updateAction() {
- tinyMCEPopup.restoreSelection();
-
- var inst = tinyMCE.selectedInstance;
- var trElm = tinyMCE.getParentElement(inst.getFocusElement(), "tr");
- var tableElm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
- var formObj = document.forms[0];
+ var inst = tinyMCEPopup.editor, dom = inst.dom, trElm, tableElm, formObj = document.forms[0];
var action = getSelectValue(formObj, 'action');
+ tinyMCEPopup.restoreSelection();
+ trElm = dom.getParent(inst.selection.getNode(), "tr");
+ tableElm = dom.getParent(inst.selection.getNode(), "table");
+
inst.execCommand('mceBeginUndoLevel');
switch (action) {
@@ -78,15 +82,16 @@ function updateAction() { break;
}
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- tinyMCE.triggerNodeChange();
+ inst.addVisual();
+ inst.nodeChanged();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
}
function updateRow(tr_elm, skip_id, skip_parent) {
- var inst = tinyMCE.selectedInstance;
+ var inst = tinyMCEPopup.editor;
var formObj = document.forms[0];
+ var dom = inst.dom;
var curRowType = tr_elm.parentNode.nodeName.toLowerCase();
var rowtype = getSelectValue(formObj, 'rowtype');
var doc = inst.getDoc();
@@ -99,8 +104,8 @@ function updateRow(tr_elm, skip_id, skip_parent) { tr_elm.setAttribute('vAlign', getSelectValue(formObj, 'valign'));
tr_elm.setAttribute('lang', formObj.lang.value);
tr_elm.setAttribute('dir', getSelectValue(formObj, 'dir'));
- tr_elm.setAttribute('style', tinyMCE.serializeStyle(tinyMCE.parseStyle(formObj.style.value)));
- tinyMCE.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
+ tr_elm.setAttribute('style', dom.serializeStyle(dom.parseStyle(formObj.style.value)));
+ dom.setAttrib(tr_elm, 'class', getSelectValue(formObj, 'class'));
// Clear deprecated attributes
tr_elm.setAttribute('background', '');
@@ -122,7 +127,7 @@ function updateRow(tr_elm, skip_id, skip_parent) { var newRow = tr_elm.cloneNode(1);
// next, find the parent of its new destination (creating it if necessary)
- var theTable = tinyMCE.getParentElement(tr_elm, "table");
+ var theTable = dom.getParent(tr_elm, "table");
var dest = rowtype;
var newParent = null;
for (var i = 0; i < theTable.childNodes.length; i++) {
@@ -133,9 +138,12 @@ function updateRow(tr_elm, skip_id, skip_parent) { if (newParent == null) {
newParent = doc.createElement(dest);
- if (dest == "thead")
- theTable.insertBefore(newParent, theTable.firstChild);
- else
+ if (dest == "thead") {
+ if (theTable.firstChild.nodeName == 'CAPTION')
+ inst.dom.insertAfter(newParent, theTable.firstChild);
+ else
+ theTable.insertBefore(newParent, theTable.firstChild);
+ } else
theTable.appendChild(newParent);
}
@@ -148,20 +156,22 @@ function updateRow(tr_elm, skip_id, skip_parent) { // set tr_elm to the new node
tr_elm = newRow;
}
+
+ dom.setAttrib(tr_elm, 'style', dom.serializeStyle(dom.parseStyle(tr_elm.style.cssText)));
}
function changedBackgroundImage() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedStyle() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
if (st['background-image'])
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
@@ -178,8 +188,8 @@ function changedStyle() { }
function changedSize() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
var height = formObj.height.value;
if (height != "")
@@ -187,14 +197,16 @@ function changedSize() { else
st['height'] = "";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedColor() {
- var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+ var st = dom.parseStyle(formObj.style.value);
st['background-color'] = formObj.bgcolor.value;
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/jscripts/table.js b/program/js/tiny_mce/plugins/table/js/table.js index 4a0ee3b47..768c26e27 100644 --- a/program/js/tiny_mce/plugins/table/jscripts/table.js +++ b/program/js/tiny_mce/plugins/table/js/table.js @@ -1,19 +1,22 @@ -var action, orgTableWidth, orgTableHeight;
+tinyMCEPopup.requireLangPack();
+
+var action, orgTableWidth, orgTableHeight, dom = tinyMCEPopup.editor.dom;
function insertTable() {
var formObj = document.forms[0];
- var inst = tinyMCE.selectedInstance;
- var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption;
- var html = '', capEl;
- var elm = tinyMCE.tableElm;
+ var inst = tinyMCEPopup.editor, dom = inst.dom;
+ var cols = 2, rows = 2, border = 0, cellpadding = -1, cellspacing = -1, align, width, height, className, caption, frame, rules;
+ var html = '', capEl, elm;
var cellLimit, rowLimit, colLimit;
+ tinyMCEPopup.restoreSelection();
+
if (!AutoValidator.validate(formObj)) {
- alert(tinyMCE.getLang('lang_invalid_data'));
+ alert(inst.getLang('invalid_data'));
return false;
}
- tinyMCEPopup.restoreSelection();
+ elm = dom.getParent(inst.selection.getNode(), 'table');
// Get form data
cols = formObj.elements['cols'].value;
@@ -22,6 +25,8 @@ function insertTable() { cellpadding = formObj.elements['cellpadding'].value != "" ? formObj.elements['cellpadding'].value : "";
cellspacing = formObj.elements['cellspacing'].value != "" ? formObj.elements['cellspacing'].value : "";
align = formObj.elements['align'].options[formObj.elements['align'].selectedIndex].value;
+ frame = formObj.elements['frame'].options[formObj.elements['frame'].selectedIndex].value;
+ rules = formObj.elements['rules'].options[formObj.elements['rules'].selectedIndex].value;
width = formObj.elements['width'].value;
height = formObj.elements['height'].value;
bordercolor = formObj.elements['bordercolor'].value;
@@ -35,19 +40,19 @@ function insertTable() { background = formObj.elements['backgroundimage'].value;
caption = formObj.elements['caption'].checked;
- cellLimit = tinyMCE.getParam('table_cell_limit', false);
- rowLimit = tinyMCE.getParam('table_row_limit', false);
- colLimit = tinyMCE.getParam('table_col_limit', false);
+ cellLimit = tinyMCEPopup.getParam('table_cell_limit', false);
+ rowLimit = tinyMCEPopup.getParam('table_row_limit', false);
+ colLimit = tinyMCEPopup.getParam('table_col_limit', false);
// Validate table size
if (colLimit && cols > colLimit) {
- alert(tinyMCE.getLang('lang_table_col_limit', '', true, {cols : colLimit}));
+ alert(inst.getLang('table_col_limit', '', true, {cols : colLimit}));
return false;
} else if (rowLimit && rows > rowLimit) {
- alert(tinyMCE.getLang('lang_table_row_limit', '', true, {rows : rowLimit}));
+ alert(inst.getLang('table_row_limit', '', true, {rows : rowLimit}));
return false;
} else if (cellLimit && cols * rows > cellLimit) {
- alert(tinyMCE.getLang('lang_table_cell_limit', '', true, {cells : cellLimit}));
+ alert(inst.getLang('table_cell_limit', '', true, {cells : cellLimit}));
return false;
}
@@ -55,50 +60,60 @@ function insertTable() { if (action == "update") {
inst.execCommand('mceBeginUndoLevel');
- tinyMCE.setAttrib(elm, 'cellPadding', cellpadding, true);
- tinyMCE.setAttrib(elm, 'cellSpacing', cellspacing, true);
- tinyMCE.setAttrib(elm, 'border', border, true);
- tinyMCE.setAttrib(elm, 'align', align);
- tinyMCE.setAttrib(elm, 'class', className);
- tinyMCE.setAttrib(elm, 'style', style);
- tinyMCE.setAttrib(elm, 'id', id);
- tinyMCE.setAttrib(elm, 'summary', summary);
- tinyMCE.setAttrib(elm, 'dir', dir);
- tinyMCE.setAttrib(elm, 'lang', lang);
-
- capEl = elm.getElementsByTagName('caption')[0];
+ dom.setAttrib(elm, 'cellPadding', cellpadding, true);
+ dom.setAttrib(elm, 'cellSpacing', cellspacing, true);
+ dom.setAttrib(elm, 'border', border);
+ dom.setAttrib(elm, 'align', align);
+ dom.setAttrib(elm, 'frame', frame);
+ dom.setAttrib(elm, 'rules', rules);
+ dom.setAttrib(elm, 'class', className);
+ dom.setAttrib(elm, 'style', style);
+ dom.setAttrib(elm, 'id', id);
+ dom.setAttrib(elm, 'summary', summary);
+ dom.setAttrib(elm, 'dir', dir);
+ dom.setAttrib(elm, 'lang', lang);
+
+ capEl = inst.dom.select('caption', elm)[0];
if (capEl && !caption)
capEl.parentNode.removeChild(capEl);
if (!capEl && caption) {
capEl = elm.ownerDocument.createElement('caption');
- capEl.innerHTML = ' ';
+
+ if (!tinymce.isIE)
+ capEl.innerHTML = '<br mce_bogus="1"/>';
+
elm.insertBefore(capEl, elm.firstChild);
}
- // Not inline styles
- if (!tinyMCE.getParam("inline_styles"))
- tinyMCE.setAttrib(elm, 'width', width, true);
+ if (width && /(pt|em|cm)$/.test(width)) {
+ dom.setStyle(elm, 'width', width);
+ dom.setAttrib(elm, 'width', '');
+ } else {
+ dom.setAttrib(elm, 'width', width, true);
+ dom.setStyle(elm, 'width', '');
+ }
// Remove these since they are not valid XHTML
- tinyMCE.setAttrib(elm, 'borderColor', '');
- tinyMCE.setAttrib(elm, 'bgColor', '');
- tinyMCE.setAttrib(elm, 'background', '');
- tinyMCE.setAttrib(elm, 'height', '');
+ dom.setAttrib(elm, 'borderColor', '');
+ dom.setAttrib(elm, 'bgColor', '');
+ dom.setAttrib(elm, 'background', '');
+
+ if (height) {
+ dom.setStyle(elm, 'height', height);
+ dom.setAttrib(elm, 'height', '');
+ }
if (background != '')
elm.style.backgroundImage = "url('" + background + "')";
else
elm.style.backgroundImage = '';
- if (tinyMCE.getParam("inline_styles"))
- elm.style.borderWidth = border + "px";
-
- if (tinyMCE.getParam("inline_styles")) {
+/* if (tinyMCEPopup.getParam("inline_styles")) {
if (width != '')
elm.style.width = getCSSSize(width);
- }
+ }*/
if (bordercolor != "") {
elm.style.borderColor = bordercolor;
@@ -110,18 +125,17 @@ function insertTable() { elm.style.backgroundColor = bgcolor;
elm.style.height = getCSSSize(height);
- tinyMCE.handleVisualAid(tinyMCE.tableElm, false, inst.visualAid, inst);
+ inst.addVisual();
// Fix for stange MSIE align bug
- tinyMCE.tableElm.outerHTML = tinyMCE.tableElm.outerHTML;
+ //elm.outerHTML = elm.outerHTML;
- tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
- tinyMCE.triggerNodeChange();
+ inst.nodeChanged();
inst.execCommand('mceEndUndoLevel');
// Repaint if dimensions changed
if (formObj.width.value != orgTableWidth || formObj.height.value != orgTableHeight)
- inst.repaint();
+ inst.execCommand('mceRepaint');
tinyMCEPopup.close();
return true;
@@ -134,26 +148,51 @@ function insertTable() { html += makeAttrib('border', border);
html += makeAttrib('cellpadding', cellpadding);
html += makeAttrib('cellspacing', cellspacing);
- html += makeAttrib('width', width);
+
+ if (width && /(pt|em|cm)$/.test(width)) {
+ if (style)
+ style += '; ';
+
+ style += 'width: ' + width;
+ } else
+ html += makeAttrib('width', width);
+
+/* if (height) {
+ if (style)
+ style += '; ';
+
+ style += 'height: ' + height;
+ }*/
+
//html += makeAttrib('height', height);
//html += makeAttrib('bordercolor', bordercolor);
//html += makeAttrib('bgcolor', bgcolor);
html += makeAttrib('align', align);
- html += makeAttrib('class', tinyMCE.getVisualAidClass(className, border == 0));
+ html += makeAttrib('frame', frame);
+ html += makeAttrib('rules', rules);
+ html += makeAttrib('class', className);
html += makeAttrib('style', style);
html += makeAttrib('summary', summary);
html += makeAttrib('dir', dir);
html += makeAttrib('lang', lang);
html += '>';
- if (caption)
- html += '<caption> </caption>';
+ if (caption) {
+ if (!tinymce.isIE)
+ html += '<caption><br mce_bogus="1"/></caption>';
+ else
+ html += '<caption></caption>';
+ }
for (var y=0; y<rows; y++) {
html += "<tr>";
- for (var x=0; x<cols; x++)
- html += '<td> </td>';
+ for (var x=0; x<cols; x++) {
+ if (!tinymce.isIE)
+ html += '<td><br mce_bogus="1"/></td>';
+ else
+ html += '<td></td>';
+ }
html += "</tr>";
}
@@ -162,7 +201,7 @@ function insertTable() { inst.execCommand('mceBeginUndoLevel');
inst.execCommand('mceInsertContent', false, html);
- tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual']);
+ inst.addVisual();
inst.execCommand('mceEndUndoLevel');
tinyMCEPopup.close();
@@ -199,20 +238,20 @@ function init() { document.getElementById('bordercolor_pickcontainer').innerHTML = getColorPickerHTML('bordercolor_pick','bordercolor');
document.getElementById('bgcolor_pickcontainer').innerHTML = getColorPickerHTML('bgcolor_pick','bgcolor');
- var cols = 2, rows = 2, border = tinyMCE.getParam('table_default_border', '0'), cellpadding = tinyMCE.getParam('table_default_cellpadding', ''), cellspacing = tinyMCE.getParam('table_default_cellspacing', '');
+ var cols = 2, rows = 2, border = tinyMCEPopup.getParam('table_default_border', '0'), cellpadding = tinyMCEPopup.getParam('table_default_cellpadding', ''), cellspacing = tinyMCEPopup.getParam('table_default_cellspacing', '');
var align = "", width = "", height = "", bordercolor = "", bgcolor = "", className = "";
- var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "";
- var inst = tinyMCE.selectedInstance;
+ var id = "", summary = "", style = "", dir = "", lang = "", background = "", bgcolor = "", bordercolor = "", rules, frame;
+ var inst = tinyMCEPopup.editor, dom = inst.dom;
var formObj = document.forms[0];
- var elm = tinyMCE.getParentElement(inst.getFocusElement(), "table");
+ var elm = dom.getParent(inst.selection.getNode(), "table");
- tinyMCE.tableElm = elm;
- action = tinyMCE.getWindowArg('action');
- if (action == null)
- action = tinyMCE.tableElm ? "update" : "insert";
+ action = tinyMCEPopup.getWindowArg('action');
- if (tinyMCE.tableElm && action != "insert") {
- var rowsAr = tinyMCE.tableElm.rows;
+ if (!action)
+ action = elm ? "update" : "insert";
+
+ if (elm && action != "insert") {
+ var rowsAr = elm.rows;
var cols = 0;
for (var i=0; i<rowsAr.length; i++)
if (rowsAr[i].cells.length > cols)
@@ -221,35 +260,41 @@ function init() { cols = cols;
rows = rowsAr.length;
- st = tinyMCE.parseStyle(tinyMCE.getAttrib(tinyMCE.tableElm, "style"));
+ st = dom.parseStyle(dom.getAttrib(elm, "style"));
border = trimSize(getStyle(elm, 'border', 'borderWidth'));
- cellpadding = tinyMCE.getAttrib(tinyMCE.tableElm, 'cellpadding', "");
- cellspacing = tinyMCE.getAttrib(tinyMCE.tableElm, 'cellspacing', "");
+ cellpadding = dom.getAttrib(elm, 'cellpadding', "");
+ cellspacing = dom.getAttrib(elm, 'cellspacing', "");
width = trimSize(getStyle(elm, 'width', 'width'));
height = trimSize(getStyle(elm, 'height', 'height'));
bordercolor = convertRGBToHex(getStyle(elm, 'bordercolor', 'borderLeftColor'));
bgcolor = convertRGBToHex(getStyle(elm, 'bgcolor', 'backgroundColor'));
- align = tinyMCE.getAttrib(tinyMCE.tableElm, 'align', align);
- className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(tinyMCE.tableElm, 'class'), false);
- id = tinyMCE.getAttrib(tinyMCE.tableElm, 'id');
- summary = tinyMCE.getAttrib(tinyMCE.tableElm, 'summary');
- style = tinyMCE.serializeStyle(st);
- dir = tinyMCE.getAttrib(tinyMCE.tableElm, 'dir');
- lang = tinyMCE.getAttrib(tinyMCE.tableElm, 'lang');
+ align = dom.getAttrib(elm, 'align', align);
+ frame = dom.getAttrib(elm, 'frame');
+ rules = dom.getAttrib(elm, 'rules');
+ className = tinymce.trim(dom.getAttrib(elm, 'class').replace(/mceItem.+/g, ''));
+ id = dom.getAttrib(elm, 'id');
+ summary = dom.getAttrib(elm, 'summary');
+ style = dom.serializeStyle(st);
+ dir = dom.getAttrib(elm, 'dir');
+ lang = dom.getAttrib(elm, 'lang');
background = getStyle(elm, 'background', 'backgroundImage').replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
- formObj.caption.checked = tinyMCE.tableElm.getElementsByTagName('caption').length > 0;
+ formObj.caption.checked = elm.getElementsByTagName('caption').length > 0;
orgTableWidth = width;
orgTableHeight = height;
action = "update";
+ formObj.insert.value = inst.getLang('update');
}
addClassesToList('class', "table_styles");
+ TinyMCE_EditableSelects.init();
// Update form
selectByValue(formObj, 'align', align);
- selectByValue(formObj, 'class', className);
+ selectByValue(formObj, 'frame', frame);
+ selectByValue(formObj, 'rules', rules);
+ selectByValue(formObj, 'class', className, true, true);
formObj.cols.value = cols;
formObj.rows.value = rows;
formObj.border.value = border;
@@ -265,7 +310,6 @@ function init() { formObj.dir.value = dir;
formObj.lang.value = lang;
formObj.backgroundimage.value = background;
- formObj.insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
updateColor('bordercolor_pick', 'bordercolor');
updateColor('bgcolor_pick', 'bgcolor');
@@ -283,13 +327,13 @@ function init() { function changedSize() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
- var width = formObj.width.value;
+/* var width = formObj.width.value;
if (width != "")
- st['width'] = tinyMCE.getParam("inline_styles") ? getCSSSize(width) : "";
+ st['width'] = tinyMCEPopup.getParam("inline_styles") ? getCSSSize(width) : "";
else
- st['width'] = "";
+ st['width'] = "";*/
var height = formObj.height.value;
if (height != "")
@@ -297,32 +341,32 @@ function changedSize() { else
st['height'] = "";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedBackgroundImage() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
st['background-image'] = "url('" + formObj.backgroundimage.value + "')";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedBorder() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
// Update border width if the element has a color
if (formObj.border.value != "" && formObj.bordercolor.value != "")
st['border-width'] = formObj.border.value + "px";
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedColor() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
st['background-color'] = formObj.bgcolor.value;
@@ -334,12 +378,12 @@ function changedColor() { st['border-width'] = formObj.border.value == "" ? "1px" : formObj.border.value + "px";
}
- formObj.style.value = tinyMCE.serializeStyle(st);
+ formObj.style.value = dom.serializeStyle(st);
}
function changedStyle() {
var formObj = document.forms[0];
- var st = tinyMCE.parseStyle(formObj.style.value);
+ var st = dom.parseStyle(formObj.style.value);
if (st['background-image'])
formObj.backgroundimage.value = st['background-image'].replace(new RegExp("url\\('?([^']*)'?\\)", 'gi'), "$1");
@@ -362,3 +406,5 @@ function changedStyle() { updateColor('bordercolor_pick','bordercolor');
}
}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js b/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js deleted file mode 100644 index 06cbb275d..000000000 --- a/program/js/tiny_mce/plugins/table/jscripts/merge_cells.js +++ /dev/null @@ -1,24 +0,0 @@ -function init() {
- tinyMCEPopup.resizeToInnerSize();
-
- var formObj = document.forms[0];
-
- formObj.numcols.value = tinyMCE.getWindowArg('numcols', 1);
- formObj.numrows.value = tinyMCE.getWindowArg('numrows', 1);
-}
-
-function mergeCells() {
- var args = new Array();
- var formObj = document.forms[0];
-
- if (!AutoValidator.validate(formObj)) {
- alert(tinyMCE.getLang('lang_invalid_data'));
- return false;
- }
-
- args["numcols"] = formObj.numcols.value;
- args["numrows"] = formObj.numrows.value;
-
- tinyMCEPopup.execCommand("mceTableMergeCells", false, args);
- tinyMCEPopup.close();
-}
diff --git a/program/js/tiny_mce/plugins/table/langs/en.js b/program/js/tiny_mce/plugins/table/langs/en.js deleted file mode 100644 index e2fbba2e5..000000000 --- a/program/js/tiny_mce/plugins/table/langs/en.js +++ /dev/null @@ -1,79 +0,0 @@ -// UK lang variables
-
-tinyMCE.addToLang('table',{
-general_tab : 'General',
-advanced_tab : 'Advanced',
-general_props : 'General properties',
-advanced_props : 'Advanced properties',
-desc : 'Inserts a new table',
-row_before_desc : 'Insert row before',
-row_after_desc : 'Insert row after',
-delete_row_desc : 'Delete row',
-col_before_desc : 'Insert column before',
-col_after_desc : 'Insert column after',
-delete_col_desc : 'Remove column',
-rowtype : 'Row in table part',
-title : 'Insert/Modify table',
-width : 'Width',
-height : 'Height',
-cols : 'Columns',
-rows : 'Rows',
-cellspacing : 'Cellspacing',
-cellpadding : 'Cellpadding',
-border : 'Border',
-align : 'Alignment',
-align_default : 'Default',
-align_left : 'Left',
-align_right : 'Right',
-align_middle : 'Center',
-row_title : 'Table row properties',
-cell_title : 'Table cell properties',
-cell_type : 'Cell type',
-row_desc : 'Table row properties',
-cell_desc : 'Table cell properties',
-valign : 'Vertical alignment',
-align_top : 'Top',
-align_bottom : 'Bottom',
-props_desc : 'Table properties',
-bordercolor : 'Border color',
-bgcolor : 'Background color',
-merge_cells_title : 'Merge 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',
-paste_row_before_desc : 'Paste table row before',
-paste_row_after_desc : 'Paste table row after',
-id : 'Id',
-style: 'Style',
-langdir : 'Language direction',
-langcode : 'Language code',
-mime : 'Target MIME type',
-ltr : 'Left to right',
-rtl : 'Right to left',
-bgimage : 'Background image',
-summary : 'Summary',
-td : "Data",
-th : "Header",
-cell_cell : 'Update current cell',
-cell_row : 'Update all cells in row',
-cell_all : 'Update all cells in table',
-row_row : 'Update current row',
-row_odd : 'Update odd rows in table',
-row_even : 'Update even rows in table',
-row_all : 'Update all rows in table',
-thead : 'Table Head',
-tbody : 'Table Body',
-tfoot : 'Table Foot',
-del : 'Delete table',
-scope : 'Scope',
-row : 'Row',
-col : 'Col',
-rowgroup : 'Row Group',
-colgroup : 'Col Group',
-col_limit : 'You\'ve exceeded the maximum number of columns of {$cols}.',
-row_limit : 'You\'ve exceeded the maximum number of rows of {$rows}.',
-cell_limit : 'You\'ve exceeded the maximum number of cells of {$cells}.',
-missing_scope: 'Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.',
-caption : 'Table caption'
-});
diff --git a/program/js/tiny_mce/plugins/table/langs/en_dlg.js b/program/js/tiny_mce/plugins/table/langs/en_dlg.js new file mode 100644 index 000000000..000332a35 --- /dev/null +++ b/program/js/tiny_mce/plugins/table/langs/en_dlg.js @@ -0,0 +1,74 @@ +tinyMCE.addI18n('en.table_dlg',{
+general_tab:"General",
+advanced_tab:"Advanced",
+general_props:"General properties",
+advanced_props:"Advanced properties",
+rowtype:"Row in table part",
+title:"Insert/Modify table",
+width:"Width",
+height:"Height",
+cols:"Cols",
+rows:"Rows",
+cellspacing:"Cellspacing",
+cellpadding:"Cellpadding",
+border:"Border",
+align:"Alignment",
+align_default:"Default",
+align_left:"Left",
+align_right:"Right",
+align_middle:"Center",
+row_title:"Table row properties",
+cell_title:"Table cell properties",
+cell_type:"Cell type",
+valign:"Vertical alignment",
+align_top:"Top",
+align_bottom:"Bottom",
+bordercolor:"Border color",
+bgcolor:"Background color",
+merge_cells_title:"Merge table cells",
+id:"Id",
+style:"Style",
+langdir:"Language direction",
+langcode:"Language code",
+mime:"Target MIME type",
+ltr:"Left to right",
+rtl:"Right to left",
+bgimage:"Background image",
+summary:"Summary",
+td:"Data",
+th:"Header",
+cell_cell:"Update current cell",
+cell_row:"Update all cells in row",
+cell_all:"Update all cells in table",
+row_row:"Update current row",
+row_odd:"Update odd rows in table",
+row_even:"Update even rows in table",
+row_all:"Update all rows in table",
+thead:"Table Head",
+tbody:"Table Body",
+tfoot:"Table Foot",
+scope:"Scope",
+rowgroup:"Row Group",
+colgroup:"Col Group",
+col_limit:"You've exceeded the maximum number of columns of {$cols}.",
+row_limit:"You've exceeded the maximum number of rows of {$rows}.",
+cell_limit:"You've exceeded the maximum number of cells of {$cells}.",
+missing_scope:"Are you sure you want to continue without specifying a scope for this table header cell. Without it, it may be difficult for some users with disabilities to understand the content or data displayed of the table.",
+caption:"Table caption",
+frame:"Frame",
+frame_none:"none",
+frame_groups:"groups",
+frame_rows:"rows",
+frame_cols:"cols",
+frame_all:"all",
+rules:"Rules",
+rules_void:"void",
+rules_above:"above",
+rules_below:"below",
+rules_hsides:"hsides",
+rules_lhs:"lhs",
+rules_rhs:"rhs",
+rules_vsides:"vsides",
+rules_box:"box",
+rules_border:"border"
+});
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/table/merge_cells.htm b/program/js/tiny_mce/plugins/table/merge_cells.htm index 10896bf9e..9d34a886b 100644 --- a/program/js/tiny_mce/plugins/table/merge_cells.htm +++ b/program/js/tiny_mce/plugins/table/merge_cells.htm @@ -1,24 +1,24 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_merge_cells_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/validate.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/merge_cells.js"></script>
+ <title>{#table_dlg.merge_cells_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/validate.js"></script>
+ <script type="text/javascript" src="js/merge_cells.js"></script>
<base target="_self" />
</head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="margin: 8px" style="display: none">
-<form onsubmit="insertTable();return false;" action="#">
+<body style="margin: 8px" style="display: none">
+<form onsubmit="mergeCells();return false;" action="#">
<fieldset>
- <legend>{$lang_table_merge_cells_title}</legend>
+ <legend>{#table_dlg.merge_cells_title}</legend>
<table border="0" cellpadding="0" cellspacing="3" width="100%">
<tr>
- <td>{$lang_table_cols}:</td>
- <td align="right"><input type="text" name="numcols" value="" class="number min1" style="width: 30px" /></td>
- <td>
+ <td>{#table_dlg.cols}:</td>
+ <td align="right"><input type="text" name="numcols" value="" class="number min1 mceFocus" style="width: 30px" /></td>
</tr>
<tr>
- <td>{$lang_table_rows}:</td>
+ <td>{#table_dlg.rows}:</td>
<td align="right"><input type="text" name="numrows" value="" class="number min1" style="width: 30px" /></td>
</tr>
</table>
@@ -26,11 +26,11 @@ <div class="mceActionPanel">
<div style="float: left">
- <input type="button" id="insert" name="insert" value="{$lang_update}" onclick="mergeCells();" />
+ <input type="submit" id="insert" name="insert" value="{#update}" />
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/table/readme.txt b/program/js/tiny_mce/plugins/table/readme.txt deleted file mode 100644 index 4fdb78aec..000000000 --- a/program/js/tiny_mce/plugins/table/readme.txt +++ /dev/null @@ -1 +0,0 @@ -Check the TinyMCE documentation for details on this plugin.
diff --git a/program/js/tiny_mce/plugins/table/row.htm b/program/js/tiny_mce/plugins/table/row.htm index 64f2afcb5..fe75bf607 100644 --- a/program/js/tiny_mce/plugins/table/row.htm +++ b/program/js/tiny_mce/plugins/table/row.htm @@ -1,74 +1,76 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_row_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/row.js"></script>
+ <title>{#table_dlg.row_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/row.js"></script>
<link href="css/row.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body id="tablerow" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="tablerow" style="display: none">
<form onsubmit="updateAction();return false;">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_table_general_props}</legend>
+ <legend>{#table_dlg.general_props}</legend>
<table border="0" cellpadding="4" cellspacing="0">
<tr>
- <td><label for="rowtype">{$lang_table_rowtype}</label></td>
+ <td><label for="rowtype">{#table_dlg.rowtype}</label></td>
<td class="col2">
- <select id="rowtype" name="rowtype">
- <option value="thead">{$lang_table_thead}</option>
- <option value="tbody">{$lang_table_tbody}</option>
- <option value="tfoot">{$lang_table_tfoot}</option>
+ <select id="rowtype" name="rowtype" class="mceFocus">
+ <option value="thead">{#table_dlg.thead}</option>
+ <option value="tbody">{#table_dlg.tbody}</option>
+ <option value="tfoot">{#table_dlg.tfoot}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="align">{$lang_table_align}</label></td>
+ <td><label for="align">{#table_dlg.align}</label></td>
<td class="col2">
<select id="align" name="align">
- <option value="">{$lang_not_set}</option>
- <option value="center">{$lang_table_align_middle}</option>
- <option value="left">{$lang_table_align_left}</option>
- <option value="right">{$lang_table_align_right}</option>
+ <option value="">{#not_set}</option>
+ <option value="center">{#table_dlg.align_middle}</option>
+ <option value="left">{#table_dlg.align_left}</option>
+ <option value="right">{#table_dlg.align_right}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="valign">{$lang_table_valign}</label></td>
+ <td><label for="valign">{#table_dlg.valign}</label></td>
<td class="col2">
<select id="valign" name="valign">
- <option value="">{$lang_not_set}</option>
- <option value="top">{$lang_table_align_top}</option>
- <option value="middle">{$lang_table_align_middle}</option>
- <option value="bottom">{$lang_table_align_bottom}</option>
+ <option value="">{#not_set}</option>
+ <option value="top">{#table_dlg.align_top}</option>
+ <option value="middle">{#table_dlg.align_middle}</option>
+ <option value="bottom">{#table_dlg.align_bottom}</option>
</select>
</td>
</tr>
<tr id="styleSelectRow">
- <td><label for="class">{$lang_class_name}</label></td>
+ <td><label for="class">{#class_name}</label></td>
<td class="col2">
- <select id="class" name="class">
- <option value="" selected="selected">{$lang_not_set}</option>
+ <select id="class" name="class" class="mceEditableSelect">
+ <option value="" selected="selected">{#not_set}</option>
</select>
</td>
</tr>
<tr>
- <td><label for="height">{$lang_table_height}</label></td>
+ <td><label for="height">{#table_dlg.height}</label></td>
<td class="col2"><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" /></td>
</tr>
</table>
@@ -77,39 +79,39 @@ <div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_table_advanced_props}</legend>
+ <legend>{#table_dlg.advanced_props}</legend>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
- <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
<td><input id="id" name="id" type="text" value="" style="width: 200px" /></td>
</tr>
<tr>
- <td><label for="style">{$lang_table_style}</label></td>
+ <td><label for="style">{#table_dlg.style}</label></td>
<td><input type="text" id="style" name="style" value="" style="width: 200px;" onchange="changedStyle();" /></td>
</tr>
<tr>
- <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
<td>
<select id="dir" name="dir" style="width: 200px">
- <option value="">{$lang_not_set}</option>
- <option value="ltr">{$lang_table_ltr}</option>
- <option value="rtl">{$lang_table_rtl}</option>
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#table_dlg.ltr}</option>
+ <option value="rtl">{#table_dlg.rtl}</option>
</select>
</td>
</tr>
<tr>
- <td class="column1"><label for="lang">{$lang_table_langcode}</label></td>
+ <td class="column1"><label for="lang">{#table_dlg.langcode}</label></td>
<td>
<input id="lang" name="lang" type="text" value="" style="width: 200px" />
</td>
</tr>
<tr>
- <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -121,7 +123,7 @@ </tr>
<tr>
- <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -139,19 +141,19 @@ <div class="mceActionPanel">
<div>
<select id="action" name="action">
- <option value="row">{$lang_table_row_row}</option>
- <option value="odd">{$lang_table_row_odd}</option>
- <option value="even">{$lang_table_row_even}</option>
- <option value="all">{$lang_table_row_all}</option>
+ <option value="row">{#table_dlg.row_row}</option>
+ <option value="odd">{#table_dlg.row_odd}</option>
+ <option value="even">{#table_dlg.row_even}</option>
+ <option value="all">{#table_dlg.row_all}</option>
</select>
</div>
<div style="float: left">
- <div><input type="button" id="insert" name="insert" value="{$lang_update}" onclick="updateAction();" /></div>
+ <div><input type="submit" id="insert" name="insert" value="{#update}" /></div>
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/table/table.htm b/program/js/tiny_mce/plugins/table/table.htm index f48418733..7d5b908f4 100644 --- a/program/js/tiny_mce/plugins/table/table.htm +++ b/program/js/tiny_mce/plugins/table/table.htm @@ -1,67 +1,68 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
- <title>{$lang_table_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="../../utils/validate.js"></script>
- <script language="javascript" type="text/javascript" src="jscripts/table.js"></script>
+ <title>{#table_dlg.title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/validate.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/table.js"></script>
<link href="css/table.css" rel="stylesheet" type="text/css" />
<base target="_self" />
</head>
-<body id="table" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="table" style="display: none">
<form onsubmit="insertTable();return false;" action="#">
<div class="tabs">
<ul>
- <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_table_general_tab}</a></span></li>
- <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{$lang_table_advanced_tab}</a></span></li>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#table_dlg.general_tab}</a></span></li>
+ <li id="advanced_tab"><span><a href="javascript:mcTabs.displayTab('advanced_tab','advanced_panel');" onmousedown="return false;">{#table_dlg.advanced_tab}</a></span></li>
</ul>
</div>
<div class="panel_wrapper">
<div id="general_panel" class="panel current">
<fieldset>
- <legend>{$lang_table_general_props}</legend>
-
+ <legend>{#table_dlg.general_props}</legend>
<table border="0" cellpadding="4" cellspacing="0" width="100%">
<tr>
- <td><label id="colslabel" for="cols">{$lang_table_cols}</label></td>
- <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
- <td><label id="rowslabel" for="rows">{$lang_table_rows}</label></td>
+ <td><label id="colslabel" for="cols">{#table_dlg.cols}</label></td>
+ <td><input id="cols" name="cols" type="text" value="" size="3" maxlength="3" class="required number min1 mceFocus" /></td>
+ <td><label id="rowslabel" for="rows">{#table_dlg.rows}</label></td>
<td><input id="rows" name="rows" type="text" value="" size="3" maxlength="3" class="required number min1" /></td>
</tr>
<tr>
- <td><label id="cellpaddinglabel" for="cellpadding">{$lang_table_cellpadding}</label></td>
+ <td><label id="cellpaddinglabel" for="cellpadding">{#table_dlg.cellpadding}</label></td>
<td><input id="cellpadding" name="cellpadding" type="text" value="" size="3" maxlength="3" class="number" /></td>
- <td><label id="cellspacinglabel" for="cellspacing">{$lang_table_cellspacing}</label></td>
+ <td><label id="cellspacinglabel" for="cellspacing">{#table_dlg.cellspacing}</label></td>
<td><input id="cellspacing" name="cellspacing" type="text" value="" size="3" maxlength="3" class="number" /></td>
</tr>
<tr>
- <td><label id="alignlabel" for="align">{$lang_table_align}</label></td>
+ <td><label id="alignlabel" for="align">{#table_dlg.align}</label></td>
<td><select id="align" name="align">
- <option value="">{$lang_not_set}</option>
- <option value="center">{$lang_table_align_middle}</option>
- <option value="left">{$lang_table_align_left}</option>
- <option value="right">{$lang_table_align_right}</option>
+ <option value="">{#not_set}</option>
+ <option value="center">{#table_dlg.align_middle}</option>
+ <option value="left">{#table_dlg.align_left}</option>
+ <option value="right">{#table_dlg.align_right}</option>
</select></td>
- <td><label id="borderlabel" for="border">{$lang_table_border}</label></td>
+ <td><label id="borderlabel" for="border">{#table_dlg.border}</label></td>
<td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="changedBorder();" class="number" /></td>
</tr>
<tr id="width_row">
- <td><label id="widthlabel" for="width">{$lang_table_width}</label></td>
+ <td><label id="widthlabel" for="width">{#table_dlg.width}</label></td>
<td><input name="width" type="text" id="width" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
- <td><label id="heightlabel" for="height">{$lang_table_height}</label></td>
+ <td><label id="heightlabel" for="height">{#table_dlg.height}</label></td>
<td><input name="height" type="text" id="height" value="" size="4" maxlength="4" onchange="changedSize();" class="size" /></td>
</tr>
<tr id="styleSelectRow">
- <td><label id="classlabel" for="class">{$lang_class_name}</label></td>
+ <td><label id="classlabel" for="class">{#class_name}</label></td>
<td colspan="3">
- <select id="class" name="class">
- <option value="" selected>{$lang_not_set}</option>
+ <select id="class" name="class" class="mceEditableSelect">
+ <option value="" selected>{#not_set}</option>
</select></td>
</tr>
<tr>
- <td class="column1"><label for="caption">{$lang_table_caption}</label></td>
+ <td class="column1"><label for="caption">{#table_dlg.caption}</label></td>
<td><input id="caption" name="caption" type="checkbox" class="checkbox" value="true" /></td>
</tr>
</table>
@@ -70,44 +71,33 @@ <div id="advanced_panel" class="panel">
<fieldset>
- <legend>{$lang_table_advanced_props}</legend>
+ <legend>{#table_dlg.advanced_props}</legend>
<table border="0" cellpadding="0" cellspacing="4">
<tr>
- <td class="column1"><label for="id">{$lang_table_id}</label></td>
+ <td class="column1"><label for="id">{#table_dlg.id}</label></td>
<td><input id="id" name="id" type="text" value="" class="advfield" /></td>
</tr>
<tr>
- <td class="column1"><label for="summary">{$lang_table_summary}</label></td>
+ <td class="column1"><label for="summary">{#table_dlg.summary}</label></td>
<td><input id="summary" name="summary" type="text" value="" class="advfield" /></td>
</tr>
<tr>
- <td><label for="style">{$lang_table_style}</label></td>
+ <td><label for="style">{#table_dlg.style}</label></td>
<td><input type="text" id="style" name="style" value="" class="advfield" onchange="changedStyle();" /></td>
</tr>
<tr>
- <td class="column1"><label for="dir">{$lang_table_langdir}</label></td>
- <td>
- <select id="dir" name="dir" class="advfield">
- <option value="">{$lang_not_set}</option>
- <option value="ltr">{$lang_table_ltr}</option>
- <option value="rtl">{$lang_table_rtl}</option>
- </select>
- </td>
- </tr>
-
- <tr>
- <td class="column1"><label id="langlabel" for="lang">{$lang_table_langcode}</label></td>
+ <td class="column1"><label id="langlabel" for="lang">{#table_dlg.langcode}</label></td>
<td>
<input id="lang" name="lang" type="text" value="" class="advfield" />
</td>
</tr>
<tr>
- <td class="column1"><label for="backgroundimage">{$lang_table_bgimage}</label></td>
+ <td class="column1"><label for="backgroundimage">{#table_dlg.bgimage}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -119,7 +109,50 @@ </tr>
<tr>
- <td class="column1"><label for="bordercolor">{$lang_table_bordercolor}</label></td>
+ <td class="column1"><label for="frame">{#table_dlg.frame}</label></td>
+ <td>
+ <select id="frame" name="frame" class="advfield">
+ <option value="">{#not_set}</option>
+ <option value="none">{#table_dlg.frame_none}</option>
+ <option value="groups">{#table_dlg.frame_groups}</option>
+ <option value="rows">{#table_dlg.frame_rows}</option>
+ <option value="cols">{#table_dlg.frame_cols}</option>
+ <option value="all">{#table_dlg.frame_all}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="rules">{#table_dlg.rules}</label></td>
+ <td>
+ <select id="rules" name="rules" class="advfield">
+ <option value="">{#not_set}</option>
+ <option value="void">{#table_dlg.rules_void}</option>
+ <option value="above">{#table_dlg.rules_above}</option>
+ <option value="below">{#table_dlg.rules_below}</option>
+ <option value="hsides">{#table_dlg.rules_hsides}</option>
+ <option value="lhs">{#table_dlg.rules_lhs}</option>
+ <option value="rhs">{#table_dlg.rules_rhs}</option>
+ <option value="vsides">{#table_dlg.rules_vsides}</option>
+ <option value="box">{#table_dlg.rules_box}</option>
+ <option value="border">{#table_dlg.rules_border}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="dir">{#table_dlg.langdir}</label></td>
+ <td>
+ <select id="dir" name="dir" class="advfield">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#table_dlg.ltr}</option>
+ <option value="rtl">{#table_dlg.rtl}</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td class="column1"><label for="bordercolor">{#table_dlg.bordercolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -131,7 +164,7 @@ </tr>
<tr>
- <td class="column1"><label for="bgcolor">{$lang_table_bgcolor}</label></td>
+ <td class="column1"><label for="bgcolor">{#table_dlg.bgcolor}</label></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
@@ -148,11 +181,11 @@ <div class="mceActionPanel">
<div style="float: left">
- <input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertTable();" />
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
</div>
<div style="float: right">
- <input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
</div>
</div>
</form>
diff --git a/program/js/tiny_mce/plugins/visualchars/editor_plugin.js b/program/js/tiny_mce/plugins/visualchars/editor_plugin.js index a35875409..e1e4238a3 100644 --- a/program/js/tiny_mce/plugins/visualchars/editor_plugin.js +++ b/program/js/tiny_mce/plugins/visualchars/editor_plugin.js @@ -1 +1 @@ -tinyMCE.importPluginLanguagePack('visualchars');var TinyMCE_VisualCharsPlugin={getInfo:function(){return{longname:'Visual characters',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion}},initInstance:function(inst){inst.visualChars={state:false}},getControlHTML:function(cn){switch(cn){case"visualchars":return tinyMCE.getButtonHTML(cn,'lang_visualchars_desc','{$pluginurl}/images/visualchars.gif','mceVisualChars',false)}return""},execCommand:function(editor_id,element,command,user_interface,value){var inst=tinyMCE.getInstanceById(editor_id);switch(command){case"mceVisualChars":this._toggleVisualChars(editor_id,inst);return true}return false},cleanup:function(type,content,inst){if(type=="insert_to_editor_dom"||type=="get_from_editor_dom"){inst.visualChars.state=true;this._toggleVisualChars(inst.editorId,inst)}return content},_toggleVisualChars:function(editor_id,inst){var nl,i,h,d=inst.getDoc(),b=inst.getBody(),nv,s=inst.selection,bo;inst.visualChars.state=!inst.visualChars.state;bo=s.getBookmark(true);tinyMCE.switchClass(editor_id+'_visualchars',inst.visualChars.state?'mceButtonSelected':'mceButtonNormal');if(inst.visualChars.state){nl=tinyMCE.selectNodes(b,function(n){return n.nodeType==3&&n.nodeValue&&n.nodeValue.indexOf('\u00a0')!=-1});for(i=0;i<nl.length;i++){nv=nl[i].nodeValue;nv=nv.replace(/(\u00a0+)/g,'<span class="mceItemHiddenVisualChar">$1</span>');nv=nv.replace(/\u00a0/g,'\u00b7');tinyMCE.setOuterHTML(nl[i],nv,d)}}else{nl=tinyMCE.selectNodes(b,function(n){return n.nodeType==1&&n.nodeName=='SPAN'&&n.className=='mceItemHiddenVisualChar'});for(i=0;i<nl.length;i++)tinyMCE.setOuterHTML(nl[i],nl[i].innerHTML.replace(/(·|\u00b7)/g,' '),d)}}};tinyMCE.addPlugin("visualchars",TinyMCE_VisualCharsPlugin);
\ No newline at end of file +(function(){tinymce.create('tinymce.plugins.VisualChars',{init:function(ed,url){var t=this;t.editor=ed;ed.addCommand('mceVisualChars',t._toggleVisualChars,t);ed.addButton('visualchars',{title:'visualchars.desc',cmd:'mceVisualChars'});ed.onBeforeGetContent.add(function(ed,o){if(t.state){t.state=true;t._toggleVisualChars();}});},getInfo:function(){return{longname:'Visual characters',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars',version:tinymce.majorVersion+"."+tinymce.minorVersion};},_toggleVisualChars:function(){var t=this,ed=t.editor,nl,i,h,d=ed.getDoc(),b=ed.getBody(),nv,s=ed.selection,bo;t.state=!t.state;ed.controlManager.setActive('visualchars',t.state);if(t.state){nl=[];tinymce.walk(b,function(n){if(n.nodeType==3&&n.nodeValue&&n.nodeValue.indexOf('\u00a0')!=-1)nl.push(n);},'childNodes');for(i=0;i<nl.length;i++){nv=nl[i].nodeValue;nv=nv.replace(/(\u00a0+)/g,'<span class="mceItemHidden mceVisualNbsp">$1</span>');nv=nv.replace(/\u00a0/g,'\u00b7');ed.dom.setOuterHTML(nl[i],nv,d);}}else{nl=tinymce.grep(ed.dom.select('span',b),function(n){return ed.dom.hasClass(n,'mceVisualNbsp');});for(i=0;i<nl.length;i++)ed.dom.setOuterHTML(nl[i],nl[i].innerHTML.replace(/(·|\u00b7)/g,' '),d);}}});tinymce.PluginManager.add('visualchars',tinymce.plugins.VisualChars);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js index fb7236de2..02ec4e698 100644 --- a/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js +++ b/program/js/tiny_mce/plugins/visualchars/editor_plugin_src.js @@ -1,89 +1,73 @@ /**
- * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
*
* @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
*/
-/* Import plugin specific language pack */
-tinyMCE.importPluginLanguagePack('visualchars');
-
-var TinyMCE_VisualCharsPlugin = {
- getInfo : function() {
- return {
- longname : 'Visual characters',
- author : 'Moxiecode Systems AB',
- authorurl : 'http://tinymce.moxiecode.com',
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars',
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
- };
- },
-
- initInstance : function(inst) {
- inst.visualChars = {
- state : false
- };
- },
-
- getControlHTML : function(cn) {
- switch (cn) {
- case "visualchars":
- return tinyMCE.getButtonHTML(cn, 'lang_visualchars_desc', '{$pluginurl}/images/visualchars.gif', 'mceVisualChars', false);
- }
-
- return "";
- },
-
- execCommand : function(editor_id, element, command, user_interface, value) {
- var inst = tinyMCE.getInstanceById(editor_id);
-
- switch (command) {
- case "mceVisualChars":
- this._toggleVisualChars(editor_id, inst);
- return true;
- }
-
- return false;
- },
-
- cleanup : function(type, content, inst) {
- if (type == "insert_to_editor_dom" || type == "get_from_editor_dom") {
- inst.visualChars.state = true;
- this._toggleVisualChars(inst.editorId, inst);
- }
-
- return content;
- },
-
- // Private plugin internal methods
-
- _toggleVisualChars : function(editor_id, inst) {
- var nl, i, h, d = inst.getDoc(), b = inst.getBody(), nv, s = inst.selection, bo;
-
- inst.visualChars.state = !inst.visualChars.state;
-
- bo = s.getBookmark(true);
-
- tinyMCE.switchClass(editor_id + '_visualchars', inst.visualChars.state ? 'mceButtonSelected' : 'mceButtonNormal');
-
- if (inst.visualChars.state) {
- nl = tinyMCE.selectNodes(b, function(n) {return n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1;});
-
- for (i=0; i<nl.length; i++) {
- nv = nl[i].nodeValue;
- nv = nv.replace(/(\u00a0+)/g, '<span class="mceItemHiddenVisualChar">$1</span>');
- nv = nv.replace(/\u00a0/g, '\u00b7');
- tinyMCE.setOuterHTML(nl[i], nv, d);
+(function() {
+ tinymce.create('tinymce.plugins.VisualChars', {
+ init : function(ed, url) {
+ var t = this;
+
+ t.editor = ed;
+
+ // Register commands
+ ed.addCommand('mceVisualChars', t._toggleVisualChars, t);
+
+ // Register buttons
+ ed.addButton('visualchars', {title : 'visualchars.desc', cmd : 'mceVisualChars'});
+
+ ed.onBeforeGetContent.add(function(ed, o) {
+ if (t.state) {
+ t.state = true;
+ t._toggleVisualChars();
+ }
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'Visual characters',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/visualchars',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ },
+
+ // Private methods
+
+ _toggleVisualChars : function() {
+ var t = this, ed = t.editor, nl, i, h, d = ed.getDoc(), b = ed.getBody(), nv, s = ed.selection, bo;
+
+ t.state = !t.state;
+ ed.controlManager.setActive('visualchars', t.state);
+
+ if (t.state) {
+ nl = [];
+ tinymce.walk(b, function(n) {
+ if (n.nodeType == 3 && n.nodeValue && n.nodeValue.indexOf('\u00a0') != -1)
+ nl.push(n);
+ }, 'childNodes');
+
+ for (i=0; i<nl.length; i++) {
+ nv = nl[i].nodeValue;
+ nv = nv.replace(/(\u00a0+)/g, '<span class="mceItemHidden mceVisualNbsp">$1</span>');
+ nv = nv.replace(/\u00a0/g, '\u00b7');
+ ed.dom.setOuterHTML(nl[i], nv, d);
+ }
+ } else {
+ nl = tinymce.grep(ed.dom.select('span', b), function(n) {
+ return ed.dom.hasClass(n, 'mceVisualNbsp');
+ });
+
+ for (i=0; i<nl.length; i++)
+ ed.dom.setOuterHTML(nl[i], nl[i].innerHTML.replace(/(·|\u00b7)/g, ' '), d);
}
- } else {
- nl = tinyMCE.selectNodes(b, function(n) {return n.nodeType == 1 && n.nodeName == 'SPAN' && n.className == 'mceItemHiddenVisualChar';});
-
- for (i=0; i<nl.length; i++)
- tinyMCE.setOuterHTML(nl[i], nl[i].innerHTML.replace(/(·|\u00b7)/g, ' '), d);
}
+ });
- //s.moveToBookmark(bo);
- }
-};
-
-tinyMCE.addPlugin("visualchars", TinyMCE_VisualCharsPlugin);
+ // Register plugin
+ tinymce.PluginManager.add('visualchars', tinymce.plugins.VisualChars);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/visualchars/images/visualchars.gif b/program/js/tiny_mce/plugins/visualchars/images/visualchars.gif Binary files differdeleted file mode 100644 index 3b4293e06..000000000 --- a/program/js/tiny_mce/plugins/visualchars/images/visualchars.gif +++ /dev/null diff --git a/program/js/tiny_mce/plugins/visualchars/langs/en.js b/program/js/tiny_mce/plugins/visualchars/langs/en.js deleted file mode 100644 index a82a4ee57..000000000 --- a/program/js/tiny_mce/plugins/visualchars/langs/en.js +++ /dev/null @@ -1,5 +0,0 @@ -// EN lang variables
-
-tinyMCE.addToLang('visualchars',{
-desc : 'Visual control characters on/off.'
-});
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm b/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm new file mode 100644 index 000000000..580028432 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/abbr.htm @@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#xhtmlxtras_dlg.title_abbr_element}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/element_common.js"></script>
+ <script type="text/javascript" src="js/abbr.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/popup.css" />
+ <base target="_self" />
+</head>
+<body style="display: none">
+<form onsubmit="insertAbbr();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>
+ <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td>
+ <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td>
+ <td><input id="id" name="id" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td>
+ <td>
+ <select id="class" name="class" class="field mceEditableSelect">
+ <option value="">{#not_set}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td>
+ <td><input id="style" name="style" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td>
+ <td>
+ <select id="dir" name="dir" class="field">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option>
+ <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" class="field" />
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ <div id="events_panel" class="panel">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label for="onfocus">onfocus</label>:</td>
+ <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onblur">onblur</label>:</td>
+ <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onclick">onclick</label>:</td>
+ <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="ondblclick">ondblclick</label>:</td>
+ <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousedown">onmousedown</label>:</td>
+ <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseup">onmouseup</label>:</td>
+ <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseover">onmouseover</label>:</td>
+ <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousemove">onmousemove</label>:</td>
+ <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseout">onmouseout</label>:</td>
+ <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeypress">onkeypress</label>:</td>
+ <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeydown">onkeydown</label>:</td>
+ <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeyup">onkeyup</label>:</td>
+ <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ </div>
+ <div style="float: left">
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAbbr();" style="display: none;" />
+ </div>
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+
+</form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm b/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm new file mode 100644 index 000000000..54e4c9d9e --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/acronym.htm @@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#xhtmlxtras_dlg.title_acronym_element}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/element_common.js"></script>
+ <script type="text/javascript" src="js/acronym.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/popup.css" />
+ <base target="_self" />
+</head>
+<body style="display: none">
+<form onsubmit="insertAcronym();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>
+ <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td>
+ <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td>
+ <td><input id="id" name="id" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td>
+ <td>
+ <select id="class" name="class" class="field mceEditableSelect">
+ <option value="">{#not_set}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td>
+ <td><input id="style" name="style" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td>
+ <td>
+ <select id="dir" name="dir" class="field">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option>
+ <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" class="field" />
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ <div id="events_panel" class="panel">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label for="onfocus">onfocus</label>:</td>
+ <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onblur">onblur</label>:</td>
+ <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onclick">onclick</label>:</td>
+ <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="ondblclick">ondblclick</label>:</td>
+ <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousedown">onmousedown</label>:</td>
+ <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseup">onmouseup</label>:</td>
+ <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseover">onmouseover</label>:</td>
+ <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousemove">onmousemove</label>:</td>
+ <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseout">onmouseout</label>:</td>
+ <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeypress">onkeypress</label>:</td>
+ <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeydown">onkeydown</label>:</td>
+ <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeyup">onkeyup</label>:</td>
+ <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ </div>
+ <div style="float: left">
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeAcronym();" style="display: none;" />
+ </div>
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+
+</form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm b/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm new file mode 100644 index 000000000..cfbb409ab --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/attributes.htm @@ -0,0 +1,154 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#xhtmlxtras_dlg.attribs_title}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="js/attributes.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/attributes.css" />
+ <base target="_self" />
+</head>
+<body style="display: none">
+<form onsubmit="insertAction();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_attrib_tab}</a></span></li>
+ <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.attribute_events_tab}</a></span></li>
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.attribute_attrib_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td>
+ <td><input id="title" name="title" type="text" value="" class="mceFocus" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td>
+ <td><input id="id" name="id" type="text" value="" /></td>
+ </tr>
+ <tr>
+ <td><label id="classlabel" for="classlist">{#class_name}</label></td>
+ <td>
+ <select id="classlist" name="classlist" class="mceEditableSelect">
+ <option value="" selected>{#not_set}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td>
+ <td><input id="style" name="style" type="text" value="" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td>
+ <td>
+ <select id="dir" name="dir">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#xhtmlxtras_dlg.option_ltr}</option>
+ <option value="rtl">{#xhtmlxtras_dlg.option_rtl}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" />
+ </td>
+ </tr>
+ <tr>
+ <td><label id="tabindexlabel" for="tabindex">{#xhtmlxtras_dlg.attribute_label_tabindex}</label></td>
+ <td><input type="text" id="tabindex" name="tabindex" value="" /></td>
+ </tr>
+
+ <tr>
+ <td><label id="accesskeylabel" for="accesskey">{#xhtmlxtras_dlg.attribute_label_accesskey}</label></td>
+ <td><input type="text" id="accesskey" name="accesskey" value="" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ <div id="events_panel" class="panel">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.attribute_events_tab}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label for="onfocus">onfocus</label>:</td>
+ <td><input id="onfocus" name="onfocus" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onblur">onblur</label>:</td>
+ <td><input id="onblur" name="onblur" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onclick">onclick</label>:</td>
+ <td><input id="onclick" name="onclick" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="ondblclick">ondblclick</label>:</td>
+ <td><input id="ondblclick" name="ondblclick" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousedown">onmousedown</label>:</td>
+ <td><input id="onmousedown" name="onmousedown" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseup">onmouseup</label>:</td>
+ <td><input id="onmouseup" name="onmouseup" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseover">onmouseover</label>:</td>
+ <td><input id="onmouseover" name="onmouseover" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousemove">onmousemove</label>:</td>
+ <td><input id="onmousemove" name="onmousemove" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseout">onmouseout</label>:</td>
+ <td><input id="onmouseout" name="onmouseout" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeypress">onkeypress</label>:</td>
+ <td><input id="onkeypress" name="onkeypress" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeydown">onkeydown</label>:</td>
+ <td><input id="onkeydown" name="onkeydown" type="text" value="" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeyup">onkeyup</label>:</td>
+ <td><input id="onkeyup" name="onkeyup" type="text" value="" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" id="insert" name="insert" value="{#insert}" />
+ </div>
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+
+</form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm b/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm new file mode 100644 index 000000000..7d9eaba4d --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/cite.htm @@ -0,0 +1,149 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#xhtmlxtras_dlg.title_cite_element}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/element_common.js"></script>
+ <script type="text/javascript" src="js/cite.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/popup.css" />
+ <base target="_self" />
+</head>
+<body style="display: none">
+<form onsubmit="insertCite();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>
+ <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td>
+ <td><input id="title" name="title" type="text" value="" class="field mceFocus" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td>
+ <td><input id="id" name="id" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td>
+ <td>
+ <select id="class" name="class" class="field mceEditableSelect">
+ <option value="">{#not_set}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td>
+ <td><input id="style" name="style" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td>
+ <td>
+ <select id="dir" name="dir" class="field">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option>
+ <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" class="field" />
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ <div id="events_panel" class="panel">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label for="onfocus">onfocus</label>:</td>
+ <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onblur">onblur</label>:</td>
+ <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onclick">onclick</label>:</td>
+ <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="ondblclick">ondblclick</label>:</td>
+ <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousedown">onmousedown</label>:</td>
+ <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseup">onmouseup</label>:</td>
+ <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseover">onmouseover</label>:</td>
+ <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousemove">onmousemove</label>:</td>
+ <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseout">onmouseout</label>:</td>
+ <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeypress">onkeypress</label>:</td>
+ <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeydown">onkeydown</label>:</td>
+ <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeyup">onkeyup</label>:</td>
+ <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ </div>
+ <div style="float: left">
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeCite();" style="display: none;" />
+ </div>
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+
+</form>
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/css/attributes.css b/program/js/tiny_mce/plugins/xhtmlxtras/css/attributes.css new file mode 100644 index 000000000..9a6a235c3 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/css/attributes.css @@ -0,0 +1,11 @@ +.panel_wrapper div.current {
+ height: 290px;
+}
+
+#id, #style, #title, #dir, #hreflang, #lang, #classlist, #tabindex, #accesskey {
+ width: 200px;
+}
+
+#events_panel input {
+ width: 200px;
+}
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/css/popup.css b/program/js/tiny_mce/plugins/xhtmlxtras/css/popup.css new file mode 100644 index 000000000..e67114dba --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/css/popup.css @@ -0,0 +1,9 @@ +input.field, select.field {width:200px;}
+input.picker {width:179px; margin-left: 5px;}
+input.disabled {border-color:#F2F2F2;}
+img.picker {vertical-align:text-bottom; cursor:pointer;}
+h1 {padding: 0 0 5px 0;}
+.panel_wrapper div.current {height:160px;}
+#xhtmlxtrasdel .panel_wrapper div.current, #xhtmlxtrasins .panel_wrapper div.current {height: 230px;}
+a.browse span {display:block; width:20px; height:20px; background:url('../../../themes/advanced/img/icons.gif') -140px -20px;}
+#datetime {width:180px;}
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/css/xhtmlxtras.css b/program/js/tiny_mce/plugins/xhtmlxtras/css/xhtmlxtras.css new file mode 100644 index 000000000..6838d9025 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/css/xhtmlxtras.css @@ -0,0 +1,24 @@ +ins {
+ border-bottom: 1px solid green;
+ text-decoration: none;
+ color: green;
+}
+
+del {
+ color: Red;
+ text-decoration: line-through;
+}
+
+cite {
+ border-bottom: 1px dashed blue;
+}
+
+acronym {
+ border-bottom: 1px dotted #CCC;
+ cursor: help;
+}
+
+abbr, html\:abbr {
+ border-bottom: 1px dashed #CCC;
+ cursor: help;
+}
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/del.htm b/program/js/tiny_mce/plugins/xhtmlxtras/del.htm new file mode 100644 index 000000000..d03c4568a --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/del.htm @@ -0,0 +1,170 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#xhtmlxtras_dlg.title_del_element}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/element_common.js"></script>
+ <script type="text/javascript" src="js/del.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/popup.css" />
+ <base target="_self" />
+</head>
+<body id="xhtmlxtrasins" style="display: none">
+<form onsubmit="insertDel();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>
+ <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td>
+ <td>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td>
+ <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse"><span class="datetime" alt="{#xhtmlxtras_dlg.insert_date}" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td>
+ <td><input id="cite" name="cite" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td>
+ <td><input id="title" name="title" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td>
+ <td><input id="id" name="id" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td>
+ <td>
+ <select id="class" name="class" class="field mceEditableSelect">
+ <option value="">{#not_set}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td>
+ <td><input id="style" name="style" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td>
+ <td>
+ <select id="dir" name="dir" class="field">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option>
+ <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" class="field" />
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ <div id="events_panel" class="panel">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label for="onfocus">onfocus</label>:</td>
+ <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onblur">onblur</label>:</td>
+ <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onclick">onclick</label>:</td>
+ <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="ondblclick">ondblclick</label>:</td>
+ <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousedown">onmousedown</label>:</td>
+ <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseup">onmouseup</label>:</td>
+ <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseover">onmouseover</label>:</td>
+ <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousemove">onmousemove</label>:</td>
+ <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseout">onmouseout</label>:</td>
+ <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeypress">onkeypress</label>:</td>
+ <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeydown">onkeydown</label>:</td>
+ <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeyup">onkeyup</label>:</td>
+ <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ </div>
+ <div style="float: left">
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeDel();" style="display: none;" />
+ </div>
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+
+</form>
+
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js new file mode 100644 index 000000000..6a3270d35 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin.js @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.XHTMLXtrasPlugin',{init:function(ed,url){ed.addCommand('mceCite',function(){ed.windowManager.open({file:url+'/cite.htm',width:350+parseInt(ed.getLang('xhtmlxtras.cite_delta_width',0)),height:250+parseInt(ed.getLang('xhtmlxtras.cite_delta_height',0)),inline:1},{plugin_url:url});});ed.addCommand('mceAcronym',function(){ed.windowManager.open({file:url+'/acronym.htm',width:350+parseInt(ed.getLang('xhtmlxtras.acronym_delta_width',0)),height:250+parseInt(ed.getLang('xhtmlxtras.acronym_delta_width',0)),inline:1},{plugin_url:url});});ed.addCommand('mceAbbr',function(){ed.windowManager.open({file:url+'/abbr.htm',width:350+parseInt(ed.getLang('xhtmlxtras.abbr_delta_width',0)),height:250+parseInt(ed.getLang('xhtmlxtras.abbr_delta_width',0)),inline:1},{plugin_url:url});});ed.addCommand('mceDel',function(){ed.windowManager.open({file:url+'/del.htm',width:340+parseInt(ed.getLang('xhtmlxtras.del_delta_width',0)),height:310+parseInt(ed.getLang('xhtmlxtras.del_delta_width',0)),inline:1},{plugin_url:url});});ed.addCommand('mceIns',function(){ed.windowManager.open({file:url+'/ins.htm',width:340+parseInt(ed.getLang('xhtmlxtras.ins_delta_width',0)),height:310+parseInt(ed.getLang('xhtmlxtras.ins_delta_width',0)),inline:1},{plugin_url:url});});ed.addCommand('mceAttributes',function(){ed.windowManager.open({file:url+'/attributes.htm',width:380,height:370,inline:1},{plugin_url:url});});ed.addButton('cite',{title:'xhtmlxtras.cite_desc',cmd:'mceCite'});ed.addButton('acronym',{title:'xhtmlxtras.acronym_desc',cmd:'mceAcronym'});ed.addButton('abbr',{title:'xhtmlxtras.abbr_desc',cmd:'mceAbbr'});ed.addButton('del',{title:'xhtmlxtras.del_desc',cmd:'mceDel'});ed.addButton('ins',{title:'xhtmlxtras.ins_desc',cmd:'mceIns'});ed.addButton('attribs',{title:'xhtmlxtras.attribs_desc',cmd:'mceAttributes'});if(tinymce.isIE){function fix(ed,o){if(o.set){o.content=o.content.replace(/<abbr([^>]+)>/gi,'<html:abbr $1>');o.content=o.content.replace(/<\/abbr>/gi,'</html:abbr>');}};ed.onBeforeSetContent.add(fix);ed.onPostProcess.add(fix);}ed.onNodeChange.add(function(ed,cm,n,co){n=ed.dom.getParent(n,'CITE,ACRONYM,ABBR,DEL,INS');cm.setDisabled('cite',co);cm.setDisabled('acronym',co);cm.setDisabled('abbr',co);cm.setDisabled('del',co);cm.setDisabled('ins',co);cm.setDisabled('attribs',n&&n.nodeName=='BODY');if(n){cm.setDisabled(n.nodeName.toLowerCase(),0);cm.setActive(n.nodeName.toLowerCase(),1);}else{cm.setActive('cite',0);cm.setActive('acronym',0);cm.setActive('abbr',0);cm.setActive('del',0);cm.setActive('ins',0);}});},getInfo:function(){return{longname:'XHTML Xtras Plugin',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',version:tinymce.majorVersion+"."+tinymce.minorVersion};}});tinymce.PluginManager.add('xhtmlxtras',tinymce.plugins.XHTMLXtrasPlugin);})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js new file mode 100644 index 000000000..143ed9216 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @@ -0,0 +1,134 @@ +/**
+ * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
+ *
+ * @author Moxiecode
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+(function() {
+ tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {
+ init : function(ed, url) {
+ // Register commands
+ ed.addCommand('mceCite', function() {
+ ed.windowManager.open({
+ file : url + '/cite.htm',
+ width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
+ height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ ed.addCommand('mceAcronym', function() {
+ ed.windowManager.open({
+ file : url + '/acronym.htm',
+ width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
+ height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ ed.addCommand('mceAbbr', function() {
+ ed.windowManager.open({
+ file : url + '/abbr.htm',
+ width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
+ height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ ed.addCommand('mceDel', function() {
+ ed.windowManager.open({
+ file : url + '/del.htm',
+ width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
+ height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ ed.addCommand('mceIns', function() {
+ ed.windowManager.open({
+ file : url + '/ins.htm',
+ width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
+ height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ ed.addCommand('mceAttributes', function() {
+ ed.windowManager.open({
+ file : url + '/attributes.htm',
+ width : 380,
+ height : 370,
+ inline : 1
+ }, {
+ plugin_url : url
+ });
+ });
+
+ // Register buttons
+ ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
+ ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
+ ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
+ ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
+ ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
+ ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
+
+ if (tinymce.isIE) {
+ function fix(ed, o) {
+ if (o.set) {
+ o.content = o.content.replace(/<abbr([^>]+)>/gi, '<html:abbr $1>');
+ o.content = o.content.replace(/<\/abbr>/gi, '</html:abbr>');
+ }
+ };
+
+ ed.onBeforeSetContent.add(fix);
+ ed.onPostProcess.add(fix);
+ }
+
+ ed.onNodeChange.add(function(ed, cm, n, co) {
+ n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
+
+ cm.setDisabled('cite', co);
+ cm.setDisabled('acronym', co);
+ cm.setDisabled('abbr', co);
+ cm.setDisabled('del', co);
+ cm.setDisabled('ins', co);
+ cm.setDisabled('attribs', n && n.nodeName == 'BODY');
+
+ if (n) {
+ cm.setDisabled(n.nodeName.toLowerCase(), 0);
+ cm.setActive(n.nodeName.toLowerCase(), 1);
+ } else {
+ cm.setActive('cite', 0);
+ cm.setActive('acronym', 0);
+ cm.setActive('abbr', 0);
+ cm.setActive('del', 0);
+ cm.setActive('ins', 0);
+ }
+ });
+ },
+
+ getInfo : function() {
+ return {
+ longname : 'XHTML Xtras Plugin',
+ author : 'Moxiecode Systems AB',
+ authorurl : 'http://tinymce.moxiecode.com',
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
+ };
+ }
+ });
+
+ // Register plugin
+ tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
+})();
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm b/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm new file mode 100644 index 000000000..c0f056ff3 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/ins.htm @@ -0,0 +1,170 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>{#xhtmlxtras_dlg.title_ins_element}</title>
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
+ <script type="text/javascript" src="../../utils/editable_selects.js"></script>
+ <script type="text/javascript" src="js/element_common.js"></script>
+ <script type="text/javascript" src="js/ins.js"></script>
+ <link rel="stylesheet" type="text/css" href="css/popup.css" />
+ <base target="_self" />
+</head>
+<body id="xhtmlxtrasins" style="display: none">
+<form onsubmit="insertIns();return false;" action="#">
+ <div class="tabs">
+ <ul>
+ <li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.general_tab}</a></span></li>
+ <!-- <li id="events_tab"><span><a href="javascript:mcTabs.displayTab('events_tab','events_panel');" onmousedown="return false;">{#xhtmlxtras_dlg.events_tab}</a></span></li> -->
+ </ul>
+ </div>
+
+ <div class="panel_wrapper">
+ <div id="general_panel" class="panel current">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_general_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="datetimelabel" for="datetime">{#xhtmlxtras_dlg.attribute_label_datetime}</label>:</td>
+ <td>
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td><input id="datetime" name="datetime" type="text" value="" maxlength="19" class="field mceFocus" /></td>
+ <td><a href="javascript:insertDateTime('datetime');" onmousedown="return false;" class="browse"><span class="datetime" alt="{#xhtmlxtras_dlg.insert_date}" title="{#xhtmlxtras_dlg.insert_date}"></span></a></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="citelabel" for="cite">{#xhtmlxtras_dlg.attribute_label_cite}</label>:</td>
+ <td><input id="cite" name="cite" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_attrib_tab}</legend>
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label id="titlelabel" for="title">{#xhtmlxtras_dlg.attribute_label_title}</label>:</td>
+ <td><input id="title" name="title" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="idlabel" for="id">{#xhtmlxtras_dlg.attribute_label_id}</label>:</td>
+ <td><input id="id" name="id" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="classlabel" for="class">{#xhtmlxtras_dlg.attribute_label_class}</label>:</td>
+ <td>
+ <select id="class" name="class" class="field mceEditableSelect">
+ <option value="">{#not_set}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="stylelabel" for="class">{#xhtmlxtras_dlg.attribute_label_style}</label>:</td>
+ <td><input id="style" name="style" type="text" value="" class="field" /></td>
+ </tr>
+ <tr>
+ <td class="label"><label id="dirlabel" for="dir">{#xhtmlxtras_dlg.attribute_label_langdir}</label>:</td>
+ <td>
+ <select id="dir" name="dir" class="field">
+ <option value="">{#not_set}</option>
+ <option value="ltr">{#xhtmlxtras_dlg.attribute_option_ltr}</option>
+ <option value="rtl">{#xhtmlxtras_dlg.attribute_option_rtl}</option>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td class="label"><label id="langlabel" for="lang">{#xhtmlxtras_dlg.attribute_label_langcode}</label>:</td>
+ <td>
+ <input id="lang" name="lang" type="text" value="" class="field" />
+ </td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ <div id="events_panel" class="panel">
+ <fieldset>
+ <legend>{#xhtmlxtras_dlg.fieldset_events_tab}</legend>
+
+ <table border="0" cellpadding="0" cellspacing="4">
+ <tr>
+ <td class="label"><label for="onfocus">onfocus</label>:</td>
+ <td><input id="onfocus" name="onfocus" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onblur">onblur</label>:</td>
+ <td><input id="onblur" name="onblur" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onclick">onclick</label>:</td>
+ <td><input id="onclick" name="onclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="ondblclick">ondblclick</label>:</td>
+ <td><input id="ondblclick" name="ondblclick" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousedown">onmousedown</label>:</td>
+ <td><input id="onmousedown" name="onmousedown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseup">onmouseup</label>:</td>
+ <td><input id="onmouseup" name="onmouseup" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseover">onmouseover</label>:</td>
+ <td><input id="onmouseover" name="onmouseover" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmousemove">onmousemove</label>:</td>
+ <td><input id="onmousemove" name="onmousemove" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onmouseout">onmouseout</label>:</td>
+ <td><input id="onmouseout" name="onmouseout" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeypress">onkeypress</label>:</td>
+ <td><input id="onkeypress" name="onkeypress" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeydown">onkeydown</label>:</td>
+ <td><input id="onkeydown" name="onkeydown" type="text" value="" class="field" /></td>
+ </tr>
+
+ <tr>
+ <td class="label"><label for="onkeyup">onkeyup</label>:</td>
+ <td><input id="onkeyup" name="onkeyup" type="text" value="" class="field" /></td>
+ </tr>
+ </table>
+ </fieldset>
+ </div>
+ </div>
+ <div class="mceActionPanel">
+ <div style="float: left">
+ <input type="submit" id="insert" name="insert" value="{#update}" />
+ </div>
+ <div style="float: left">
+ <input type="button" id="remove" name="remove" class="button" value="{#xhtmlxtras_dlg.remove}" onclick="removeIns();" style="display: none;" />
+ </div>
+ <div style="float: right">
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
+ </div>
+ </div>
+
+</form>
+
+</body>
+</html>
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js new file mode 100644 index 000000000..e84b6a837 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/abbr.js @@ -0,0 +1,25 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+function init() {
+ SXE.initElementDialog('abbr');
+ if (SXE.currentAction == "update") {
+ SXE.showRemoveButton();
+ }
+}
+
+function insertAbbr() {
+ SXE.insertElement(tinymce.isIE ? 'html:abbr' : 'abbr');
+ tinyMCEPopup.close();
+}
+
+function removeAbbr() {
+ SXE.removeElement('abbr');
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js new file mode 100644 index 000000000..933d122cb --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/acronym.js @@ -0,0 +1,25 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+function init() {
+ SXE.initElementDialog('acronym');
+ if (SXE.currentAction == "update") {
+ SXE.showRemoveButton();
+ }
+}
+
+function insertAcronym() {
+ SXE.insertElement('acronym');
+ tinyMCEPopup.close();
+}
+
+function removeAcronym() {
+ SXE.removeElement('acronym');
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js new file mode 100644 index 000000000..23c7fa4c2 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/attributes.js @@ -0,0 +1,123 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2006, Moxiecode Systems AB, All rights reserved.
+ */
+
+function init() {
+ tinyMCEPopup.resizeToInnerSize();
+ var inst = tinyMCEPopup.editor;
+ var dom = inst.dom;
+ var elm = inst.selection.getNode();
+ var f = document.forms[0];
+ var onclick = dom.getAttrib(elm, 'onclick');
+
+ setFormValue('title', dom.getAttrib(elm, 'title'));
+ setFormValue('id', dom.getAttrib(elm, 'id'));
+ setFormValue('style', dom.getAttrib(elm, "style"));
+ setFormValue('dir', dom.getAttrib(elm, 'dir'));
+ setFormValue('lang', dom.getAttrib(elm, 'lang'));
+ setFormValue('tabindex', dom.getAttrib(elm, 'tabindex', typeof(elm.tabindex) != "undefined" ? elm.tabindex : ""));
+ setFormValue('accesskey', dom.getAttrib(elm, 'accesskey', typeof(elm.accesskey) != "undefined" ? elm.accesskey : ""));
+ setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));
+ setFormValue('onblur', dom.getAttrib(elm, 'onblur'));
+ setFormValue('onclick', onclick);
+ setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));
+ setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));
+ setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));
+ setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));
+ setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));
+ setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));
+ setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));
+ setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));
+ setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));
+ className = dom.getAttrib(elm, 'class');
+
+ addClassesToList('classlist', 'advlink_styles');
+ selectByValue(f, 'classlist', className, true);
+
+ TinyMCE_EditableSelects.init();
+}
+
+function setFormValue(name, value) {
+ if(value && document.forms[0].elements[name]){
+ document.forms[0].elements[name].value = value;
+ }
+}
+
+function insertAction() {
+ var inst = tinyMCEPopup.editor;
+ var elm = inst.selection.getNode();
+
+ tinyMCEPopup.execCommand("mceBeginUndoLevel");
+ setAllAttribs(elm);
+ tinyMCEPopup.execCommand("mceEndUndoLevel");
+ tinyMCEPopup.close();
+}
+
+function setAttrib(elm, attrib, value) {
+ var formObj = document.forms[0];
+ var valueElm = formObj.elements[attrib.toLowerCase()];
+ var inst = tinyMCEPopup.editor;
+ var dom = inst.dom;
+
+ if (typeof(value) == "undefined" || value == null) {
+ value = "";
+
+ if (valueElm)
+ value = valueElm.value;
+ }
+
+ if (value != "") {
+ dom.setAttrib(elm, attrib.toLowerCase(), value);
+
+ if (attrib == "style")
+ attrib = "style.cssText";
+
+ if (attrib.substring(0, 2) == 'on')
+ value = 'return true;' + value;
+
+ if (attrib == "class")
+ attrib = "className";
+
+ elm[attrib]=value;
+ } else
+ elm.removeAttribute(attrib);
+}
+
+function setAllAttribs(elm) {
+ var f = document.forms[0];
+
+ setAttrib(elm, 'title');
+ setAttrib(elm, 'id');
+ setAttrib(elm, 'style');
+ setAttrib(elm, 'class', getSelectValue(f, 'classlist'));
+ setAttrib(elm, 'dir');
+ setAttrib(elm, 'lang');
+ setAttrib(elm, 'tabindex');
+ setAttrib(elm, 'accesskey');
+ setAttrib(elm, 'onfocus');
+ setAttrib(elm, 'onblur');
+ setAttrib(elm, 'onclick');
+ setAttrib(elm, 'ondblclick');
+ setAttrib(elm, 'onmousedown');
+ setAttrib(elm, 'onmouseup');
+ setAttrib(elm, 'onmouseover');
+ setAttrib(elm, 'onmousemove');
+ setAttrib(elm, 'onmouseout');
+ setAttrib(elm, 'onkeypress');
+ setAttrib(elm, 'onkeydown');
+ setAttrib(elm, 'onkeyup');
+
+ // Refresh in old MSIE
+// if (tinyMCE.isMSIE5)
+// elm.outerHTML = elm.outerHTML;
+}
+
+function insertAttribute() {
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
+tinyMCEPopup.requireLangPack();
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js new file mode 100644 index 000000000..c36f7fd87 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/cite.js @@ -0,0 +1,25 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+function init() {
+ SXE.initElementDialog('cite');
+ if (SXE.currentAction == "update") {
+ SXE.showRemoveButton();
+ }
+}
+
+function insertCite() {
+ SXE.insertElement('cite');
+ tinyMCEPopup.close();
+}
+
+function removeCite() {
+ SXE.removeElement('cite');
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js new file mode 100644 index 000000000..005a619c7 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/del.js @@ -0,0 +1,50 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+function init() {
+ SXE.initElementDialog('del');
+ if (SXE.currentAction == "update") {
+ setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
+ setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
+ SXE.showRemoveButton();
+ }
+}
+
+function setElementAttribs(elm) {
+ setAllCommonAttribs(elm);
+ setAttrib(elm, 'datetime');
+ setAttrib(elm, 'cite');
+}
+
+function insertDel() {
+ var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'DEL');
+
+ tinyMCEPopup.execCommand('mceBeginUndoLevel');
+ if (elm == null) {
+ var s = SXE.inst.selection.getContent();
+ if(s.length > 0) {
+ tinyMCEPopup.execCommand('mceInsertContent', false, '<del id="#sxe_temp_del#">' + s + '</del>');
+ var elementArray = tinymce.grep(SXE.inst.dom.select('del'), function(n) {return n.id == '#sxe_temp_del#';});
+ for (var i=0; i<elementArray.length; i++) {
+ var elm = elementArray[i];
+ setElementAttribs(elm);
+ }
+ }
+ } else {
+ setElementAttribs(elm);
+ }
+ tinyMCEPopup.editor.nodeChanged();
+ tinyMCEPopup.execCommand('mceEndUndoLevel');
+ tinyMCEPopup.close();
+}
+
+function removeDel() {
+ SXE.removeElement('del');
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js new file mode 100644 index 000000000..724d9d1a9 --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/element_common.js @@ -0,0 +1,221 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+tinyMCEPopup.requireLangPack();
+
+function initCommonAttributes(elm) {
+ var formObj = document.forms[0], dom = tinyMCEPopup.editor.dom;
+
+ // Setup form data for common element attributes
+ setFormValue('title', dom.getAttrib(elm, 'title'));
+ setFormValue('id', dom.getAttrib(elm, 'id'));
+ selectByValue(formObj, 'class', dom.getAttrib(elm, 'class'), true);
+ setFormValue('style', dom.getAttrib(elm, 'style'));
+ selectByValue(formObj, 'dir', dom.getAttrib(elm, 'dir'));
+ setFormValue('lang', dom.getAttrib(elm, 'lang'));
+ setFormValue('onfocus', dom.getAttrib(elm, 'onfocus'));
+ setFormValue('onblur', dom.getAttrib(elm, 'onblur'));
+ setFormValue('onclick', dom.getAttrib(elm, 'onclick'));
+ setFormValue('ondblclick', dom.getAttrib(elm, 'ondblclick'));
+ setFormValue('onmousedown', dom.getAttrib(elm, 'onmousedown'));
+ setFormValue('onmouseup', dom.getAttrib(elm, 'onmouseup'));
+ setFormValue('onmouseover', dom.getAttrib(elm, 'onmouseover'));
+ setFormValue('onmousemove', dom.getAttrib(elm, 'onmousemove'));
+ setFormValue('onmouseout', dom.getAttrib(elm, 'onmouseout'));
+ setFormValue('onkeypress', dom.getAttrib(elm, 'onkeypress'));
+ setFormValue('onkeydown', dom.getAttrib(elm, 'onkeydown'));
+ setFormValue('onkeyup', dom.getAttrib(elm, 'onkeyup'));
+}
+
+function setFormValue(name, value) {
+ if(document.forms[0].elements[name]) document.forms[0].elements[name].value = value;
+}
+
+function insertDateTime(id) {
+ document.getElementById(id).value = getDateTime(new Date(), "%Y-%m-%dT%H:%M:%S");
+}
+
+function getDateTime(d, fmt) {
+ fmt = fmt.replace("%D", "%m/%d/%y");
+ fmt = fmt.replace("%r", "%I:%M:%S %p");
+ fmt = fmt.replace("%Y", "" + d.getFullYear());
+ fmt = fmt.replace("%y", "" + d.getYear());
+ fmt = fmt.replace("%m", addZeros(d.getMonth()+1, 2));
+ fmt = fmt.replace("%d", addZeros(d.getDate(), 2));
+ fmt = fmt.replace("%H", "" + addZeros(d.getHours(), 2));
+ fmt = fmt.replace("%M", "" + addZeros(d.getMinutes(), 2));
+ fmt = fmt.replace("%S", "" + addZeros(d.getSeconds(), 2));
+ fmt = fmt.replace("%I", "" + ((d.getHours() + 11) % 12 + 1));
+ fmt = fmt.replace("%p", "" + (d.getHours() < 12 ? "AM" : "PM"));
+ fmt = fmt.replace("%%", "%");
+
+ return fmt;
+}
+
+function addZeros(value, len) {
+ var i;
+
+ value = "" + value;
+
+ if (value.length < len) {
+ for (i=0; i<(len-value.length); i++)
+ value = "0" + value;
+ }
+
+ return value;
+}
+
+function selectByValue(form_obj, field_name, value, add_custom, ignore_case) {
+ if (!form_obj || !form_obj.elements[field_name])
+ return;
+
+ var sel = form_obj.elements[field_name];
+
+ var found = false;
+ for (var i=0; i<sel.options.length; i++) {
+ var option = sel.options[i];
+
+ if (option.value == value || (ignore_case && option.value.toLowerCase() == value.toLowerCase())) {
+ option.selected = true;
+ found = true;
+ } else
+ option.selected = false;
+ }
+
+ if (!found && add_custom && value != '') {
+ var option = new Option('Value: ' + value, value);
+ option.selected = true;
+ sel.options[sel.options.length] = option;
+ }
+
+ return found;
+}
+
+function setAttrib(elm, attrib, value) {
+ var formObj = document.forms[0];
+ var valueElm = formObj.elements[attrib.toLowerCase()];
+ tinyMCEPopup.editor.dom.setAttrib(elm, attrib, value || valueElm.value);
+}
+
+function setAllCommonAttribs(elm) {
+ setAttrib(elm, 'title');
+ setAttrib(elm, 'id');
+ setAttrib(elm, 'class');
+ setAttrib(elm, 'style');
+ setAttrib(elm, 'dir');
+ setAttrib(elm, 'lang');
+ /*setAttrib(elm, 'onfocus');
+ setAttrib(elm, 'onblur');
+ setAttrib(elm, 'onclick');
+ setAttrib(elm, 'ondblclick');
+ setAttrib(elm, 'onmousedown');
+ setAttrib(elm, 'onmouseup');
+ setAttrib(elm, 'onmouseover');
+ setAttrib(elm, 'onmousemove');
+ setAttrib(elm, 'onmouseout');
+ setAttrib(elm, 'onkeypress');
+ setAttrib(elm, 'onkeydown');
+ setAttrib(elm, 'onkeyup');*/
+}
+
+SXE = {
+ currentAction : "insert",
+ inst : tinyMCEPopup.editor,
+ updateElement : null
+}
+
+SXE.focusElement = SXE.inst.selection.getNode();
+
+SXE.initElementDialog = function(element_name) {
+ addClassesToList('class', 'xhtmlxtras_styles');
+ TinyMCE_EditableSelects.init();
+
+ element_name = element_name.toLowerCase();
+ var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());
+ if (elm != null && elm.nodeName == element_name.toUpperCase()) {
+ SXE.currentAction = "update";
+ }
+
+ if (SXE.currentAction == "update") {
+ initCommonAttributes(elm);
+ SXE.updateElement = elm;
+ }
+
+ document.forms[0].insert.value = tinyMCEPopup.getLang(SXE.currentAction, 'Insert', true);
+}
+
+SXE.insertElement = function(element_name) {
+ var elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase()), h, tagName;
+
+ tinyMCEPopup.execCommand('mceBeginUndoLevel');
+ if (elm == null) {
+ var s = SXE.inst.selection.getContent();
+ if(s.length > 0) {
+ tagName = element_name;
+
+ if (tinymce.isIE && element_name.indexOf('html:') == 0)
+ element_name = element_name.substring(5).toLowerCase();
+
+ h = '<' + tagName + ' id="#sxe_temp_' + element_name + '#">' + s + '</' + tagName + '>';
+
+ tinyMCEPopup.execCommand('mceInsertContent', false, h);
+
+ var elementArray = tinymce.grep(SXE.inst.dom.select(element_name), function(n) {return n.id == '#sxe_temp_' + element_name + '#';});
+ for (var i=0; i<elementArray.length; i++) {
+ var elm = elementArray[i];
+
+ elm.id = '';
+ elm.setAttribute('id', '');
+ elm.removeAttribute('id');
+
+ setAllCommonAttribs(elm);
+ }
+ }
+ } else {
+ setAllCommonAttribs(elm);
+ }
+ SXE.inst.nodeChanged();
+ tinyMCEPopup.execCommand('mceEndUndoLevel');
+}
+
+SXE.removeElement = function(element_name){
+ element_name = element_name.toLowerCase();
+ elm = SXE.inst.dom.getParent(SXE.focusElement, element_name.toUpperCase());
+ if(elm && elm.nodeName == element_name.toUpperCase()){
+ tinyMCEPopup.execCommand('mceBeginUndoLevel');
+ tinyMCE.execCommand('mceRemoveNode', false, elm);
+ SXE.inst.nodeChanged();
+ tinyMCEPopup.execCommand('mceEndUndoLevel');
+ }
+}
+
+SXE.showRemoveButton = function() {
+ document.getElementById("remove").style.display = 'block';
+}
+
+SXE.containsClass = function(elm,cl) {
+ return (elm.className.indexOf(cl) > -1) ? true : false;
+}
+
+SXE.removeClass = function(elm,cl) {
+ if(elm.className == null || elm.className == "" || !SXE.containsClass(elm,cl)) {
+ return true;
+ }
+ var classNames = elm.className.split(" ");
+ var newClassNames = "";
+ for (var x = 0, cnl = classNames.length; x < cnl; x++) {
+ if (classNames[x] != cl) {
+ newClassNames += (classNames[x] + " ");
+ }
+ }
+ elm.className = newClassNames.substring(0,newClassNames.length-1); //removes extra space at the end
+}
+
+SXE.addClass = function(elm,cl) {
+ if(!SXE.containsClass(elm,cl)) elm.className ? elm.className += " " + cl : elm.className = cl;
+ return true;
+}
\ No newline at end of file diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js b/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js new file mode 100644 index 000000000..b03ca1b5e --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/js/ins.js @@ -0,0 +1,49 @@ + /**
+ * $Id: editor_plugin_src.js 42 2006-08-08 14:32:24Z spocke $
+ *
+ * @author Moxiecode - based on work by Andrew Tetlaw
+ * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
+ */
+
+function init() {
+ SXE.initElementDialog('ins');
+ if (SXE.currentAction == "update") {
+ setFormValue('datetime', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'datetime'));
+ setFormValue('cite', tinyMCEPopup.editor.dom.getAttrib(SXE.updateElement, 'cite'));
+ SXE.showRemoveButton();
+ }
+}
+
+function setElementAttribs(elm) {
+ setAllCommonAttribs(elm);
+ setAttrib(elm, 'datetime');
+ setAttrib(elm, 'cite');
+}
+
+function insertIns() {
+ var elm = tinyMCEPopup.editor.dom.getParent(SXE.focusElement, 'INS');
+ tinyMCEPopup.execCommand('mceBeginUndoLevel');
+ if (elm == null) {
+ var s = SXE.inst.selection.getContent();
+ if(s.length > 0) {
+ tinyMCEPopup.execCommand('mceInsertContent', false, '<ins id="#sxe_temp_ins#">' + s + '</ins>');
+ var elementArray = tinymce.grep(SXE.inst.dom.select('ins'), function(n) {return n.id == '#sxe_temp_ins#';});
+ for (var i=0; i<elementArray.length; i++) {
+ var elm = elementArray[i];
+ setElementAttribs(elm);
+ }
+ }
+ } else {
+ setElementAttribs(elm);
+ }
+ tinyMCEPopup.editor.nodeChanged();
+ tinyMCEPopup.execCommand('mceEndUndoLevel');
+ tinyMCEPopup.close();
+}
+
+function removeIns() {
+ SXE.removeElement('ins');
+ tinyMCEPopup.close();
+}
+
+tinyMCEPopup.onInit.add(init);
diff --git a/program/js/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js b/program/js/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js new file mode 100644 index 000000000..45b6b267b --- /dev/null +++ b/program/js/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js @@ -0,0 +1,32 @@ +tinyMCE.addI18n('en.xhtmlxtras_dlg',{
+attribute_label_title:"Title",
+attribute_label_id:"ID",
+attribute_label_class:"Class",
+attribute_label_style:"Style",
+attribute_label_cite:"Cite",
+attribute_label_datetime:"Date/Time",
+attribute_label_langdir:"Text Direction",
+attribute_option_ltr:"Left to right",
+attribute_option_rtl:"Right to left",
+attribute_label_langcode:"Language",
+attribute_label_tabindex:"TabIndex",
+attribute_label_accesskey:"AccessKey",
+attribute_events_tab:"Events",
+attribute_attrib_tab:"Attributes",
+general_tab:"General",
+attrib_tab:"Attributes",
+events_tab:"Events",
+fieldset_general_tab:"General Settings",
+fieldset_attrib_tab:"Element Attributes",
+fieldset_events_tab:"Element Events",
+title_ins_element:"Insertion Element",
+title_del_element:"Deletion Element",
+title_acronym_element:"Acronym Element",
+title_abbr_element:"Abbreviation Element",
+title_cite_element:"Citation Element",
+remove:"Remove",
+insert_date:"Insert current date/time",
+option_ltr:"Left to right",
+option_rtl:"Right to left",
+attribs_title:"Insert/Edit Attributes"
+});
\ No newline at end of file |