FR.components.gridColumnModel=Ext.extend(Ext.grid.ColumnModel,{constructor:function(config){var availableWidth=FR.UI.layout.gridPanel.availableWidth;var columns=[{id:"checkbox",width:FR.UI.layout.isSmall?30:40,resizable:false,hideable:false,menuDisabled:true,sortable:false,header:'<a class="select-all" href="javascript:FR.utils.toggleGridSelection();" ext:qtip="'+FR.T("Select All")+'"><i class="fa fa-fw fa-check-square"></i></a>',renderer:function(v,m,r){return r.data.checkboxHTML}},{id:"icon",width:40,resizable:false,hideable:false,menuDisabled:true,sortable:false,renderer:function(v,m,r){if(r.data.label){m.attr='ext:qtip="'+r.data.label.text+'"'}return r.data.iconHTML}},{id:"filename",hideable:false,header:"Name",renderer:function(v,m,r){if(r.data.isFolder){return v}return r.data.filenameWithoutExt},dataIndex:"filename",width:220},{id:"extension",header:"Type",hideable:false,dataIndex:"ext",width:75},{id:"type",dataIndex:"type",hidden:true,header:"File Type"},{id:"icons",sortable:false,header:"Icons",renderer:function(v,m,r){return r.data.icons},width:90},{id:"modified",dataIndex:"modified",hidden:FR.UI.layout.isSmall,header:"Modified",width:95,renderer:function(v,col,row){if(Settings.grid_short_date){return row.data.modifiedHuman}return Ext.util.Format.date(v,FR.T("Date Format: Files"))}},{id:"label",dataIndex:"label",hidden:true,hideable:User.perms.read_comments,header:"Label",width:90,renderer:function(v){if(v){return FR.utils.getLabelHTML(v)}}},{id:"nice_filesize",dataIndex:"nice_filesize",hidden:availableWidth<540,header:"Size",width:75},{id:"meta_filetype",dataIndex:"meta_filetype",custom:"filetype",hidden:true,header:"Meta Type",renderer:function(v){if(v&&FR.metaFileTypes[v]){return FR.metaFileTypes[v].name}}},{id:"created",dataIndex:"created",hidden:true,header:"Created",width:95,renderer:function(v,col,row){if(Settings.grid_short_date){return row.data.createdHuman}return Ext.util.Format.date(v,FR.T("Date Format: Files"))}},{id:"deleted",dataIndex:"deleted",hidden:true,width:95,header:'<span class="metaColumnFieldSet">'+FR.T("Trash")+":</span> "+FR.T("Date deleted"),renderer:function(v,col,row){if(Settings.grid_short_date){return row.data.deletedHuman}return Ext.util.Format.date(v,FR.T("Date Format: Files"))}},{id:"trash_deleted_from",dataIndex:"trash_deleted_from",hidden:true,header:'<span class="metaColumnFieldSet">'+FR.T("Trash")+":</span> "+FR.T("Deleted from"),width:180},{id:"path",dataIndex:"path",hidden:true,header:"Location",width:180,renderer:FR.utils.humanFilePath},{dataIndex:"comments",hidden:true,hideable:User.perms.read_comments,header:"Comments count",width:95,renderer:function(val){return val>0?val:""}},{dataIndex:"tags",custom:"tags",hidden:true,hideable:User.perms.metadata,header:"Tags"},{dataIndex:"rating",custom:"rating",hidden:true,hideable:User.perms.metadata,width:70,header:"Rating",renderer:function(v){return'<i class="fa fa-circle-'+v+'"></i>'}},{dataIndex:"star",hidden:true,hideable:User.perms.metadata,header:"Star",width:70,renderer:function(v){return v?'<i class="fa fa-star-o"></i>':""}},{dataIndex:"share",hidden:true,header:"Shared",width:95,renderer:this.renderers.YesNo},{dataIndex:"hasWebLink",hidden:true,header:"Web link",width:95,renderer:this.renderers.YesNo},{dataIndex:"lockInfo",hidden:true,header:"Locked by",renderer:function(v){return v?v:""}},{dataIndex:"version",hidden:true,header:"Version",width:75,renderer:function(v){return v&&v!="1"?v:""}},{dataIndex:"isNew",hidden:true,header:"Is new",width:75,renderer:this.renderers.YesNo}];Ext.each(FR.UI.grid.customColumns,function(col){if(col.custom==FR.specialMetaFields.title){col.renderer=function(v,col,row){if(!v){return row.data.filename}return v}}columns.push(col)},this);config=Ext.apply({defaults:{sortable:true,width:120},columns:columns},config);FR.components.gridColumnModel.superclass.constructor.call(this,config);FR.UI.YesLabel=FR.T("Yes")},getMetaCols:function(){var cols=[];this.getColumnsBy(function(col,indx){if(col.custom&&!col.hidden){cols.push(col.custom);return true}},this);return cols},getMetaTypeCol:function(){var theCol;this.getColumnsBy(function(col,indx){if(col.id=="meta_filetype"){theCol={column:col,indx:indx};return true}},this);return theCol},renderers:{YesNo:function(v){return v?FR.UI.YesLabel:""}}});