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