Pman.Tab.AdminNotify.bjs
[Pman.Admin] / Pman.Tab.AdminNotify.bjs
1 {
2  "name" : "Pman.Tab.AdminNotify",
3  "parent" : "Pman.Tab.AdminWatchNotify",
4  "title" : "Pman.Tab.AdminNotify",
5  "path" : "/home/alan/gitlive/Pman.Admin/Pman.Tab.AdminNotify.bjs",
6  "permname" : "",
7  "modOrder" : "001",
8  "strings" : {
9   "136fac3c5c5881e0a7d0039e57decd68" : "Select notify type",
10   "bf1cb7e2a337a5e2ebf614009cbce9cc" : "Current Notifications",
11   "8535bcc0f05358a583bb432bbadf7e0d" : "Select type",
12   "e12167aa0a7698e6ebc92b4ce3909b53" : "To",
13   "478192f02d448c49bc6b7d76818d8483" : "Ontable",
14   "dca4dd744d00b6fe1362ef7825ffdee5" : "No core_notify found",
15   "dc873ea4b71ca217b0d8d1fdd45854ac" : "id#",
16   "0f6d01b16d57911731aa44b94dbfefcc" : "Act when",
17   "7f8c0283f16925caed8e632086b81b9c" : "Sent",
18   "c956c97343a45cca5d492e70c56daa8e" : "Select person",
19   "12832b4def6eb0b6105b3d11e16066ea" : "Msgid",
20   "1243daf593fa297e07ab03bf06d925af" : "Searching...",
21   "24463f10155b8af973300f86302c4fde" : "Who to notify",
22   "b22e7ea679daf5146f08f477419dd8bd" : "Triggered by",
23   "5da618e8e4b89c66fe86e32cdafde142" : "From",
24   "e4b478c05a833569833f9cc63b6c4354" : "Displaying core_notify{0} - {1} of {2}",
25   "4c3880bb027f159e801041b1021e88e8" : "Method",
26   "a4ecfc70574394990cf17bd83df499f7" : "Event",
27   "12ea1a38991aa3bc4992b10adac0f3bc" : "Event Details",
28   "f2a6c498fb90ee345d997f888fce3b18" : "Delete",
29   "f821027bade4aa6b7a4191cd1676cf41" : "Show Completed"
30  },
31  "items" : [
32   {
33    "xtype" : "NestedLayoutPanel",
34    "$ xns" : "Roo",
35    "String region" : "center",
36    "String title" : "Current Notifications",
37    "items" : [
38     {
39      "xtype" : "BorderLayout",
40      "$ xns" : "Roo",
41      "* prop" : "layout",
42      "items" : [
43       {
44        "xtype" : "LayoutRegion",
45        "$ xns" : "Roo",
46        "* prop" : "center"
47       },
48       {
49        "autoScroll" : true,
50        "xtype" : "LayoutRegion",
51        "String collapsedTitle" : "View Details",
52        "$ xns" : "Roo",
53        "Boolean collapsible" : true,
54        "split" : true,
55        "String title" : "Event Details",
56        "height" : 150,
57        "* prop" : "south",
58        "Boolean split" : true
59       },
60       {
61        "listeners" : {
62         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
63        },
64        "bool background" : true,
65        "fitToframe" : true,
66        "region" : "center",
67        "title" : "Current Notifications",
68        "xtype" : "GridPanel",
69        "fitContainer" : true,
70        "$ xns" : "Roo",
71        "tableName" : "core_notify",
72        "items" : [
73         {
74          "listeners" : {
75           "|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}"
76          },
77          "autoExpandColumn" : "person_id_name",
78          "xtype" : "Grid",
79          "loadMask" : true,
80          "$ xns" : "Roo.grid",
81          "* prop" : "grid",
82          "items" : [
83           {
84            "listeners" : {
85             "beforeload" : "function (_self, options)\n{\n    options.params = options.params || {};\n    \n    options.params._evtype_align = 1;\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    var from = _this.fromDateSel.getValue();\n    \n    if(from){\n        options.params.from = from.format('Y-m-d');\n    }\n    \n    var to = _this.toDateSel.getValue();\n    \n    if(to){\n        options.params.to = to.format('Y-m-d');\n    }\n    \n    var type = _this.typeCombo.getValue();\n    \n    if(type.length){\n        options.params.evtype = type;\n    }\n}"
86            },
87            "xtype" : "Store",
88            "remoteSort" : true,
89            "$ sortInfo" : "{ field : 'act_when', direction: 'DESC' }",
90            "$ xns" : "Roo.data",
91            "* prop" : "dataSource",
92            "items" : [
93             {
94              "$ url" : "baseURL + '/Roo/core_notify.php'",
95              "method" : "GET",
96              "xtype" : "HttpProxy",
97              "$ xns" : "Roo.data",
98              "* prop" : "proxy"
99             },
100             {
101              "id" : "id",
102              "root" : "data",
103              "xtype" : "JsonReader",
104              "$ xns" : "Roo.data",
105              "$ 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]",
106              "* prop" : "reader",
107              "totalProperty" : "total"
108             }
109            ]
110           },
111           {
112            "listeners" : {
113             "afterselectionchange" : "function (_self)\n{\n    // load detail log in _this.viewPanel;\n    if (!this.getSelected()) {\n        this.viewPanel.setContent(\"Nothing Selected\");\n        return;\n    }\n    var id = this.getSelected().data.event_id;\n    if (id *1 < 0) {\n    \n        this.viewPanel.setContent(\"No Event for this line\");    \n        return;\n    }\n    _this.viewPanel.load( { url : baseURL + \"/Admin/EventView/\" + id + \".html\" });\n    \n}"
114            },
115            "xtype" : "RowSelectionModel",
116            "singleSelect" : true,
117            "$ xns" : "Roo.grid",
118            "* prop" : "sm"
119           },
120           {
121            "pageSize" : 25,
122            "xtype" : "PagingToolbar",
123            "emptyMsg" : "No core_notify found",
124            "$ xns" : "Roo",
125            "displayInfo" : true,
126            "displayMsg" : "Displaying core_notify{0} - {1} of {2}",
127            "* prop" : "footer"
128           },
129           {
130            "xtype" : "Toolbar",
131            "$ xns" : "Roo",
132            "* prop" : "toolbar",
133            "items" : [
134             {
135              "listeners" : {
136               "render" : "function (_self)\n{\n   _this.personCombo = _self;\n}",
137               "select" : "function (combo, record, index)\n{\n   _this.grid.footer.onClick('first');\n}"
138              },
139              "listWidth" : 400,
140              "triggerAction" : "all",
141              "forceSelection" : true,
142              "selectOnFocus" : true,
143              "pageSize" : 20,
144              "displayField" : "person_id_name",
145              "emptyText" : "Select person",
146              "minChars" : 2,
147              "valueField" : "person_id",
148              "xtype" : "ComboBox",
149              "allowBlank" : true,
150              "editable" : true,
151              "width" : 200,
152              "$ xns" : "Roo.form",
153              "qtip" : "Select person",
154              "queryParam" : "query[person_id_name]",
155              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>",
156              "loadingText" : "Searching...",
157              "items" : [
158               {
159                "listeners" : {
160                 "|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"
161                },
162                "xtype" : "Store",
163                "remoteSort" : true,
164                "$ sortInfo" : "{ direction : 'ASC', field: 'person_id_name' }",
165                "$ xns" : "Roo.data",
166                "* prop" : "store",
167                "items" : [
168                 {
169                  "$ url" : "baseURL + '/Roo/core_notify.php'",
170                  "method" : "GET",
171                  "xtype" : "HttpProxy",
172                  "$ xns" : "Roo.data",
173                  "* prop" : "proxy"
174                 },
175                 {
176                  "id" : "id",
177                  "root" : "data",
178                  "xtype" : "JsonReader",
179                  "$ xns" : "Roo.data",
180                  "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]",
181                  "* prop" : "reader",
182                  "totalProperty" : "total"
183                 }
184                ]
185               }
186              ]
187             },
188             {
189              "xtype" : "Separator",
190              "$ xns" : "Roo.Toolbar"
191             },
192             {
193              "listeners" : {
194               "render" : "function (_self)\n{\n   _this.typeCombo = _self;\n}",
195               "select" : "function (combo, record, index)\n{\n   _this.grid.footer.onClick('first');\n}"
196              },
197              "listWidth" : 400,
198              "triggerAction" : "all",
199              "forceSelection" : true,
200              "selectOnFocus" : true,
201              "pageSize" : 20,
202              "displayField" : "display_name",
203              "emptyText" : "Select notify type",
204              "minChars" : 2,
205              "valueField" : "name",
206              "xtype" : "ComboBox",
207              "allowBlank" : true,
208              "editable" : true,
209              "width" : 200,
210              "$ xns" : "Roo.form",
211              "qtip" : "Select type",
212              "queryParam" : "query[name]",
213              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b></div>",
214              "loadingText" : "Searching...",
215              "items" : [
216               {
217                "listeners" : {
218                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    o.params.etype = 'Core.NotifyType';\n    o.params.active = 1;\n}\n"
219                },
220                "xtype" : "Store",
221                "remoteSort" : true,
222                "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
223                "$ xns" : "Roo.data",
224                "* prop" : "store",
225                "items" : [
226                 {
227                  "$ url" : "baseURL + '/Roo/core_enum.php'",
228                  "xtype" : "HttpProxy",
229                  "method" : "GET",
230                  "$ xns" : "Roo.data",
231                  "* prop" : "proxy"
232                 },
233                 {
234                  "id" : "id",
235                  "root" : "data",
236                  "xtype" : "JsonReader",
237                  "$ xns" : "Roo.data",
238                  "$ fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"display_name\",\"type\":\"string\"}]",
239                  "* prop" : "reader",
240                  "totalProperty" : "total"
241                 }
242                ]
243               }
244              ]
245             },
246             {
247              "xtype" : "Separator",
248              "$ xns" : "Roo.Toolbar"
249             },
250             {
251              "text" : "From",
252              "xtype" : "TextItem",
253              "$ xns" : "Roo.Toolbar"
254             },
255             {
256              "listeners" : {
257               "render" : "function (_self)\r\n{\r\n    _this.fromDateSel = _self;\r\n   //_self.setValue(  new Date() );\r\n}",
258               "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
259              },
260              "format" : "d/M/Y",
261              "xtype" : "DateField",
262              "width" : 100,
263              "$ xns" : "Roo.form"
264             },
265             {
266              "xtype" : "Separator",
267              "$ xns" : "Roo.Toolbar"
268             },
269             {
270              "text" : "To",
271              "xtype" : "TextItem",
272              "$ xns" : "Roo.Toolbar"
273             },
274             {
275              "listeners" : {
276               "render" : "function (_self)\r\n{\r\n    _this.toDateSel = _self;\r\n   //_self.setValue(  new Date() );\r\n}",
277               "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
278              },
279              "format" : "d/M/Y",
280              "xtype" : "DateField",
281              "width" : 100,
282              "$ xns" : "Roo.form"
283             },
284             {
285              "xtype" : "Fill",
286              "$ xns" : "Roo.Toolbar"
287             },
288             {
289              "listeners" : {
290               "|click" : "function()\n{\n    Pman.genericDelete(_this, 'core_notify'); \n}\n        "
291              },
292              "text" : "Delete",
293              "xtype" : "Button",
294              "cls" : "x-btn-text-icon",
295              "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
296              "$ xns" : "Roo.Toolbar"
297             },
298             {
299              "listeners" : {
300               "toggle" : "function (_self, pressed)\n{\n    this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");\n    _this.grid.footer.onClick('first');\n}",
301               "render" : "function (_self)\n{\n    _this.toggleBtn = _self;\n}"
302              },
303              "text" : "Show Completed",
304              "enableToggle" : true,
305              "xtype" : "Button",
306              "$ xns" : "Roo.Toolbar"
307             }
308            ]
309           },
310           {
311            "xtype" : "ColumnModel",
312            "sortable" : true,
313            "header" : "id#",
314            "width" : 50,
315            "$ renderer" : "function(v) { return String.format('{0}', v ); }",
316            "$ xns" : "Roo.grid",
317            "* prop" : "colModel[]",
318            "dataIndex" : "id"
319           },
320           {
321            "xtype" : "ColumnModel",
322            "sortable" : true,
323            "header" : "Method",
324            "width" : 100,
325            "$ renderer" : "function(v,x,r) \n{ \n    var vv = (typeof(r.data.evtype_align) != 'undefined' && r.data.evtype_align) ? r.data.evtype_align : v;\n    return String.format('<span qtip=\"{0}\">{1}</span>', v, vv ); \n}",
326            "$ xns" : "Roo.grid",
327            "* prop" : "colModel[]",
328            "dataIndex" : "evtype"
329           },
330           {
331            "xtype" : "ColumnModel",
332            "sortable" : true,
333            "header" : "Act when",
334            "width" : 150,
335            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
336            "$ xns" : "Roo.grid",
337            "* prop" : "colModel[]",
338            "dataIndex" : "act_when"
339           },
340           {
341            "xtype" : "ColumnModel",
342            "sortable" : true,
343            "header" : "Sent",
344            "width" : 150,
345            "$ 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  }",
346            "$ xns" : "Roo.grid",
347            "* prop" : "colModel[]",
348            "dataIndex" : "sent"
349           },
350           {
351            "xtype" : "ColumnModel",
352            "header" : "Ontable",
353            "width" : 150,
354            "$ renderer" : "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }",
355            "$ xns" : "Roo.grid",
356            "* prop" : "colModel[]",
357            "dataIndex" : "ontable"
358           },
359           {
360            "xtype" : "ColumnModel",
361            "header" : "Who to notify",
362            "width" : 100,
363            "$ renderer" : "function(v,x,r) {\n\n    var pt = r.data.person_table.toLowerCase() ;\n    var pt = pt.length ? pt : 'person';\n     var ecol = pt + '_id_email' ;\n     var ncol = pt + '_id_name' ;\n     return String.format('{0} <u>&lt;{1}&gt;</u>', r.data[ncol], r.data[ecol]); \n }",
364            "$ xns" : "Roo.grid",
365            "* prop" : "colModel[]",
366            "dataIndex" : "person_id_name"
367           },
368           {
369            "xtype" : "ColumnModel",
370            "header" : "Triggered by",
371            "width" : 100,
372            "$ 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 }",
373            "$ xns" : "Roo.grid",
374            "* prop" : "colModel[]",
375            "dataIndex" : "trigger_event_id"
376           },
377           {
378            "xtype" : "ColumnModel",
379            "width" : 200,
380            "header" : "Msgid",
381            "$ renderer" : "function(v) { return String.format('{0}', v); }",
382            "$ xns" : "Roo.grid",
383            "* prop" : "colModel[]",
384            "dataIndex" : "msgid"
385           },
386           {
387            "xtype" : "ColumnModel",
388            "header" : "Event",
389            "width" : 300,
390            "$ renderer" : "function(v) { return String.format('<span qtip=\"{0}\">{0}</span>', v); }",
391            "$ xns" : "Roo.grid",
392            "* prop" : "colModel[]",
393            "dataIndex" : "event_id_remarks"
394           }
395          ]
396         }
397        ]
398       },
399       {
400        "listeners" : {
401         "render" : "function (_self)\n{\n  _this.viewPanel = _self;\n}"
402        },
403        "fitToFrame" : true,
404        "region" : "south",
405        "xtype" : "ContentPanel",
406        "$ xns" : "Roo"
407       }
408      ]
409     }
410    ]
411   }
412  ]
413 }