From 205291de43b20f0b6ba6aaba86ff0b214e16e73b Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Tue, 23 Jun 2015 11:01:48 +0800 Subject: [PATCH] Pman.Tab.AdminLogEvents.bjs Pman.Tab.AdminLogEvents.js --- Pman.Tab.AdminLogEvents.bjs | 29 +- Pman.Tab.AdminLogEvents.js | 1026 +++++++++++++++++------------------ 2 files changed, 505 insertions(+), 550 deletions(-) diff --git a/Pman.Tab.AdminLogEvents.bjs b/Pman.Tab.AdminLogEvents.bjs index baba02c..bf443e6 100644 --- a/Pman.Tab.AdminLogEvents.bjs +++ b/Pman.Tab.AdminLogEvents.bjs @@ -2,7 +2,7 @@ "name" : "Pman.Tab.AdminLogEvents", "parent" : "Pman.Tab.AdminLogs", "title" : "Admin - Logs - Events", - "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminLogEvents.bjs", + "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminLogEvents.bjs", "permname" : "Admin.Logs", "modOrder" : "001", "strings" : { @@ -15,6 +15,7 @@ "01bd6a16732dfa2b760dc8566c58afae" : "Download to Excel", "498f79c4c5bbde77f1bceb6c86fd0f6d" : "Show", "037fd50b0e85bb65995ca7125d06c7cd" : "Select Person Table", + "42cf593b947cd3d591fa132742486f89" : "Person ", "fd7535ce3979bb8547e2c01689db0767" : "Select Person ", "679308a758de538c5f39c4c6cdba6593" : "Select Affects", "a8929eb5c1553d3f70497f862d25d0ce" : "Select Action", @@ -28,8 +29,8 @@ "items" : [ { "region" : "center", - "title" : "Events", "xtype" : "NestedLayoutPanel", + "title" : "Events", "$ xns" : "Roo", "items" : [ { @@ -63,9 +64,9 @@ "listeners" : { "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, + "fitToframe" : true, "background" : false, "region" : "center", - "fitToframe" : true, "title" : "Events", "xtype" : "GridPanel", "fitContainer" : true, @@ -112,8 +113,8 @@ }, { "$ url" : "baseURL + '/Roo/Events.php'", - "xtype" : "HttpProxy", "method" : "GET", + "xtype" : "HttpProxy", "$ xns" : "Roo.data", "* prop" : "proxy" } @@ -223,8 +224,8 @@ "items" : [ { "$ url" : "baseURL + '/Roo/Person.php'", - "method" : "GET", "xtype" : "HttpProxy", + "method" : "GET", "$ xns" : "Roo.data", "* prop" : "proxy" }, @@ -279,8 +280,8 @@ "items" : [ { "$ url" : "baseURL + '/Roo/Events.php'", - "method" : "GET", "xtype" : "HttpProxy", + "method" : "GET", "$ xns" : "Roo.data", "* prop" : "proxy" }, @@ -335,8 +336,8 @@ "items" : [ { "$ url" : "baseURL + '/Roo/Events.php'", - "method" : "GET", "xtype" : "HttpProxy", + "method" : "GET", "$ xns" : "Roo.data", "* prop" : "proxy" }, @@ -380,8 +381,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "When", + "width" : 100, "$ renderer" : "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -389,16 +390,16 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "#id", + "width" : 100, "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "id" }, { "xtype" : "ColumnModel", - "width" : 150, "header" : "Person", + "width" : 150, "$ renderer" : "function(v,x,r) { \n \n var ptable = _this.tableSel.getValue();\n \n var efield = 'person_id_email';\n var nfield = 'person_id_name'; \n \n if(\n ptable.length &&\n ptable != 'Person' &&\n typeof(r.data[ptable + '_id_email']) != 'undefined' &&\n typeof(r.data[ptable + '_id_name']) != 'undefined'\n ){\n efield = ptable + '_id_email';\n nfield = ptable + '_id_name'; \n }\n \n var email = r.data[efield]; // ? r.data.person_id_email : r.data.person_id_email;\n var name = r.data[nfield]; // ? r.data.person_id_name : r.data.person_id_name; \n return String.format('{0} <{1}>', \n name, email); \n\n\n}", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -406,8 +407,8 @@ }, { "xtype" : "ColumnModel", - "header" : "Action", "width" : 100, + "header" : "Action", "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -415,8 +416,8 @@ }, { "xtype" : "ColumnModel", - "header" : "IP", "width" : 100, + "header" : "IP", "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -424,8 +425,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "Affected", + "width" : 100, "$ renderer" : "function(v, x, r) { \n return v ? String.format('{0}({1})', v, r.data.on_id) : ''; \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -433,8 +434,8 @@ }, { "xtype" : "ColumnModel", - "width" : 300, "header" : "Remarks", + "width" : 300, "$ renderer" : "function(v) { return String.format('{0}', v, Roo.util.Format.htmlEncode(v)); }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", diff --git a/Pman.Tab.AdminLogEvents.js b/Pman.Tab.AdminLogEvents.js index dc24738..d66e9d0 100644 --- a/Pman.Tab.AdminLogEvents.js +++ b/Pman.Tab.AdminLogEvents.js @@ -16,6 +16,7 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ '01bd6a16732dfa2b760dc8566c58afae' :"Download to Excel", '498f79c4c5bbde77f1bceb6c86fd0f6d' :"Show", '037fd50b0e85bb65995ca7125d06c7cd' :"Select Person Table", + '42cf593b947cd3d591fa132742486f89' :"Person ", 'fd7535ce3979bb8547e2c01689db0767' :"Select Person ", '679308a758de538c5f39c4c6cdba6593' :"Select Affects", 'a8929eb5c1553d3f70497f862d25d0ce' :"Select Action", @@ -39,29 +40,34 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ var _this = this; var MODULE = this; return { + region : 'center', + title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'] /* Events */, + xns : Roo, + '|xns' : 'Roo', + xtype : 'NestedLayoutPanel', layout : { + xns : Roo, + '|xns' : 'Roo', + xtype : 'BorderLayout', center : { - '|xns' : 'Roo', xns : Roo, + '|xns' : 'Roo', xtype : 'LayoutRegion' }, south : { - '|xns' : 'Roo', autoScroll : true, height : 150, split : true, xns : Roo, + '|xns' : 'Roo', xtype : 'LayoutRegion' }, - '|xns' : 'Roo', - xns : Roo, - xtype : 'BorderLayout', - items : [ + items : [ { - '|xns' : 'Roo', fitToFrame : true, region : 'south', xns : Roo, + '|xns' : 'Roo', xtype : 'ContentPanel', listeners : { render : function (_self) @@ -71,228 +77,52 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ } }, { - grid : { - sm : { - '|xns' : 'Roo.grid', - singleSelect : true, - xns : Roo.grid, - xtype : 'RowSelectionModel', - listeners : { - afterselectionchange : function (_self) - { - // load detail log in _this.viewPanel; - if (!this.getSelected()) { - this.viewPanel.setContent("Nothing Selected"); - return; - } - var id = this.getSelected().data.id; - _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" }); - - } + background : false, + fitContainer : true, + fitToframe : true, + region : 'center', + tableName : 'Events', + title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'] /* Events */, + xns : Roo, + '|xns' : 'Roo', + xtype : 'GridPanel', + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } } - }, - dataSource : { - reader : { - '|xns' : 'Roo.data', - fields : [ - { - 'name': 'id', - 'type': 'int' - }, - { - 'name': 'person_name', - 'type': 'string' - }, - { - 'name': 'event_when', - 'type': 'date', - 'dateFormat': 'Y-m-d' - }, - { - 'name': 'action', - 'type': 'string' - }, - { - 'name': 'ipaddr', - 'type': 'string' - }, - { - 'name': 'on_id', - 'type': 'int' - }, - { - 'name': 'on_table', - 'type': 'string' - }, - { - 'name': 'person_id', - 'type': 'int' - }, - { - 'name': 'remarks', - 'type': 'string' - }, - { - 'name': 'person_id_id', - 'type': 'int' - }, - { - 'name': 'person_id_office_id', - 'type': 'int' - }, - { - 'name': 'person_id_name', - 'type': 'string' - }, - { - 'name': 'person_id_phone', - 'type': 'string' - }, - { - 'name': 'person_id_fax', - 'type': 'string' - }, - { - 'name': 'person_id_email', - 'type': 'string' - }, - { - 'name': 'person_id_company_id', - 'type': 'int' - }, - { - 'name': 'person_id_role', - 'type': 'string' - }, - { - 'name': 'person_id_active', - 'type': 'int' - }, - { - 'name': 'person_id_remarks', - 'type': 'string' - }, - { - 'name': 'person_id_passwd', - 'type': 'string' - }, - { - 'name': 'person_id_owner_id', - 'type': 'int' - }, - { - 'name': 'person_id_lang', - 'type': 'string' - }, - { - 'name': 'person_id_no_reset_sent', - 'type': 'int' - }, - { - 'name': 'person_id_action_type', - 'type': 'string' - }, - { - 'name': 'person_id_project_id', - 'type': 'int' - }, - { - 'name': 'person_id_deleted_by', - 'type': 'int' - }, - { - 'name': 'person_id_deleted_dt', - 'type': 'date' + }, + grid : { + autoExpandColumn : 'remarks', + loadMask : true, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'Grid', + listeners : { + render : function () + { + _this.grid = this; + //_this.dialog = Pman.Dialog.FILL_IN + if (_this.panel.active) { + this.footer.onClick('first'); } - ], - id : 'id', - root : 'data', - totalProperty : 'total', - xns : Roo.data, - xtype : 'JsonReader' - }, - proxy : { - '|xns' : 'Roo.data', - method : 'GET', - url : baseURL + '/Roo/Events.php', - xns : Roo.data, - xtype : 'HttpProxy' - }, - '|xns' : 'Roo.data', - remoteSort : true, - sortInfo : { field: 'event_when', direction: 'DESC'}, - xns : Roo.data, - xtype : 'Store', - listeners : { - beforeload : function (_self, o) - { - if (!Pman.buildCompleted) { - return false; - } - - - if (! _this.personSel) { - return false; - } - o.params = o.params || {}; - o.params.person_id = _this.personSel.getValue(); - o.params.person_table = _this.tableSel.getValue(); - var act = _this.actionSel.getValue(); - if (act.length) { - o.params.action = act; - } - var tbl = _this.affectSel.getValue(); - if (tbl.length) { - o.params.on_table = tbl; - } - act = _this.dateFrom.getValue(); - if (act.format) { - o.params['query[from]'] = act.format('Y-m-d'); - } - act = _this.dateTo.getValue(); - if (act.format) { - o.params['query[to]'] = act.format('Y-m-d'); - } - - - /* - act = _this.groupedCombo.getValue(); - o.params['query[grouped]'] = act; - if (o.params['query[grouped]'] == 'gr') { - - if (!tbl.length) { - Roo.MessageBox.alert("Error", "Select a table to group results on"); - return false; - } - // o.params['_columns'] = - o.params['_distinct'] = 'on_id'; - - - } - - */ - - - } - }, - items : [ - - ] - + } }, footer : { - '|xns' : 'Roo', displayInfo : true, - displayMsg : _this._strings['2ea72778ebaacc973260c88837dd7a2f'], - emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'], + displayMsg : _this._strings['2ea72778ebaacc973260c88837dd7a2f'] /* Displaying Events {0} - {1} of {2} */, + emptyMsg : _this._strings['90e4ac2e5a22e53df63b6b186d8727ba'] /* No Events found */, pageSize : 25, xns : Roo, + '|xns' : 'Roo', xtype : 'PagingToolbar', - items : [ + items : [ { - '|xns' : 'Roo.Toolbar', - text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'], + text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */, xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar', xtype : 'Button', listeners : { click : function (_self, e) @@ -342,50 +172,31 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ } } ] - }, toolbar : { - '|xns' : 'Roo', xns : Roo, + '|xns' : 'Roo', xtype : 'Toolbar', - items : [ + items : [ { - '|xns' : 'Roo.Toolbar', - text : _this._strings['498f79c4c5bbde77f1bceb6c86fd0f6d'], + text : _this._strings['498f79c4c5bbde77f1bceb6c86fd0f6d'] /* Show */, xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar', xtype : 'TextItem' }, { - store : { - '|xns' : 'Roo.data', - data : (function() { - - if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){ - - return []; - } - - return uiConfig.events_person_table; - - })(), - fields : [ 'value' ], - isLocal : true, - xns : Roo.data, - xtype : 'SimpleStore' - }, - '|xns' : 'Roo.form', allowBlank : true, alwaysQuery : true, displayField : 'value', editable : false, - emptyText : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'], + emptyText : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'] /* Select Person Table */, forceSelection : true, listWidth : 300, - loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'], + loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */, minChars : 2, name : 'person_table', pageSize : 20, - qtip : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'], + qtip : _this._strings['037fd50b0e85bb65995ca7125d06c7cd'] /* Select Person Table */, selectOnFocus : true, tpl : '
{value}
', triggerAction : 'all', @@ -393,6 +204,7 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ valueField : 'value', width : 150, xns : Roo.form, + '|xns' : 'Roo.form', xtype : 'ComboBox', listeners : { render : function (_self) @@ -413,22 +225,79 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ _this.grid.footer.onClick('first'); } }, - items : [ - - ] - + store : { + data : (function() { + + if(typeof(uiConfig) == 'undefined' || typeof(uiConfig.events_person_table) == 'undefined' || !uiConfig.events_person_table.length){ + + return []; + } + + return uiConfig.events_person_table; + + })(), + fields : [ 'value' ], + isLocal : true, + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'SimpleStore' + } }, { + allowBlank : true, + displayField : 'name', + editable : true, + emptyText : _this._strings['fd7535ce3979bb8547e2c01689db0767'] /* Select Person */, + fieldLabel : _this._strings['42cf593b947cd3d591fa132742486f89'] /* Person */, + forceSelection : true, + listWidth : 600, + loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */, + minChars : 2, + name : 'person_id_name', + pageSize : 20, + qtip : _this._strings['fd7535ce3979bb8547e2c01689db0767'] /* Select Person */, + queryParam : 'query[name]', + selectOnFocus : true, + tpl : '
{name} ({company_id_name}) <{email}>
', + triggerAction : 'all', + typeAhead : true, + valueField : 'id', + width : 150, + xns : Roo.form, + '|xns' : 'Roo.form', + xtype : 'ComboBox', + listeners : { + render : function (_self) + { + _this.personSel = _self; + }, + select : function (combo, record, index) + { + _this.grid.footer.onClick('first'); + + } + }, store : { + remoteSort : true, + sortInfo : { field : 'name' , direction : 'ASC' }, + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'Store', + listeners : { + beforeload : function (_self, o) + { + o.params = o.params || {}; + o.params.company_id = Pman.Login.authUser.company_id; + } + }, proxy : { - '|xns' : 'Roo.data', method : 'GET', url : baseURL + '/Roo/Person.php', xns : Roo.data, + '|xns' : 'Roo.data', xtype : 'HttpProxy' }, reader : { - '|xns' : 'Roo.data', fields : [ { 'name': 'id', @@ -768,74 +637,69 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ root : 'data', totalProperty : 'total', xns : Roo.data, + '|xns' : 'Roo.data', xtype : 'JsonReader' - }, - '|xns' : 'Roo.data', - remoteSort : true, - sortInfo : { field : 'name' , direction : 'ASC' }, - xns : Roo.data, - xtype : 'Store', - listeners : { - beforeload : function (_self, o) - { - o.params = o.params || {}; - o.params.company_id = Pman.Login.authUser.company_id; - } - }, - items : [ - - ] - - }, - '|xns' : 'Roo.form', + } + } + }, + { allowBlank : true, - displayField : 'name', + displayField : 'action', editable : true, - emptyText : _this._strings['fd7535ce3979bb8547e2c01689db0767'], - fieldLabel : 'Person ', + emptyText : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */, forceSelection : true, - listWidth : 600, - loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'], + listWidth : 300, + loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */, minChars : 2, - name : 'person_id_name', + name : 'action', pageSize : 20, - qtip : _this._strings['fd7535ce3979bb8547e2c01689db0767'], - queryParam : 'query[name]', + qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */, + queryParam : 'query[action]', selectOnFocus : true, - tpl : '
{name} ({company_id_name}) <{email}>
', + tpl : '
{action}
', triggerAction : 'all', typeAhead : true, - valueField : 'id', + valueField : 'action', width : 150, xns : Roo.form, + '|xns' : 'Roo.form', xtype : 'ComboBox', listeners : { render : function (_self) { - _this.personSel = _self; + _this.actionSel = _self; }, select : function (combo, record, index) { _this.grid.footer.onClick('first'); - } }, - items : [ - - ] - - }, - { store : { + remoteSort : true, + sortInfo : { field : 'action' , direction : 'ASC' }, + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'Store', + listeners : { + beforeload : function (_self, o) + { + o.params = o.params || {}; + // staff can see all logs, other companies can only see their own. + if (Pman.Login.authUser.company_id_comptype != 'OWNER') { + o.params.company_id = Pman.Login.authUser.company_id; + } + o.params._distinct = 'action'; + o.params._columns ='action'; + } + }, proxy : { - '|xns' : 'Roo.data', method : 'GET', url : baseURL + '/Roo/Events.php', xns : Roo.data, + '|xns' : 'Roo.data', xtype : 'HttpProxy' }, reader : { - '|xns' : 'Roo.data', fields : [ { 'name': 'id', @@ -951,77 +815,73 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ root : 'data', totalProperty : 'total', xns : Roo.data, + '|xns' : 'Roo.data', xtype : 'JsonReader' - }, - '|xns' : 'Roo.data', - remoteSort : true, - sortInfo : { field : 'action' , direction : 'ASC' }, - xns : Roo.data, - xtype : 'Store', - listeners : { - beforeload : function (_self, o) - { - o.params = o.params || {}; - // staff can see all logs, other companies can only see their own. - if (Pman.Login.authUser.company_id_comptype != 'OWNER') { - o.params.company_id = Pman.Login.authUser.company_id; - } - o.params._distinct = 'action'; - o.params._columns ='action'; - } - }, - items : [ - - ] - - }, - '|xns' : 'Roo.form', + } + } + }, + { allowBlank : true, - displayField : 'action', + displayField : 'on_table', editable : true, - emptyText : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'], + emptyText : _this._strings['679308a758de538c5f39c4c6cdba6593'] /* Select Affects */, forceSelection : true, listWidth : 300, - loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'], + loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'] /* Searching... */, minChars : 2, - name : 'action', + name : 'on_table', pageSize : 20, - qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'], - queryParam : 'query[action]', + qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'] /* Select Action */, + queryParam : 'query[on_table]', selectOnFocus : true, - tpl : '
{action}
', + tpl : '
{on_table}
', triggerAction : 'all', typeAhead : true, valueField : 'action', width : 150, xns : Roo.form, + '|xns' : 'Roo.form', xtype : 'ComboBox', listeners : { render : function (_self) { - _this.actionSel = _self; + _this.affectSel = _self; + + if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){ + this.hide(); + } }, select : function (combo, record, index) { _this.grid.footer.onClick('first'); } }, - items : [ - - ] - - }, - { store : { + remoteSort : true, + sortInfo : { field : 'on_table' , direction : 'ASC' }, + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'Store', + listeners : { + beforeload : function (_self, o) + { + o.params = o.params || {}; + // staff can see all logs, other companies can only see their own. + if (Pman.Login.authUser.company_id_comptype != 'OWNER') { + o.params.company_id = Pman.Login.authUser.company_id; + } + o.params._distinct = 'on_table'; + o.params._columns ='on_table'; + } + }, proxy : { - '|xns' : 'Roo.data', method : 'GET', url : baseURL + '/Roo/Events.php', xns : Roo.data, + '|xns' : 'Roo.data', xtype : 'HttpProxy' }, reader : { - '|xns' : 'Roo.data', fields : [ { 'name': 'id', @@ -1137,80 +997,21 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ root : 'data', totalProperty : 'total', xns : Roo.data, + '|xns' : 'Roo.data', xtype : 'JsonReader' - }, - '|xns' : 'Roo.data', - remoteSort : true, - sortInfo : { field : 'on_table' , direction : 'ASC' }, - xns : Roo.data, - xtype : 'Store', - listeners : { - beforeload : function (_self, o) - { - o.params = o.params || {}; - // staff can see all logs, other companies can only see their own. - if (Pman.Login.authUser.company_id_comptype != 'OWNER') { - o.params.company_id = Pman.Login.authUser.company_id; - } - o.params._distinct = 'on_table'; - o.params._columns ='on_table'; - } - }, - items : [ - - ] - - }, + } + } + }, + { + text : _this._strings['39b9e051f9fe75e65c7a330bb00499d4'] /* Date Range */, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar', + xtype : 'TextItem' + }, + { + format : 'Y-m-d', + xns : Roo.form, '|xns' : 'Roo.form', - allowBlank : true, - displayField : 'on_table', - editable : true, - emptyText : _this._strings['679308a758de538c5f39c4c6cdba6593'], - forceSelection : true, - listWidth : 300, - loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'], - minChars : 2, - name : 'on_table', - pageSize : 20, - qtip : _this._strings['a8929eb5c1553d3f70497f862d25d0ce'], - queryParam : 'query[on_table]', - selectOnFocus : true, - tpl : '
{on_table}
', - triggerAction : 'all', - typeAhead : true, - valueField : 'action', - width : 150, - xns : Roo.form, - xtype : 'ComboBox', - listeners : { - render : function (_self) - { - _this.affectSel = _self; - - if(!Pman.hasPerm('Admin.Logs_Affects', 'S')){ - this.hide(); - } - }, - select : function (combo, record, index) - { - _this.grid.footer.onClick('first'); - } - }, - items : [ - - ] - - }, - { - '|xns' : 'Roo.Toolbar', - text : _this._strings['39b9e051f9fe75e65c7a330bb00499d4'], - xns : Roo.Toolbar, - xtype : 'TextItem' - }, - { - '|xns' : 'Roo.form', - format : 'Y-m-d', - xns : Roo.form, xtype : 'DateField', listeners : { change : function (_self, newValue, oldValue) @@ -1224,9 +1025,9 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ } }, { - '|xns' : 'Roo.form', format : 'Y-m-d', xns : Roo.form, + '|xns' : 'Roo.form', xtype : 'DateField', listeners : { change : function (_self, newValue, oldValue) @@ -1240,150 +1041,303 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ } } ] - }, - '|xns' : 'Roo.grid', - autoExpandColumn : 'remarks', - loadMask : true, - xns : Roo.grid, - xtype : 'Grid', - colModel : [ - { - '|xns' : 'Roo.grid', - dataIndex : 'event_when', - header : _this._strings['4e97aeeaa8b15ca1180fcd1f3ac478d1'], - renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }, - width : 100, - xns : Roo.grid, - xtype : 'ColumnModel' - }, -{ - '|xns' : 'Roo.grid', - dataIndex : 'id', - header : _this._strings['1b7f7d24575cdbfadb83b9587fa1bf97'], - width : 100, - xns : Roo.grid, - xtype : 'ColumnModel' - }, -{ - '|xns' : 'Roo.grid', - dataIndex : 'person_id_name', - header : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'], - renderer : function(v,x,r) { - - var ptable = _this.tableSel.getValue(); + dataSource : { + remoteSort : true, + sortInfo : { field: 'event_when', direction: 'DESC'}, + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'Store', + listeners : { + beforeload : function (_self, o) + { + if (!Pman.buildCompleted) { + return false; + } + + + if (! _this.personSel) { + return false; + } + o.params = o.params || {}; + o.params.person_id = _this.personSel.getValue(); + o.params.person_table = _this.tableSel.getValue(); + var act = _this.actionSel.getValue(); + if (act.length) { + o.params.action = act; + } + var tbl = _this.affectSel.getValue(); + if (tbl.length) { + o.params.on_table = tbl; + } + act = _this.dateFrom.getValue(); + if (act.format) { + o.params['query[from]'] = act.format('Y-m-d'); + } + act = _this.dateTo.getValue(); + if (act.format) { + o.params['query[to]'] = act.format('Y-m-d'); + } + - var efield = 'person_id_email'; - var nfield = 'person_id_name'; + /* + act = _this.groupedCombo.getValue(); + o.params['query[grouped]'] = act; + if (o.params['query[grouped]'] == 'gr') { - if( - ptable.length && - ptable != 'Person' && - typeof(r.data[ptable + '_id_email']) != 'undefined' && - typeof(r.data[ptable + '_id_name']) != 'undefined' - ){ - efield = ptable + '_id_email'; - nfield = ptable + '_id_name'; + if (!tbl.length) { + Roo.MessageBox.alert("Error", "Select a table to group results on"); + return false; + } + // o.params['_columns'] = + o.params['_distinct'] = 'on_id'; + + } - var email = r.data[efield]; // ? r.data.person_id_email : r.data.person_id_email; - var name = r.data[nfield]; // ? r.data.person_id_name : r.data.person_id_name; - return String.format('{0} <{1}>', - name, email); - + */ - }, - width : 150, - xns : Roo.grid, - xtype : 'ColumnModel' - }, -{ - '|xns' : 'Roo.grid', - dataIndex : 'action', - header : _this._strings['004bf6c9a40003140292e97330236c53'], - renderer : function(v) { return String.format('{0}', v); }, - width : 100, - xns : Roo.grid, - xtype : 'ColumnModel' - }, -{ - '|xns' : 'Roo.grid', - dataIndex : 'ipaddr', - header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'], - renderer : function(v) { return String.format('{0}', v); }, - width : 100, - xns : Roo.grid, - xtype : 'ColumnModel' - }, -{ - '|xns' : 'Roo.grid', - dataIndex : 'on_table', - header : _this._strings['2c92a9a6a5dbf570825e62eabcdecd8d'], - renderer : function(v, x, r) { - return v ? String.format('{0}({1})', v, r.data.on_id) : ''; + + } + }, + proxy : { + method : 'GET', + url : baseURL + '/Roo/Events.php', + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'HttpProxy' + }, + reader : { + fields : [ + { + 'name': 'id', + 'type': 'int' }, - width : 100, - xns : Roo.grid, - xtype : 'ColumnModel' - }, -{ - '|xns' : 'Roo.grid', - dataIndex : 'remarks', - header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'], - renderer : function(v) { return String.format('{0}', v, Roo.util.Format.htmlEncode(v)); }, - width : 300, - xns : Roo.grid, - xtype : 'ColumnModel' - } - ], - listeners : { - render : function () - { - _this.grid = this; - //_this.dialog = Pman.Dialog.FILL_IN - if (_this.panel.active) { - this.footer.onClick('first'); + { + 'name': 'person_name', + 'type': 'string' + }, + { + 'name': 'event_when', + 'type': 'date', + 'dateFormat': 'Y-m-d' + }, + { + 'name': 'action', + 'type': 'string' + }, + { + 'name': 'ipaddr', + 'type': 'string' + }, + { + 'name': 'on_id', + 'type': 'int' + }, + { + 'name': 'on_table', + 'type': 'string' + }, + { + 'name': 'person_id', + 'type': 'int' + }, + { + 'name': 'remarks', + 'type': 'string' + }, + { + 'name': 'person_id_id', + 'type': 'int' + }, + { + 'name': 'person_id_office_id', + 'type': 'int' + }, + { + 'name': 'person_id_name', + 'type': 'string' + }, + { + 'name': 'person_id_phone', + 'type': 'string' + }, + { + 'name': 'person_id_fax', + 'type': 'string' + }, + { + 'name': 'person_id_email', + 'type': 'string' + }, + { + 'name': 'person_id_company_id', + 'type': 'int' + }, + { + 'name': 'person_id_role', + 'type': 'string' + }, + { + 'name': 'person_id_active', + 'type': 'int' + }, + { + 'name': 'person_id_remarks', + 'type': 'string' + }, + { + 'name': 'person_id_passwd', + 'type': 'string' + }, + { + 'name': 'person_id_owner_id', + 'type': 'int' + }, + { + 'name': 'person_id_lang', + 'type': 'string' + }, + { + 'name': 'person_id_no_reset_sent', + 'type': 'int' + }, + { + 'name': 'person_id_action_type', + 'type': 'string' + }, + { + 'name': 'person_id_project_id', + 'type': 'int' + }, + { + 'name': 'person_id_deleted_by', + 'type': 'int' + }, + { + 'name': 'person_id_deleted_dt', + 'type': 'date' } - } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + '|xns' : 'Roo.data', + xtype : 'JsonReader' + } }, - items : [ - - ] - - }, - '|xns' : 'Roo', - background : false, - fitContainer : true, - fitToframe : true, - region : 'center', - tableName : 'Events', - title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'], - xns : Roo, - xtype : 'GridPanel', - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - _this.grid.footer.onClick('first'); - } + sm : { + singleSelect : true, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'RowSelectionModel', + listeners : { + afterselectionchange : function (_self) + { + // load detail log in _this.viewPanel; + if (!this.getSelected()) { + this.viewPanel.setContent("Nothing Selected"); + return; + } + var id = this.getSelected().data.id; + _this.viewPanel.load( { url : baseURL + "/Admin/EventView/" + id + ".html" }); + + } } - }, - items : [ - - ] - + }, + colModel : [ + { + dataIndex : 'event_when', + header : _this._strings['4e97aeeaa8b15ca1180fcd1f3ac478d1'] /* When */, + renderer : function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + }, + { + dataIndex : 'id', + header : _this._strings['1b7f7d24575cdbfadb83b9587fa1bf97'] /* #id */, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + }, + { + dataIndex : 'person_id_name', + header : _this._strings['40bed7cf9b3d4bb3a3d7a7e3eb18c5eb'] /* Person */, + renderer : function(v,x,r) { + + var ptable = _this.tableSel.getValue(); + + var efield = 'person_id_email'; + var nfield = 'person_id_name'; + + if( + ptable.length && + ptable != 'Person' && + typeof(r.data[ptable + '_id_email']) != 'undefined' && + typeof(r.data[ptable + '_id_name']) != 'undefined' + ){ + efield = ptable + '_id_email'; + nfield = ptable + '_id_name'; + } + + var email = r.data[efield]; // ? r.data.person_id_email : r.data.person_id_email; + var name = r.data[nfield]; // ? r.data.person_id_name : r.data.person_id_name; + return String.format('{0} <{1}>', + name, email); + + + }, + width : 150, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + }, + { + dataIndex : 'action', + header : _this._strings['004bf6c9a40003140292e97330236c53'] /* Action */, + renderer : function(v) { return String.format('{0}', v); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + }, + { + dataIndex : 'ipaddr', + header : _this._strings['a12a3079e14ced46e69ba52b8a90b21a'] /* IP */, + renderer : function(v) { return String.format('{0}', v); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + }, + { + dataIndex : 'on_table', + header : _this._strings['2c92a9a6a5dbf570825e62eabcdecd8d'] /* Affected */, + renderer : function(v, x, r) { + return v ? String.format('{0}({1})', v, r.data.on_id) : ''; + }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + }, + { + dataIndex : 'remarks', + header : _this._strings['231bc72756b5e6de492aaaa1577f61b1'] /* Remarks */, + renderer : function(v) { return String.format('{0}', v, Roo.util.Format.htmlEncode(v)); }, + width : 300, + xns : Roo.grid, + '|xns' : 'Roo.grid', + xtype : 'ColumnModel' + } + ] + } } ] - - }, - '|xns' : 'Roo', - region : 'center', - title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'], - xns : Roo, - xtype : 'NestedLayoutPanel', - items : [ - - ] - + } }; } }); -- 2.39.2