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