1 //<script type="text/javascript">
4 Pman.on('beforeload', function()
6 // this is always shown if Clipping module is enabled!!
7 //if (!Pman.hasPerm('Admin.Campaigns', 'E')) {
11 modKey : '016-pman-tab-ftpfiles',
12 module : Pman.Tab.FtpFiles,
14 parent : Pman.Tab.FtpTab,
26 add : function(parentLayout, region) {
30 parentLayout.getRegion(region).showPanel(this.panel);
36 this.layout = new Ext.BorderLayout(
37 parentLayout.getEl().createChild({tag:'div'}),
61 this.tab = parentLayout.add(region, new Ext.NestedLayoutPanel(
62 this.layout, {title: "Files", background: true}));
64 this.tab.on('activate', function() {
65 _this.delayedCreate();
69 delayedCreate : function()
75 this.layout.beginUpdate();
78 var frm = this.layout.getEl().createChild({tag:'div'});
79 //this.grid = new Ext.grid.EditorGrid(frm, {
80 this.grid = new Ext.grid.Grid(frm, {
82 ds: new Ext.data.Store({
84 proxy: new Ext.data.HttpProxy({
85 url: baseURL + '/Ftp/List.php',
91 totalProperty : 'total',
104 beforeload: function(t, o) {
105 var sn = Pman.Tab.FtpTree.tree.getSelectionModel().getSelectedNode();
110 o.params.name = sn.attributes.id;
111 o.params.type = 'files';
112 //console.log(o.params);
114 // need to show month here..
115 //o.params = o.params ? o.params : {};
116 // o.params['query[project_search]'] = _this.searchBox.getValue();
117 // o.params['query[project_filter]'] = _this.filter;
125 loadexception : Pman.loadException
129 field: 'name', direction: 'DESC'
132 cm: new Ext.grid.ColumnModel(
135 id : 'ftpfiles-name',
157 autoExpandColumn: 'ftpfiles-name' , // fixme!!!!
163 // sel. changed-> show detail breakdown @ bottom.
165 //rowclick : function(g, ri, e) {
167 // var x = g.getDataSource().getAt(ri);
168 // x.data.languagelist = x.json.languagelist;
169 // x.data.countrylist= x.json.countrylist;
170 // _dialog.show(x.data, refreshPager);
176 xtype : 'RowSelectionModel',
179 afterselectionchange : function(sm) {
180 var s = sm.getSelections();
181 if (!s || s.length != 1) {
184 // if it's not a text file.. download it..
186 var mt = s[0].data.mimetype;
188 if (mt.match(/^text\//)) {
189 _this.viewLayout.load(baseURL+ '/Ftp/View/' + s[0].data.id + '?html=1');
192 if (mt.match(/\/xml$/)) {
193 _this.viewLayout.load(baseURL+ '/Ftp/View/' + s[0].data.id + '?html=1');
198 url: baseURL+ '/Ftp/View/' + s[0].data.id
206 this.grid.getSelectionModel().singleSelect = true;
207 this.grid.getSelectionModel().on('selectionchange' , function (s) {
213 this.panel = this.layout.add('center', new Ext.GridPanel(this.grid ,
214 { fitToframe: true,fitContainer: true })
217 /*var gridFoot = this.grid.getView().getFooterPanel(true);
218 this.paging = new Ext.PagingToolbar(gridFoot, this.grid.getDataSource(), {
225 var pagerFirst = function()
230 var grid = this.grid;
232 var gridHead = this.grid.getView().getHeaderPanel(true);
233 var tb = new Ext.Toolbar(gridHead);
235 var td = Date.parseDate((new Date()).format('Y-m-01'), 'Y-m-d');
248 // add stuff to toolbar?
251 // _this.paging.onClick('refresh');
253 var frame = this.layout.getRegion('south').el.createChild({tag:'div', style: 'margin:0px;'});
254 this.viewLayout = this.layout.add('south',
255 new Ext.ContentPanel(frame, {
264 this.layout.endUpdate();
265 //this.viewLayout.resizeEl= this.viewLayout.getEl();
266 //this.viewLayout.el.setStyle('overflow', 'auto');
272 this.grid.getDataSource().load({