CKEDITOR.plugins.add('forms',{init:function(a){var b=a.lang;a.addCss('form{border: 1px dotted #FF0000;padding: 2px;}\n');a.addCss('img.cke_hidden{background-image: url('+CKEDITOR.getUrl(this.path+'images/hiddenfield.gif')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 16px !important;'+'height: 16px !important;'+'}');var c=function(e,f,g){a.addCommand(f,new CKEDITOR.dialogCommand(f));a.ui.addButton(e,{label:b.common[e.charAt(0).toLowerCase()+e.slice(1)],command:f});CKEDITOR.dialog.add(f,g);},d=this.path+'dialogs/';c('Form','form',d+'form.js');c('Checkbox','checkbox',d+'checkbox.js');c('Radio','radio',d+'radio.js');c('TextField','textfield',d+'textfield.js');c('Textarea','textarea',d+'textarea.js');c('Select','select',d+'select.js');c('Button','button',d+'button.js');c('ImageButton','imagebutton',CKEDITOR.plugins.getPath('image')+'dialogs/image.js');c('HiddenField','hiddenfield',d+'hiddenfield.js');if(a.addMenuItems)a.addMenuItems({form:{label:b.form.menu,command:'form',group:'form'},checkbox:{label:b.checkboxAndRadio.checkboxTitle,command:'checkbox',group:'checkbox'},radio:{label:b.checkboxAndRadio.radioTitle,command:'radio',group:'radio'},textfield:{label:b.textfield.title,command:'textfield',group:'textfield'},hiddenfield:{label:b.hidden.title,command:'hiddenfield',group:'hiddenfield'},imagebutton:{label:b.image.titleButton,command:'imagebutton',group:'imagebutton'},button:{label:b.button.title,command:'button',group:'button'},select:{label:b.select.title,command:'select',group:'select'},textarea:{label:b.textarea.title,command:'textarea',group:'textarea'}});if(a.contextMenu){a.contextMenu.addListener(function(e){if(e&&e.hasAscendant('form',true)&&!e.isReadOnly())return{form:CKEDITOR.TRISTATE_OFF};});a.contextMenu.addListener(function(e){if(e&&!e.isReadOnly()){var f=e.getName();if(f=='select')return{select:CKEDITOR.TRISTATE_OFF};if(f=='textarea')return{textarea:CKEDITOR.TRISTATE_OFF};if(f=='input')switch(e.getAttribute('type')){case 'button':case 'submit':case 'reset':return{button:CKEDITOR.TRISTATE_OFF};case 'checkbox':return{checkbox:CKEDITOR.TRISTATE_OFF};case 'radio':return{radio:CKEDITOR.TRISTATE_OFF};case 'image':return{imagebutton:CKEDITOR.TRISTATE_OFF};default:return{textfield:CKEDITOR.TRISTATE_OFF};}if(f=='img'&&e.data('cke-real-element-type')=='hiddenfield')return{hiddenfield:CKEDITOR.TRISTATE_OFF};}});}a.on('doubleclick',function(e){var f=e.data.element;if(f.is('form'))e.data.dialog='form';
else if(f.is('select'))e.data.dialog='select';else if(f.is('textarea'))e.data.dialog='textarea';else if(f.is('img')&&f.data('cke-real-element-type')=='hiddenfield')e.data.dialog='hiddenfield';else if(f.is('input'))switch(f.getAttribute('type')){case 'button':case 'submit':case 'reset':e.data.dialog='button';break;case 'checkbox':e.data.dialog='checkbox';break;case 'radio':e.data.dialog='radio';break;case 'image':e.data.dialog='imagebutton';break;default:e.data.dialog='textfield';break;}});},afterInit:function(a){var b=a.dataProcessor,c=b&&b.htmlFilter,d=b&&b.dataFilter;if(CKEDITOR.env.ie)c&&c.addRules({elements:{input:function(e){var f=e.attributes,g=f.type;if(!g)f.type='text';if(g=='checkbox'||g=='radio')f.value=='on'&&delete f.value;}}});if(d)d.addRules({elements:{input:function(e){if(e.attributes.type=='hidden')return a.createFakeParserElement(e,'cke_hidden','hiddenfield');}}});},requires:['image','fakeobjects']});if(CKEDITOR.env.ie)CKEDITOR.dom.element.prototype.hasAttribute=CKEDITOR.tools.override(CKEDITOR.dom.element.prototype.hasAttribute,function(a){return function(b){var e=this;var c=e.$.attributes.getNamedItem(b);if(e.getName()=='input')switch(b){case 'class':return e.$.className.length>0;case 'checked':return!!e.$.checked;case 'value':var d=e.getAttribute('type');return d=='checkbox'||d=='radio'?e.$.value!='on':e.$.value;}return a.apply(e,arguments);};});
