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