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