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