MODx.panel.ContentType=function(A){A=A||{};Ext.applyIf(A,{id:"modx-panel-content-type",url:MODx.config.connectors_url+"system/contenttype.php",baseParams:{action:"updateFromGrid"},defaults:{collapsible:false,autoHeight:true},items:[{html:"<h2>"+_("content_types")+"</h2>",cls:"modx-page-header",itemId:"header",border:false},{layout:"form",itemId:"form",bodyStyle:"padding: 15px;",items:[{html:"<p>"+_("content_type_desc")+"</p>",itemId:"description",border:false},{xtype:"modx-grid-content-type",itemId:"grid",preventRender:true}]}],listeners:{"setup":{fn:this.setup,scope:this},"success":{fn:this.success,scope:this},"beforeSubmit":{fn:this.beforeSubmit,scope:this}}});MODx.panel.ContentType.superclass.constructor.call(this,A);};Ext.extend(MODx.panel.ContentType,MODx.FormPanel,{initialized:false,setup:function(){},beforeSubmit:function(B){var A=this.getComponent("form").getComponent("grid");Ext.apply(B.form.baseParams,{data:A.encodeModified()});},success:function(A){this.getComponent("form").getComponent("grid").getStore().commitChanges();}});Ext.reg("modx-panel-content-type",MODx.panel.ContentType);MODx.grid.ContentType=function(B){B=B||{};var A=new Ext.ux.grid.CheckColumn({header:_("binary"),dataIndex:"binary",width:40,sortable:true});Ext.applyIf(B,{url:MODx.config.connectors_url+"system/contenttype.php",fields:["id","name","mime_type","file_extensions","headers","binary","description"],paging:true,remoteSort:true,plugins:A,columns:[{header:_("id"),dataIndex:"id",width:50,sortable:true},{header:_("name"),dataIndex:"name",sortable:true,editor:{xtype:"textfield"}},{header:_("description"),dataIndex:"description",editor:{xtype:"textfield"},width:200},{header:_("mime_type"),dataIndex:"mime_type",sortable:true,editor:{xtype:"textfield"},width:80},{header:_("file_extensions"),dataIndex:"file_extensions",sortable:true,editor:{xtype:"textfield"}},A],tbar:[{text:_("content_type_new"),handler:{xtype:"modx-window-content-type-create",blankValues:true}}]});MODx.grid.ContentType.superclass.constructor.call(this,B);};Ext.extend(MODx.grid.ContentType,MODx.grid.Grid,{getMenu:function(){var A=[];A.push({text:_("content_type_remove"),handler:this.confirm.createDelegate(this,["remove",_("content_type_remove_confirm")])});this.menu.record.menu=A;}});Ext.reg("modx-grid-content-type",MODx.grid.ContentType);MODx.window.CreateContentType=function(A){A=A||{};this.ident=A.ident||"cct"+Ext.id();Ext.applyIf(A,{title:_("content_type_new"),width:350,url:MODx.config.connectors_url+"system/contenttype.php",action:"create",fields:[{fieldLabel:_("name"),name:"name",id:"modx-"+this.ident+"-name",xtype:"textfield",width:200,allowBlank:false},{fieldLabel:_("mime_type"),name:"mime_type",id:"modx-"+this.ident+"-mime-type",xtype:"textfield",description:_("mime_type_desc"),width:200,allowBlank:false},{fieldLabel:_("file_extensions"),name:"file_extensions",id:"modx-"+this.ident+"-file-extensions",xtype:"textfield",description:_("file_extensions_desc"),width:200,allowBlank:false},{xtype:"combo-boolean",fieldLabel:_("binary"),name:"binary",id:"modx-"+this.ident+"-binary",description:_("binary_desc"),width:60,value:0},{fieldLabel:_("description"),name:"description",id:"modx-"+this.ident+"-description",xtype:"textarea",width:200,grow:true}]});MODx.window.CreateContentType.superclass.constructor.call(this,A);};Ext.extend(MODx.window.CreateContentType,MODx.Window);Ext.reg("modx-window-content-type-create",MODx.window.CreateContentType);