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