Ext.namespace("Ext.ux");Ext.ux.CommentEditor=Ext.extend(Ext.Window,{initComponent:function(){var a={id:"tabsinform-win",width:550,autoHeight:true,modal:true,title:this.winTitle,closable:false,closeAction:"close",plain:true,bbar:new Ext.StatusBar({id:"statusbar",defaultText:""}),formHasChanged:false,listeners:{close:this.handleClose}};this.titleField=new Ext.form.TextField({name:"title",id:"title",fieldLabel:this.labelField1,xtype:"textfield",anchor:"100%",allowBlank:false});Ext.applyIf(this,a);Ext.ux.CommentEditor.superclass.initComponent.apply(this,arguments);this.on("close",this.handleClose,this);this.centerPanel=new Ext.FormPanel({title:this.panelTitle,id:"tabsinform-form",url:'http://www.eco-conception.fr/index.php/pub/datasrc/form.comment.json',autoScroll:true,bodyStyle:"padding:10px",labelAlign:"top",items:[this.titleField,{xtype:"htmleditor",id:"com-body",anchor:"99%",fieldLabel:this.labelField2,allowBlank:false,enableColors:false,enableAlignments:false,enableFont:false,enableFontSize:false,enableSourceEdit:false,height:200}]})},buttons:[{text:this.btnSubmit,handler:function(a){var b=Ext.getCmp("tabsinform-form").getForm();if(b.isValid()){b.submit({params:{cmd:"submit",page_id:a.ownerCt.page_id,user_id:a.ownerCt.user_id,comment_type_id:a.ownerCt.comment_type_id,comment_id:a.ownerCt.comment_id,parent_id:a.ownerCt.parent_id},waitMsg:this.msgWaitLoading,success:function(d,c){a.ownerCt.formHasChanged=true;if(Ext.getCmp("statusbar")){Ext.getCmp("statusbar").setStatus({text:c.result.msg,iconCls:"",clear:true})}Ext.MessageBox.show({title:a.ownerCt.winModerationTitle,msg:a.ownerCt.winModerationMessage,buttons:Ext.MessageBox.OK,icon:"ext-mb-info"});a.ownerCt.close()},failure:function(e,c){if(!c.result.deconnected){Ext.MessageBox.show({title:this.winReturnTitle,msg:c.result.message,buttons:Ext.MessageBox.OK,icon:"ext-mb-error"})}else{var d=new Ext.ux.LoginBoxPopup({closable:true,autoWidth:400,autoHeight:true,modal:true,multiline:true});d.show();d.syncSize()}}})}}},{text:this.btnCancel,handler:function(a){a.ownerCt.close()}}],onRender:function(){this.buttons[0].setText(this.btnSubmit);this.buttons[1].setText(this.btnCancel);Ext.ux.CommentEditor.superclass.onRender.apply(this,arguments);this.add(this.centerPanel);if(this.comment_id!=0){Ext.getCmp("tabsinform-form").getForm().load({waitMsg:this.msgWaitLoading,params:{cmd:this.cmd,parent_id:this.parent_id,comment_id:this.comment_id}})}},handleClose:function(a){if(this.formHasChanged){Ext.get(this.targetDiv).load({url:this.targetUrl,waitMsg:this.msgWaitLoading,params:{page_id:this.page_id}})}}});Ext.reg("commenteditor",Ext.ux.CommentEditor);
