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/edward/gitlive/Pman.Admin/Pman.Tab.AdminNotify.bjs",
6     "permname" : "",
7     "modOrder" : "001",
8     "items" : [
9         {
10             "listeners" : {
11                 "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n    \n}"
12             },
13             "fitToframe" : true,
14             "background" : true,
15             "region" : "center",
16             "title" : "Current Notifications",
17             "xtype" : "GridPanel",
18             "fitContainer" : true,
19             "$ xns" : "Roo",
20             "tableName" : "core_notify",
21             "items" : [
22                 {
23                     "listeners" : {
24                         "|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}"
25                     },
26                     "autoExpandColumn" : "person_id_name",
27                     "xtype" : "Grid",
28                     "loadMask" : true,
29                     "$ xns" : "Roo.grid",
30                     "* prop" : "grid",
31                     "items" : [
32                         {
33                             "listeners" : {
34                                 "beforeload" : "function (_self, options)\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}"
35                             },
36                             "xtype" : "Store",
37                             "remoteSort" : true,
38                             "$ sortInfo" : "{ field : 'act_when', direction: 'DESC' }",
39                             "$ xns" : "Roo.data",
40                             "* prop" : "dataSource",
41                             "items" : [
42                                 {
43                                     "$ url" : "baseURL + '/Roo/core_notify.php'",
44                                     "method" : "GET",
45                                     "xtype" : "HttpProxy",
46                                     "$ xns" : "Roo.data",
47                                     "* prop" : "proxy"
48                                 },
49                                 {
50                                     "id" : "id",
51                                     "root" : "data",
52                                     "xtype" : "JsonReader",
53                                     "$ xns" : "Roo.data",
54                                     "$ 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]",
55                                     "* prop" : "reader",
56                                     "totalProperty" : "total"
57                                 }
58                             ]
59                         },
60                         {
61                             "pageSize" : 25,
62                             "xtype" : "PagingToolbar",
63                             "emptyMsg" : "No core_notify found",
64                             "$ xns" : "Roo",
65                             "displayInfo" : true,
66                             "displayMsg" : "Displaying core_notify{0} - {1} of {2}",
67                             "* prop" : "footer"
68                         },
69                         {
70                             "xtype" : "Toolbar",
71                             "$ xns" : "Roo",
72                             "* prop" : "toolbar",
73                             "items" : [
74                                 {
75                                     "listeners" : {
76                                         "render" : "function (_self)\n{\n   _this.personCombo = _self;\n}",
77                                         "select" : "function (combo, record, index)\n{\n   _this.grid.footer.onClick('first');\n}"
78                                     },
79                                     "listWidth" : 400,
80                                     "triggerAction" : "all",
81                                     "forceSelection" : true,
82                                     "selectOnFocus" : true,
83                                     "pageSize" : 20,
84                                     "displayField" : "person_id_name",
85                                     "emptyText" : "Select person",
86                                     "hiddenName" : "id",
87                                     "minChars" : 2,
88                                     "valueField" : "person_id",
89                                     "xtype" : "ComboBox",
90                                     "allowBlank" : true,
91                                     "editable" : true,
92                                     "width" : 300,
93                                     "$ xns" : "Roo.form",
94                                     "name" : "name",
95                                     "qtip" : "Select core_notify",
96                                     "queryParam" : "query[person_id_name]",
97                                     "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{person_id_name}</b> {person_id_email}</div>",
98                                     "loadingText" : "Searching...",
99                                     "items" : [
100                                         {
101                                             "listeners" : {
102                                                 "|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"
103                                             },
104                                             "xtype" : "Store",
105                                             "remoteSort" : true,
106                                             "$ sortInfo" : "{ direction : 'ASC', field: 'person_id_name' }",
107                                             "$ xns" : "Roo.data",
108                                             "* prop" : "store",
109                                             "items" : [
110                                                 {
111                                                     "$ url" : "baseURL + '/Roo/core_notify.php'",
112                                                     "method" : "GET",
113                                                     "xtype" : "HttpProxy",
114                                                     "$ xns" : "Roo.data",
115                                                     "* prop" : "proxy"
116                                                 },
117                                                 {
118                                                     "id" : "id",
119                                                     "root" : "data",
120                                                     "xtype" : "JsonReader",
121                                                     "$ xns" : "Roo.data",
122                                                     "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"ontable\",\"type\":\"string\"}]",
123                                                     "* prop" : "reader",
124                                                     "totalProperty" : "total"
125                                                 }
126                                             ]
127                                         }
128                                     ]
129                                 },
130                                 {
131                                     "xtype" : "Fill",
132                                     "$ xns" : "Roo.Toolbar"
133                                 },
134                                 {
135                                     "listeners" : {
136                                         "|click" : "function()\n{\n    Pman.genericDelete(_this, 'core_notify'); \n}\n        "
137                                     },
138                                     "text" : "Delete",
139                                     "xtype" : "Button",
140                                     "cls" : "x-btn-text-icon",
141                                     "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'",
142                                     "$ xns" : "Roo.Toolbar"
143                                 },
144                                 {
145                                     "listeners" : {
146                                         "toggle" : "function (_self, pressed)\n{\n    this.setText(pressed ? \"Hide Completed\" : \"Show Completed\");\n    _this.grid.footer.onClick('first');\n}",
147                                         "render" : "function (_self)\n{\n    _this.toggleBtn = _self;\n}"
148                                     },
149                                     "text" : "Show Completed",
150                                     "enableToggle" : true,
151                                     "xtype" : "Button",
152                                     "$ xns" : "Roo.Toolbar"
153                                 }
154                             ]
155                         },
156                         {
157                             "xtype" : "ColumnModel",
158                             "sortable" : true,
159                             "header" : "id#",
160                             "width" : 50,
161                             "$ renderer" : "function(v) { return String.format('{0}', v ); }",
162                             "$ xns" : "Roo.grid",
163                             "* prop" : "colModel[]",
164                             "dataIndex" : "id"
165                         },
166                         {
167                             "xtype" : "ColumnModel",
168                             "sortable" : true,
169                             "header" : "Method",
170                             "width" : 200,
171                             "$ 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}",
172                             "$ xns" : "Roo.grid",
173                             "* prop" : "colModel[]",
174                             "dataIndex" : "evtype"
175                         },
176                         {
177                             "xtype" : "ColumnModel",
178                             "sortable" : true,
179                             "header" : "Act when",
180                             "width" : 150,
181                             "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y H:i:s') : ''); }",
182                             "$ xns" : "Roo.grid",
183                             "* prop" : "colModel[]",
184                             "dataIndex" : "act_when"
185                         },
186                         {
187                             "xtype" : "ColumnModel",
188                             "sortable" : true,
189                             "header" : "Sent",
190                             "width" : 150,
191                             "$ 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  }",
192                             "$ xns" : "Roo.grid",
193                             "* prop" : "colModel[]",
194                             "dataIndex" : "sent"
195                         },
196                         {
197                             "xtype" : "ColumnModel",
198                             "header" : "Ontable",
199                             "width" : 150,
200                             "$ renderer" : "function(v,x,r) { return String.format('{0}:{1}', v,r.data.onid); }",
201                             "$ xns" : "Roo.grid",
202                             "* prop" : "colModel[]",
203                             "dataIndex" : "ontable"
204                         },
205                         {
206                             "xtype" : "ColumnModel",
207                             "header" : "Who to notify",
208                             "width" : 100,
209                             "$ renderer" : "function(v,x,r) {\n     return String.format('{0} <u>&lt;{1}&gt;</u>', v, r.data.person_id_email); \n }",
210                             "$ xns" : "Roo.grid",
211                             "* prop" : "colModel[]",
212                             "dataIndex" : "person_id_name"
213                         },
214                         {
215                             "xtype" : "ColumnModel",
216                             "header" : "Triggered by",
217                             "width" : 100,
218                             "$ 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 }",
219                             "$ xns" : "Roo.grid",
220                             "* prop" : "colModel[]",
221                             "dataIndex" : "trigger_event_id"
222                         },
223                         {
224                             "xtype" : "ColumnModel",
225                             "width" : 200,
226                             "header" : "Msgid",
227                             "$ renderer" : "function(v) { return String.format('{0}', v); }",
228                             "$ xns" : "Roo.grid",
229                             "* prop" : "colModel[]",
230                             "dataIndex" : "msgid"
231                         },
232                         {
233                             "xtype" : "ColumnModel",
234                             "header" : "Event",
235                             "width" : 300,
236                             "$ renderer" : "function(v) { return String.format('<span qtip=\"{0}\">{0}</span>', v); }",
237                             "$ xns" : "Roo.grid",
238                             "* prop" : "colModel[]",
239                             "dataIndex" : "event_id_remarks"
240                         }
241                     ]
242                 }
243             ]
244         }
245     ]
246 }