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