Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • osian/sucs-site
  • kais58/sucs-site
  • imranh/sucs-site
  • foshjedi2004/sucs-site
  • gigosaurus/sucs-site
  • matstn/sucs-site
  • ripp_/sucs-site
  • eggnog/sucs-site
  • sucssite/sucs-site
  • elbows/sucs-site
  • realitykiller/sucs-site
  • crox/sucs-site
  • vectre/sucs-site
  • welshbyte/sucs-site
  • paperclipman/sucs-site
15 results
Show changes
Showing
with 0 additions and 1362 deletions
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.20 $
* $Date: 2006/02/10 16:29:39 $
*
* @author Moxiecode
* @copyright Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('iespell', 'en,tr,cs,el,fr_ca,it,ko,sv,zh_cn,fr,de,pl,pt_br,nl,da,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,fi,cy,es,is,zh_tw,zh_tw_utf8,sk');
var TinyMCE_IESpellPlugin = {
getInfo : function() {
return {
longname : 'IESpell (MSIE Only)',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_iespell.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
/**
* Returns the HTML contents of the iespell control.
*/
getControlHTML : function(cn) {
// Is it the iespell control and is the brower MSIE.
if (cn == "iespell" && (tinyMCE.isMSIE && !tinyMCE.isOpera))
return tinyMCE.getButtonHTML(cn, 'lang_iespell_desc', '{$pluginurl}/images/iespell.gif', 'mceIESpell');
return "";
},
/**
* Executes the mceIESpell command.
*/
execCommand : function(editor_id, element, command, user_interface, value) {
// Handle ieSpellCommand
if (command == "mceIESpell") {
try {
var ieSpell = new ActiveXObject("ieSpell.ieSpellExtension");
ieSpell.CheckDocumentNode(tinyMCE.getInstanceById(editor_id).contentDocument.documentElement);
} catch (e) {
if (e.number == -2146827859) {
if (confirm(tinyMCE.getLang("lang_iespell_download", "", true)))
window.open('http://www.iespell.com/download.php', 'ieSpellDownload', '');
} else
alert("Error Loading ieSpell: Exception " + e.number);
}
return true;
}
// Pass to next handler in chain
return false;
}
};
tinyMCE.addPlugin("iespell", TinyMCE_IESpellPlugin);
// UK lang variables
tinyMCE.addToLang('',{
iespell_desc : 'Run spell checking',
iespell_download : "ieSpell not detected. Click OK to go to download page."
});
Check the TinyMCE documentation for details on this plugin.
/* Window classes */
.mceWindow {
position: absolute;
left: 0;
top: 0;
border: 1px solid black;
background-color: #D4D0C8;
}
.mceWindowHead {
background-color: #334F8D;
width: 100%;
height: 18px;
cursor: move;
overflow: hidden;
}
.mceWindowBody {
clear: both;
background-color: white;
}
.mceWindowStatusbar {
background-color: #D4D0C8;
height: 12px;
border-top: 1px solid black;
}
.mceWindowTitle {
float: left;
font-family: "MS Sans Serif";
font-size: 9pt;
font-weight: bold;
line-height: 18px;
color: white;
margin-left: 2px;
overflow: hidden;
}
.mceWindowHeadTools {
margin-right: 2px;
}
.mceWindowClose, .mceWindowMinimize, .mceWindowMaximize {
display: block;
float: right;
overflow: hidden;
margin-top: 2px;
}
.mceWindowClose {
margin-left: 2px;
}
.mceWindowMinimize {
}
.mceWindowMaximize {
}
.mceWindowResize {
display: block;
float: right;
overflow: hidden;
cursor: se-resize;
width: 12px;
height: 12px;
}
var TinyMCE_InlinePopupsPlugin={getInfo:function(){return{longname:'Inline Popups',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};}};tinyMCE.addPlugin("inlinepopups",TinyMCE_InlinePopupsPlugin);TinyMCE_Engine.prototype.orgOpenWindow=TinyMCE_Engine.prototype.openWindow;TinyMCE_Engine.prototype.openWindow=function(template,args){if(args['inline']!="yes"||tinyMCE.isOpera||tinyMCE.getParam("plugins").indexOf('inlinepopups')==-1){mcWindows.selectedWindow=null;args['mce_inside_iframe']=false;this.orgOpenWindow(template,args);return;}var url,resizable,scrollbars;args['mce_inside_iframe']=true;tinyMCE.windowArgs=args;if(template['file'].charAt(0)!='/'&&template['file'].indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template['file'];else url=template['file'];if(!(width=parseInt(template['width'])))width=320;if(!(height=parseInt(template['height'])))height=200;resizable=(args&&args['resizable'])?args['resizable']:"no";scrollbars=(args&&args['scrollbars'])?args['scrollbars']:"no";height+=18;for(var name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]));}var elm=document.getElementById(this.selectedInstance.editorId+'_parent');var pos=tinyMCE.getAbsPosition(elm);pos.absLeft+=Math.round((elm.firstChild.clientWidth/2)-(width/2));pos.absTop+=Math.round((elm.firstChild.clientHeight/2)-(height/2));mcWindows.open(url,mcWindows.idCounter++,"modal=yes,width="+width+",height="+height+",resizable="+resizable+",scrollbars="+scrollbars+",statusbar="+resizable+",left="+pos.absLeft+",top="+pos.absTop);};TinyMCE_Engine.prototype.orgCloseWindow=TinyMCE_Engine.prototype.closeWindow;TinyMCE_Engine.prototype.closeWindow=function(win){if(mcWindows.selectedWindow!=null)mcWindows.selectedWindow.close();else this.orgCloseWindow(win);};TinyMCE_Engine.prototype.setWindowTitle=function(win_ref,title){for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(win_ref.name==win.id+"_iframe")window.frames[win.id+"_iframe"].document.getElementById(win.id+'_title').innerHTML=title;}};function TinyMCE_Windows(){this.settings=new Array();this.windows=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.action="none";this.selectedWindow=null;this.lastSelectedWindow=null;this.zindex=100;this.mouseDownScreenX=0;this.mouseDownScreenY=0;this.mouseDownLayerX=0;this.mouseDownLayerY=0;this.mouseDownWidth=0;this.mouseDownHeight=0;this.idCounter=0;};TinyMCE_Windows.prototype.init=function(settings){this.settings=settings;if(this.isMSIE)this.addEvent(document,"mousemove",mcWindows.eventDispatcher);else this.addEvent(window,"mousemove",mcWindows.eventDispatcher);this.addEvent(document,"mouseup",mcWindows.eventDispatcher);this.doc=document;};TinyMCE_Windows.prototype.getParam=function(name,default_value){var value=null;value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");return value;};TinyMCE_Windows.prototype.eventDispatcher=function(e){e=typeof(e)=="undefined"?window.event:e;if(mcWindows.selectedWindow==null)return;if(mcWindows.isGecko&&e.type=="mousedown"){var elm=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(win.headElement==elm||win.resizeElement==elm){win.focus();break;}}}switch(e.type){case"mousemove":mcWindows.selectedWindow.onMouseMove(e);break;case"mouseup":mcWindows.selectedWindow.onMouseUp(e);break;case"mousedown":mcWindows.selectedWindow.onMouseDown(e);break;case"focus":mcWindows.selectedWindow.onFocus(e);break;}};TinyMCE_Windows.prototype.addEvent=function(obj,name,handler){if(this.isMSIE)obj.attachEvent("on"+name,handler);else obj.addEventListener(name,handler,true);};TinyMCE_Windows.prototype.cancelEvent=function(e){if(this.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE_Windows.prototype.parseFeatures=function(opts){opts=opts.toLowerCase();opts=opts.replace(/;/g,",");opts=opts.replace(/[^0-9a-z=,]/g,"");var optionChunks=opts.split(',');var options=new Array();options['left']="10";options['top']="10";options['width']="300";options['height']="300";options['resizable']="yes";options['minimizable']="yes";options['maximizable']="yes";options['close']="yes";options['movable']="yes";options['statusbar']="yes";options['scrollbars']="auto";options['modal']="no";if(opts=="")return options;for(var i=0;i<optionChunks.length;i++){var parts=optionChunks[i].split('=');if(parts.length==2)options[parts[0]]=parts[1];}options['left']=parseInt(options['left']);options['top']=parseInt(options['top']);options['width']=parseInt(options['width']);options['height']=parseInt(options['height']);return options;};TinyMCE_Windows.prototype.open=function(url,name,features){this.lastSelectedWindow=this.selectedWindow;var win=new TinyMCE_Window();var winDiv,html="",id;var imgPath=this.getParam("images_path");features=this.parseFeatures(features);id="mcWindow_"+name;win.deltaHeight=18;if(features['statusbar']=="yes"){win.deltaHeight+=13;if(this.isMSIE)win.deltaHeight+=1;}width=parseInt(features['width']);height=parseInt(features['height'])-win.deltaHeight;if(this.isMSIE)width-=2;win.id=id;win.url=url;win.name=name;win.features=features;this.windows[name]=win;iframeWidth=width;iframeHeight=height;html+='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';html+='<html>';html+='<head>';html+='<title>Wrapper iframe</title>';html+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';html+='<link href="'+this.getParam("css_file")+'" rel="stylesheet" type="text/css" />';html+='</head>';html+='<body onload="parent.mcWindows.onLoad(\''+name+'\');">';html+='<div id="'+id+'_container" class="mceWindow">';html+='<div id="'+id+'_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';html+=' <div id="'+id+'_title" class="mceWindowTitle"';html+=' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';html+=' <div class="mceWindowHeadTools">';html+=' <a href="javascript:parent.mcWindows.windows[\''+name+'\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="'+imgPath+'/window_close.gif" /></a>';html+=' </div>';html+='</div><div id="'+id+'_body" class="mceWindowBody" style="width: '+width+'px; height: '+height+'px;">';html+='<iframe id="'+id+'_iframe" name="'+id+'_iframe" frameborder="0" width="'+iframeWidth+'" height="'+iframeHeight+'" src="'+url+'" class="mceWindowBodyIframe" scrolling="'+features['scrollbars']+'"></iframe></div>';if(features['statusbar']=="yes"){html+='<div id="'+id+'_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();">';if(features['resizable']=="yes"){if(this.isGecko)html+='<div id="'+id+'_resize" class="mceWindowResize"><div style="background-image: url(\''+imgPath+'/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';else html+='<div id="'+id+'_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\''+name+'\'].focus();" border="0" src="'+imgPath+'/window_resize.gif" /></div>';}html+='</div>';}html+='</div>';html+='</body>';html+='</html>';this.createFloatingIFrame(id,features['left'],features['top'],features['width'],features['height'],html);};TinyMCE_Windows.prototype.setDocumentLock=function(state){if(state){var elm=document.getElementById('mcWindowEventBlocker');if(elm==null){elm=document.createElement("div");elm.id="mcWindowEventBlocker";elm.style.position="absolute";elm.style.left="0";elm.style.top="0";document.body.appendChild(elm);}elm.style.display="none";var imgPath=this.getParam("images_path");var width=document.body.clientWidth;var height=document.body.clientHeight;elm.style.width=width;elm.style.height=height;elm.innerHTML='<img src="'+imgPath+'/spacer.gif" width="'+width+'" height="'+height+'" />';elm.style.zIndex=mcWindows.zindex-1;elm.style.display="block";}else{var elm=document.getElementById('mcWindowEventBlocker');if(mcWindows.windows.length==0)elm.parentNode.removeChild(elm);else elm.style.zIndex=mcWindows.zindex-1;}};TinyMCE_Windows.prototype.onLoad=function(name){var win=mcWindows.windows[name];var id="mcWindow_"+name;var wrapperIframe=window.frames[id+"_iframe"].frames[0];var wrapperDoc=window.frames[id+"_iframe"].document;var doc=window.frames[id+"_iframe"].document;var winDiv=document.getElementById("mcWindow_"+name+"_div");var realIframe=window.frames[id+"_iframe"].frames[0];win.id="mcWindow_"+name;win.winElement=winDiv;win.bodyElement=doc.getElementById(id+'_body');win.iframeElement=doc.getElementById(id+'_iframe');win.headElement=doc.getElementById(id+'_head');win.titleElement=doc.getElementById(id+'_title');win.resizeElement=doc.getElementById(id+'_resize');win.containerElement=doc.getElementById(id+'_container');win.left=win.features['left'];win.top=win.features['top'];win.frame=window.frames[id+'_iframe'].frames[0];win.wrapperFrame=window.frames[id+'_iframe'];win.wrapperIFrameElement=document.getElementById(id+"_iframe");mcWindows.addEvent(win.headElement,"mousedown",mcWindows.eventDispatcher);if(win.resizeElement!=null)mcWindows.addEvent(win.resizeElement,"mousedown",mcWindows.eventDispatcher);if(mcWindows.isMSIE){mcWindows.addEvent(realIframe.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(realIframe,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(realIframe,"focus",mcWindows.eventDispatcher);}for(var i=0;i<window.frames.length;i++){if(!window.frames[i]._hasMouseHandlers){if(mcWindows.isMSIE){mcWindows.addEvent(window.frames[i].document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i].document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(window.frames[i],"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(window.frames[i],"mouseup",mcWindows.eventDispatcher);}window.frames[i]._hasMouseHandlers=true;}}if(mcWindows.isMSIE){mcWindows.addEvent(win.frame.document,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame.document,"mouseup",mcWindows.eventDispatcher);}else{mcWindows.addEvent(win.frame,"mousemove",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"mouseup",mcWindows.eventDispatcher);mcWindows.addEvent(win.frame,"focus",mcWindows.eventDispatcher);}var func=this.getParam("on_open_window","");if(func!="")eval(func+"(win);");win.focus();if(win.features['modal']=="yes")mcWindows.setDocumentLock(true);};TinyMCE_Windows.prototype.createFloatingIFrame=function(id_prefix,left,top,width,height,html){var iframe=document.createElement("iframe");var div=document.createElement("div");width=parseInt(width);height=parseInt(height)+1;div.setAttribute("id",id_prefix+"_div");div.setAttribute("width",width);div.setAttribute("height",(height));div.style.position="absolute";div.style.left=left+"px";div.style.top=top+"px";div.style.width=width+"px";div.style.height=(height)+"px";div.style.backgroundColor="white";div.style.display="none";if(this.isGecko){iframeWidth=width+2;iframeHeight=height+2;}else{iframeWidth=width;iframeHeight=height+1;}iframe.setAttribute("id",id_prefix+"_iframe");iframe.setAttribute("name",id_prefix+"_iframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMargin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",iframeWidth);iframe.setAttribute("height",iframeHeight);iframe.setAttribute("scrolling","no");iframe.style.width=iframeWidth+"px";iframe.style.height=iframeHeight+"px";iframe.style.backgroundColor="white";div.appendChild(iframe);document.body.appendChild(div);div.innerHTML=div.innerHTML;if(this.isSafari){window.setTimeout(function(){doc=window.frames[id_prefix+'_iframe'].document;doc.open();doc.write(html);doc.close();},10);}else{doc=window.frames[id_prefix+'_iframe'].window.document;doc.open();doc.write(html);doc.close();}div.style.display="block";return div;};function TinyMCE_Window(){};TinyMCE_Window.prototype.focus=function(){if(this!=mcWindows.selectedWindow){this.winElement.style.zIndex=++mcWindows.zindex;mcWindows.lastSelectedWindow=mcWindows.selectedWindow;mcWindows.selectedWindow=this;}};TinyMCE_Window.prototype.minimize=function(){};TinyMCE_Window.prototype.maximize=function(){};TinyMCE_Window.prototype.startResize=function(){mcWindows.action="resize";};TinyMCE_Window.prototype.startMove=function(e){mcWindows.action="move";};TinyMCE_Window.prototype.close=function(){if(this.frame&&this.frame['tinyMCEPopup'])this.frame['tinyMCEPopup'].restoreSelection();if(mcWindows.lastSelectedWindow!=null)mcWindows.lastSelectedWindow.focus();var mcWindowsNew=new Array();for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(win.name!=this.name)mcWindowsNew[n]=win;}mcWindows.windows=mcWindowsNew;var e=mcWindows.doc.getElementById(this.id+"_iframe");e.parentNode.removeChild(e);var e=mcWindows.doc.getElementById(this.id+"_div");e.parentNode.removeChild(e);mcWindows.setDocumentLock(false);};TinyMCE_Window.prototype.onMouseMove=function(e){var scrollX=0;var scrollY=0;var dx=e.screenX-mcWindows.mouseDownScreenX;var dy=e.screenY-mcWindows.mouseDownScreenY;switch(mcWindows.action){case"resize":width=mcWindows.mouseDownWidth+(e.screenX-mcWindows.mouseDownScreenX);height=mcWindows.mouseDownHeight+(e.screenY-mcWindows.mouseDownScreenY);width=width<100?100:width;height=height<100?100:height;this.wrapperIFrameElement.style.width=width+2;this.wrapperIFrameElement.style.height=height+2;this.wrapperIFrameElement.width=width+2;this.wrapperIFrameElement.height=height+2;this.winElement.style.width=width;this.winElement.style.height=height;height=height-this.deltaHeight;this.containerElement.style.width=width;this.iframeElement.style.width=width;this.iframeElement.style.height=height;this.bodyElement.style.width=width;this.bodyElement.style.height=height;this.headElement.style.width=width;mcWindows.cancelEvent(e);break;case"move":this.left=mcWindows.mouseDownLayerX+(e.screenX-mcWindows.mouseDownScreenX);this.top=mcWindows.mouseDownLayerY+(e.screenY-mcWindows.mouseDownScreenY);this.winElement.style.left=this.left+"px";this.winElement.style.top=this.top+"px";mcWindows.cancelEvent(e);break;}};function debug(msg){document.getElementById('debug').value+=msg+"\n";}TinyMCE_Window.prototype.onMouseUp=function(e){mcWindows.action="none";};TinyMCE_Window.prototype.onFocus=function(e){var winRef=e.currentTarget;for(var n in mcWindows.windows){var win=mcWindows.windows[n];if(typeof(win)=='function')continue;if(winRef.name==win.id+"_iframe"){win.focus();return;}}};TinyMCE_Window.prototype.onMouseDown=function(e){var elm=mcWindows.isMSIE?this.wrapperFrame.event.srcElement:e.target;var scrollX=0;var scrollY=0;mcWindows.mouseDownScreenX=e.screenX;mcWindows.mouseDownScreenY=e.screenY;mcWindows.mouseDownLayerX=this.left;mcWindows.mouseDownLayerY=this.top;mcWindows.mouseDownWidth=parseInt(this.winElement.style.width);mcWindows.mouseDownHeight=parseInt(this.winElement.style.height);if(this.resizeElement!=null&&elm==this.resizeElement.firstChild)this.startResize(e);else this.startMove(e);mcWindows.cancelEvent(e);};var mcWindows=new TinyMCE_Windows();mcWindows.init({images_path:tinyMCE.baseURL+"/plugins/inlinepopups/images",css_file:tinyMCE.baseURL+"/plugins/inlinepopups/css/inlinepopup.css"});
\ No newline at end of file
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.8 $
* $Date: 2006/02/06 20:02:38 $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
// Patch openWindow, closeWindow TinyMCE functions
var TinyMCE_InlinePopupsPlugin = {
getInfo : function() {
return {
longname : 'Inline Popups',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_inlinepopups.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
}
};
tinyMCE.addPlugin("inlinepopups", TinyMCE_InlinePopupsPlugin);
// Patch openWindow, closeWindow TinyMCE functions
TinyMCE_Engine.prototype.orgOpenWindow = TinyMCE_Engine.prototype.openWindow;
TinyMCE_Engine.prototype.openWindow = function(template, args) {
// Does the caller support inline
if (args['inline'] != "yes" || tinyMCE.isOpera || tinyMCE.getParam("plugins").indexOf('inlinepopups') == -1) {
mcWindows.selectedWindow = null;
args['mce_inside_iframe'] = false;
this.orgOpenWindow(template, args);
return;
}
var url, resizable, scrollbars;
args['mce_inside_iframe'] = true;
tinyMCE.windowArgs = args;
if (template['file'].charAt(0) != '/' && template['file'].indexOf('://') == -1)
url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template['file'];
else
url = template['file'];
if (!(width = parseInt(template['width'])))
width = 320;
if (!(height = parseInt(template['height'])))
height = 200;
resizable = (args && args['resizable']) ? args['resizable'] : "no";
scrollbars = (args && args['scrollbars']) ? args['scrollbars'] : "no";
height += 18;
// Replace all args as variables in URL
for (var name in args) {
if (typeof(args[name]) == 'function')
continue;
url = tinyMCE.replaceVar(url, name, escape(args[name]));
}
var elm = document.getElementById(this.selectedInstance.editorId + '_parent');
var pos = tinyMCE.getAbsPosition(elm);
// Center div in editor area
pos.absLeft += Math.round((elm.firstChild.clientWidth / 2) - (width / 2));
pos.absTop += Math.round((elm.firstChild.clientHeight / 2) - (height / 2));
mcWindows.open(url, mcWindows.idCounter++, "modal=yes,width=" + width+ ",height=" + height + ",resizable=" + resizable + ",scrollbars=" + scrollbars + ",statusbar=" + resizable + ",left=" + pos.absLeft + ",top=" + pos.absTop);
};
TinyMCE_Engine.prototype.orgCloseWindow = TinyMCE_Engine.prototype.closeWindow;
TinyMCE_Engine.prototype.closeWindow = function(win) {
if (mcWindows.selectedWindow != null)
mcWindows.selectedWindow.close();
else
this.orgCloseWindow(win);
};
TinyMCE_Engine.prototype.setWindowTitle = function(win_ref, title) {
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win_ref.name == win.id + "_iframe")
window.frames[win.id + "_iframe"].document.getElementById(win.id + '_title').innerHTML = title;
}
};
// * * * * * TinyMCE_Windows classes below
// Windows handler
function TinyMCE_Windows() {
this.settings = new Array();
this.windows = new Array();
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
this.action = "none";
this.selectedWindow = null;
this.lastSelectedWindow = null;
this.zindex = 100;
this.mouseDownScreenX = 0;
this.mouseDownScreenY = 0;
this.mouseDownLayerX = 0;
this.mouseDownLayerY = 0;
this.mouseDownWidth = 0;
this.mouseDownHeight = 0;
this.idCounter = 0;
};
TinyMCE_Windows.prototype.init = function(settings) {
this.settings = settings;
if (this.isMSIE)
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
else
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
this.doc = document;
};
TinyMCE_Windows.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
TinyMCE_Windows.prototype.eventDispatcher = function(e) {
e = typeof(e) == "undefined" ? window.event : e;
if (mcWindows.selectedWindow == null)
return;
// Switch focus
if (mcWindows.isGecko && e.type == "mousedown") {
var elm = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
break;
}
}
}
switch (e.type) {
case "mousemove":
mcWindows.selectedWindow.onMouseMove(e);
break;
case "mouseup":
mcWindows.selectedWindow.onMouseUp(e);
break;
case "mousedown":
mcWindows.selectedWindow.onMouseDown(e);
break;
case "focus":
mcWindows.selectedWindow.onFocus(e);
break;
}
};
TinyMCE_Windows.prototype.addEvent = function(obj, name, handler) {
if (this.isMSIE)
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, true);
};
TinyMCE_Windows.prototype.cancelEvent = function(e) {
if (this.isMSIE) {
e.returnValue = false;
e.cancelBubble = true;
} else
e.preventDefault();
};
TinyMCE_Windows.prototype.parseFeatures = function(opts) {
// Cleanup the options
opts = opts.toLowerCase();
opts = opts.replace(/;/g, ",");
opts = opts.replace(/[^0-9a-z=,]/g, "");
var optionChunks = opts.split(',');
var options = new Array();
options['left'] = "10";
options['top'] = "10";
options['width'] = "300";
options['height'] = "300";
options['resizable'] = "yes";
options['minimizable'] = "yes";
options['maximizable'] = "yes";
options['close'] = "yes";
options['movable'] = "yes";
options['statusbar'] = "yes";
options['scrollbars'] = "auto";
options['modal'] = "no";
if (opts == "")
return options;
for (var i=0; i<optionChunks.length; i++) {
var parts = optionChunks[i].split('=');
if (parts.length == 2)
options[parts[0]] = parts[1];
}
options['left'] = parseInt(options['left']);
options['top'] = parseInt(options['top']);
options['width'] = parseInt(options['width']);
options['height'] = parseInt(options['height']);
return options;
};
TinyMCE_Windows.prototype.open = function(url, name, features) {
this.lastSelectedWindow = this.selectedWindow;
var win = new TinyMCE_Window();
var winDiv, html = "", id;
var imgPath = this.getParam("images_path");
features = this.parseFeatures(features);
// Create div
id = "mcWindow_" + name;
win.deltaHeight = 18;
if (features['statusbar'] == "yes") {
win.deltaHeight += 13;
if (this.isMSIE)
win.deltaHeight += 1;
}
width = parseInt(features['width']);
height = parseInt(features['height'])-win.deltaHeight;
if (this.isMSIE)
width -= 2;
// Setup first part of window
win.id = id;
win.url = url;
win.name = name;
win.features = features;
this.windows[name] = win;
iframeWidth = width;
iframeHeight = height;
// Create inner content
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
html += '<html>';
html += '<head>';
html += '<title>Wrapper iframe</title>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="' + this.getParam("css_file") + '" rel="stylesheet" type="text/css" />';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
html += '<div id="' + id + '_container" class="mceWindow">';
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;"></div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" target="_self" onmousedown="return false;" class="mceWindowClose"><img border="0" src="' + imgPath + '/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" target="_self" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" target="_self" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe" scrolling="' + features['scrollbars'] + '"></iframe></div>';
if (features['statusbar'] == "yes") {
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
if (features['resizable'] == "yes") {
if (this.isGecko)
html += '<div id="' + id + '_resize" class="mceWindowResize"><div style="background-image: url(\'' + imgPath + '/window_resize.gif\'); width: 12px; height: 12px;"></div></div>';
else
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="' + imgPath + '/window_resize.gif" /></div>';
}
html += '</div>';
}
html += '</div>';
html += '</body>';
html += '</html>';
// Create iframe
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
};
// Blocks the document events by placing a image over the whole document
TinyMCE_Windows.prototype.setDocumentLock = function(state) {
if (state) {
var elm = document.getElementById('mcWindowEventBlocker');
if (elm == null) {
elm = document.createElement("div");
elm.id = "mcWindowEventBlocker";
elm.style.position = "absolute";
elm.style.left = "0";
elm.style.top = "0";
document.body.appendChild(elm);
}
elm.style.display = "none";
var imgPath = this.getParam("images_path");
var width = document.body.clientWidth;
var height = document.body.clientHeight;
elm.style.width = width;
elm.style.height = height;
elm.innerHTML = '<img src="' + imgPath + '/spacer.gif" width="' + width + '" height="' + height + '" />';
elm.style.zIndex = mcWindows.zindex-1;
elm.style.display = "block";
} else {
var elm = document.getElementById('mcWindowEventBlocker');
if (mcWindows.windows.length == 0)
elm.parentNode.removeChild(elm);
else
elm.style.zIndex = mcWindows.zindex-1;
}
};
// Gets called when wrapper iframe is initialized
TinyMCE_Windows.prototype.onLoad = function(name) {
var win = mcWindows.windows[name];
var id = "mcWindow_" + name;
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
var wrapperDoc = window.frames[id + "_iframe"].document;
var doc = window.frames[id + "_iframe"].document;
var winDiv = document.getElementById("mcWindow_" + name + "_div");
var realIframe = window.frames[id + "_iframe"].frames[0];
// Set window data
win.id = "mcWindow_" + name;
win.winElement = winDiv;
win.bodyElement = doc.getElementById(id + '_body');
win.iframeElement = doc.getElementById(id + '_iframe');
win.headElement = doc.getElementById(id + '_head');
win.titleElement = doc.getElementById(id + '_title');
win.resizeElement = doc.getElementById(id + '_resize');
win.containerElement = doc.getElementById(id + '_container');
win.left = win.features['left'];
win.top = win.features['top'];
win.frame = window.frames[id + '_iframe'].frames[0];
win.wrapperFrame = window.frames[id + '_iframe'];
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
// Add event handlers
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
if (win.resizeElement != null)
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
if (mcWindows.isMSIE) {
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
}
for (var i=0; i<window.frames.length; i++) {
if (!window.frames[i]._hasMouseHandlers) {
if (mcWindows.isMSIE) {
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
}
window.frames[i]._hasMouseHandlers = true;
}
}
if (mcWindows.isMSIE) {
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
}
// Dispatch open window event
var func = this.getParam("on_open_window", "");
if (func != "")
eval(func + "(win);");
win.focus();
if (win.features['modal'] == "yes")
mcWindows.setDocumentLock(true);
};
TinyMCE_Windows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
var div = document.createElement("div");
width = parseInt(width);
height = parseInt(height)+1;
// Create wrapper div
div.setAttribute("id", id_prefix + "_div");
div.setAttribute("width", width);
div.setAttribute("height", (height));
div.style.position = "absolute";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = width + "px";
div.style.height = (height) + "px";
div.style.backgroundColor = "white";
div.style.display = "none";
if (this.isGecko) {
iframeWidth = width + 2;
iframeHeight = height + 2;
} else {
iframeWidth = width;
iframeHeight = height + 1;
}
// Create iframe
iframe.setAttribute("id", id_prefix + "_iframe");
iframe.setAttribute("name", id_prefix + "_iframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("marginWidth", "0");
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
iframe.setAttribute("width", iframeWidth);
iframe.setAttribute("height", iframeHeight);
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
// iframe.setAttribute("allowtransparency", "false");
iframe.setAttribute("scrolling", "no");
iframe.style.width = iframeWidth + "px";
iframe.style.height = iframeHeight + "px";
iframe.style.backgroundColor = "white";
div.appendChild(iframe);
document.body.appendChild(div);
// Fixed MSIE 5.0 issue
div.innerHTML = div.innerHTML;
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
}, 10);
} else {
doc = window.frames[id_prefix + '_iframe'].window.document;
doc.open();
doc.write(html);
doc.close();
}
div.style.display = "block";
return div;
};
// Window instance
function TinyMCE_Window() {
};
TinyMCE_Window.prototype.focus = function() {
if (this != mcWindows.selectedWindow) {
this.winElement.style.zIndex = ++mcWindows.zindex;
mcWindows.lastSelectedWindow = mcWindows.selectedWindow;
mcWindows.selectedWindow = this;
}
};
TinyMCE_Window.prototype.minimize = function() {
};
TinyMCE_Window.prototype.maximize = function() {
};
TinyMCE_Window.prototype.startResize = function() {
mcWindows.action = "resize";
};
TinyMCE_Window.prototype.startMove = function(e) {
mcWindows.action = "move";
};
TinyMCE_Window.prototype.close = function() {
if (this.frame && this.frame['tinyMCEPopup'])
this.frame['tinyMCEPopup'].restoreSelection();
if (mcWindows.lastSelectedWindow != null)
mcWindows.lastSelectedWindow.focus();
var mcWindowsNew = new Array();
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.name != this.name)
mcWindowsNew[n] = win;
}
mcWindows.windows = mcWindowsNew;
// alert(mcWindows.doc.getElementById(this.id + "_iframe"));
var e = mcWindows.doc.getElementById(this.id + "_iframe");
e.parentNode.removeChild(e);
var e = mcWindows.doc.getElementById(this.id + "_div");
e.parentNode.removeChild(e);
mcWindows.setDocumentLock(false);
};
TinyMCE_Window.prototype.onMouseMove = function(e) {
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
// Calculate real X, Y
var dx = e.screenX - mcWindows.mouseDownScreenX;
var dy = e.screenY - mcWindows.mouseDownScreenY;
switch (mcWindows.action) {
case "resize":
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
width = width < 100 ? 100 : width;
height = height < 100 ? 100 : height;
this.wrapperIFrameElement.style.width = width+2;
this.wrapperIFrameElement.style.height = height+2;
this.wrapperIFrameElement.width = width+2;
this.wrapperIFrameElement.height = height+2;
this.winElement.style.width = width;
this.winElement.style.height = height;
height = height - this.deltaHeight;
this.containerElement.style.width = width;
this.iframeElement.style.width = width;
this.iframeElement.style.height = height;
this.bodyElement.style.width = width;
this.bodyElement.style.height = height;
this.headElement.style.width = width;
//this.statusElement.style.width = width;
mcWindows.cancelEvent(e);
break;
case "move":
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
this.winElement.style.left = this.left + "px";
this.winElement.style.top = this.top + "px";
mcWindows.cancelEvent(e);
break;
}
};
function debug(msg) {
document.getElementById('debug').value += msg + "\n";
}
TinyMCE_Window.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
TinyMCE_Window.prototype.onFocus = function(e) {
// Gecko only handler
var winRef = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id + "_iframe") {
win.focus();
return;
}
}
};
TinyMCE_Window.prototype.onMouseDown = function(e) {
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
mcWindows.mouseDownScreenX = e.screenX;
mcWindows.mouseDownScreenY = e.screenY;
mcWindows.mouseDownLayerX = this.left;
mcWindows.mouseDownLayerY = this.top;
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
if (this.resizeElement != null && elm == this.resizeElement.firstChild)
this.startResize(e);
else
this.startMove(e);
mcWindows.cancelEvent(e);
};
// Global instance
var mcWindows = new TinyMCE_Windows();
// Initialize windows
mcWindows.init({
images_path : tinyMCE.baseURL + "/plugins/inlinepopups/images",
css_file : tinyMCE.baseURL + "/plugins/inlinepopups/css/inlinepopup.css"
});
/**
* $RCSfile: mcwindows.js,v $
* $Revision: 1.2 $
* $Date: 2005/10/18 13:59:43 $
*
* Moxiecode DHTML Windows script.
*
* @author Moxiecode
* @copyright Copyright 2004, Moxiecode Systems AB, All rights reserved.
*/
// Windows handler
function MCWindows() {
this.settings = new Array();
this.windows = new Array();
this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
this.isGecko = navigator.userAgent.indexOf('Gecko') != -1;
this.isSafari = navigator.userAgent.indexOf('Safari') != -1;
this.isMac = navigator.userAgent.indexOf('Mac') != -1;
this.isMSIE5_0 = this.isMSIE && (navigator.userAgent.indexOf('MSIE 5.0') != -1);
this.action = "none";
this.selectedWindow = null;
this.zindex = 100;
this.mouseDownScreenX = 0;
this.mouseDownScreenY = 0;
this.mouseDownLayerX = 0;
this.mouseDownLayerY = 0;
this.mouseDownWidth = 0;
this.mouseDownHeight = 0;
};
MCWindows.prototype.init = function(settings) {
this.settings = settings;
if (this.isMSIE)
this.addEvent(document, "mousemove", mcWindows.eventDispatcher);
else
this.addEvent(window, "mousemove", mcWindows.eventDispatcher);
this.addEvent(document, "mouseup", mcWindows.eventDispatcher);
};
MCWindows.prototype.getParam = function(name, default_value) {
var value = null;
value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
// Fix bool values
if (value == "true" || value == "false")
return (value == "true");
return value;
};
MCWindows.prototype.eventDispatcher = function(e) {
e = typeof(e) == "undefined" ? window.event : e;
if (mcWindows.selectedWindow == null)
return;
// Switch focus
if (mcWindows.isGecko && e.type == "mousedown") {
var elm = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (win.headElement == elm || win.resizeElement == elm) {
win.focus();
break;
}
}
}
switch (e.type) {
case "mousemove":
mcWindows.selectedWindow.onMouseMove(e);
break;
case "mouseup":
mcWindows.selectedWindow.onMouseUp(e);
break;
case "mousedown":
mcWindows.selectedWindow.onMouseDown(e);
break;
case "focus":
mcWindows.selectedWindow.onFocus(e);
break;
}
}
MCWindows.prototype.addEvent = function(obj, name, handler) {
if (this.isMSIE)
obj.attachEvent("on" + name, handler);
else
obj.addEventListener(name, handler, true);
};
MCWindows.prototype.cancelEvent = function(e) {
if (this.isMSIE) {
e.returnValue = false;
e.cancelBubble = true;
} else
e.preventDefault();
};
MCWindows.prototype.parseFeatures = function(opts) {
// Cleanup the options
opts = opts.toLowerCase();
opts = opts.replace(/;/g, ",");
opts = opts.replace(/[^0-9a-z=,]/g, "");
var optionChunks = opts.split(',');
var options = new Array();
options['left'] = 10;
options['top'] = 10;
options['width'] = 300;
options['height'] = 300;
options['resizable'] = true;
options['minimizable'] = true;
options['maximizable'] = true;
options['close'] = true;
options['movable'] = true;
if (opts == "")
return options;
for (var i=0; i<optionChunks.length; i++) {
var parts = optionChunks[i].split('=');
if (parts.length == 2)
options[parts[0]] = parts[1];
}
return options;
};
MCWindows.prototype.open = function(url, name, features) {
var win = new MCWindow();
var winDiv, html = "", id;
features = this.parseFeatures(features);
// Create div
id = "mcWindow_" + name;
width = parseInt(features['width']);
height = parseInt(features['height'])-12-19;
if (this.isMSIE)
width -= 2;
// Setup first part of window
win.id = id;
win.url = url;
win.name = name;
win.features = features;
this.windows[name] = win;
iframeWidth = width;
iframeHeight = height;
// Create inner content
html += '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">';
html += '<html>';
html += '<head>';
html += '<title>Wrapper iframe</title>';
html += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
html += '<link href="../jscripts/tiny_mce/themes/advanced/css/editor_ui.css" rel="stylesheet" type="text/css" />';
html += '</head>';
html += '<body onload="parent.mcWindows.onLoad(\'' + name + '\');">';
html += '<div id="' + id + '_container" class="mceWindow">';
html += '<div id="' + id + '_head" class="mceWindowHead" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += ' <div id="' + id + '_title" class="mceWindowTitle"';
html += ' onselectstart="return false;" unselectable="on" style="-moz-user-select: none !important;">No name window</div>';
html += ' <div class="mceWindowHeadTools">';
html += ' <a href="javascript:parent.mcWindows.windows[\'' + name + '\'].close();" onmousedown="return false;" class="mceWindowClose"><img border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_close.gif" /></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].maximize();" onmousedown="return false;" class="mceWindowMaximize"></a>';
// html += ' <a href="javascript:mcWindows.windows[\'' + name + '\'].minimize();" onmousedown="return false;" class="mceWindowMinimize"></a>';
html += ' </div>';
html += '</div><div id="' + id + '_body" class="mceWindowBody" style="width: ' + width + 'px; height: ' + height + 'px;">';
html += '<iframe id="' + id + '_iframe" name="' + id + '_iframe" onfocus="parent.mcWindows.windows[\'' + name + '\'].focus();" frameborder="0" width="' + iframeWidth + '" height="' + iframeHeight + '" src="' + url + '" class="mceWindowBodyIframe"></iframe></div>';
html += '<div id="' + id + '_statusbar" class="mceWindowStatusbar" onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();">';
html += '<div id="' + id + '_resize" class="mceWindowResize"><img onmousedown="parent.mcWindows.windows[\'' + name + '\'].focus();" border="0" src="../jscripts/tiny_mce/themes/advanced/images/window_resize.gif" /></div>';
html += '</div>';
html += '</div>';
html += '</body>';
html += '</html>';
// Create iframe
this.createFloatingIFrame(id, features['left'], features['top'], features['width'], features['height'], html);
};
// Gets called when wrapper iframe is initialized
MCWindows.prototype.onLoad = function(name) {
var win = mcWindows.windows[name];
var id = "mcWindow_" + name;
var wrapperIframe = window.frames[id + "_iframe"].frames[0];
var wrapperDoc = window.frames[id + "_iframe"].document;
var doc = window.frames[id + "_iframe"].document;
var winDiv = document.getElementById("mcWindow_" + name + "_div");
var realIframe = window.frames[id + "_iframe"].frames[0];
// Set window data
win.id = "mcWindow_" + name + "_iframe";
win.winElement = winDiv;
win.bodyElement = doc.getElementById(id + '_body');
win.iframeElement = doc.getElementById(id + '_iframe');
win.headElement = doc.getElementById(id + '_head');
win.titleElement = doc.getElementById(id + '_title');
win.resizeElement = doc.getElementById(id + '_resize');
win.containerElement = doc.getElementById(id + '_container');
win.left = win.features['left'];
win.top = win.features['top'];
win.frame = window.frames[id + '_iframe'].frames[0];
win.wrapperFrame = window.frames[id + '_iframe'];
win.wrapperIFrameElement = document.getElementById(id + "_iframe");
// Add event handlers
mcWindows.addEvent(win.headElement, "mousedown", mcWindows.eventDispatcher);
mcWindows.addEvent(win.resizeElement, "mousedown", mcWindows.eventDispatcher);
if (mcWindows.isMSIE) {
mcWindows.addEvent(realIframe.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(realIframe, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(realIframe, "focus", mcWindows.eventDispatcher);
}
for (var i=0; i<window.frames.length; i++) {
if (!window.frames[i]._hasMouseHandlers) {
if (mcWindows.isMSIE) {
mcWindows.addEvent(window.frames[i].document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i].document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(window.frames[i], "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(window.frames[i], "mouseup", mcWindows.eventDispatcher);
}
window.frames[i]._hasMouseHandlers = true;
}
}
if (mcWindows.isMSIE) {
mcWindows.addEvent(win.frame.document, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame.document, "mouseup", mcWindows.eventDispatcher);
} else {
mcWindows.addEvent(win.frame, "mousemove", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "mouseup", mcWindows.eventDispatcher);
mcWindows.addEvent(win.frame, "focus", mcWindows.eventDispatcher);
}
this.selectedWindow = win;
};
MCWindows.prototype.createFloatingIFrame = function(id_prefix, left, top, width, height, html) {
var iframe = document.createElement("iframe");
var div = document.createElement("div");
width = parseInt(width);
height = parseInt(height)+1;
// Create wrapper div
div.setAttribute("id", id_prefix + "_div");
div.setAttribute("width", width);
div.setAttribute("height", (height));
div.style.position = "absolute";
div.style.left = left + "px";
div.style.top = top + "px";
div.style.width = width + "px";
div.style.height = (height) + "px";
div.style.backgroundColor = "white";
div.style.display = "none";
if (this.isGecko) {
iframeWidth = width + 2;
iframeHeight = height + 2;
} else {
iframeWidth = width;
iframeHeight = height + 1;
}
// Create iframe
iframe.setAttribute("id", id_prefix + "_iframe");
iframe.setAttribute("name", id_prefix + "_iframe");
iframe.setAttribute("border", "0");
iframe.setAttribute("frameBorder", "0");
iframe.setAttribute("marginWidth", "0");
iframe.setAttribute("marginHeight", "0");
iframe.setAttribute("leftMargin", "0");
iframe.setAttribute("topMargin", "0");
iframe.setAttribute("width", iframeWidth);
iframe.setAttribute("height", iframeHeight);
// iframe.setAttribute("src", "../jscripts/tiny_mce/blank.htm");
// iframe.setAttribute("allowtransparency", "false");
iframe.setAttribute("scrolling", "no");
iframe.style.width = iframeWidth + "px";
iframe.style.height = iframeHeight + "px";
iframe.style.backgroundColor = "white";
div.appendChild(iframe);
document.body.appendChild(div);
// Fixed MSIE 5.0 issue
div.innerHTML = div.innerHTML;
if (this.isSafari) {
// Give Safari some time to setup
window.setTimeout(function() {
doc = window.frames[id_prefix + '_iframe'].document;
doc.open();
doc.write(html);
doc.close();
}, 10);
} else {
doc = window.frames[id_prefix + '_iframe'].window.document
doc.open();
doc.write(html);
doc.close();
}
div.style.display = "block";
return div;
};
// Window instance
function MCWindow() {
};
MCWindow.prototype.focus = function() {
this.winElement.style.zIndex = mcWindows.zindex++;
mcWindows.selectedWindow = this;
};
MCWindow.prototype.minimize = function() {
};
MCWindow.prototype.maximize = function() {
};
MCWindow.prototype.startResize = function() {
mcWindows.action = "resize";
};
MCWindow.prototype.startMove = function(e) {
mcWindows.action = "move";
};
MCWindow.prototype.close = function() {
document.body.removeChild(this.winElement);
mcWindows.windows[this.name] = null;
};
MCWindow.prototype.onMouseMove = function(e) {
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
// Calculate real X, Y
var dx = e.screenX - mcWindows.mouseDownScreenX;
var dy = e.screenY - mcWindows.mouseDownScreenY;
switch (mcWindows.action) {
case "resize":
width = mcWindows.mouseDownWidth + (e.screenX - mcWindows.mouseDownScreenX);
height = mcWindows.mouseDownHeight + (e.screenY - mcWindows.mouseDownScreenY);
width = width < 100 ? 100 : width;
height = height < 100 ? 100 : height;
this.wrapperIFrameElement.style.width = width+2;
this.wrapperIFrameElement.style.height = height+2;
this.wrapperIFrameElement.width = width+2;
this.wrapperIFrameElement.height = height+2;
this.winElement.style.width = width;
this.winElement.style.height = height;
height = height-12-19;
this.containerElement.style.width = width;
this.iframeElement.style.width = width;
this.iframeElement.style.height = height;
this.bodyElement.style.width = width;
this.bodyElement.style.height = height;
this.headElement.style.width = width;
//this.statusElement.style.width = width;
mcWindows.cancelEvent(e);
break;
case "move":
this.left = mcWindows.mouseDownLayerX + (e.screenX - mcWindows.mouseDownScreenX);
this.top = mcWindows.mouseDownLayerY + (e.screenY - mcWindows.mouseDownScreenY);
this.winElement.style.left = this.left + "px";
this.winElement.style.top = this.top + "px";
mcWindows.cancelEvent(e);
break;
}
};
MCWindow.prototype.onMouseUp = function(e) {
mcWindows.action = "none";
};
MCWindow.prototype.onFocus = function(e) {
// Gecko only handler
var winRef = e.currentTarget;
for (var n in mcWindows.windows) {
var win = mcWindows.windows[n];
if (typeof(win) == 'function')
continue;
if (winRef.name == win.id) {
win.focus();
return;
}
}
};
MCWindow.prototype.onMouseDown = function(e) {
var elm = mcWindows.isMSIE ? this.wrapperFrame.event.srcElement : e.target;
var scrollX = 0;//this.doc.body.scrollLeft;
var scrollY = 0;//this.doc.body.scrollTop;
mcWindows.mouseDownScreenX = e.screenX;
mcWindows.mouseDownScreenY = e.screenY;
mcWindows.mouseDownLayerX = this.left;
mcWindows.mouseDownLayerY = this.top;
mcWindows.mouseDownWidth = parseInt(this.winElement.style.width);
mcWindows.mouseDownHeight = parseInt(this.winElement.style.height);
if (elm == this.resizeElement.firstChild)
this.startResize(e);
else
this.startMove(e);
mcWindows.cancelEvent(e);
};
// Global instance
var mcWindows = new MCWindows();
tinyMCE.importPluginLanguagePack('insertdatetime','en,tr,cs,el,fr_ca,it,ko,sv,zh_cn,fa,fr,de,pl,pt_br,nl,da,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl');var TinyMCE_InsertDateTimePlugin={getInfo:function(){return{longname:'Insert date/time',author:'Moxiecode Systems',authorurl:'http://tinymce.moxiecode.com',infourl:'http://tinymce.moxiecode.com/tinymce/docs/plugin_insertdatetime.html',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};},getControlHTML:function(cn){switch(cn){case"insertdate":return tinyMCE.getButtonHTML(cn,'lang_insertdate_desc','{$pluginurl}/images/insertdate.gif','mceInsertDate');case"inserttime":return tinyMCE.getButtonHTML(cn,'lang_inserttime_desc','{$pluginurl}/images/inserttime.gif','mceInsertTime');}return"";},execCommand:function(editor_id,element,command,user_interface,value){function addZeros(value,len){value=""+value;if(value.length<len){for(var i=0;i<(len-value.length);i++)value="0"+value;}return value;}function getDateTime(date,format){format=tinyMCE.regexpReplace(format,"%D","%m/%d/%y");format=tinyMCE.regexpReplace(format,"%r","%I:%M:%S %p");format=tinyMCE.regexpReplace(format,"%Y",""+date.getFullYear());format=tinyMCE.regexpReplace(format,"%y",""+date.getYear());format=tinyMCE.regexpReplace(format,"%m",addZeros(date.getMonth()+1,2));format=tinyMCE.regexpReplace(format,"%d",addZeros(date.getDate(),2));format=tinyMCE.regexpReplace(format,"%H",""+addZeros(date.getHours(),2));format=tinyMCE.regexpReplace(format,"%M",""+addZeros(date.getMinutes(),2));format=tinyMCE.regexpReplace(format,"%S",""+addZeros(date.getSeconds(),2));format=tinyMCE.regexpReplace(format,"%I",""+((date.getHours()+11)%12+1));format=tinyMCE.regexpReplace(format,"%p",""+(date.getHours()<12?"AM":"PM"));format=tinyMCE.regexpReplace(format,"%B",""+tinyMCE.getLang("lang_inserttime_months_long")[date.getMonth()]);format=tinyMCE.regexpReplace(format,"%b",""+tinyMCE.getLang("lang_inserttime_months_short")[date.getMonth()]);format=tinyMCE.regexpReplace(format,"%A",""+tinyMCE.getLang("lang_inserttime_day_long")[date.getDay()]);format=tinyMCE.regexpReplace(format,"%a",""+tinyMCE.getLang("lang_inserttime_day_short")[date.getDay()]);format=tinyMCE.regexpReplace(format,"%%","%");return format;}switch(command){case"mceInsertDate":tinyMCE.execInstanceCommand(editor_id,'mceInsertContent',false,getDateTime(new Date(),tinyMCE.getParam("plugin_insertdate_dateFormat",tinyMCE.getLang('lang_insertdate_def_fmt'))));return true;case"mceInsertTime":tinyMCE.execInstanceCommand(editor_id,'mceInsertContent',false,getDateTime(new Date(),tinyMCE.getParam("plugin_insertdate_timeFormat",tinyMCE.getLang('lang_inserttime_def_fmt'))));return true;}return false;}};tinyMCE.addPlugin("insertdatetime",TinyMCE_InsertDateTimePlugin);
\ No newline at end of file
/**
* $RCSfile: editor_plugin_src.js,v $
* $Revision: 1.22 $
* $Date: 2006/02/10 16:29:39 $
*
* @author Moxiecode
* @copyright Copyright 2004-2006, Moxiecode Systems AB, All rights reserved.
*/
/* Import plugin specific language pack */
tinyMCE.importPluginLanguagePack('insertdatetime', 'en,tr,cs,el,fr_ca,it,ko,sv,zh_cn,fa,fr,de,pl,pt_br,nl,da,he,nb,ru,ru_KOI8-R,ru_UTF-8,nn,fi,es,cy,is,pl');
var TinyMCE_InsertDateTimePlugin = {
getInfo : function() {
return {
longname : 'Insert date/time',
author : 'Moxiecode Systems',
authorurl : 'http://tinymce.moxiecode.com',
infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_insertdatetime.html',
version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
};
},
/**
* Returns the HTML contents of the insertdate, inserttime controls.
*/
getControlHTML : function(cn) {
switch (cn) {
case "insertdate":
return tinyMCE.getButtonHTML(cn, 'lang_insertdate_desc', '{$pluginurl}/images/insertdate.gif', 'mceInsertDate');
case "inserttime":
return tinyMCE.getButtonHTML(cn, 'lang_inserttime_desc', '{$pluginurl}/images/inserttime.gif', 'mceInsertTime');
}
return "";
},
/**
* Executes the mceInsertDate command.
*/
execCommand : function(editor_id, element, command, user_interface, value) {
/* Adds zeros infront of value */
function addZeros(value, len) {
value = "" + value;
if (value.length < len) {
for (var i=0; i<(len-value.length); i++)
value = "0" + value;
}
return value;
}
/* Returns the date object in the specified format */
function getDateTime(date, format) {
format = tinyMCE.regexpReplace(format, "%D", "%m/%d/%y");
format = tinyMCE.regexpReplace(format, "%r", "%I:%M:%S %p");
format = tinyMCE.regexpReplace(format, "%Y", "" + date.getFullYear());
format = tinyMCE.regexpReplace(format, "%y", "" + date.getYear());
format = tinyMCE.regexpReplace(format, "%m", addZeros(date.getMonth()+1, 2));
format = tinyMCE.regexpReplace(format, "%d", addZeros(date.getDate(), 2));
format = tinyMCE.regexpReplace(format, "%H", "" + addZeros(date.getHours(), 2));
format = tinyMCE.regexpReplace(format, "%M", "" + addZeros(date.getMinutes(), 2));
format = tinyMCE.regexpReplace(format, "%S", "" + addZeros(date.getSeconds(), 2));
format = tinyMCE.regexpReplace(format, "%I", "" + ((date.getHours() + 11) % 12 + 1));
format = tinyMCE.regexpReplace(format, "%p", "" + (date.getHours() < 12 ? "AM" : "PM"));
format = tinyMCE.regexpReplace(format, "%B", "" + tinyMCE.getLang("lang_inserttime_months_long")[date.getMonth()]);
format = tinyMCE.regexpReplace(format, "%b", "" + tinyMCE.getLang("lang_inserttime_months_short")[date.getMonth()]);
format = tinyMCE.regexpReplace(format, "%A", "" + tinyMCE.getLang("lang_inserttime_day_long")[date.getDay()]);
format = tinyMCE.regexpReplace(format, "%a", "" + tinyMCE.getLang("lang_inserttime_day_short")[date.getDay()]);
format = tinyMCE.regexpReplace(format, "%%", "%");
return format;
}
// Handle commands
switch (command) {
case "mceInsertDate":
tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, getDateTime(new Date(), tinyMCE.getParam("plugin_insertdate_dateFormat", tinyMCE.getLang('lang_insertdate_def_fmt'))));
return true;
case "mceInsertTime":
tinyMCE.execInstanceCommand(editor_id, 'mceInsertContent', false, getDateTime(new Date(), tinyMCE.getParam("plugin_insertdate_timeFormat", tinyMCE.getLang('lang_inserttime_def_fmt'))));
return true;
}
// Pass to next handler in chain
return false;
}
};
tinyMCE.addPlugin("insertdatetime", TinyMCE_InsertDateTimePlugin);
// UK lang variables
tinyMCE.addToLang('',{
insertdate_def_fmt : '%Y-%m-%d',
inserttime_def_fmt : '%H:%M:%S',
insertdate_desc : 'Insert date',
inserttime_desc : 'Insert time',
inserttime_months_long : new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"),
inserttime_months_short : new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
inserttime_day_long : new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"),
inserttime_day_short : new Array("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun")
});
Check the TinyMCE documentation for details on this plugin.