MODx.page.EditFile=function(A){A=A||{};var B=[];if(A.canSave){B.push({process:"update",text:_("save"),method:"remote",keys:[{key:MODx.config.keymap_save||"s",ctrl:true}]});B.push("-");}B.push({process:"cancel",text:_("cancel"),params:{a:MODx.action.welcome}});Ext.applyIf(A,{formpanel:"modx-panel-file-edit",components:[{xtype:"modx-panel-file-edit",renderTo:"modx-panel-file-edit-div",file:A.file,record:A.record||{}}],buttons:B});MODx.page.EditFile.superclass.constructor.call(this,A);};Ext.extend(MODx.page.EditFile,MODx.Component);Ext.reg("modx-page-file-edit",MODx.page.EditFile);MODx.panel.EditFile=function(A){A=A||{};A.record=A.record||{};Ext.applyIf(A,{id:"modx-panel-file-edit",url:MODx.config.connectors_url+"browser/file.php",baseParams:{action:"update",file:A.file,wctx:MODx.request.wctx},border:false,bodyStyle:"",items:[{html:"<h2>"+_("file_edit")+"</h2>",border:false,cls:"modx-page-header",id:"modx-chunk-header"},MODx.getPageStructure([{title:_("file_edit"),id:"modx-form-file-edit",bodyStyle:"padding: 15px;",defaults:{border:false,msgTarget:"side"},layout:"form",labelWidth:150,items:[{xtype:"statictextfield",fieldLabel:_("name"),name:"name",id:"modx-file-name",width:300,value:A.record.name||""},{xtype:"statictextfield",fieldLabel:_("file_size"),name:"size",id:"modx-file-size",value:A.record.size||0},{xtype:"statictextfield",fieldLabel:_("file_last_accessed"),name:"last_accessed",id:"modx-file-last-accessed",width:200,value:A.record.last_accessed||""},{xtype:"statictextfield",fieldLabel:_("file_last_modified"),name:"last_modified",id:"modx-file-last-modified",width:200,value:A.record.last_modified||""},{xtype:"textarea",hideLabel:true,name:"content",id:"modx-file-content",anchor:"95%",grow:false,height:400,style:"font-size: 11px;",value:A.record.content||""}]}])],listeners:{setup:{fn:this.setup,scope:this},success:{fn:this.success,scope:this},beforeSubmit:{fn:this.beforeSubmit,scope:this}}});MODx.panel.EditFile.superclass.constructor.call(this,A);this.addEvents("ready");};Ext.extend(MODx.panel.EditFile,MODx.FormPanel,{initialized:false,setup:function(){this.fireEvent("ready",this.config.record);return true;},success:function(A){this.getForm().setValues(A.result.object);},beforeSubmit:function(A){this.cleanupEditor();return this.fireEvent("save",{values:this.getForm().getValues()});},cleanupEditor:function(){if(MODx.onSaveEditor){var A=Ext.getCmp("modx-file-content");MODx.onSaveEditor(A);}}});Ext.reg("modx-panel-file-edit",MODx.panel.EditFile);