From 335b13a19fe675e1186270e6cc5daf46cf78b2be Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 6 Jul 2015 11:46:33 +0800 Subject: [PATCH] Pman.Tab.AdminLogEvents.bjs Pman.Tab.AdminLogEvents.js --- Pman.Tab.AdminLogEvents.bjs | 34 ++++++++++++++---------- Pman.Tab.AdminLogEvents.js | 52 +++++++++++++++++++++++++++++++++++++ 2 files changed, 73 insertions(+), 13 deletions(-) diff --git a/Pman.Tab.AdminLogEvents.bjs b/Pman.Tab.AdminLogEvents.bjs index bf443e6..50c5a07 100644 --- a/Pman.Tab.AdminLogEvents.bjs +++ b/Pman.Tab.AdminLogEvents.bjs @@ -29,8 +29,8 @@ "items" : [ { "region" : "center", - "xtype" : "NestedLayoutPanel", "title" : "Events", + "xtype" : "NestedLayoutPanel", "$ xns" : "Roo", "items" : [ { @@ -64,9 +64,9 @@ "listeners" : { "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" }, + "region" : "center", "fitToframe" : true, "background" : false, - "region" : "center", "title" : "Events", "xtype" : "GridPanel", "fitContainer" : true, @@ -113,8 +113,8 @@ }, { "$ url" : "baseURL + '/Roo/Events.php'", - "method" : "GET", "xtype" : "HttpProxy", + "method" : "GET", "$ xns" : "Roo.data", "* prop" : "proxy" } @@ -129,6 +129,14 @@ "displayMsg" : "Displaying Events {0} - {1} of {2}", "* prop" : "footer", "items" : [ + { + "listeners" : { + "click" : "function (_self, e)\n{\n \n var params = {\n 'sort' : 'event_when',\n 'dir' : 'DESC',\n 'start' : 0,\n 'limit' : 900,\n person_id : _this.personSel.getValue(), \n 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when', \n 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name', \n 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action', \n 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' ,\n 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table',\n 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks' \n }\n \n params.person_id = _this.personSel.getValue();\n var act = _this.actionSel.getValue();\n if (act.length) {\n params.action = act;\n }\n var tbl = _this.affectSel.getValue();\n if (tbl.length) {\n params.on_table = tbl;\n }\n act = _this.dateFrom.getValue();\n if (act.format) {\n params['query[from]'] = act.format('Y-m-d');\n }\n act = _this.dateTo.getValue();\n if (act.format) {\n params['query[to]'] = act.format('Y-m-d');\n }\n params.limit = 9999;\n \n\n new Pman.download({\n url : baseURL + '/Roo/Events.php',\n params : params ,\n newWindow: true\n \n });\n}" + }, + "text" : "Download to Excel", + "xtype" : "Button", + "$ xns" : "Roo.Toolbar" + }, { "listeners" : { "click" : "function (_self, e)\n{\n \n var params = {\n 'sort' : 'event_when',\n 'dir' : 'DESC',\n 'start' : 0,\n 'limit' : 900,\n person_id : _this.personSel.getValue(), \n 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when', \n 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name', \n 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action', \n 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' ,\n 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table',\n 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks' \n }\n \n params.person_id = _this.personSel.getValue();\n var act = _this.actionSel.getValue();\n if (act.length) {\n params.action = act;\n }\n var tbl = _this.affectSel.getValue();\n if (tbl.length) {\n params.on_table = tbl;\n }\n act = _this.dateFrom.getValue();\n if (act.format) {\n params['query[from]'] = act.format('Y-m-d');\n }\n act = _this.dateTo.getValue();\n if (act.format) {\n params['query[to]'] = act.format('Y-m-d');\n }\n params.limit = 9999;\n \n\n new Pman.download({\n url : baseURL + '/Roo/Events.php',\n params : params ,\n newWindow: true\n \n });\n}" @@ -224,8 +232,8 @@ "items" : [ { "$ url" : "baseURL + '/Roo/Person.php'", - "xtype" : "HttpProxy", "method" : "GET", + "xtype" : "HttpProxy", "$ xns" : "Roo.data", "* prop" : "proxy" }, @@ -280,8 +288,8 @@ "items" : [ { "$ url" : "baseURL + '/Roo/Events.php'", - "xtype" : "HttpProxy", "method" : "GET", + "xtype" : "HttpProxy", "$ xns" : "Roo.data", "* prop" : "proxy" }, @@ -336,8 +344,8 @@ "items" : [ { "$ url" : "baseURL + '/Roo/Events.php'", - "xtype" : "HttpProxy", "method" : "GET", + "xtype" : "HttpProxy", "$ xns" : "Roo.data", "* prop" : "proxy" }, @@ -381,8 +389,8 @@ }, { "xtype" : "ColumnModel", - "header" : "When", "width" : 100, + "header" : "When", "$ renderer" : "function(v) { return v ? v.dateFormat('d/m/Y H:i') : ''; }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -390,16 +398,16 @@ }, { "xtype" : "ColumnModel", - "header" : "#id", "width" : 100, + "header" : "#id", "$ xns" : "Roo.grid", "* prop" : "colModel[]", "dataIndex" : "id" }, { "xtype" : "ColumnModel", - "header" : "Person", "width" : 150, + "header" : "Person", "$ 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[]", @@ -407,8 +415,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "Action", + "width" : 100, "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -416,8 +424,8 @@ }, { "xtype" : "ColumnModel", - "width" : 100, "header" : "IP", + "width" : 100, "$ renderer" : "function(v) { return String.format('{0}', v); }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -425,8 +433,8 @@ }, { "xtype" : "ColumnModel", - "header" : "Affected", "width" : 100, + "header" : "Affected", "$ renderer" : "function(v, x, r) { \n return v ? String.format('{0}({1})', v, r.data.on_id) : ''; \n }", "$ xns" : "Roo.grid", "* prop" : "colModel[]", @@ -434,8 +442,8 @@ }, { "xtype" : "ColumnModel", - "header" : "Remarks", "width" : 300, + "header" : "Remarks", "$ 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 d66e9d0..85a9e84 100644 --- a/Pman.Tab.AdminLogEvents.js +++ b/Pman.Tab.AdminLogEvents.js @@ -162,6 +162,58 @@ Pman.Tab.AdminLogEvents = new Roo.XComponent({ params.limit = 9999; + new Pman.download({ + url : baseURL + '/Roo/Events.php', + params : params , + newWindow: true + + }); + } + } + }, + { + text : _this._strings['01bd6a16732dfa2b760dc8566c58afae'] /* Download to Excel */, + xns : Roo.Toolbar, + '|xns' : 'Roo.Toolbar', + xtype : 'Button', + listeners : { + click : function (_self, e) + { + + var params = { + 'sort' : 'event_when', + 'dir' : 'DESC', + 'start' : 0, + 'limit' : 900, + person_id : _this.personSel.getValue(), + 'csvTitles[0]' : 'When', 'csvCols[0]' : 'event_when', + 'csvTitles[1]' : 'Staff', 'csvCols[1]' : 'person_id_name', + 'csvTitles[2]' : 'Action', 'csvCols[2]' : 'action', + 'csvTitles[3]' : 'Record ID', 'csvCols[3]' : 'on_id' , + 'csvTitles[4]' : 'Record Type', 'csvCols[4]' : 'on_table', + 'csvTitles[5]' : 'Remarks', 'csvCols[5]' : 'remarks' + } + + params.person_id = _this.personSel.getValue(); + var act = _this.actionSel.getValue(); + if (act.length) { + params.action = act; + } + var tbl = _this.affectSel.getValue(); + if (tbl.length) { + params.on_table = tbl; + } + act = _this.dateFrom.getValue(); + if (act.format) { + params['query[from]'] = act.format('Y-m-d'); + } + act = _this.dateTo.getValue(); + if (act.format) { + params['query[to]'] = act.format('Y-m-d'); + } + params.limit = 9999; + + new Pman.download({ url : baseURL + '/Roo/Events.php', params : params , -- 2.39.2