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