X-Git-Url: https://jasonwoof.com/gitweb/?p=ckeditor.git;a=blobdiff_plain;f=plugins%2Fimage%2Fdialogs%2Fimage.js;h=45f9f9db41936cc79c716b85f77e63b180efeb70;hp=d7d5c35a798c029873a671b58e5c6f1c35bde0bd;hb=8665a7c6c60586526e32e8941fe2896739b6ebfb;hpb=e7789c1ad838194d45eeee6ac2eb6e55f5cf35a1 diff --git a/plugins/image/dialogs/image.js b/plugins/image/dialogs/image.js index d7d5c35..45f9f9d 100644 --- a/plugins/image/dialogs/image.js +++ b/plugins/image/dialogs/image.js @@ -3,11 +3,11 @@ Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ -(function(){var a=1,b=2,c=4,d=8,e=/^\s*(\d+)((px)|\%)?\s*$/i,f=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,g=/^\d+px$/,h=function(){var q=this.getValue(),r=this.getDialog(),s=q.match(e);if(s){if(s[2]=='%')m(r,false);q=s[1];}if(r.lockRatio){var t=r.originalElement;if(t.getCustomData('isReady')=='true')if(this.id=='txtHeight'){if(q&&q!='0')q=Math.round(t.$.width*(q/t.$.height));if(!isNaN(q))r.setValueOf('info','txtWidth',q);}else{if(q&&q!='0')q=Math.round(t.$.height*(q/t.$.width));if(!isNaN(q))r.setValueOf('info','txtHeight',q);}}i(r);},i=function(q){if(!q.originalElement||!q.preview)return 1;q.commitContent(c,q.preview);return 0;};function j(){var q=arguments,r=this.getContentElement('advanced','txtdlgGenStyle');r&&r.commit.apply(r,q);this.foreach(function(s){if(s.commit&&s.id!='txtdlgGenStyle')s.commit.apply(s,q);});};var k;function l(q){if(k)return;k=1;var r=this.getDialog(),s=r.imageElement;if(s){this.commit(a,s);q=[].concat(q);var t=q.length,u;for(var v=0;v0){v=this.getDialog();var x=v.originalElement;v.preview.removeStyle('display');x.setCustomData('isReady','false');var y=CKEDITOR.document.getById('ImagePreviewLoader');if(y)y.setStyle('display','');x.on('load',t,v);x.on('error',u,v);x.on('abort',u,v);x.setAttribute('src',w);s.setAttribute('src',w);v.preview.setAttribute('src',s.$.src);i(v);}else if(v.preview){v.preview.removeAttribute('src');v.preview.setStyle('display','none');}},setup:function(v,w){if(v==a){var x=w.getAttribute('_cke_saved_src')||w.getAttribute('src'),y=this;this.getDialog().dontResetSize=true;y.setValue(x);y.setInitValue();y.focus();}},commit:function(v,w){var x=this;if(v==a&&(x.getValue()||x.isChanged())){w.setAttribute('_cke_saved_src',decodeURI(x.getValue()));w.setAttribute('src',decodeURI(x.getValue()));}else if(v==d){w.setAttribute('src','');w.removeAttribute('src');}},validate:CKEDITOR.dialog.validate.notEmpty(q.lang.image.urlMissing)},{type:'button',id:'browse',style:'display:inline-block;margin-top:10px;',align:'center',label:q.lang.common.browseServer,hidden:true,filebrowser:'info:txtUrl'}]}]},{id:'txtAlt',type:'text',label:q.lang.image.alt,accessKey:'A','default':'',onChange:function(){i(this.getDialog()); -},setup:function(v,w){if(v==a)this.setValue(w.getAttribute('alt'));},commit:function(v,w){var x=this;if(v==a){if(x.getValue()||x.isChanged())w.setAttribute('alt',x.getValue());}else if(v==c)w.setAttribute('alt',x.getValue());else if(v==d)w.removeAttribute('alt');}},{type:'hbox',widths:['140px','240px'],children:[{type:'vbox',padding:10,children:[{type:'hbox',widths:['70%','30%'],children:[{type:'vbox',padding:1,children:[{type:'text',width:'40px',id:'txtWidth',labelLayout:'horizontal',label:q.lang.image.width,onKeyUp:h,onChange:function(){l.call(this,'advanced:txtdlgGenStyle');},validate:function(){var v=this.getValue().match(f);if(!v)alert(q.lang.image.validateWidth);return!!v;},setup:o,commit:function(v,w,x){var y=this.getValue();if(v==a){if(y)w.setStyle('width',CKEDITOR.tools.cssLength(y));else if(!y&&this.isChanged())w.removeStyle('width');!x&&w.removeAttribute('width');}else if(v==c){var z=y.match(e);if(!z){var A=this.getDialog().originalElement;if(A.getCustomData('isReady')=='true')w.setStyle('width',A.$.width+'px');}else w.setStyle('width',y+'px');}else if(v==d){w.removeAttribute('width');w.removeStyle('width');}}},{type:'text',id:'txtHeight',width:'40px',labelLayout:'horizontal',label:q.lang.image.height,onKeyUp:h,onChange:function(){l.call(this,'advanced:txtdlgGenStyle');},validate:function(){var v=this.getValue().match(f);if(!v)alert(q.lang.image.validateHeight);return!!v;},setup:o,commit:function(v,w,x){var y=this.getValue();if(v==a){if(y)w.setStyle('height',CKEDITOR.tools.cssLength(y));else if(!y&&this.isChanged())w.removeStyle('height');if(!x&&v==a)w.removeAttribute('height');}else if(v==c){var z=y.match(e);if(!z){var A=this.getDialog().originalElement;if(A.getCustomData('isReady')=='true')w.setStyle('height',A.$.height+'px');}else w.setStyle('height',y+'px');}else if(v==d){w.removeAttribute('height');w.removeStyle('height');}}}]},{type:'html',style:'margin-top:10px;width:40px;height:40px;',onLoad:function(){var v=CKEDITOR.document.getById('btnResetSize'),w=CKEDITOR.document.getById('btnLockSizes');if(v){v.on('click',function(x){n(this);x.data.preventDefault();},this.getDialog());v.on('mouseover',function(){this.addClass('cke_btn_over');},v);v.on('mouseout',function(){this.removeClass('cke_btn_over');},v);}if(w){w.on('click',function(x){var C=this;var y=m(C),z=C.originalElement,A=C.getValueOf('info','txtWidth');if(z.getCustomData('isReady')=='true'&&A){var B=z.$.height/z.$.width*A;if(!isNaN(B)){C.setValueOf('info','txtHeight',Math.round(B));i(C); -}}x.data.preventDefault();},this.getDialog());w.on('mouseover',function(){this.addClass('cke_btn_over');},w);w.on('mouseout',function(){this.removeClass('cke_btn_over');},w);}},html:'
'+q.lang.image.unlockRatio+''+''+q.lang.image.resetSize+''+'
'}]},{type:'vbox',padding:1,children:[{type:'text',id:'txtBorder',width:'60px',labelLayout:'horizontal',label:q.lang.image.border,'default':'',onKeyUp:function(){i(this.getDialog());},onChange:function(){l.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(q.lang.image.validateBorder),setup:function(v,w){if(v==a){var x,y=w.getStyle('border-width');y=y&&y.match(/^(\d+px)(?: \1 \1 \1)?$/);x=y&&parseInt(y[1],10);isNaN(parseInt(x,10))&&(x=w.getAttribute('border'));this.setValue(x);}},commit:function(v,w,x){var y=parseInt(this.getValue(),10);if(v==a||v==c){if(!isNaN(y)){w.setStyle('border-width',CKEDITOR.tools.cssLength(y));w.setStyle('border-style','solid');}else if(!y&&this.isChanged()){w.removeStyle('border-width');w.removeStyle('border-style');w.removeStyle('border-color');}if(!x&&v==a)w.removeAttribute('border');}else if(v==d){w.removeAttribute('border');w.removeStyle('border-width');w.removeStyle('border-style');w.removeStyle('border-color');}}},{type:'text',id:'txtHSpace',width:'60px',labelLayout:'horizontal',label:q.lang.image.hSpace,'default':'',onKeyUp:function(){i(this.getDialog());},onChange:function(){l.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(q.lang.image.validateHSpace),setup:function(v,w){if(v==a){var x,y,z,A=w.getStyle('margin-left'),B=w.getStyle('margin-right');A=A&&A.match(g);B=B&&B.match(g);y=parseInt(A,10);z=parseInt(B,10);x=y==z&&y;isNaN(parseInt(x,10))&&(x=w.getAttribute('hspace'));this.setValue(x);}},commit:function(v,w,x){var y=parseInt(this.getValue(),10);if(v==a||v==c){if(!isNaN(y)){w.setStyle('margin-left',CKEDITOR.tools.cssLength(y));w.setStyle('margin-right',CKEDITOR.tools.cssLength(y));}else if(!y&&this.isChanged()){w.removeStyle('margin-left');w.removeStyle('margin-right');}if(!x&&v==a)w.removeAttribute('hspace');}else if(v==d){w.removeAttribute('hspace');w.removeStyle('margin-left'); -w.removeStyle('margin-right');}}},{type:'text',id:'txtVSpace',width:'60px',labelLayout:'horizontal',label:q.lang.image.vSpace,'default':'',onKeyUp:function(){i(this.getDialog());},onChange:function(){l.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(q.lang.image.validateVSpace),setup:function(v,w){if(v==a){var x,y,z,A=w.getStyle('margin-top'),B=w.getStyle('margin-bottom');A=A&&A.match(g);B=B&&B.match(g);y=parseInt(A,10);z=parseInt(B,10);x=y==z&&y;isNaN(parseInt(x,10))&&(x=w.getAttribute('vspace'));this.setValue(x);}},commit:function(v,w,x){var y=parseInt(this.getValue(),10);if(v==a||v==c){if(!isNaN(y)){w.setStyle('margin-top',CKEDITOR.tools.cssLength(y));w.setStyle('margin-bottom',CKEDITOR.tools.cssLength(y));}else if(!y&&this.isChanged()){w.removeStyle('margin-top');w.removeStyle('margin-bottom');}if(!x&&v==a)w.removeAttribute('vspace');}else if(v==d){w.removeAttribute('vspace');w.removeStyle('margin-top');w.removeStyle('margin-bottom');}}},{id:'cmbAlign',type:'select',labelLayout:'horizontal',widths:['35%','65%'],style:'width:90px',label:q.lang.image.align,'default':'',items:[[q.lang.common.notSet,''],[q.lang.image.alignLeft,'left'],[q.lang.image.alignRight,'right']],onChange:function(){i(this.getDialog());l.call(this,'advanced:txtdlgGenStyle');},setup:function(v,w){if(v==a){var x=w.getStyle('float');switch(x){case 'inherit':case 'none':x='';}!x&&(x=(w.getAttribute('align')||'').toLowerCase());this.setValue(x);}},commit:function(v,w,x){var y=this.getValue();if(v==a||v==c){if(y)w.setStyle('float',y);else w.removeStyle('float');if(!x&&v==a){y=(w.getAttribute('align')||'').toLowerCase();switch(y){case 'left':case 'right':w.removeAttribute('align');}}}else if(v==d)w.removeStyle('float');}}]}]},{type:'vbox',height:'250px',children:[{type:'html',style:'width:95%;',html:'
'+CKEDITOR.tools.htmlEncode(q.lang.common.preview)+'
'+''+'
'+''+''+(q.config.image_previewText||'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.')+'
'}]}]}]},{id:'Link',label:q.lang.link.title,padding:0,elements:[{id:'txtUrl',type:'text',label:q.lang.common.url,style:'width: 100%','default':'',setup:function(v,w){if(v==b){var x=w.getAttribute('_cke_saved_href'); -if(!x)x=w.getAttribute('href');this.setValue(x);}},commit:function(v,w){var x=this;if(v==b)if(x.getValue()||x.isChanged()){w.setAttribute('_cke_saved_href',decodeURI(x.getValue()));w.setAttribute('href','javascript:void(0)/*'+CKEDITOR.tools.getNextNumber()+'*/');if(x.getValue()||!q.config.image_removeLinkByEmptyURL)x.getDialog().addLink=true;}}},{type:'button',id:'browse',filebrowser:{action:'Browse',target:'Link:txtUrl',url:q.config.filebrowserImageBrowseLinkUrl||q.config.filebrowserBrowseUrl},style:'float:right',hidden:true,label:q.lang.common.browseServer},{id:'cmbTarget',type:'select',label:q.lang.common.target,'default':'',items:[[q.lang.common.notSet,''],[q.lang.common.targetNew,'_blank'],[q.lang.common.targetTop,'_top'],[q.lang.common.targetSelf,'_self'],[q.lang.common.targetParent,'_parent']],setup:function(v,w){if(v==b)this.setValue(w.getAttribute('target'));},commit:function(v,w){if(v==b)if(this.getValue()||this.isChanged())w.setAttribute('target',this.getValue());}}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:q.lang.image.upload,elements:[{type:'file',id:'upload',label:q.lang.image.btnUpload,style:'height:40px',size:38},{type:'fileButton',id:'uploadButton',filebrowser:'info:txtUrl',label:q.lang.image.btnUpload,'for':['Upload','upload']}]},{id:'advanced',label:q.lang.common.advancedTab,elements:[{type:'hbox',widths:['50%','25%','25%'],children:[{type:'text',id:'linkId',label:q.lang.common.id,setup:function(v,w){if(v==a)this.setValue(w.getAttribute('id'));},commit:function(v,w){if(v==a)if(this.getValue()||this.isChanged())w.setAttribute('id',this.getValue());}},{id:'cmbLangDir',type:'select',style:'width : 100px;',label:q.lang.common.langDir,'default':'',items:[[q.lang.common.notSet,''],[q.lang.common.langDirLtr,'ltr'],[q.lang.common.langDirRtl,'rtl']],setup:function(v,w){if(v==a)this.setValue(w.getAttribute('dir'));},commit:function(v,w){if(v==a)if(this.getValue()||this.isChanged())w.setAttribute('dir',this.getValue());}},{type:'text',id:'txtLangCode',label:q.lang.common.langCode,'default':'',setup:function(v,w){if(v==a)this.setValue(w.getAttribute('lang'));},commit:function(v,w){if(v==a)if(this.getValue()||this.isChanged())w.setAttribute('lang',this.getValue());}}]},{type:'text',id:'txtGenLongDescr',label:q.lang.common.longDescr,setup:function(v,w){if(v==a)this.setValue(w.getAttribute('longDesc'));},commit:function(v,w){if(v==a)if(this.getValue()||this.isChanged())w.setAttribute('longDesc',this.getValue());}},{type:'hbox',widths:['50%','50%'],children:[{type:'text',id:'txtGenClass',label:q.lang.common.cssClass,'default':'',setup:function(v,w){if(v==a)this.setValue(w.getAttribute('class')); -},commit:function(v,w){if(v==a)if(this.getValue()||this.isChanged())w.setAttribute('class',this.getValue());}},{type:'text',id:'txtGenTitle',label:q.lang.common.advisoryTitle,'default':'',onChange:function(){i(this.getDialog());},setup:function(v,w){if(v==a)this.setValue(w.getAttribute('title'));},commit:function(v,w){var x=this;if(v==a){if(x.getValue()||x.isChanged())w.setAttribute('title',x.getValue());}else if(v==c)w.setAttribute('title',x.getValue());else if(v==d)w.removeAttribute('title');}}]},{type:'text',id:'txtdlgGenStyle',label:q.lang.common.cssStyle,'default':'',setup:function(v,w){if(v==a){var x=w.getAttribute('style');if(!x&&w.$.style.cssText)x=w.$.style.cssText;this.setValue(x);var y=w.$.style.height,z=w.$.style.width,A=(y?y:'').match(e),B=(z?z:'').match(e);this.attributesInStyle={height:!!A,width:!!B};}},onChange:function(){l.call(this,['info:cmbFloat','info:cmbAlign','info:txtVSpace','info:txtHSpace','info:txtBorder','info:txtWidth','info:txtHeight']);i(this);},commit:function(v,w){if(v==a&&(this.getValue()||this.isChanged()))w.setAttribute('style',this.getValue());}}]}]};};CKEDITOR.dialog.add('image',function(q){return p(q,'image');});CKEDITOR.dialog.add('imagebutton',function(q){return p(q,'imagebutton');});})(); +(function(){var a=function(b,c){var d=1,e=2,f=4,g=8,h=/^\s*(\d+)((px)|\%)?\s*$/i,i=/(^\s*(\d+)((px)|\%)?\s*$)|^$/i,j=/^\d+px$/,k=function(){var C=this.getValue(),D=this.getDialog(),E=C.match(h);if(E){if(E[2]=='%')p(D,false);C=E[1];}if(D.lockRatio){var F=D.originalElement;if(F.getCustomData('isReady')=='true')if(this.id=='txtHeight'){if(C&&C!='0')C=Math.round(F.$.width*(C/F.$.height));if(!isNaN(C))D.setValueOf('info','txtWidth',C);}else{if(C&&C!='0')C=Math.round(F.$.height*(C/F.$.width));if(!isNaN(C))D.setValueOf('info','txtHeight',C);}}l(D);},l=function(C){if(!C.originalElement||!C.preview)return 1;C.commitContent(f,C.preview);return 0;};function m(){var C=arguments,D=this.getContentElement('advanced','txtdlgGenStyle');D&&D.commit.apply(D,C);this.foreach(function(E){if(E.commit&&E.id!='txtdlgGenStyle')E.commit.apply(E,C);});};var n;function o(C){if(n)return;n=1;var D=this.getDialog(),E=D.imageElement;if(E){this.commit(d,E);C=[].concat(C);var F=C.length,G;for(var H=0;H0){C=this.getDialog();var E=C.originalElement;C.preview.removeStyle('display');E.setCustomData('isReady','false');var F=CKEDITOR.document.getById(y);if(F)F.setStyle('display','');E.on('load',t,C);E.on('error',u,C);E.on('abort',u,C);E.setAttribute('src',D);s.setAttribute('src',D);C.preview.setAttribute('src',s.$.src);l(C);}else if(C.preview){C.preview.removeAttribute('src');C.preview.setStyle('display','none');}},setup:function(C,D){if(C==d){var E=D.getAttribute('_cke_saved_src')||D.getAttribute('src'),F=this;this.getDialog().dontResetSize=true;F.setValue(E);F.setInitValue();F.focus();}},commit:function(C,D){var E=this;if(C==d&&(E.getValue()||E.isChanged())){D.setAttribute('_cke_saved_src',decodeURI(E.getValue()));D.setAttribute('src',decodeURI(E.getValue()));}else if(C==g){D.setAttribute('src',''); +D.removeAttribute('src');}},validate:CKEDITOR.dialog.validate.notEmpty(b.lang.image.urlMissing)},{type:'button',id:'browse',style:'display:inline-block;margin-top:10px;',align:'center',label:b.lang.common.browseServer,hidden:true,filebrowser:'info:txtUrl'}]}]},{id:'txtAlt',type:'text',label:b.lang.image.alt,accessKey:'A','default':'',onChange:function(){l(this.getDialog());},setup:function(C,D){if(C==d)this.setValue(D.getAttribute('alt'));},commit:function(C,D){var E=this;if(C==d){if(E.getValue()||E.isChanged())D.setAttribute('alt',E.getValue());}else if(C==f)D.setAttribute('alt',E.getValue());else if(C==g)D.removeAttribute('alt');}},{type:'hbox',widths:['140px','240px'],children:[{type:'vbox',padding:10,children:[{type:'hbox',widths:['70%','30%'],children:[{type:'vbox',padding:1,children:[{type:'text',width:'40px',id:'txtWidth',labelLayout:'horizontal',label:b.lang.image.width,onKeyUp:k,onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:function(){var C=this.getValue().match(i);if(!C)alert(b.lang.image.validateWidth);return!!C;},setup:r,commit:function(C,D,E){var F=this.getValue();if(C==d){if(F)D.setStyle('width',CKEDITOR.tools.cssLength(F));else if(!F&&this.isChanged())D.removeStyle('width');!E&&D.removeAttribute('width');}else if(C==f){var G=F.match(h);if(!G){var H=this.getDialog().originalElement;if(H.getCustomData('isReady')=='true')D.setStyle('width',H.$.width+'px');}else D.setStyle('width',F+'px');}else if(C==g){D.removeAttribute('width');D.removeStyle('width');}}},{type:'text',id:'txtHeight',width:'40px',labelLayout:'horizontal',label:b.lang.image.height,onKeyUp:k,onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:function(){var C=this.getValue().match(i);if(!C)alert(b.lang.image.validateHeight);return!!C;},setup:r,commit:function(C,D,E){var F=this.getValue();if(C==d){if(F)D.setStyle('height',CKEDITOR.tools.cssLength(F));else if(!F&&this.isChanged())D.removeStyle('height');if(!E&&C==d)D.removeAttribute('height');}else if(C==f){var G=F.match(h);if(!G){var H=this.getDialog().originalElement;if(H.getCustomData('isReady')=='true')D.setStyle('height',H.$.height+'px');}else D.setStyle('height',F+'px');}else if(C==g){D.removeAttribute('height');D.removeStyle('height');}}}]},{type:'html',style:'margin-top:10px;width:40px;height:40px;',onLoad:function(){var C=CKEDITOR.document.getById(x),D=CKEDITOR.document.getById(w);if(C){C.on('click',function(E){q(this);E.data.preventDefault();},this.getDialog());C.on('mouseover',function(){this.addClass('cke_btn_over'); +},C);C.on('mouseout',function(){this.removeClass('cke_btn_over');},C);}if(D){D.on('click',function(E){var J=this;var F=p(J),G=J.originalElement,H=J.getValueOf('info','txtWidth');if(G.getCustomData('isReady')=='true'&&H){var I=G.$.height/G.$.width*H;if(!isNaN(I)){J.setValueOf('info','txtHeight',Math.round(I));l(J);}}E.data.preventDefault();},this.getDialog());D.on('mouseover',function(){this.addClass('cke_btn_over');},D);D.on('mouseout',function(){this.removeClass('cke_btn_over');},D);}},html:'
'+b.lang.image.unlockRatio+''+''+b.lang.image.resetSize+''+'
'}]},{type:'vbox',padding:1,children:[{type:'text',id:'txtBorder',width:'60px',labelLayout:'horizontal',label:b.lang.image.border,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateBorder),setup:function(C,D){if(C==d){var E,F=D.getStyle('border-width');F=F&&F.match(/^(\d+px)(?: \1 \1 \1)?$/);E=F&&parseInt(F[1],10);isNaN(parseInt(E,10))&&(E=D.getAttribute('border'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('border-width',CKEDITOR.tools.cssLength(F));D.setStyle('border-style','solid');}else if(!F&&this.isChanged()){D.removeStyle('border-width');D.removeStyle('border-style');D.removeStyle('border-color');}if(!E&&C==d)D.removeAttribute('border');}else if(C==g){D.removeAttribute('border');D.removeStyle('border-width');D.removeStyle('border-style');D.removeStyle('border-color');}}},{type:'text',id:'txtHSpace',width:'60px',labelLayout:'horizontal',label:b.lang.image.hSpace,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateHSpace),setup:function(C,D){if(C==d){var E,F,G,H=D.getStyle('margin-left'),I=D.getStyle('margin-right');H=H&&H.match(j);I=I&&I.match(j);F=parseInt(H,10);G=parseInt(I,10);E=F==G&&F;isNaN(parseInt(E,10))&&(E=D.getAttribute('hspace'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('margin-left',CKEDITOR.tools.cssLength(F)); +D.setStyle('margin-right',CKEDITOR.tools.cssLength(F));}else if(!F&&this.isChanged()){D.removeStyle('margin-left');D.removeStyle('margin-right');}if(!E&&C==d)D.removeAttribute('hspace');}else if(C==g){D.removeAttribute('hspace');D.removeStyle('margin-left');D.removeStyle('margin-right');}}},{type:'text',id:'txtVSpace',width:'60px',labelLayout:'horizontal',label:b.lang.image.vSpace,'default':'',onKeyUp:function(){l(this.getDialog());},onChange:function(){o.call(this,'advanced:txtdlgGenStyle');},validate:CKEDITOR.dialog.validate.integer(b.lang.image.validateVSpace),setup:function(C,D){if(C==d){var E,F,G,H=D.getStyle('margin-top'),I=D.getStyle('margin-bottom');H=H&&H.match(j);I=I&&I.match(j);F=parseInt(H,10);G=parseInt(I,10);E=F==G&&F;isNaN(parseInt(E,10))&&(E=D.getAttribute('vspace'));this.setValue(E);}},commit:function(C,D,E){var F=parseInt(this.getValue(),10);if(C==d||C==f){if(!isNaN(F)){D.setStyle('margin-top',CKEDITOR.tools.cssLength(F));D.setStyle('margin-bottom',CKEDITOR.tools.cssLength(F));}else if(!F&&this.isChanged()){D.removeStyle('margin-top');D.removeStyle('margin-bottom');}if(!E&&C==d)D.removeAttribute('vspace');}else if(C==g){D.removeAttribute('vspace');D.removeStyle('margin-top');D.removeStyle('margin-bottom');}}},{id:'cmbAlign',type:'select',labelLayout:'horizontal',widths:['35%','65%'],style:'width:90px',label:b.lang.image.align,'default':'',items:[[b.lang.common.notSet,''],[b.lang.image.alignLeft,'left'],[b.lang.image.alignRight,'right']],onChange:function(){l(this.getDialog());o.call(this,'advanced:txtdlgGenStyle');},setup:function(C,D){if(C==d){var E=D.getStyle('float');switch(E){case 'inherit':case 'none':E='';}!E&&(E=(D.getAttribute('align')||'').toLowerCase());this.setValue(E);}},commit:function(C,D,E){var F=this.getValue();if(C==d||C==f){if(F)D.setStyle('float',F);else D.removeStyle('float');if(!E&&C==d){F=(D.getAttribute('align')||'').toLowerCase();switch(F){case 'left':case 'right':D.removeAttribute('align');}}}else if(C==g)D.removeStyle('float');}}]}]},{type:'vbox',height:'250px',children:[{type:'html',style:'width:95%;',html:'
'+CKEDITOR.tools.htmlEncode(b.lang.common.preview)+'
'+''+'
'+''+''+(b.config.image_previewText||'Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. Ut ultrices, ipsum at venenatis fringilla, sem nulla lacinia tellus, eget aliquet turpis mauris non enim. Nam turpis. Suspendisse lacinia. Curabitur ac tortor ut ipsum egestas elementum. Nunc imperdiet gravida mauris.')+'
'}]}]}]},{id:'Link',label:b.lang.link.title,padding:0,elements:[{id:'txtUrl',type:'text',label:b.lang.common.url,style:'width: 100%','default':'',setup:function(C,D){if(C==e){var E=D.getAttribute('_cke_saved_href'); +if(!E)E=D.getAttribute('href');this.setValue(E);}},commit:function(C,D){var E=this;if(C==e)if(E.getValue()||E.isChanged()){D.setAttribute('_cke_saved_href',decodeURI(E.getValue()));D.setAttribute('href','javascript:void(0)/*'+CKEDITOR.tools.getNextNumber()+'*/');if(E.getValue()||!b.config.image_removeLinkByEmptyURL)E.getDialog().addLink=true;}}},{type:'button',id:'browse',filebrowser:{action:'Browse',target:'Link:txtUrl',url:b.config.filebrowserImageBrowseLinkUrl||b.config.filebrowserBrowseUrl},style:'float:right',hidden:true,label:b.lang.common.browseServer},{id:'cmbTarget',type:'select',label:b.lang.common.target,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.targetNew,'_blank'],[b.lang.common.targetTop,'_top'],[b.lang.common.targetSelf,'_self'],[b.lang.common.targetParent,'_parent']],setup:function(C,D){if(C==e)this.setValue(D.getAttribute('target'));},commit:function(C,D){if(C==e)if(this.getValue()||this.isChanged())D.setAttribute('target',this.getValue());}}]},{id:'Upload',hidden:true,filebrowser:'uploadButton',label:b.lang.image.upload,elements:[{type:'file',id:'upload',label:b.lang.image.btnUpload,style:'height:40px',size:38},{type:'fileButton',id:'uploadButton',filebrowser:'info:txtUrl',label:b.lang.image.btnUpload,'for':['Upload','upload']}]},{id:'advanced',label:b.lang.common.advancedTab,elements:[{type:'hbox',widths:['50%','25%','25%'],children:[{type:'text',id:'linkId',label:b.lang.common.id,setup:function(C,D){if(C==d)this.setValue(D.getAttribute('id'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('id',this.getValue());}},{id:'cmbLangDir',type:'select',style:'width : 100px;',label:b.lang.common.langDir,'default':'',items:[[b.lang.common.notSet,''],[b.lang.common.langDirLtr,'ltr'],[b.lang.common.langDirRtl,'rtl']],setup:function(C,D){if(C==d)this.setValue(D.getAttribute('dir'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('dir',this.getValue());}},{type:'text',id:'txtLangCode',label:b.lang.common.langCode,'default':'',setup:function(C,D){if(C==d)this.setValue(D.getAttribute('lang'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('lang',this.getValue());}}]},{type:'text',id:'txtGenLongDescr',label:b.lang.common.longDescr,setup:function(C,D){if(C==d)this.setValue(D.getAttribute('longDesc'));},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('longDesc',this.getValue());}},{type:'hbox',widths:['50%','50%'],children:[{type:'text',id:'txtGenClass',label:b.lang.common.cssClass,'default':'',setup:function(C,D){if(C==d)this.setValue(D.getAttribute('class')); +},commit:function(C,D){if(C==d)if(this.getValue()||this.isChanged())D.setAttribute('class',this.getValue());}},{type:'text',id:'txtGenTitle',label:b.lang.common.advisoryTitle,'default':'',onChange:function(){l(this.getDialog());},setup:function(C,D){if(C==d)this.setValue(D.getAttribute('title'));},commit:function(C,D){var E=this;if(C==d){if(E.getValue()||E.isChanged())D.setAttribute('title',E.getValue());}else if(C==f)D.setAttribute('title',E.getValue());else if(C==g)D.removeAttribute('title');}}]},{type:'text',id:'txtdlgGenStyle',label:b.lang.common.cssStyle,'default':'',setup:function(C,D){if(C==d){var E=D.getAttribute('style');if(!E&&D.$.style.cssText)E=D.$.style.cssText;this.setValue(E);var F=D.$.style.height,G=D.$.style.width,H=(F?F:'').match(h),I=(G?G:'').match(h);this.attributesInStyle={height:!!H,width:!!I};}},onChange:function(){o.call(this,['info:cmbFloat','info:cmbAlign','info:txtVSpace','info:txtHSpace','info:txtBorder','info:txtWidth','info:txtHeight']);l(this);},commit:function(C,D){if(C==d&&(this.getValue()||this.isChanged()))D.setAttribute('style',this.getValue());}}]}]};};CKEDITOR.dialog.add('image',function(b){return a(b,'image');});CKEDITOR.dialog.add('imagebutton',function(b){return a(b,'imagebutton');});})();