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            "pageSize" : 25,
113            "xtype" : "PagingToolbar",
114            "emptyMsg" : "No core_notify found",
115            "$ xns" : "Roo",
116            "displayInfo" : true,
117            "displayMsg" : "Displaying core_notify{0} - {1} of {2}",
118            "* prop" : "footer"
119           },
120           {
121            "xtype" : "Toolbar",
122            "$ xns" : "Roo",
123            "* prop" : "toolbar",
124            "items" : [
125             {
126              "listeners" : {
127               "render" : "function (_self)\n{\n   _this.personCombo = _self;\n}",
128               "select" : "function (combo, record, index)\n{\n   _this.grid.footer.onClick('first');\n}"
129              },
130              "listWidth" : 400,
131              "triggerAction" : "all",
132              "forceSelection" : true,
133              "selectOnFocus" : true,
134              "pageSize" : 20,
135              "displayField" : "person_id_name",
136              "emptyText" : "Select person",
137              "minChars" : 2,
138              "valueField" : "person_id",
139              "xtype" : "ComboBox",
140              "allowBlank" : true,
141              "editable" : true,
142              "width" : 200,
143              "$ xns" : "Roo.form",
144              "qtip" : "Select person",
145              "queryParam" : "query[person_id_name]",
146              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>",
147              "loadingText" : "Searching...",
148              "items" : [
149               {
150                "listeners" : {
151                 "|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"
152                },
153                "xtype" : "Store",
154                "remoteSort" : true,
155                "$ sortInfo" : "{ direction : 'ASC', field: 'person_id_name' }",
156                "$ xns" : "Roo.data",
157                "* prop" : "store",
158                "items" : [
159                 {
160                  "$ url" : "baseURL + '/Roo/core_notify.php'",
161                  "method" : "GET",
162                  "xtype" : "HttpProxy",
163                  "$ xns" : "Roo.data",
164                  "* prop" : "proxy"
165                 },
166                 {
167                  "id" : "id",
168                  "root" : "data",
169                  "xtype" : "JsonReader",
170                  "$ xns" : "Roo.data",
171                  "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]",
172                  "* prop" : "reader",
173                  "totalProperty" : "total"
174                 }
175                ]
176               }
177              ]
178             },
179             {
180              "xtype" : "Separator",
181              "$ xns" : "Roo.Toolbar"
182             },
183             {
184              "listeners" : {
185               "render" : "function (_self)\n{\n   _this.typeCombo = _self;\n}",
186               "select" : "function (combo, record, index)\n{\n   _this.grid.footer.onClick('first');\n}"
187              },
188              "listWidth" : 400,
189              "triggerAction" : "all",
190              "forceSelection" : true,
191              "selectOnFocus" : true,
192              "pageSize" : 20,
193              "displayField" : "display_name",
194              "emptyText" : "Select notify type",
195              "minChars" : 2,
196              "valueField" : "name",
197              "xtype" : "ComboBox",
198              "allowBlank" : true,
199              "editable" : true,
200              "width" : 200,
201              "$ xns" : "Roo.form",
202              "qtip" : "Select type",
203              "queryParam" : "query[name]",
204              "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{display_name}</b></div>",
205              "loadingText" : "Searching...",
206              "items" : [
207               {
208                "listeners" : {
209                 "|beforeload" : "function (_self, o){\n    o.params = o.params || {};\n    o.params.etype = 'Core.NotifyType';\n    o.params.active = 1;\n}\n"
210                },
211                "xtype" : "Store",
212                "remoteSort" : true,
213                "$ sortInfo" : "{ direction : 'ASC', field: 'id' }",
214                "$ xns" : "Roo.data",
215                "* prop" : "store",
216                "items" : [
217                 {
218                  "$ url" : "baseURL + '/Roo/core_enum.php'",
219                  "xtype" : "HttpProxy",
220                  "method" : "GET",
221                  "$ xns" : "Roo.data",
222                  "* prop" : "proxy"
223                 },
224                 {
225                  "id" : "id",
226                  "root" : "data",
227                  "xtype" : "JsonReader",
228                  "$ xns" : "Roo.data",
229                  "$ fields" : "[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"display_name\",\"type\":\"string\"}]",
230                  "* prop" : "reader",
231                  "totalProperty" : "total"
232                 }
233                ]
234               }
235              ]
236             },
237             {
238              "xtype" : "Separator",
239              "$ xns" : "Roo.Toolbar"
240             },
241             {
242              "text" : "From",
243              "xtype" : "TextItem",
244              "$ xns" : "Roo.Toolbar"
245             },
246             {
247              "listeners" : {
248               "render" : "function (_self)\r\n{\r\n    _this.fromDateSel = _self;\r\n   //_self.setValue(  new Date() );\r\n}",
249               "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
250              },
251              "format" : "d/M/Y",
252              "xtype" : "DateField",
253              "width" : 100,
254              "$ xns" : "Roo.form"
255             },
256             {
257              "xtype" : "Separator",
258              "$ xns" : "Roo.Toolbar"
259             },
260             {
261              "text" : "To",
262              "xtype" : "TextItem",
263              "$ xns" : "Roo.Toolbar"
264             },
265             {
266              "listeners" : {
267               "render" : "function (_self)\r\n{\r\n    _this.toDateSel = _self;\r\n   //_self.setValue(  new Date() );\r\n}",
268               "select" : "function (combo, date)\n{\n    _this.grid.footer.onClick('first');\n}"
269              },
270              "format" : "d/M/Y",
271              "xtype" : "DateField",
272              "width" : 100,
273              "$ xns" : "Roo.form"
274             },
275             {
276              "xtype" : "Fill",
277              "$ xns" : "Roo.Toolbar"
278             },
279             {
280              "listeners" : {
281               "|click" : "function()\n{\n    Pman.genericDelete(_this, 'core_notify'); \n}\n        "
282              },
283              "text" : "Delete",
284              "xtype" : "Button",
285              "cls" : "x-btn-text-icon",
286              "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
287              "$ xns" : "Roo.Toolbar"
288             },
289             {
290              "listeners" : {
291               "toggle" : "function (_self, pressed)\n{\n    this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");\n    _this.grid.footer.onClick('first');\n}",
292               "render" : "function (_self)\n{\n    _this.toggleBtn = _self;\n}"
293              },
294              "text" : "Show Completed",
295              "enableToggle" : true,
296              "xtype" : "Button",
297              "$ xns" : "Roo.Toolbar"
298             }
299            ]
300           },
301           {
302            "xtype" : "ColumnModel",
303            "sortable" : true,
304            "header" : "id#",
305            "width" : 50,
306            "$ renderer" : "function(v) { return String.format('{0}', v ); }",
307            "$ xns" : "Roo.grid",
308            "* prop" : "colModel[]",
309            "dataIndex" : "id"
310           },
311           {
312            "xtype" : "ColumnModel",
313            "sortable" : true,
314            "header" : "Method",
315            "width" : 100,
316            "$ 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}",
317            "$ xns" : "Roo.grid",
318            "* prop" : "colModel[]",
319            "dataIndex" : "evtype"
320           },
321           {
322            "xtype" : "ColumnModel",
323            "sortable" : true,
324            "header" : "Act when",
325            "width" : 150,
326            "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
327            "$ xns" : "Roo.grid",
328            "* prop" : "colModel[]",
329            "dataIndex" : "act_when"
330           },
331           {
332            "xtype" : "ColumnModel",
333            "sortable" : true,
334            "header" : "Sent",
335            "width" : 150,
336            "$ 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  }",
337            "$ xns" : "Roo.grid",
338            "* prop" : "colModel[]",
339            "dataIndex" : "sent"
340           },
341           {
342            "xtype" : "ColumnModel",
343            "header" : "Ontable",
344            "width" : 150,
345            "$ renderer" : "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }",
346            "$ xns" : "Roo.grid",
347            "* prop" : "colModel[]",
348            "dataIndex" : "ontable"
349           },
350           {
351            "xtype" : "ColumnModel",
352            "header" : "Who to notify",
353            "width" : 100,
354            "$ 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 }",
355            "$ xns" : "Roo.grid",
356            "* prop" : "colModel[]",
357            "dataIndex" : "person_id_name"
358           },
359           {
360            "xtype" : "ColumnModel",
361            "header" : "Triggered by",
362            "width" : 100,
363            "$ 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 }",
364            "$ xns" : "Roo.grid",
365            "* prop" : "colModel[]",
366            "dataIndex" : "trigger_event_id"
367           },
368           {
369            "xtype" : "ColumnModel",
370            "width" : 200,
371            "header" : "Msgid",
372            "$ renderer" : "function(v) { return String.format('{0}', v); }",
373            "$ xns" : "Roo.grid",
374            "* prop" : "colModel[]",
375            "dataIndex" : "msgid"
376           },
377           {
378            "xtype" : "ColumnModel",
379            "header" : "Event",
380            "width" : 300,
381            "$ renderer" : "function(v) { return String.format('<span qtip=\"{0}\">{0}</span>', v); }",
382            "$ xns" : "Roo.grid",
383            "* prop" : "colModel[]",
384            "dataIndex" : "event_id_remarks"
385           }
386          ]
387         }
388        ]
389       },
390       {
391        "listeners" : {
392         "render" : "function (_self)\n{\n  _this.viewPanel = _self;\n}"
393        },
394        "fitToFrame" : true,
395        "region" : "south",
396        "xtype" : "ContentPanel",
397        "$ xns" : "Roo"
398       }
399      ]
400     }
401    ]
402   }
403  ]
404 }