Files
sogo/UI/WebServerResources/ckeditor/plugins/dialog/plugin.js
C Robert b943372f17 HTML composition, take 2
Monotone-Parent: dbd490c81ea6cac4c12b2e17661e2fef43219e68
Monotone-Revision: 0801dc9f1e4fdc49ea44fc0450fb025c2639ed26

Monotone-Author: crobert@inverse.ca
Monotone-Date: 2009-06-25T19:18:02
Monotone-Branch: ca.inverse.sogo
2009-06-25 19:18:02 +00:00

17 lines
27 KiB
JavaScript

/*
Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/
CKEDITOR.plugins.add('dialog',{requires:['dialogui']});CKEDITOR.DIALOG_RESIZE_NONE=0;CKEDITOR.DIALOG_RESIZE_WIDTH=1;CKEDITOR.DIALOG_RESIZE_HEIGHT=2;CKEDITOR.DIALOG_RESIZE_BOTH=3;(function(){function a(x){return!!this._.tabs[x][0].$.offsetHeight;};function b(){var B=this;var x=B._.currentTabId,y=B._.tabIdList.length,z=CKEDITOR.tools.indexOf(B._.tabIdList,x)+y;for(var A=z-1;A>z-y;A--)if(a.call(B,B._.tabIdList[A%y]))return B._.tabIdList[A%y];return null;};function c(){var B=this;var x=B._.currentTabId,y=B._.tabIdList.length,z=CKEDITOR.tools.indexOf(B._.tabIdList,x);for(var A=z+1;A<z+y;A++)if(a.call(B,B._.tabIdList[A%y]))return B._.tabIdList[A%y];return null;};var d={};CKEDITOR.dialog=function(x,y){var z=CKEDITOR.dialog._.dialogDefinitions[y];if(!z){console.log('Error: The dialog "'+y+'" is not defined.');return;}z=CKEDITOR.tools.extend(z(x),e);z=CKEDITOR.tools.clone(z);z=new i(this,z);this.definition=z=CKEDITOR.fire('dialogDefinition',{name:y,definition:z},x).definition;var A=CKEDITOR.document,B=x.theme.buildDialog(x);this._={editor:x,element:B.element,name:y,contentSize:{width:0,height:0},size:{width:0,height:0},updateSize:false,contents:{},buttons:{},accessKeyMap:{},tabs:{},tabIdList:[],currentTabId:null,currentTabIndex:null,pageCount:0,lastTab:null,tabBarMode:false,focusList:[],currentFocusIndex:0,hasFocus:false};this.parts=B.parts;this.parts.dialog.setStyles({position:CKEDITOR.env.ie6Compat?'absolute':'fixed',top:0,left:0,visibility:'hidden'});CKEDITOR.event.call(this);if(z.onLoad)this.on('load',z.onLoad);if(z.onShow)this.on('show',z.onShow);if(z.onHide)this.on('hide',z.onHide);if(z.onOk)this.on('ok',function(L){if(z.onOk.call(this,L)===false)L.data.hide=false;});if(z.onCancel)this.on('cancel',function(L){if(z.onCancel.call(this,L)===false)L.data.hide=false;});var C=this,D=function(L){var M=C._.contents,N=false;for(var O in M)for(var P in M[O]){N=L.call(this,M[O][P]);if(N)return;}};this.on('ok',function(L){D(function(M){if(M.validate){var N=M.validate(this);if(typeof N=='string'){alert(N);N=false;}if(N===false){if(M.select)M.select();else M.focus();L.data.hide=false;L.stop();return true;}}});},this,null,0);this.on('cancel',function(L){D(function(M){if(M.isChanged()){if(!confirm(x.lang.common.confirmCancel))L.data.hide=false;return true;}});},this,null,0);this.parts.close.on('click',function(L){if(this.fire('cancel',{hide:true}).hide!==false)this.hide();},this);function E(L){var M=C._.focusList,N=L?1:-1;if(M.length<1)return;var O=(C._.currentFocusIndex+N+M.length)%(M.length);
while(!M[O].isFocusable()){O=(O+N+M.length)%(M.length);if(O==C._.currentFocusIndex)break;}M[O].focus();};function F(L){if(C!=CKEDITOR.dialog._.currentTop)return;var M=L.data.getKeystroke(),N=false;if(M==9||M==CKEDITOR.SHIFT+9){var O=M==CKEDITOR.SHIFT+9;if(C._.tabBarMode){var P=O?b.call(C):c.call(C);C.selectPage(P);C._.tabs[P][0].focus();}else E(!O);N=true;}else if(M==CKEDITOR.ALT+121&&!C._.tabBarMode){C._.tabBarMode=true;C._.tabs[C._.currentTabId][0].focus();N=true;}else if((M==37||M==39)&&(C._.tabBarMode)){P=M==37?b.call(C):c.call(C);C.selectPage(P);C._.tabs[P][0].focus();N=true;}if(N){L.stop();L.data.preventDefault();}};this.on('show',function(){CKEDITOR.document.on('keydown',F,this,null,0);if(CKEDITOR.env.ie6Compat){var L=n.getChild(0).getFrameDocument();L.on('keydown',F,this,null,0);}});this.on('hide',function(){CKEDITOR.document.removeListener('keydown',F);});this.on('iframeAdded',function(L){var M=new CKEDITOR.dom.document(L.data.iframe.$.contentWindow.document);M.on('keydown',F,this,null,0);});this.on('show',function(){if(!this._.hasFocus){this._.currentFocusIndex=-1;E(true);if(CKEDITOR.env.ie){var L=x.document.$.selection,M=L.createRange();if(M)if(M.parentElement&&M.parentElement().ownerDocument==x.document.$||M.item&&M.item(0).ownerDocument==x.document.$){var N=document.body.createTextRange();N.moveToElementText(this.getElement().getFirst().$);N.collapse(true);N.select();}}}},this,null,4294967295);if(CKEDITOR.env.ie6Compat)this.on('load',function(L){var M=this.getElement(),N=M.getFirst();N.remove();N.appendTo(M);},this);k(this);l(this);new CKEDITOR.dom.text(z.title,CKEDITOR.document).appendTo(this.parts.title);for(var G=0;G<z.contents.length;G++)this.addPage(z.contents[G]);var H=/cke_dialog_tab(\s|$|_)/,I=/cke_dialog_tab(\s|$)/;this.parts.tabs.on('click',function(L){var Q=this;var M=L.data.getTarget(),N=M,O,P;if(!(H.test(M.$.className)||M.getName()=='a'))return;O=M.$.id.substr(0,M.$.id.lastIndexOf('_'));Q.selectPage(O);if(Q._.tabBarMode){Q._.tabBarMode=false;Q._.currentFocusIndex=-1;E(true);}L.data.preventDefault();},this);var J=[],K=CKEDITOR.dialog._.uiElementBuilders.hbox.build(this,{type:'hbox',className:'cke_dialog_footer_buttons',widths:[],children:z.buttons},J).getChild();this.parts.footer.setHtml(J.join(''));for(G=0;G<K.length;G++)this._.buttons[K[G].id]=K[G];CKEDITOR.skins.load(x,'dialog');};CKEDITOR.dialog.prototype={resize:(function(){return function(x,y){var z=this;if(z._.contentSize&&z._.contentSize.width==x&&z._.contentSize.height==y)return;
CKEDITOR.dialog.fire('resize',{dialog:z,skin:z._.editor.skinName,width:x,height:y},z._.editor);z._.contentSize={width:x,height:y};z._.updateSize=true;};})(),getSize:function(){var z=this;if(!z._.updateSize)return z._.size;var x=z._.element.getFirst(),y=z._.size={width:x.$.offsetWidth||0,height:x.$.offsetHeight||0};z._.updateSize=!y.width||!y.height;return y;},move:(function(){var x;return function(y,z){var C=this;var A=C._.element.getFirst();if(x===undefined)x=A.getComputedStyle('position')=='fixed';if(x&&C._.position&&C._.position.x==y&&C._.position.y==z)return;C._.position={x:y,y:z};if(!x){var B=CKEDITOR.document.getWindow().getScrollPosition();y+=B.x;z+=B.y;}A.setStyles({left:(y>0?y:0)+('px'),top:(z>0?z:0)+('px')});};})(),getPosition:function(){return CKEDITOR.tools.extend({},this._.position);},show:function(){if(CKEDITOR.env.ie)this._.editor.getSelection().lock();var x=this._.element,y=this.definition;if(!(x.getParent()&&x.getParent().equals(CKEDITOR.document.getBody())))x.appendTo(CKEDITOR.document.getBody());else return;if(CKEDITOR.env.gecko&&CKEDITOR.env.version<10900){var z=this.parts.dialog;z.setStyle('position','absolute');setTimeout(function(){z.setStyle('position','fixed');},0);}this.resize(y.minWidth,y.minHeight);this.selectPage(this.definition.contents[0].id);this.reset();if(CKEDITOR.dialog._.currentZIndex===null)CKEDITOR.dialog._.currentZIndex=this._.editor.config.baseFloatZIndex;this._.element.getFirst().setStyle('z-index',CKEDITOR.dialog._.currentZIndex+=10);if(CKEDITOR.dialog._.currentTop===null){CKEDITOR.dialog._.currentTop=this;this._.parentDialog=null;o(this._.editor);CKEDITOR.document.on('keydown',r);CKEDITOR.document.on('keyup',s);}else{this._.parentDialog=CKEDITOR.dialog._.currentTop;var A=this._.parentDialog.getElement().getFirst();A.$.style.zIndex-=Math.floor(this._.editor.config.baseFloatZIndex/2);CKEDITOR.dialog._.currentTop=this;}t(this,this,'\x1b',null,function(){this.getButton('cancel')&&this.getButton('cancel').click();});this._.hasFocus=false;CKEDITOR.tools.setTimeout(function(){var B=CKEDITOR.document.getWindow().getViewPaneSize(),C=this.getSize();this.move((B.width-C.width)/(2),(B.height-C.height)/(2));this.parts.dialog.setStyle('visibility','');this.fireOnce('load',{});this.fire('show',{});this.foreach(function(D){D.setInitValue&&D.setInitValue();});},100,this);},foreach:function(x){var A=this;for(var y in A._.contents)for(var z in A._.contents[y])x(A._.contents[y][z]);return A;},reset:(function(){var x=function(y){if(y.reset)y.reset();
};return function(){this.foreach(x);return this;};})(),setupContent:function(){var x=arguments;this.foreach(function(y){if(y.setup)y.setup.apply(y,x);});},commitContent:function(){var x=arguments;this.foreach(function(y){if(y.commit)y.commit.apply(y,x);});},hide:function(){this.fire('hide',{});var x=this._.element;if(!x.getParent())return;x.remove();this.parts.dialog.setStyle('visibility','hidden');u(this);if(!this._.parentDialog)p();else{var y=this._.parentDialog.getElement().getFirst();y.setStyle('z-index',parseInt(y.$.style.zIndex,10)+Math.floor(this._.editor.config.baseFloatZIndex/2));}CKEDITOR.dialog._.currentTop=this._.parentDialog;if(!this._.parentDialog){CKEDITOR.dialog._.currentZIndex=null;CKEDITOR.document.removeListener('keydown',r);CKEDITOR.document.removeListener('keyup',s);var z=this._.editor;z.focus();if(CKEDITOR.env.ie)z.getSelection().unlock(true);}else CKEDITOR.dialog._.currentZIndex-=10;this.foreach(function(A){A.resetInitValue&&A.resetInitValue();});},addPage:function(x){var H=this;var y=[],z=x.label?' title="'+CKEDITOR.tools.htmlEncode(x.label)+'"':'',A=x.elements,B=CKEDITOR.dialog._.uiElementBuilders.vbox.build(H,{type:'vbox',className:'cke_dialog_page_contents',children:x.elements,expand:!!x.expand,padding:x.padding,style:x.style||'width: 100%; height: 100%;'},y),C=CKEDITOR.dom.element.createFromHtml(y.join('')),D=CKEDITOR.dom.element.createFromHtml(['<a class="cke_dialog_tab"',H._.pageCount>0?' cke_last':'cke_first',z,!!x.hidden?' style="display:none"':'',' id="',x.id+'_',CKEDITOR.tools.getNextNumber(),'" href="javascript:void(0)"',' hidefocus="true">',x.label,'</a>'].join(''));if(H._.pageCount===0)H.parts.dialog.addClass('cke_single_page');else H.parts.dialog.removeClass('cke_single_page');H._.tabs[x.id]=[D,C];H._.tabIdList.push(x.id);H._.pageCount++;H._.lastTab=D;var E=H._.contents[x.id]={},F,G=B.getChild();while(F=G.shift()){E[F.id]=F;if(typeof F.getChild=='function')G.push.apply(G,F.getChild());}C.setAttribute('name',x.id);C.appendTo(H.parts.contents);D.unselectable();H.parts.tabs.append(D);if(x.accessKey){t(H,H,'CTRL+'+x.accessKey,w,v);H._.accessKeyMap['CTRL+'+x.accessKey]=x.id;}},selectPage:function(x){var C=this;for(var y in C._.tabs){var z=C._.tabs[y][0],A=C._.tabs[y][1];if(y!=x){z.removeClass('cke_dialog_tab_selected');A.hide();}}var B=C._.tabs[x];B[0].addClass('cke_dialog_tab_selected');B[1].show();C._.currentTabId=x;C._.currentTabIndex=CKEDITOR.tools.indexOf(C._.tabIdList,x);},hidePage:function(x){var y=this._.tabs[x]&&this._.tabs[x][0];
if(!y)return;y.hide();},showPage:function(x){var y=this._.tabs[x]&&this._.tabs[x][0];if(!y)return;y.show();},getElement:function(){return this._.element;},getName:function(){return this._.name;},getContentElement:function(x,y){return this._.contents[x][y];},getValueOf:function(x,y){return this.getContentElement(x,y).getValue();},setValueOf:function(x,y,z){return this.getContentElement(x,y).setValue(z);},getButton:function(x){return this._.buttons[x];},click:function(x){return this._.buttons[x].click();},disableButton:function(x){return this._.buttons[x].disable();},enableButton:function(x){return this._.buttons[x].enable();},getPageCount:function(){return this._.pageCount;},getParentEditor:function(){return this._.editor;},getSelectedElement:function(){return this.getParentEditor().getSelection().getSelectedElement();}};CKEDITOR.tools.extend(CKEDITOR.dialog,{add:function(x,y){if(!this._.dialogDefinitions[x]||typeof y=='function')this._.dialogDefinitions[x]=y;},exists:function(x){return!!this._.dialogDefinitions[x];},getCurrent:function(){return CKEDITOR.dialog._.currentTop;},okButton:(function(){var x=function(y,z){z=z||{};return CKEDITOR.tools.extend({id:'ok',type:'button',label:y.lang.common.ok,'class':'cke_dialog_ui_button_ok',onClick:function(A){var B=A.data.dialog;if(B.fire('ok',{hide:true}).hide!==false)B.hide();}},z,true);};x.type='button';x.override=function(y){return CKEDITOR.tools.extend(function(z){return x(z,y);},{type:'button'},true);};return x;})(),cancelButton:(function(){var x=function(y,z){z=z||{};return CKEDITOR.tools.extend({id:'cancel',type:'button',label:y.lang.common.cancel,'class':'cke_dialog_ui_button_cancel',onClick:function(A){var B=A.data.dialog;if(B.fire('cancel',{hide:true}).hide!==false)B.hide();}},z,true);};x.type='button';x.override=function(y){return CKEDITOR.tools.extend(function(z){return x(z,y);},{type:'button'},true);};return x;})(),addUIElement:function(x,y){this._.uiElementBuilders[x]=y;}});CKEDITOR.dialog._={uiElementBuilders:{},dialogDefinitions:{},currentTop:null,currentZIndex:null};CKEDITOR.event.implementOn(CKEDITOR.dialog);CKEDITOR.event.implementOn(CKEDITOR.dialog.prototype,true);var e={resizable:CKEDITOR.DIALOG_RESIZE_NONE,minWidth:600,minHeight:400,buttons:[CKEDITOR.dialog.okButton,CKEDITOR.dialog.cancelButton]},f=function(x,y,z){for(var A=0,B;B=x[A];A++){if(B.id==y)return B;if(z&&B[z]){var C=f(B[z],y,z);if(C)return C;}}return null;},g=function(x,y,z,A,B){if(z){for(var C=0,D;D=x[C];C++){if(D.id==z){x.splice(C,0,y);
return y;}if(A&&D[A]){var E=g(D[A],y,z,A,true);if(E)return E;}}if(B)return null;}x.push(y);return y;},h=function(x,y,z){for(var A=0,B;B=x[A];A++){if(B.id==y)return x.splice(A,1);if(z&&B[z]){var C=h(B[z],y,z);if(C)return C;}}return null;},i=function(x,y){this.dialog=x;var z=y.contents;for(var A=0,B;B=z[A];A++)z[A]=new j(x,B);CKEDITOR.tools.extend(this,y);};i.prototype={getContents:function(x){return f(this.contents,x);},getButton:function(x){return f(this.buttons,x);},addContents:function(x,y){return g(this.contents,x,y);},addButton:function(x,y){return g(this.buttons,x,y);},removeContents:function(x){h(this.contents,x);},removeButton:function(x){h(this.buttons,x);}};function j(x,y){this._={dialog:x};CKEDITOR.tools.extend(this,y);};j.prototype={get:function(x){return f(this.elements,x,'children');},add:function(x,y){return g(this.elements,x,y,'children');},remove:function(x){h(this.elements,x,'children');}};function k(x){var y=null,z=null,A=x.getElement().getFirst(),B=x.getParentEditor(),C=B.config.dialog_magnetDistance,D=d[B.skinName].margins||[0,0,0,0];function E(G){var H=x.getSize(),I=CKEDITOR.document.getWindow().getViewPaneSize(),J=G.data.$.screenX,K=G.data.$.screenY,L=J-y.x,M=K-y.y,N,O;y={x:J,y:K};z.x+=L;z.y+=M;if(z.x+D[3]<C)N=-D[3];else if(z.x-D[1]>I.width-H.width-C)N=I.width-H.width+D[1];else N=z.x;if(z.y+D[0]<C)O=-D[0];else if(z.y-D[2]>I.height-H.height-C)O=I.height-H.height+D[2];else O=z.y;x.move(N,O);G.data.preventDefault();};function F(G){CKEDITOR.document.removeListener('mousemove',E);CKEDITOR.document.removeListener('mouseup',F);if(CKEDITOR.env.ie6Compat){var H=n.getChild(0).getFrameDocument();H.removeListener('mousemove',E);H.removeListener('mouseup',F);}};x.parts.title.on('mousedown',function(G){y={x:G.data.$.screenX,y:G.data.$.screenY};CKEDITOR.document.on('mousemove',E);CKEDITOR.document.on('mouseup',F);z=x.getPosition();if(CKEDITOR.env.ie6Compat){var H=n.getChild(0).getFrameDocument();H.on('mousemove',E);H.on('mouseup',F);}G.data.preventDefault();},x);};function l(x){var y=x.definition,z=y.minWidth||0,A=y.minHeight||0,B=y.resizable,C=d[x.getParentEditor().skinName].margins||[0,0,0,0];function D(O,P){O.y+=P;};function E(O,P){O.x2+=P;};function F(O,P){O.y2+=P;};function G(O,P){O.x+=P;};var H=null,I=null,J=x._.editor.config.magnetDistance,K=['tl','t','tr','l','r','bl','b','br'];function L(O){var P=O.listenerData.part,Q=x.getSize();I=x.getPosition();CKEDITOR.tools.extend(I,{x2:I.x+Q.width,y2:I.y+Q.height});H={x:O.data.$.screenX,y:O.data.$.screenY};
CKEDITOR.document.on('mousemove',M,x,{part:P});CKEDITOR.document.on('mouseup',N,x,{part:P});if(CKEDITOR.env.ie6Compat){var R=n.getChild(0).getFrameDocument();R.on('mousemove',M,x,{part:P});R.on('mouseup',N,x,{part:P});}O.data.preventDefault();};function M(O){var P=O.data.$.screenX,Q=O.data.$.screenY,R=P-H.x,S=Q-H.y,T=CKEDITOR.document.getWindow().getViewPaneSize(),U=O.listenerData.part;if(U.search('t')!=-1)D(I,S);if(U.search('l')!=-1)G(I,R);if(U.search('b')!=-1)F(I,S);if(U.search('r')!=-1)E(I,R);H={x:P,y:Q};var V,W,X,Y;if(I.x+C[3]<J)V=-C[3];else if(U.search('l')!=-1&&I.x2-I.x<z+J)V=I.x2-z;else V=I.x;if(I.y+C[0]<J)W=-C[0];else if(U.search('t')!=-1&&I.y2-I.y<A+J)W=I.y2-A;else W=I.y;if(I.x2-C[1]>T.width-J)X=T.width+C[1];else if(U.search('r')!=-1&&I.x2-I.x<z+J)X=I.x+z;else X=I.x2;if(I.y2-C[2]>T.height-J)Y=T.height+C[2];else if(U.search('b')!=-1&&I.y2-I.y<A+J)Y=I.y+A;else Y=I.y2;x.move(V,W);x.resize(X-V,Y-W);O.data.preventDefault();};function N(O){CKEDITOR.document.removeListener('mouseup',N);CKEDITOR.document.removeListener('mousemove',M);if(CKEDITOR.env.ie6Compat){var P=n.getChild(0).getFrameDocument();P.removeListener('mouseup',N);P.removeListener('mousemove',M);}};};var m,n,o=function(x){var y=CKEDITOR.document.getWindow();if(!n){var z=['<div style="position: ',CKEDITOR.env.ie6Compat?'absolute':'fixed','; z-index: ',x.config.baseFloatZIndex,'; top: 0px; left: 0px; ','background-color: ',x.config.dialog_backgroundCoverColor,'" id="cke_dialog_background_cover">'];if(CKEDITOR.env.ie6Compat){var A=CKEDITOR.env.isCustomDomain();z.push('<iframe hidefocus="true" frameborder="0" id="cke_dialog_background_iframe" src="javascript:');z.push(A?"void((function(){document.open();document.domain='"+document.domain+"';"+'document.close();'+'})())':"''");z.push('" style="position:absolute;left:0;top:0;width:100%;height: 100%;progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>');}z.push('</div>');n=CKEDITOR.dom.element.createFromHtml(z.join(''));}var B=n,C=function(){var F=y.getViewPaneSize();B.setStyles({width:F.width+'px',height:F.height+'px'});},D=function(){var F=y.getScrollPosition(),G=CKEDITOR.dialog._.currentTop;B.setStyles({left:F.x+'px',top:F.y+'px'});do{var H=G.getPosition();G.move(H.x,H.y);}while(G=G._.parentDialog)};m=C;y.on('resize',C);C();if(CKEDITOR.env.ie6Compat){var E=function(){D();arguments.callee.prevScrollHandler.apply(this,arguments);};y.$.setTimeout(function(){E.prevScrollHandler=window.onscroll||(function(){});window.onscroll=E;},0);D();}B.setOpacity(x.config.dialog_backgroundCoverOpacity);
B.appendTo(CKEDITOR.document.getBody());},p=function(){if(!n)return;var x=CKEDITOR.document.getWindow();n.remove();x.removeListener('resize',m);if(CKEDITOR.env.ie6Compat)x.$.setTimeout(function(){var y=window.onscroll&&window.onscroll.prevScrollHandler;window.onscroll=y||null;},0);m=null;},q={},r=function(x){var y=x.data.$.ctrlKey||x.data.$.metaKey,z=x.data.$.altKey,A=x.data.$.shiftKey,B=String.fromCharCode(x.data.$.keyCode),C=q[(y?'CTRL+':'')+(z?'ALT+':'')+(A?'SHIFT+':'')+B];if(!C||!C.length)return;C=C[C.length-1];C.keydown&&C.keydown.call(C.uiElement,C.dialog,C.key);x.data.preventDefault();},s=function(x){var y=x.data.$.ctrlKey||x.data.$.metaKey,z=x.data.$.altKey,A=x.data.$.shiftKey,B=String.fromCharCode(x.data.$.keyCode),C=q[(y?'CTRL+':'')+(z?'ALT+':'')+(A?'SHIFT+':'')+B];if(!C||!C.length)return;C=C[C.length-1];C.keyup&&C.keyup.call(C.uiElement,C.dialog,C.key);x.data.preventDefault();},t=function(x,y,z,A,B){var C=q[z]||(q[z]=[]);C.push({uiElement:x,dialog:y,key:z,keyup:B||x.accessKeyUp,keydown:A||x.accessKeyDown});},u=function(x){for(var y in q){var z=q[y];for(var A=z.length-1;A>=0;A--)if(z[A].dialog==x||z[A].uiElement==x)z.splice(A,1);if(z.length===0)delete q[y];}},v=function(x,y){if(x._.accessKeyMap[y])x.selectPage(x._.accessKeyMap[y]);},w=function(x,y){};(function(){CKEDITOR.ui.dialog={uiElement:function(x,y,z,A,B,C,D){if(arguments.length<4)return;var E=(A.call?A(y):A)||('div'),F=['<',E,' '],G=(B&&B.call?B(y):B)||({}),H=(C&&C.call?C(y):C)||({}),I=(D&&D.call?D(x,y):D)||(''),J=this.domId=H.id||CKEDITOR.tools.getNextNumber()+'_uiElement',K=this.id=y.id,L;H.id=J;var M={};if(y.type)M['cke_dialog_ui_'+y.type]=1;if(y.className)M[y.className]=1;var N=H['class']&&H['class'].split?H['class'].split(' '):[];for(L=0;L<N.length;L++)if(N[L])M[N[L]]=1;var O=[];for(L in M)O.push(L);H['class']=O.join(' ');if(y.title)H.title=y.title;var P=(y.style||'').split(';');for(L in G)P.push(L+':'+G[L]);if(y.hidden)P.push('display:none');for(L=P.length-1;L>=0;L--)if(P[L]==='')P.splice(L,1);if(P.length>0)H.style=(H.style?H.style+'; ':'')+(P.join('; '));for(L in H)F.push(L+'="'+CKEDITOR.tools.htmlEncode(H[L])+'" ');F.push('>',I,'</',E,'>');z.push(F.join(''));(this._||(this._={})).dialog=x;if(typeof y.isChanged=='boolean')this.isChanged=function(){return y.isChanged;};if(typeof y.isChanged=='function')this.isChanged=y.isChanged;CKEDITOR.event.implementOn(this);this.registerEvents(y);if(this.accessKeyUp&&this.accessKeyDown&&y.accessKey)t(this,x,'CTRL+'+y.accessKey);var Q=this;x.on('load',function(){if(Q.getInputElement())Q.getInputElement().on('focus',function(){x._.tabBarMode=false;
x._.hasFocus=true;Q.fire('focus');},Q);});if(this.keyboardFocusable){this.focusIndex=x._.focusList.push(this)-1;this.on('focus',function(){x._.currentFocusIndex=Q.focusIndex;});}CKEDITOR.tools.extend(this,y);},hbox:function(x,y,z,A,B){if(arguments.length<4)return;this._||(this._={});var C=this._.children=y,D=B&&B.widths||null,E=B&&B.height||null,F={},G,H=function(){var I=['<tbody><tr class="cke_dialog_ui_hbox">'];for(G=0;G<z.length;G++){var J='cke_dialog_ui_hbox_child',K=[];if(G===0)J='cke_dialog_ui_hbox_first';if(G==z.length-1)J='cke_dialog_ui_hbox_last';I.push('<td class="',J,'" ');if(D){if(D[G])K.push('width:'+CKEDITOR.tools.cssLength(D[G]));}else K.push('width:'+Math.floor(100/z.length)+'%');if(E)K.push('height:'+CKEDITOR.tools.cssLength(E));if(B&&B.padding!=undefined)K.push('padding:'+CKEDITOR.tools.cssLength(B.padding));if(K.length>0)I.push('style="'+K.join('; ')+'" ');I.push('>',z[G],'</td>');}I.push('</tr></tbody>');return I.join('');};CKEDITOR.ui.dialog.uiElement.call(this,x,B||{type:'hbox'},A,'table',F,B&&B.align&&{align:B.align}||null,H);},vbox:function(x,y,z,A,B){if(arguments.length<3)return;this._||(this._={});var C=this._.children=y,D=B&&B.width||null,E=B&&B.heights||null,F=function(){var G=['<table cellspacing="0" border="0" '];G.push('style="');if(B&&B.expand)G.push('height:100%;');G.push('width:'+CKEDITOR.tools.cssLength(D||'100%'),';');G.push('"');G.push('align="',CKEDITOR.tools.htmlEncode(B&&B.align||(x.getParentEditor().lang.dir=='ltr'?'left':'right')),'" ');G.push('><tbody>');for(var H=0;H<z.length;H++){var I=[];G.push('<tr><td ');if(D)I.push('width:'+CKEDITOR.tools.cssLength(D||'100%'));if(E)I.push('height:'+CKEDITOR.tools.cssLength(E[H]));else if(B&&B.expand)I.push('height:'+Math.floor(100/z.length)+'%');if(B&&B.padding!=undefined)I.push('padding:'+CKEDITOR.tools.cssLength(B.padding));if(I.length>0)G.push('style="',I.join('; '),'" ');G.push(' class="cke_dialog_ui_vbox_child">',z[H],'</td></tr>');}G.push('</tbody></table>');return G.join('');};CKEDITOR.ui.dialog.uiElement.call(this,x,B||{type:'vbox'},A,'div',null,null,F);}};})();CKEDITOR.ui.dialog.uiElement.prototype={getElement:function(){return CKEDITOR.document.getById(this.domId);},getInputElement:function(){return this.getElement();},getDialog:function(){return this._.dialog;},setValue:function(x){this.getInputElement().setValue(x);this.fire('change',{value:x});return this;},getValue:function(){return this.getInputElement().getValue();},isChanged:function(){return false;},selectParentTab:function(){var A=this;
var x=A.getInputElement(),y=x,z;while((y=y.getParent())&&(y.$.className.search('cke_dialog_page_contents')==-1)){}if(!y)return A;z=y.getAttribute('name');if(A._.dialog._.currentTabId!=z)A._.dialog.selectPage(z);return A;},focus:function(){this.selectParentTab().getInputElement().focus();return this;},registerEvents:function(x){var y=/^on([A-Z]\w+)/,z,A=function(C,D,E,F){D.on('load',function(){C.getInputElement().on(E,F,C);});};for(var B in x){if(!(z=B.match(y)))continue;if(this.eventProcessors[B])this.eventProcessors[B].call(this,this._.dialog,x[B]);else A(this,this._.dialog,z[1].toLowerCase(),x[B]);}return this;},eventProcessors:{onLoad:function(x,y){x.on('load',y,this);},onShow:function(x,y){x.on('show',y,this);},onHide:function(x,y){x.on('hide',y,this);}},accessKeyDown:function(x,y){this.focus();},accessKeyUp:function(x,y){},disable:function(){var x=this.getInputElement();x.setAttribute('disabled','true');x.addClass('cke_disabled');},enable:function(){var x=this.getInputElement();x.removeAttribute('disabled');x.removeClass('cke_disabled');},isEnabled:function(){return!this.getInputElement().getAttribute('disabled');},isVisible:function(){return!!this.getInputElement().$.offsetHeight;},isFocusable:function(){if(!this.isEnabled()||!this.isVisible())return false;return true;}};CKEDITOR.ui.dialog.hbox.prototype=CKEDITOR.tools.extend(new CKEDITOR.ui.dialog.uiElement(),{getChild:function(x){var y=this;if(arguments.length<1)return y._.children.concat();if(!x.splice)x=[x];if(x.length<2)return y._.children[x[0]];else return y._.children[x[0]]&&y._.children[x[0]].getChild?y._.children[x[0]].getChild(x.slice(1,x.length)):null;}},true);CKEDITOR.ui.dialog.vbox.prototype=new CKEDITOR.ui.dialog.hbox();(function(){var x={build:function(y,z,A){var B=z.children,C,D=[],E=[];for(var F=0;F<B.length&&(C=B[F]);F++){var G=[];D.push(G);E.push(CKEDITOR.dialog._.uiElementBuilders[C.type].build(y,C,G));}return new CKEDITOR.ui.dialog[z.type](y,E,D,A,z);}};CKEDITOR.dialog.addUIElement('hbox',x);CKEDITOR.dialog.addUIElement('vbox',x);})();CKEDITOR.dialogCommand=function(x){this.dialogName=x;};CKEDITOR.dialogCommand.prototype={exec:function(x){x.openDialog(this.dialogName);},canUndo:false};(function(){var x=/^([a]|[^a])+$/,y=/^\d*$/,z=/^\d*(?:\.\d+)?$/;CKEDITOR.VALIDATE_OR=1;CKEDITOR.VALIDATE_AND=2;CKEDITOR.dialog.validate={functions:function(){return function(){var G=this;var A=G&&G.getValue?G.getValue():arguments[0],B=undefined,C=CKEDITOR.VALIDATE_AND,D=[],E;for(E=0;E<arguments.length;
E++)if(typeof arguments[E]=='function')D.push(arguments[E]);else break;if(E<arguments.length&&typeof arguments[E]=='string'){B=arguments[E];E++;}if(E<arguments.length&&typeof arguments[E]=='number')C=arguments[E];var F=C==CKEDITOR.VALIDATE_AND?true:false;for(E=0;E<D.length;E++)if(C==CKEDITOR.VALIDATE_AND)F=F&&D[E](A);else F=F||D[E](A);if(!F){if(B!==undefined)alert(B);if(G&&(G.select||G.focus))G.select||G.focus();return false;}return true;};},regex:function(A,B){return function(){var D=this;var C=D&&D.getValue?D.getValue():arguments[0];if(!A.test(C)){if(B!==undefined)alert(B);if(D&&(D.select||D.focus))if(D.select)D.select();else D.focus();return false;}return true;};},notEmpty:function(A){return this.regex(x,A);},integer:function(A){return this.regex(y,A);},number:function(A){return this.regex(z,A);},equals:function(A,B){return this.functions(function(C){return C==A;},B);},notEqual:function(A,B){return this.functions(function(C){return C!=A;},B);}};})();CKEDITOR.skins.add=(function(){var x=CKEDITOR.skins.add;return function(y,z){d[y]={margins:z.margins};return x.apply(this,arguments);};})();})();CKEDITOR.tools.extend(CKEDITOR.editor.prototype,{openDialog:function(a){var b=CKEDITOR.dialog._.dialogDefinitions[a];if(typeof b=='function'){var c=this._.storedDialogs||(this._.storedDialogs={}),d=c[a]||(c[a]=new CKEDITOR.dialog(this,a));d.show();return d;}else if(b=='failed')throw new Error('[CKEDITOR.dialog.openDialog] Dialog "'+a+'" failed when loading definition.');var e=CKEDITOR.document.getBody(),f=e.$.style.cursor,g=this;e.setStyle('cursor','wait');CKEDITOR.scriptLoader.load(CKEDITOR.getUrl(b),function(){if(typeof CKEDITOR.dialog._.dialogDefinitions[a]!='function')CKEDITOR.dialog._.dialogDefinitions[a]='failed';g.openDialog(a);e.setStyle('cursor',f);});return null;}});CKEDITOR.config.dialog_backgroundCoverColor='white';CKEDITOR.config.dialog_backgroundCoverOpacity=0.5;CKEDITOR.config.dialog_magnetDistance=20;