Ext.namespace('Zarafa.plugins.emailtracking.ui'); /** * @class Zarafa.plugins.emailtracking.ui.TrackingInfoPanel * @extends Zarafa.core.ui.ContentPanel * * Show the tracking table. * @xtype emailtracking.trackinginfopanel */ Zarafa.plugins.emailtracking.ui.TrackingInfoPanel = Ext.extend(Zarafa.core.ui.ContentPanel, { /** * @var object The server response */ record : null, store: null, /** * @constructor * @param config Configuration structure */ constructor : function(config) { config = config || {}; // fill the store // create the data store this.store = new Ext.data.ArrayStore({ fields: [ {name: 'ip'}, {name: 'timestamp', type: 'date'}, {name: 'referrer'}, {name: 'client'}, {name: 'tracking_type'} ] }); var data = []; var internals = container.getSettingsModel().get('zarafa/v1/plugins/emailtracking/internals'); Ext.each(config.record.log, function(rec) { // hide entries from the own system (only external tracking will be possible!) if(internals || (rec.referrer != window.location.href)) { data.push([rec.ip_addr, rec.timestamp, rec.referrer, rec.client, rec.tracking_type]); } }); this.store.loadData(data); Ext.applyIf(config, { layout : 'fit', title : _('Tracking information'), closeOnSave : true, width : 340, height : 300, //Add panel items : [{ xtype: "grid", style: 'margin-top:20px;', store: this.store, columns: [ { header : 'IP Address', width : 75, sortable : true, dataIndex: 'ip' }, { id : "timestamp", header : 'Date', width : 75, sortable : true, renderer : Ext.util.Format.dateRenderer('m/d/Y H:m:s'), dataIndex: 'timestamp' }, { header : 'Referrer', width : 150, hidden : true, sortable : true, dataIndex: 'referrer' }, { header : 'Client', width : 150, hidden : true, sortable : true, dataIndex: 'client' }, { header : 'Type', width : 60, hidden : true, sortable : true, dataIndex: 'tracking_type' } ], viewConfig: { forceFit: true }, sm: new Ext.grid.RowSelectionModel({singleSelect:true}), frame: true },{ xtype: 'button', text: _('Close'), handler: this.close, scope: this }] }); Zarafa.plugins.emailtracking.ui.TrackingInfoPanel.superclass.constructor.call(this, config); } }); Ext.reg('emailtracking.trackinginfopanel' ,Zarafa.plugins.emailtracking.ui.TrackingInfoPanel);