CKEDITOR.dialog.add('textarea',function(a){return{title:a.lang.textarea.title,minWidth:350,minHeight:150,onHide:function(){this._code_mode=false;},onShow:function(){var c=this;delete c.textarea;c.getContentElement('info','content').getInputElement().setValue('');var b=c.getParentEditor().getSelection().getSelectedElement();if(b&&b.getName()=='textarea'){c.textarea=b;if(b.getAttribute('name')=='__code__')c._code_mode=true;c.setupContent(b);}if(c._code_mode){c.parts.title.setHtml(a.lang.code);c.getContentElement('info','type_box').getElement().show();c.getContentElement('info','rows').getElement().hide();c.getContentElement('info','cols').getElement().hide();c.getContentElement('info','_cke_saved_name').getElement().hide();}else{c.parts.title.setHtml(a.lang.textarea.title);c.getContentElement('info','type_box').getElement().hide();c.getContentElement('info','rows').getElement().show();c.getContentElement('info','cols').getElement().show();c.getContentElement('info','_cke_saved_name').getElement().show();}},onOk:function(){var g=this;var b,c=g.textarea,d=!c;if(d){b=g.getParentEditor();c=b.document.createElement('textarea');}g.commitContent(c);var e=g.getValueOf('info','type'),f=g.getContentElement('info','content').getInputElement().getValue();if(g._code_mode)c.setAttribute('name','__code__');if(d)b.insertElement(c);},contents:[{id:'info',label:a.lang.textarea.title,title:a.lang.textarea.title,elements:[{id:'_cke_saved_name',type:'text',label:a.lang.common.name,'default':'',accessKey:'N',setup:function(b){this.setValue(b.data('cke-saved-name')||b.getAttribute('name')||'');},commit:function(b){var c=this;if(c.getDialog()._code_mode)c.setValue('__code__');if(c.getValue())b.data('cke-saved-name',c.getValue());else{b.data('cke-saved-name',false);b.removeAttribute('name');}}},{id:'cols',type:'text',label:a.lang.textarea.cols,'default':'',accessKey:'C',style:'width:50px',validate:CKEDITOR.dialog.validate.integer(a.lang.common.validateNumberFailed),setup:function(b){var c=b.hasAttribute('cols')&&b.getAttribute('cols');this.setValue(c||'');},commit:function(b){if(this.getValue())b.setAttribute('cols',this.getValue());else b.removeAttribute('cols');}},{id:'rows',type:'text',label:a.lang.textarea.rows,'default':'',accessKey:'R',style:'width:50px',validate:CKEDITOR.dialog.validate.integer(a.lang.common.validateNumberFailed),setup:function(b){var c=b.hasAttribute('rows')&&b.getAttribute('rows');this.setValue(c||'');},commit:function(b){if(this.getValue())b.setAttribute('rows',this.getValue());
else b.removeAttribute('rows');}},{type:'hbox',id:'type_box',children:[{id:'type',type:'select','default':'Xml',label:a.lang.insert_code.type,items:[['php','Php'],['xml / html','Xml'],['CSS','Css'],['javascript','JScript'],['C#','CSharp'],['JAVA','Java'],['SQL','Sql']],setup:function(b){this.setValue(b.getAttribute('class')||'');},commit:function(b){if(this.getDialog()._code_mode&&this.getValue())b.data('cke-saved-class',this.getValue());else{b.data('cke-saved-class',false);b.removeAttribute('class');}}}]},{type:'html',id:'content',style:'width:340px;height:170px',html:'<textarea style="width:346px;height:140px;resize: none;direction:'+a.config.contentsLangDirection+';'+'border:1px solid black;'+'background-color:white">'+'</textarea>',setup:function(b){if(b.getValue())this.getInputElement().setValue(b.getValue());else this.getInputElement().setValue('');},commit:function(b){var c=CKEDITOR.tools.htmlEncode(this.getInputElement().getValue());if(c){b.setHtml('');b.setHtml(c);b.setValue(c);}}}]}]};});
