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