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