From 3e86bad55a7bde1920a17e86253bd41740f5928d Mon Sep 17 00:00:00 2001 From: Edward Date: Wed, 11 Feb 2015 13:46:25 +0800 Subject: [PATCH] Pman.Tab.AdminNotify.bjs Pman.Tab.AdminNotify.js --- Pman.Tab.AdminNotify.bjs | 373 ++++++++++++++------------- Pman.Tab.AdminNotify.js | 541 +++++++++++++++++++++------------------ 2 files changed, 479 insertions(+), 435 deletions(-) diff --git a/Pman.Tab.AdminNotify.bjs b/Pman.Tab.AdminNotify.bjs index 7990061..cca5c3b 100644 --- a/Pman.Tab.AdminNotify.bjs +++ b/Pman.Tab.AdminNotify.bjs @@ -1,248 +1,247 @@ { - "id": "roo-file-255", - "name": "Pman.Tab.AdminNotify", - "parent": "Pman.Tab.AdminWatchNotify", - "title": "Pman.Tab.AdminNotify", - "path": "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminNotify.bjs", - "items": [ + "name" : "Pman.Tab.AdminNotify", + "parent" : "Pman.Tab.AdminWatchNotify", + "title" : "Pman.Tab.AdminNotify", + "path" : "/home/edward/gitlive/Pman.Admin/Pman.Tab.AdminNotify.bjs", + "permname" : "", + "modOrder" : "001", + "items" : [ { - "listeners": { - "|activate": "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n \n}" + "listeners" : { + "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n \n}" }, - "background": true, - "fitContainer": true, - "fitToframe": true, - "region": "center", - "tableName": "core_notify", - "title": "Current Notifications", - "xtype": "GridPanel", - "|xns": "Roo", - "items": [ + "fitToframe" : true, + "background" : true, + "region" : "center", + "title" : "Current Notifications", + "xtype" : "GridPanel", + "fitContainer" : true, + "$ xns" : "Roo", + "tableName" : "core_notify", + "items" : [ { - "listeners": { - "|render": "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}", - "|rowdblclick": "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n" + "listeners" : { + "|rowdblclick" : "function (_self, rowIndex, e)\n{\n if (!_this.dialog) return;\n _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n _this.grid.footer.onClick('first');\n }); \n}\n", + "|render" : "function() \n{\n _this.grid = this; \n //_this.dialog = Pman.Dialog.FILL_IN\n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}" }, - "*prop": "grid", - "autoExpandColumn": "person_id_name", - "loadMask": true, - "xtype": "Grid", - "|xns": "Roo.grid", - "items": [ + "autoExpandColumn" : "person_id_name", + "xtype" : "Grid", + "loadMask" : true, + "$ xns" : "Roo.grid", + "* prop" : "grid", + "items" : [ { - "listeners": { - "beforeload": "function (_self, options)\n{\n if (!_this.toggleBtn.pressed) {\n options.params['event_id'] = 0;\n }\n if (!_this.personCombo) {\n return false;\n }\n var p = _this.personCombo.getValue();\n if (p*1) { \n options.params.person_id = p;\n }\n \n}" + "listeners" : { + "beforeload" : "function (_self, options)\n{\n if (!_this.toggleBtn.pressed) {\n options.params['event_id'] = 0;\n }\n if (!_this.personCombo) {\n return false;\n }\n var p = _this.personCombo.getValue();\n if (p*1) { \n options.params.person_id = p;\n }\n \n}" }, - "*prop": "dataSource", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ field : 'act_when', direction: 'DESC' }", - "|xns": "Roo.data", - "items": [ + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ field : 'act_when', direction: 'DESC' }", + "$ xns" : "Roo.data", + "* prop" : "dataSource", + "items" : [ { - "*prop": "proxy", - "xtype": "HttpProxy", - "method": "GET", - "|url": "baseURL + '/Roo/core_notify.php'", - "|xns": "Roo.data" + "$ url" : "baseURL + '/Roo/core_notify.php'", + "method" : "GET", + "xtype" : "HttpProxy", + "$ xns" : "Roo.data", + "* prop" : "proxy" }, { - "|xns": "Roo.data", - "xtype": "JsonReader", - "totalProperty": "total", - "root": "data", - "*prop": "reader", - "id": "id", - "|fields": "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'act_when',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'onid',\n 'type': 'int'\n },\n {\n 'name': 'ontable',\n 'type': 'string'\n },\n {\n 'name': 'person_id',\n 'type': 'int'\n },\n {\n 'name': 'msgid',\n 'type': 'string'\n },\n {\n 'name': 'sent',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'event_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_office_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_name',\n 'type': 'string'\n },\n {\n 'name': 'person_id_phone',\n 'type': 'string'\n },\n {\n 'name': 'person_id_fax',\n 'type': 'string'\n },\n {\n 'name': 'person_id_email',\n 'type': 'string'\n },\n {\n 'name': 'person_id_company_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_role',\n 'type': 'string'\n },\n {\n 'name': 'person_id_active',\n 'type': 'int'\n },\n {\n 'name': 'person_id_remarks',\n 'type': 'string'\n },\n {\n 'name': 'person_id_passwd',\n 'type': 'string'\n },\n {\n 'name': 'person_id_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_lang',\n 'type': 'string'\n },\n {\n 'name': 'person_id_no_reset_sent',\n 'type': 'int'\n },\n {\n 'name': 'person_id_action_type',\n 'type': 'string'\n },\n {\n 'name': 'person_id_project_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_deleted_by',\n 'type': 'int'\n },\n {\n 'name': 'person_id_deleted_dt',\n 'type': 'date'\n },\n {\n 'name': 'event_id_id',\n 'type': 'int'\n },\n {\n 'name': 'event_id_person_name',\n 'type': 'string'\n },\n {\n 'name': 'event_id_event_when',\n 'type': 'date'\n },\n {\n 'name': 'event_id_action',\n 'type': 'string'\n },\n {\n 'name': 'event_id_ipaddr',\n 'type': 'string'\n },\n {\n 'name': 'event_id_on_id',\n 'type': 'int'\n },\n {\n 'name': 'event_id_on_table',\n 'type': 'string'\n },\n {\n 'name': 'event_id_person_id',\n 'type': 'int'\n },\n {\n 'name': 'event_id_remarks',\n 'type': 'string'\n }\n]" + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ xns" : "Roo.data", + "$ fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'act_when',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'onid',\n 'type': 'int'\n },\n {\n 'name': 'ontable',\n 'type': 'string'\n },\n {\n 'name': 'person_id',\n 'type': 'int'\n },\n {\n 'name': 'msgid',\n 'type': 'string'\n },\n {\n 'name': 'sent',\n 'type': 'date',\n 'dateFormat': 'Y-m-d'\n },\n {\n 'name': 'event_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_office_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_name',\n 'type': 'string'\n },\n {\n 'name': 'person_id_phone',\n 'type': 'string'\n },\n {\n 'name': 'person_id_fax',\n 'type': 'string'\n },\n {\n 'name': 'person_id_email',\n 'type': 'string'\n },\n {\n 'name': 'person_id_company_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_role',\n 'type': 'string'\n },\n {\n 'name': 'person_id_active',\n 'type': 'int'\n },\n {\n 'name': 'person_id_remarks',\n 'type': 'string'\n },\n {\n 'name': 'person_id_passwd',\n 'type': 'string'\n },\n {\n 'name': 'person_id_owner_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_lang',\n 'type': 'string'\n },\n {\n 'name': 'person_id_no_reset_sent',\n 'type': 'int'\n },\n {\n 'name': 'person_id_action_type',\n 'type': 'string'\n },\n {\n 'name': 'person_id_project_id',\n 'type': 'int'\n },\n {\n 'name': 'person_id_deleted_by',\n 'type': 'int'\n },\n {\n 'name': 'person_id_deleted_dt',\n 'type': 'date'\n },\n {\n 'name': 'event_id_id',\n 'type': 'int'\n },\n {\n 'name': 'event_id_person_name',\n 'type': 'string'\n },\n {\n 'name': 'event_id_event_when',\n 'type': 'date'\n },\n {\n 'name': 'event_id_action',\n 'type': 'string'\n },\n {\n 'name': 'event_id_ipaddr',\n 'type': 'string'\n },\n {\n 'name': 'event_id_on_id',\n 'type': 'int'\n },\n {\n 'name': 'event_id_on_table',\n 'type': 'string'\n },\n {\n 'name': 'event_id_person_id',\n 'type': 'int'\n },\n {\n 'name': 'event_id_remarks',\n 'type': 'string'\n }\n]", + "* prop" : "reader", + "totalProperty" : "total" } ] }, { - "*prop": "footer", - "xtype": "PagingToolbar", - "pageSize": 25, - "displayInfo": true, - "displayMsg": "Displaying core_notify{0} - {1} of {2}", - "emptyMsg": "No core_notify found", - "|xns": "Roo" + "pageSize" : 25, + "xtype" : "PagingToolbar", + "emptyMsg" : "No core_notify found", + "$ xns" : "Roo", + "displayInfo" : true, + "displayMsg" : "Displaying core_notify{0} - {1} of {2}", + "* prop" : "footer" }, { - "*prop": "toolbar", - "xtype": "Toolbar", - "|xns": "Roo", - "items": [ + "xtype" : "Toolbar", + "$ xns" : "Roo", + "* prop" : "toolbar", + "items" : [ { - "listeners": { - "select": "function (combo, record, index)\n{\n (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}", - "render": "function (_self)\n{\n _this.personCombo = _self;\n}" + "listeners" : { + "render" : "function (_self)\n{\n _this.personCombo = _self;\n}", + "select" : "function (combo, record, index)\n{\n (function() { _this.grid.footer.onClick('first'); }).defer(100);\n}" }, - "allowBlank": true, - "displayField": "person_id_name", - "editable": true, - "emptyText": "Select person", - "forceSelection": true, - "hiddenName": "id", - "listWidth": 400, - "loadingText": "Searching...", - "minChars": 2, - "name": "name", - "pageSize": 20, - "qtip": "Select core_notify", - "queryParam": "query[person_id_name]", - "selectOnFocus": true, - "tpl": "
{person_id_name} {person_id_email}
", - "triggerAction": "all", - "valueField": "person_id", - "width": 300, - "xtype": "ComboBox", - "|xns": "Roo.form", - "items": [ + "listWidth" : 400, + "triggerAction" : "all", + "forceSelection" : true, + "selectOnFocus" : true, + "pageSize" : 20, + "displayField" : "person_id_name", + "emptyText" : "Select person", + "hiddenName" : "id", + "minChars" : 2, + "valueField" : "person_id", + "xtype" : "ComboBox", + "allowBlank" : true, + "editable" : true, + "width" : 300, + "$ xns" : "Roo.form", + "name" : "name", + "qtip" : "Select core_notify", + "queryParam" : "query[person_id_name]", + "tpl" : "
{person_id_name} {person_id_email}
", + "loadingText" : "Searching...", + "items" : [ { - "listeners": { - "|beforeload": "function (_self, o){\n o.params = o.params || {};\n o.params._distinct='person_id';\n o.params._columns='person_id,person_id_name,person_id_email';\n o.params['!person_id_name'] = '';\n \n // set more here\n}\n" + "listeners" : { + "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n o.params._distinct='person_id';\n o.params._columns='person_id,person_id_name,person_id_email';\n o.params['!person_id_name'] = '';\n \n // set more here\n}\n" }, - "*prop": "store", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ direction : 'ASC', field: 'person_id_name' }", - "|xns": "Roo.data", - "items": [ + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ direction : 'ASC', field: 'person_id_name' }", + "$ xns" : "Roo.data", + "* prop" : "store", + "items" : [ { - "*prop": "proxy", - "xtype": "HttpProxy", - "method": "GET", - "|xns": "Roo.data", - "|url": "baseURL + '/Roo/core_notify.php'" + "$ url" : "baseURL + '/Roo/core_notify.php'", + "method" : "GET", + "xtype" : "HttpProxy", + "$ xns" : "Roo.data", + "* prop" : "proxy" }, { - "*prop": "reader", - "xtype": "JsonReader", - "|xns": "Roo.data", - "id": "id", - "root": "data", - "totalProperty": "total", - "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]" + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ xns" : "Roo.data", + "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]", + "* prop" : "reader", + "totalProperty" : "total" } ] } ] }, { - "|xns": "Roo.Toolbar", - "xtype": "Fill" + "xtype" : "Fill", + "$ xns" : "Roo.Toolbar" }, { - "listeners": { - "|click": "function()\n {\n Pman.genericDelete(_this, 'core_notify'); \n }\n " + "listeners" : { + "|click" : "function()\n {\n Pman.genericDelete(_this, 'core_notify'); \n }\n " }, - "cls": "x-btn-text-icon", - "text": "Delete", - "xtype": "Button", - "|icon": "rootURL + '/Pman/templates/images/trash.gif'", - "|xns": "Roo.Toolbar" + "text" : "Delete", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'", + "$ xns" : "Roo.Toolbar" }, { - "listeners": { - "render": "function (_self)\n{\n _this.toggleBtn = _self;\n}", - "toggle": "function (_self, pressed)\n{\n this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");\n _this.grid.footer.onClick('first');\n}" + "listeners" : { + "toggle" : "function (_self, pressed)\n{\n this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");\n _this.grid.footer.onClick('first');\n}", + "render" : "function (_self)\n{\n _this.toggleBtn = _self;\n}" }, - "enableToggle": true, - "text": "Show Completed", - "xtype": "Button", - "|xns": "Roo.Toolbar" + "text" : "Show Completed", + "enableToggle" : true, + "xtype" : "Button", + "$ xns" : "Roo.Toolbar" } ] }, { - "*prop": "colModel[]", - "dataIndex": "id", - "header": "id#", - "sortable": true, - "width": 50, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v ); }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "sortable" : true, + "header" : "id#", + "width" : 50, + "$ renderer" : "function(v) { return String.format('{0}', v ); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "id" }, { - "*prop": "colModel[]", - "dataIndex": "evtype", - "header": "Method", - "sortable": true, - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v ); }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "sortable" : true, + "header" : "Method", + "width" : 100, + "$ renderer" : "function(v) { return String.format('{0}', v ); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "evtype" }, { - "*prop": "colModel[]", - "dataIndex": "act_when", - "header": "Act when", - "sortable": true, - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "sortable" : true, + "header" : "Act when", + "width" : 100, + "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "act_when" }, { - "*prop": "colModel[]", - "dataIndex": "sent", - "header": "Sent", - "sortable": true, - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) {\n if (r.data.event_id *1 == 0) {\n return '';\n }\n return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');\n }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "sortable" : true, + "header" : "Sent", + "width" : 100, + "$ renderer" : "function(v,x,r) {\n if (r.data.event_id *1 == 0) {\n return '';\n }\n return String.format('{0}', v ? v.format('d/M/Y H:i:s') : '');\n }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "sent" }, { - "*prop": "colModel[]", - "dataIndex": "ontable", - "header": "Ontable", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "header" : "Ontable", + "width" : 100, + "$ renderer" : "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "ontable" }, { - "*prop": "colModel[]", - "dataIndex": "person_id_name", - "header": "Who to notify", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) {\n return String.format('{0} <{1}>', v, r.data.person_id_email); \n }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "header" : "Who to notify", + "width" : 100, + "$ renderer" : "function(v,x,r) {\n return String.format('{0} <{1}>', v, r.data.person_id_email); \n }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "person_id_name" }, { - "*prop": "colModel[]", - "dataIndex": "trigger_event_id", - "header": "Triggered by", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) {\n return String.format(\n '{0} : {1} {2}', \n r.data.trigger_event_id_on_table, \n r.data.trigger_event_id_on_id, \n r.data.trigger_event_id_remarks\n ); \n }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "header" : "Triggered by", + "width" : 100, + "$ renderer" : "function(v,x,r) {\n return String.format(\n '{0} : {1} {2}', \n r.data.trigger_event_id_on_table, \n r.data.trigger_event_id_on_id, \n r.data.trigger_event_id_remarks\n ); \n }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "trigger_event_id" }, { - "xtype": "ColumnModel", - "header": "Msgid", - "width": 200, - "dataIndex": "msgid", - "|renderer": "function(v) { return String.format('{0}', v); }", - "|xns": "Roo.grid", - "*prop": "colModel[]" + "xtype" : "ColumnModel", + "width" : 200, + "header" : "Msgid", + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "msgid" }, { - "*prop": "colModel[]", - "dataIndex": "event_id_remarks", - "header": "Event", - "width": 300, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v); }", - "|xns": "Roo.grid" + "xtype" : "ColumnModel", + "header" : "Event", + "width" : 300, + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "event_id_remarks" } ] } ] } - ], - "permname": "", - "modOrder": "001" + ] } \ No newline at end of file diff --git a/Pman.Tab.AdminNotify.js b/Pman.Tab.AdminNotify.js index cef11c5..a70f067 100644 --- a/Pman.Tab.AdminNotify.js +++ b/Pman.Tab.AdminNotify.js @@ -2,8 +2,10 @@ // Auto generated file - created by app.Builder.js- do not edit directly (at present!) +Roo.namespace('Pman.Tab'); + Pman.Tab.AdminNotify = new Roo.XComponent({ - part : ["Admin","Notify"], + part : ["Admin", "Notify" ], order : '001-Pman.Tab.AdminNotify', region : 'center', parent : 'Pman.Tab.AdminWatchNotify', @@ -15,78 +17,21 @@ Pman.Tab.AdminNotify = new Roo.XComponent({ var _this = this; var MODULE = this; return { - xtype: 'GridPanel', - xns: Roo, - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - _this.grid.footer.onClick('first'); - } - - } - }, - background : true, - fitContainer : true, - fitToframe : true, - region : 'center', - tableName : 'core_notify', - title : "Current Notifications", grid : { - xtype: 'Grid', - xns: Roo.grid, - listeners : { - render : function() - { - _this.grid = this; - //_this.dialog = Pman.Dialog.FILL_IN - if (_this.panel.active) { - this.footer.onClick('first'); - } - }, - rowdblclick : function (_self, rowIndex, e) - { - if (!_this.dialog) return; - _this.dialog.show( this.getDataSource().getAt(rowIndex), function() { - _this.grid.footer.onClick('first'); - }); - } - }, - autoExpandColumn : 'person_id_name', - loadMask : true, dataSource : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, options) - { - if (!_this.toggleBtn.pressed) { - options.params['event_id'] = 0; - } - if (!_this.personCombo) { - return false; - } - var p = _this.personCombo.getValue(); - if (p*1) { - options.params.person_id = p; - } - - } - }, - remoteSort : true, - sortInfo : { field : 'act_when', direction: 'DESC' }, proxy : { - xtype: 'HttpProxy', - xns: Roo.data, + '|xns' : 'Roo.data', + url : baseURL + '/Roo/core_notify.php', method : 'GET', - url : baseURL + '/Roo/core_notify.php' + xtype : 'HttpProxy', + xns : Roo.data }, reader : { - xtype: 'JsonReader', - xns: Roo.data, - totalProperty : 'total', - root : 'data', + '|xns' : 'Roo.data', id : 'id', + root : 'data', + xtype : 'JsonReader', + xns : Roo.data, fields : [ { 'name': 'id', @@ -230,212 +175,312 @@ Pman.Tab.AdminNotify = new Roo.XComponent({ 'name': 'event_id_remarks', 'type': 'string' } - ] - } + ], + totalProperty : 'total' + }, + '|xns' : 'Roo.data', + xtype : 'Store', + remoteSort : true, + sortInfo : { field : 'act_when', direction: 'DESC' }, + xns : Roo.data, + listeners : { + beforeload : function (_self, options) + { + if (!_this.toggleBtn.pressed) { + options.params['event_id'] = 0; + } + if (!_this.personCombo) { + return false; + } + var p = _this.personCombo.getValue(); + if (p*1) { + options.params.person_id = p; + } + + } + }, + items : [ + + ] + }, footer : { - xtype: 'PagingToolbar', - xns: Roo, + '|xns' : 'Roo', pageSize : 25, + xtype : 'PagingToolbar', + emptyMsg : "No core_notify found", + xns : Roo, displayInfo : true, - displayMsg : "Displaying core_notify{0} - {1} of {2}", - emptyMsg : "No core_notify found" + displayMsg : "Displaying core_notify{0} - {1} of {2}" }, toolbar : { - xtype: 'Toolbar', - xns: Roo, + '|xns' : 'Roo', + xtype : 'Toolbar', + xns : Roo, items : [ - { - xtype: 'ComboBox', - xns: Roo.form, - listeners : { - select : function (combo, record, index) - { - (function() { _this.grid.footer.onClick('first'); }).defer(100); + { + store : { + proxy : { + '|xns' : 'Roo.data', + url : baseURL + '/Roo/core_notify.php', + method : 'GET', + xtype : 'HttpProxy', + xns : Roo.data + }, + reader : { + '|xns' : 'Roo.data', + id : 'id', + root : 'data', + xtype : 'JsonReader', + xns : Roo.data, + fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}], + totalProperty : 'total' + }, + '|xns' : 'Roo.data', + xtype : 'Store', + remoteSort : true, + sortInfo : { direction : 'ASC', field: 'person_id_name' }, + xns : Roo.data, + listeners : { + beforeload : function (_self, o){ + o.params = o.params || {}; + o.params._distinct='person_id'; + o.params._columns='person_id,person_id_name,person_id_email'; + o.params['!person_id_name'] = ''; + + // set more here + } }, - render : function (_self) - { - _this.personCombo = _self; - } + items : [ + + ] + }, - allowBlank : true, + '|xns' : 'Roo.form', + listWidth : 400, + triggerAction : 'all', + forceSelection : true, + selectOnFocus : true, + pageSize : 20, displayField : 'person_id_name', - editable : true, emptyText : "Select person", - forceSelection : true, hiddenName : 'id', - listWidth : 400, - loadingText : "Searching...", minChars : 2, + valueField : 'person_id', + xtype : 'ComboBox', + allowBlank : true, + editable : true, + width : 300, + xns : Roo.form, name : 'name', - pageSize : 20, qtip : "Select core_notify", queryParam : 'query[person_id_name]', - selectOnFocus : true, - tpl : '
{person_id_name} {person_id_email}
', - triggerAction : 'all', - valueField : 'person_id', - width : 300, - store : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o){ - o.params = o.params || {}; - o.params._distinct='person_id'; - o.params._columns='person_id,person_id_name,person_id_email'; - o.params['!person_id_name'] = ''; - - // set more here - } - }, - remoteSort : true, - sortInfo : { direction : 'ASC', field: 'person_id_name' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/core_notify.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [{"name":"id","type":"int"},{"name":"ontable","type":"string"}] - } - } + tpl : '
{person_id_name} {person_id_email}
', + loadingText : "Searching...", + listeners : { + render : function (_self) + { + _this.personCombo = _self; + }, + select : function (combo, record, index) + { + (function() { _this.grid.footer.onClick('first'); }).defer(100); + } + }, + items : [ + + ] + }, - { - xtype: 'Fill', - xns: Roo.Toolbar + { + '|xns' : 'Roo.Toolbar', + xtype : 'Fill', + xns : Roo.Toolbar }, - { - xtype: 'Button', - xns: Roo.Toolbar, - listeners : { - click : function() - { - Pman.genericDelete(_this, 'core_notify'); - } - }, - cls : 'x-btn-text-icon', + { + '|xns' : 'Roo.Toolbar', text : "Delete", - icon : rootURL + '/Pman/templates/images/trash.gif' - }, - { - xtype: 'Button', - xns: Roo.Toolbar, + xtype : 'Button', + cls : 'x-btn-text-icon', + icon : rootURL + '/Pman/templates/images/trash.gif', + xns : Roo.Toolbar, listeners : { - render : function (_self) - { - _this.toggleBtn = _self; - }, - toggle : function (_self, pressed) - { - this.setText(pressed ? "Hide Completed" : "Show Completed"); - _this.grid.footer.onClick('first'); - } - }, + click : function() + { + Pman.genericDelete(_this, 'core_notify'); + } + } + }, + { + '|xns' : 'Roo.Toolbar', + text : "Show Completed", enableToggle : true, - text : "Show Completed" + xtype : 'Button', + xns : Roo.Toolbar, + listeners : { + toggle : function (_self, pressed) + { + this.setText(pressed ? "Hide Completed" : "Show Completed"); + _this.grid.footer.onClick('first'); + }, + render : function (_self) + { + _this.toggleBtn = _self; + } + } } ] + }, + '|xns' : 'Roo.grid', + autoExpandColumn : 'person_id_name', + xtype : 'Grid', + loadMask : true, + xns : Roo.grid, colModel : [ - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'id', - header : 'id#', - sortable : true, - width : 50, - renderer : function(v) { return String.format('{0}', v ); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'evtype', - header : 'Method', - sortable : true, - width : 100, - renderer : function(v) { return String.format('{0}', v ); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'act_when', - header : 'Act when', - sortable : true, - width : 100, - renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'sent', - header : 'Sent', - sortable : true, - width : 100, - renderer : function(v,x,r) { - if (r.data.event_id *1 == 0) { - return ''; - } - return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'ontable', - header : 'Ontable', - width : 100, - renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'person_id_name', - header : 'Who to notify', - width : 100, - renderer : function(v,x,r) { - return String.format('{0} <{1}>', v, r.data.person_id_email); - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'trigger_event_id', - header : 'Triggered by', - width : 100, - renderer : function(v,x,r) { - return String.format( - '{0} : {1} {2}', - r.data.trigger_event_id_on_table, - r.data.trigger_event_id_on_id, - r.data.trigger_event_id_remarks - ); - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - header : 'Msgid', - width : 200, - dataIndex : 'msgid', - renderer : function(v) { return String.format('{0}', v); } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'event_id_remarks', - header : 'Event', - width : 300, - renderer : function(v) { return String.format('{0}', v); } - } + { + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + sortable : true, + header : 'id#', + width : 50, + renderer : function(v) { return String.format('{0}', v ); }, + xns : Roo.grid, + dataIndex : 'id' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + sortable : true, + header : 'Method', + width : 100, + renderer : function(v) { return String.format('{0}', v ); }, + xns : Roo.grid, + dataIndex : 'evtype' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + sortable : true, + header : 'Act when', + width : 100, + renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }, + xns : Roo.grid, + dataIndex : 'act_when' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + sortable : true, + header : 'Sent', + width : 100, + renderer : function(v,x,r) { + if (r.data.event_id *1 == 0) { + return ''; + } + return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); + }, + xns : Roo.grid, + dataIndex : 'sent' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + header : 'Ontable', + width : 100, + renderer : function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }, + xns : Roo.grid, + dataIndex : 'ontable' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + header : 'Who to notify', + width : 100, + renderer : function(v,x,r) { + return String.format('{0} <{1}>', v, r.data.person_id_email); + }, + xns : Roo.grid, + dataIndex : 'person_id_name' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + header : 'Triggered by', + width : 100, + renderer : function(v,x,r) { + return String.format( + '{0} : {1} {2}', + r.data.trigger_event_id_on_table, + r.data.trigger_event_id_on_id, + r.data.trigger_event_id_remarks + ); + }, + xns : Roo.grid, + dataIndex : 'trigger_event_id' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + width : 200, + header : 'Msgid', + renderer : function(v) { return String.format('{0}', v); }, + xns : Roo.grid, + dataIndex : 'msgid' + }, +{ + '|xns' : 'Roo.grid', + xtype : 'ColumnModel', + header : 'Event', + width : 300, + renderer : function(v) { return String.format('{0}', v); }, + xns : Roo.grid, + dataIndex : 'event_id_remarks' + } + ], + listeners : { + rowdblclick : function (_self, rowIndex, e) + { + if (!_this.dialog) return; + _this.dialog.show( this.getDataSource().getAt(rowIndex), function() { + _this.grid.footer.onClick('first'); + }); + }, + render : function() + { + _this.grid = this; + //_this.dialog = Pman.Dialog.FILL_IN + if (_this.panel.active) { + this.footer.onClick('first'); + } + } + }, + items : [ + ] - } - }; - } + + }, + '|xns' : 'Roo', + fitToframe : true, + background : true, + region : 'center', + title : "Current Notifications", + xtype : 'GridPanel', + fitContainer : true, + xns : Roo, + tableName : 'core_notify', + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } + + } + }, + items : [ + + ] + + }; } }); -- 2.39.2