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