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