FR={clearLog:function(){window.parent.FR.UI.showLoading(FR.T("Clearing activity log..."));Ext.Ajax.request({url:URLRoot+"/?module=filelog&section=default&page=clear_log",method:"post",params:{path:FR.path},callback:function(opts,succ,req){window.parent.FR.UI.doneLoading();try{var rs=Ext.decode(req.responseText)}catch(er){return false}if(rs.msg){window.parent.FR.UI.feedback(rs.msg,"success")}FR.gridPanel.store.load({params:{start:0,limit:100}})}})}};Ext.onReady(function(){Ext.override(Ext.grid.GridView,{emptyText:'<div style="text-align:center">'+FR.T("No activity records found for this file.")+"</div>"});var store=new Ext.data.Store({baseParams:{path:FR.path},proxy:new Ext.data.HttpProxy({url:URLRoot+"/?module=filelog&section=ajax&page=list"}),reader:new Ext.data.JsonReader({root:"records",totalProperty:"totalCount",id:"id",fields:["id",{name:"date",type:"date",dateFormat:"Y-m-d h:i:s"},"uid","fullName","action","details"]}),listeners:{load:function(store){if(store.reader.jsonData.msg){window.parent.FR.UI.feedback(store.reader.jsonData.msg,"error")}}}});var cm=new Ext.grid.ColumnModel({defaults:{hideable:false,menuDisabled:true},defaultSortable:true,columns:[{header:FR.T("Date"),dataIndex:"date",width:130,renderer:function(value){return Ext.util.Format.date(value,"d M y, H:i")}},{header:FR.T("User"),dataIndex:"fullName",width:130},{header:FR.T("Action"),dataIndex:"action",width:130},{id:"details",header:FR.T("Details"),dataIndex:"details",sortable:false}]});FR.gridPanel=new Ext.grid.GridPanel({region:"center",selModel:new Ext.grid.RowSelectionModel({singleSelect:true}),store:store,cm:cm,loadMask:true,autoExpandColumn:"details",autoExpandMin:400,bbar:new Ext.PagingToolbar({cls:"fr-viewport-top-bar",pageSize:100,store:store,displayInfo:true,displayMsg:FR.T("Displaying records {0} - {1} of {2}"),emptyMsg:FR.T("No records to display"),items:["-",{text:"Clear log",hidden:!window.parent.User.isAdmin&&!window.parent.User.isIndep,handler:function(){new Ext.ux.prompt({text:FR.T("Are you sure you want to clear the file's activity log?"),confirmHandler:function(){FR.clearLog()}})}}]}),listeners:{afterrender:function(){this.store.load({params:{start:0,limit:100}})}}});new Ext.Viewport({items:FR.gridPanel})});