FR.components.gridStore=Ext.extend(Ext.data.JsonStore,{enableFolderGrouping:true,constructor:function(config){FR.natCollator=new Intl.Collator(navigator.languages[0]||navigator.language,{numeric:true,sensitivity:"base"});var cols=[{name:"pid"},{mapping:"b",name:"perms"},{mapping:"cc",name:"comments"},{mapping:"c",name:"created",type:"date",dateFormat:"m/d/Y h:i"},{mapping:"ch",name:"createdHuman"},{mapping:"d",name:"deleted",type:"date",dateFormat:"m/d/Y h:i"},{mapping:"dir",name:"isFolder"},{mapping:"dh",name:"deletedHuman"},{mapping:"dt",name:"taken",type:"int"},{mapping:"fn",name:"notInfo"},{mapping:"ft",name:"filetype"},{mapping:"i",name:"icon"},{mapping:"id",name:"uniqid"},{mapping:"l",name:"label",convert:function(v,r){if(!v){return false}return FR.utils.parseRawLabel(v)},sortFunction:function(r1,r2){var l1=r1.get("label"),l2=r2.get("label");if(!l1){return-1}if(!l2){return 1}return FR.natCollator.compare(l2.text.toLowerCase(),l1.text.toLowerCase())}},{mapping:"lI",name:"lockInfo"},{mapping:"m",name:"modified",type:"date",dateFormat:"m/d/Y h:i"},{mapping:"mf",name:"meta_filetype"},{mapping:"mh",name:"modifiedHuman"},{mapping:"n",name:"filename",sortFunction:function(r1,r2){return FR.natCollator.compare(r1.data.filename,r2.data.filename)}},{mapping:"new",name:"isNew"},{mapping:"ns",name:"nice_filesize",sortFunction:function(r1,r2){var v1=r1.data.filesize;var v2=r2.data.filesize;return v1>v2?1:v1<v2?-1:0}},{mapping:"nx",name:"filenameWithoutExt"},{mapping:"hW",name:"hasWebLink"},{mapping:"ot",name:"objectType",convert:function(v,r){return v||"virtual"}},{mapping:"p",name:"path",convert:function(v,r){return v||FR.currentPath+"/"+r.n}},{mapping:"r",name:"rating"},{mapping:"s",name:"filesize"},{mapping:"sh",name:"share"},{mapping:"st",name:"star"},{mapping:"t",name:"type"},{mapping:"tdf",name:"trash_deleted_from"},{mapping:"th",name:"thumb"},{mapping:"iw",name:"imageWidth"},{mapping:"ih",name:"imageHeight"},{mapping:"tg",name:"tags"},{mapping:"v",name:"version"},{mapping:"x",name:"extra"},{mapping:"xt",name:"ext"}];Ext.each(FR.UI.grid.customColumns,function(col){cols.push({name:col.dataIndex})},this);config=Ext.apply({url:FR.getBaseURL+"&page=grid",root:"files",totalProperty:"count",idProperty:"id",fields:cols},config);FR.components.gridStore.superclass.constructor.call(this,config)},applySort:function(reset){if(this.enableFolderGrouping){this.multiSortInfo={sorters:[],direction:"DESC"};this.multiSortInfo.sorters.push({field:"isFolder",direction:"DESC"});this.hasMultiSort=true;if(this.sortInfo&&!reset){this.multiSortInfo.sorters.push({field:this.sortInfo.field,direction:this.sortInfo.direction})}else{if(reset){this.sortInfo=false;this.sortToggle={filename:"ASC"}}this.multiSortInfo.sorters.push({field:"filename",direction:"ASC"})}}if(this.remoteSort){this.sortInfo=false}FR.components.gridStore.superclass.applySort.apply(this,arguments)}});