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',
156 autoExpandColumn: 'ftpfiles-name' , // fixme!!!!
162 // sel. changed-> show detail breakdown @ bottom.
164 //rowclick : function(g, ri, e) {
166 // var x = g.getDataSource().getAt(ri);
167 // x.data.languagelist = x.json.languagelist;
168 // x.data.countrylist= x.json.countrylist;
169 // _dialog.show(x.data, refreshPager);
175 xtype : 'RowSelectionModel',
178 afterselectionchange : function(sm) {
179 var s = sm.getSelections();
180 if (!s || s.length != 1) {
183 // if it's not a text file.. download it..
185 var mt = s[0].data.mimetype;
187 if (mt.match(/^text\//)) {
188 _this.viewLayout.load(baseURL+ '/Ftp/View/' + s[0].data.id + '?html=1');
191 if (mt.match(/\/xml$/)) {
192 _this.viewLayout.load(baseURL+ '/Ftp/View/' + s[0].data.id + '?html=1');
197 url: baseURL+ '/Ftp/View/' + s[0].data.id
205 this.grid.getSelectionModel().singleSelect = true;
206 this.grid.getSelectionModel().on('selectionchange' , function (s) {
212 this.panel = this.layout.add('center', new Ext.GridPanel(this.grid ,
213 { fitToframe: true,fitContainer: true })
216 /*var gridFoot = this.grid.getView().getFooterPanel(true);
217 this.paging = new Ext.PagingToolbar(gridFoot, this.grid.getDataSource(), {
224 var pagerFirst = function()
229 var grid = this.grid;
231 var gridHead = this.grid.getView().getHeaderPanel(true);
232 var tb = new Ext.Toolbar(gridHead);
234 var td = Date.parseDate((new Date()).format('Y-m-01'), 'Y-m-d');
247 // add stuff to toolbar?
250 // _this.paging.onClick('refresh');
252 var frame = this.layout.getRegion('south').el.createChild({tag:'div', style: 'margin:0px;'});
253 this.viewLayout = this.layout.add('south',
254 new Ext.ContentPanel(frame, {
263 this.layout.endUpdate();
264 //this.viewLayout.resizeEl= this.viewLayout.getEl();
265 //this.viewLayout.el.setStyle('overflow', 'auto');
271 this.grid.getDataSource().load({