-// Patch openWindow, closeWindow TinyMCE functions\r
-\r
-function TinyMCE_inlinepopups_getInfo() {\r
- return {\r
- longname : 'Inline Popups',\r
- author : 'Moxiecode Systems',\r
- authorurl : 'http://tinymce.moxiecode.com',\r
- infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',\r
- version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion\r
- };\r
-};\r
-\r
-TinyMCE.prototype.orgOpenWindow = TinyMCE.prototype.openWindow;\r
-\r
-TinyMCE.prototype.openWindow = function(template, args) {\r
- // Does the caller support inline\r
- if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {\r
- mcWindows.selectedWindow = null;\r
- args['mce_inside_iframe'] = false;\r
- this.orgOpenWindow(template, args);\r
- return;\r
- }\r
-\r
- var url, resizable, scrollbars;\r
-\r
- args['mce_inside_iframe'] = true;\r
- tinyMCE.windowArgs = args;\r
-\r
- if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)\r
- url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];\r
- else\r
- url = template['file'];\r
-\r
- if (!(width = parseInt(template['width'])))\r
- width = 320;\r
-\r
- if (!(height = parseInt(template['height'])))\r
- height = 200;\r
-\r
- resizable = (args && args['resizable']) ? args['resizable'] : "no";\r
- scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";\r
-\r
- height += 18;\r
-\r
- // Replace all args as variables in URL\r
- for (var name in args) {\r
- if (typeof(args[name]) == 'function')\r
- continue;\r
-\r
- url = tinyMCE.replaceVar(url, name, escape(args[name]));\r
- }\r
-\r
- var elm = document.getElementById(this.selectedInstance.editorId + '_parent');\r
- var pos = tinyMCE.getAbsPosition(elm);\r
-\r
- // Center div in editor area\r
- pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));\r
- pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));\r
-\r
- mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);\r
-};\r
-\r
-TinyMCE.prototype.orgCloseWindow = TinyMCE.prototype.closeWindow;\r
-\r
-TinyMCE.prototype.closeWindow = function(win) {\r
- if (mcWindows.selectedWindow != null)\r
- mcWindows.selectedWindow.close();\r
- else\r
- this.orgCloseWindow(win);\r
-};\r
-\r
-TinyMCE.prototype.setWindowTitle = function(win_ref, title) {\r
- for (var n in mcWindows.windows) {\r
- var win = mcWindows.windows[n];\r
- if (typeof(win) == 'function')\r
- continue;\r
-\r
- if (win_ref.name == win.id + "_iframe")\r
- window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;\r
- }\r
-};\r
-\r
-// * * * * * MCWindows classes below\r
-\r
-// Windows handler\r
-function MCWindows() {\r
- this.settings = new Array();\r
- this.windows = new Array();\r
- this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");\r
- this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;\r
- this.isSafari = navigator.userAgent.indexOf('Safari') != -1;\r
- this.isMac = navigator.userAgent.indexOf('Mac') != -1;\r
- this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);\r
- this.action = "none";\r
- this.selectedWindow = null;\r
- this.lastSelectedWindow = null;\r
- this.zindex = 100;\r
- this.mouseDownScreenX = 0;\r
- this.mouseDownScreenY = 0;\r
- this.mouseDownLayerX = 0;\r
- this.mouseDownLayerY = 0;\r
- this.mouseDownWidth = 0;\r
- this.mouseDownHeight = 0;\r
- this.idCounter = 0;\r
-};\r
-\r
-MCWindows.prototype.init = function(settings) {\r
- this.settings = settings;\r
-\r
- if (this.isMSIE)\r
- this.addEvent(document, "mousemove", mcWindows.eventDispatcher);\r
- else\r
- this.addEvent(window, "mousemove", mcWindows.eventDispatcher);\r
-\r
- this.addEvent(document, "mouseup", mcWindows.eventDispatcher);\r
-\r
- this.doc = document;\r
-};\r
-\r
-MCWindows.prototype.getParam = function(name, default_value) {\r
- var value = null;\r
-\r
- value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];\r
-\r
- // Fix bool values\r
- if (value == "true" || value == "false")\r
- return (value == "true");\r
-\r
- return value;\r
-};\r
-\r
-MCWindows.prototype.eventDispatcher = function(e) {\r
- e = typeof(e) == "undefined" ? window.event : e;\r
-\r
- if (mcWindows.selectedWindow == null)\r
- return;\r
-\r
- // Switch focus\r
- if (mcWindows.isGecko && e.type == "mousedown") {\r
- var elm = e.currentTarget;\r
-\r
- for (var n in mcWindows.windows) {\r
- var win = mcWindows.windows[n];\r
-\r
- if (win.headElement == elm || win.resizeElement == elm) {\r
- win.focus();\r
- break;\r
- }\r
+(function() {\r
+ var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;\r
+\r
+ tinymce.create('tinymce.plugins.InlinePopups', {\r
+ init : function(ed, url) {\r
+ // Replace window manager\r
+ ed.onBeforeRenderUI.add(function() {\r
+ ed.windowManager = new tinymce.InlineWindowManager(ed);\r
+ DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");\r
+ });\r
+ },\r
+\r
+ getInfo : function() {\r
+ return {\r
+ longname : 'InlinePopups',\r
+ author : 'Moxiecode Systems AB',\r
+ authorurl : 'http://tinymce.moxiecode.com',\r
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',\r
+ version : tinymce.majorVersion + "." + tinymce.minorVersion\r
+ };\r