--- /dev/null
+//<script type="text/javascript">
+// tab on left...
+
+Pman.on('beforeload', function()
+{
+ // this is always shown if Clipping module is enabled!!
+ //if (!Pman.hasPerm('Admin.Campaigns', 'E')) {
+ // return;
+ //}
+ Pman.register({
+ modKey : '016-pman-tab-ftpfiles',
+ module : Pman.Tab.FtpFiles,
+ region : 'center',
+ parent : Pman.Tab.FtpTab,
+ name : "Ftp Files"
+ });
+});
+
+
+
+Pman.Tab.FtpFiles = {
+ grid : false,
+ panel : false,
+
+
+ add : function(parentLayout, region) {
+
+
+ if (this.panel) {
+ parentLayout.getRegion(region).showPanel(this.panel);
+ return;
+ }
+
+
+
+ this.layout = new Ext.BorderLayout(
+ parentLayout.getEl().createChild({tag:'div'}),
+ {
+
+ center: {
+ autoScroll:true,
+ hideTabs: true,
+ fitToFrame : true
+ },
+ south : {
+ split:true,
+ titleBar: false,
+
+ autoScroll:true,
+ hideTabs: true,
+ // hideTabs: false,
+ collapsible: false,
+ // collapsed : true,
+ height: 250
+ }
+ }
+ );
+
+ var _this = this;
+
+ this.tab = parentLayout.add(region, new Ext.NestedLayoutPanel(
+ this.layout, {title: "Files", background: true}));
+
+ this.tab.on('activate', function() {
+ _this.delayedCreate();
+ _this.reload();
+ });
+ },
+ delayedCreate : function()
+ {
+ if (this.grid) {
+ return;
+ }
+ var _this = this;
+ this.layout.beginUpdate();
+
+
+ var frm = this.layout.getEl().createChild({tag:'div'});
+ //this.grid = new Ext.grid.EditorGrid(frm, {
+ this.grid = new Ext.grid.Grid(frm, {
+ id: 'grid-supplog',
+ ds: new Ext.data.Store({
+ // load using HTTP
+ proxy: new Ext.data.HttpProxy({
+ url: baseURL + '/Ftp/List.php',
+ method: 'GET'
+ }),
+ remoteSort: true,
+ reader: {
+ root : 'data',
+ totalProperty : 'total',
+ id : 'id',
+ xtype : 'JsonReader',
+ fields : [
+ 'id',
+ 'name',
+ 'mtime',
+ 'size'
+ ]
+ },
+ listeners : {
+
+ beforeload: function(t, o) {
+ var sn = Pman.Tab.FtpTree.tree.getSelectionModel().getSelectedNode();
+ if (!sn) {
+ // clear!?!?
+ return false;
+ }
+ o.params.name = sn.attributes.id;
+ o.params.type = 'files';
+ //console.log(o.params);
+ // teams!?!
+ // need to show month here..
+ //o.params = o.params ? o.params : {};
+ // o.params['query[project_search]'] = _this.searchBox.getValue();
+ // o.params['query[project_filter]'] = _this.filter;
+
+
+ },
+ load : function()
+ {
+
+ },
+ loadexception : Pman.loadException
+
+ },
+ sortInfo: {
+ field: 'name', direction: 'DESC'
+ }
+ }),
+ cm: new Ext.grid.ColumnModel(
+ [
+ {
+ id : 'ftpfiles-name',
+ header : "Filename",
+ dataIndex : 'name',
+ sortable : false,
+ width : 170
+
+ },
+
+ {
+ header : "Size",
+ dataIndex : 'size',
+ sortable : false,
+ width : 130
+ },
+ {
+ header : "Modified",
+ dataIndex : 'mtime',
+ sortable : false,
+ width : 130
+ } ]
+ ),
+ autoExpandColumn: 'ftpfiles-name' , // fixme!!!!
+ clicksToEdit : 1,
+
+ loadMask: true,
+
+ listeners: {
+ // sel. changed-> show detail breakdown @ bottom.
+
+ //rowclick : function(g, ri, e) {
+
+ // var x = g.getDataSource().getAt(ri);
+ // x.data.languagelist = x.json.languagelist;
+ // x.data.countrylist= x.json.countrylist;
+ // _dialog.show(x.data, refreshPager);
+ //}
+
+
+ },
+ selModel : {
+ xtype : 'RowSelectionModel',
+ singleSelect: true,
+ listeners : {
+ afterselectionchange : function(sm) {
+ var s = sm.getSelections();
+ if (!s || s.length != 1) {
+ return;
+ }
+ _this.viewLayout.load(baseURL+ '/Ftp/View' + s[0].data.id + '?html=1');
+ }
+ }
+ }
+ });
+ this.grid.getSelectionModel().singleSelect = true;
+ this.grid.getSelectionModel().on('selectionchange' , function (s) {
+ //
+ });
+
+
+
+ this.panel = this.layout.add('center', new Ext.GridPanel(this.grid ,
+ { fitToframe: true,fitContainer: true })
+ );
+ this.grid.render();
+ /*var gridFoot = this.grid.getView().getFooterPanel(true);
+ this.paging = new Ext.PagingToolbar(gridFoot, this.grid.getDataSource(), {
+ pageSize: 25,
+ displayInfo: true,
+ displayMsg: "",
+ emptyMsg: ""
+ });
+ */
+ var pagerFirst = function()
+ {
+ _this.reload();
+ }
+
+ var grid = this.grid;
+
+ var gridHead = this.grid.getView().getHeaderPanel(true);
+ var tb = new Ext.Toolbar(gridHead);
+ var daterange = [];
+ var td = Date.parseDate((new Date()).format('Y-m-01'), 'Y-m-d');
+
+
+ tb.add(
+
+
+ "DELETE",
+ "RENAME"
+
+ );
+
+
+ //this.toolbar = tb;
+ // add stuff to toolbar?
+
+
+ // _this.paging.onClick('refresh');
+
+ var frame = this.layout.getRegion('south').el.createChild({tag:'div', style: 'margin:0px;'});
+ this.viewLayout = this.layout.add('south',
+ new Ext.ContentPanel(frame, {
+ //autoCreate : true,
+ //toolbar: this.tb,
+ background : true,
+ fitToFrame:true,
+ fitContainer: true,
+ title : "Details"
+ }));
+ //return;
+ this.layout.endUpdate();
+ //this.viewLayout.resizeEl= this.viewLayout.getEl();
+ //this.viewLayout.el.setStyle('overflow', 'auto');
+
+ },
+
+ reload : function()
+ {
+ this.grid.getDataSource().load({
+ params: {
+ start:0,
+ limit:999
+ }
+ });
+ }
+
+
+
+
+};
+
\ No newline at end of file