Pman.Dialog.CoreNotifyRefer.bjs
[Pman.Core] / Pman.Dialog.CoreNotifyRefer.bjs
1 {
2     "id": "roo-file-94",
3     "name": "Pman.Dialog.CoreNotifyRefer",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRefer.bjs",
7     "items": [
8         {
9             "height": 500,
10             "modal": true,
11             "resizable": false,
12             "title": "Modify Recurrent Notifications",
13             "width": 800,
14             "xtype": "LayoutDialog",
15             "|xns": "Roo",
16             "items": [
17                 {
18                     "*prop": "center",
19                     "autoScroll": true,
20                     "loadOnce": true,
21                     "xtype": "LayoutRegion",
22                     "|xns": "Roo"
23                 },
24                 {
25                     "listeners": {
26                         "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
27                     },
28                     "background": false,
29                     "fitContainer": true,
30                     "fitToFrame": true,
31                     "region": "center",
32                     "tableName": "core_notify_recur",
33                     "title": "core_notify_recur",
34                     "xtype": "GridPanel",
35                     "|xns": "Roo",
36                     "items": [
37                         {
38                             "listeners": {
39                                 "|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}",
40                                 "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
41                             },
42                             "*prop": "grid",
43                             "autoExpandColumn": "freq_day",
44                             "clicksToEdit": 1,
45                             "loadMask": true,
46                             "xtype": "EditorGrid",
47                             "|xns": "Roo.grid",
48                             "items": [
49                                 {
50                                     "*prop": "dataSource",
51                                     "xtype": "Store",
52                                     "remoteSort": true,
53                                     "|sortInfo": "{ field : 'freq', direction: 'ASC' }",
54                                     "|xns": "Roo.data",
55                                     "items": [
56                                         {
57                                             "*prop": "proxy",
58                                             "xtype": "HttpProxy",
59                                             "method": "GET",
60                                             "|url": "baseURL + '/Roo/core_notify_recur.php'",
61                                             "|xns": "Roo.data"
62                                         },
63                                         {
64                                             "*prop": "reader",
65                                             "id": "id",
66                                             "root": "data",
67                                             "totalProperty": "total",
68                                             "xtype": "JsonReader",
69                                             "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'person_id',\n        'type': 'int'\n    },\n    {\n        'name': 'dtstart',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'dtend',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'tz',\n        'type': 'float'\n    },\n    {\n        'name': 'last_applied_dt',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'freq',\n        'type': 'string'\n    },\n    {\n        'name': 'freq_day',\n        'type': 'string'\n    },\n    {\n        'name': 'freq_hour',\n        'type': 'string'\n    },\n    {\n        'name': 'last_event_id',\n        'type': 'int'\n    },\n    {\n        'name': 'method',\n        'type': 'string'\n    }\n]",
70                                             "|xns": "Roo.data"
71                                         }
72                                     ]
73                                 },
74                                 {
75                                     "*prop": "footer",
76                                     "xtype": "PagingToolbar",
77                                     "pageSize": 25,
78                                     "displayInfo": true,
79                                     "displayMsg": "Displaying core_notify_recur{0} - {1} of {2}",
80                                     "emptyMsg": "No core_notify_recur found",
81                                     "|xns": "Roo"
82                                 },
83                                 {
84                                     "*prop": "toolbar",
85                                     "xtype": "Toolbar",
86                                     "|xns": "Roo",
87                                     "items": [
88                                         {
89                                             "listeners": {
90                                                 "|click": "function()\n{\n    var grid = _this.grid;\n    var r = grid.getDataSource().reader.newRow({\n    // defaults..\n        person_id : _this.data.person_id,\n        dtstart : new Date(0),\n        dtend : Date.parseDate('2050-01-01', 'Y-m-d'),\n        tz : 'Asia/Hong Kong',\n        onid : _this.data.onid,\n        ontable : _this.data.ontable,\n        method : _this.data.method,\n        last_event_id : 0,\n        freq_day_name : '',\n        freq_hour_name : '',\n        freq_name : ''\n        \n    \n    });\n    grid.stopEditing();\n    grid.getDataSource().insert(0, r); \n    grid.startEditing(0, 2); \n\n}\n"
91                                             },
92                                             "cls": "x-btn-text-icon",
93                                             "text": "Add",
94                                             "xtype": "Button",
95                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
96                                             "|xns": "Roo.Toolbar"
97                                         },
98                                         {
99                                             "|xns": "Roo.Toolbar",
100                                             "xtype": "Fill"
101                                         },
102                                         {
103                                             "text": "Delete",
104                                             "cls": "x-btn-text-icon",
105                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
106                                             "xtype": "Button",
107                                             "listeners": {
108                                                 "|click": "function()\n{\n     Pman.genericDelete(_this, 'core_notify_recur'); \n}\n        "
109                                             },
110                                             "|xns": "Roo.Toolbar"
111                                         }
112                                     ]
113                                 },
114                                 {
115                                     "*prop": "colModel[]",
116                                     "dataIndex": "dtstart",
117                                     "header": "From",
118                                     "width": 75,
119                                     "xtype": "ColumnModel",
120                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
121                                     "|xns": "Roo.grid",
122                                     "items": [
123                                         {
124                                             "|xns": "Roo.grid",
125                                             "xtype": "GridEditor",
126                                             "*prop": "editor",
127                                             "items": [
128                                                 {
129                                                     "|xns": "Roo.form",
130                                                     "xtype": "DateField",
131                                                     "*prop": "field"
132                                                 }
133                                             ]
134                                         }
135                                     ]
136                                 },
137                                 {
138                                     "*prop": "colModel[]",
139                                     "dataIndex": "dtend",
140                                     "header": "Until",
141                                     "width": 75,
142                                     "xtype": "ColumnModel",
143                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
144                                     "|xns": "Roo.grid",
145                                     "items": [
146                                         {
147                                             "|xns": "Roo.grid",
148                                             "xtype": "GridEditor",
149                                             "*prop": "editor",
150                                             "items": [
151                                                 {
152                                                     "|xns": "Roo.form",
153                                                     "xtype": "DateField",
154                                                     "*prop": "field"
155                                                 }
156                                             ]
157                                         }
158                                     ]
159                                 },
160                                 {
161                                     "*prop": "colModel[]",
162                                     "dataIndex": "freq",
163                                     "header": "Frequency",
164                                     "width": 70,
165                                     "xtype": "ColumnModel",
166                                     "|renderer": "function(v,x,r) { \n\n    Roo.log(this);\n    var cm = _this.grid.colModel;\n    var ix = cm.findColumnIndex('freq');\n    var ce = cm.getCellEditor(ix)\n    var matches = ce.field.store.query('code',v);\n    if (!matches.length) {\n        return '';\n    }\n    return String.format('{0}', matches.first().data.title);\n }",
167                                     "|xns": "Roo.grid",
168                                     "items": [
169                                         {
170                                             "|xns": "Roo.grid",
171                                             "xtype": "GridEditor",
172                                             "*prop": "editor",
173                                             "items": [
174                                                 {
175                                                     "*prop": "field",
176                                                     "allowBlank": false,
177                                                     "displayField": "title",
178                                                     "editable": false,
179                                                     "fieldLabel": "Country",
180                                                     "hiddenName": "freq",
181                                                     "listWidth": 200,
182                                                     "mode": "local",
183                                                     "name": "freq_name",
184                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
185                                                     "triggerAction": "all",
186                                                     "valueField": "code",
187                                                     "width": 200,
188                                                     "xtype": "ComboBox",
189                                                     "|xns": "Roo.form",
190                                                     "items": [
191                                                         {
192                                                             "*prop": "store",
193                                                             "xtype": "SimpleStore",
194                                                             "|data": "[ \n    [ 'HOURLY' , 'Hourly at' ] ,\n       [ 'DAILY' , 'Daily at'] ,\n        [ 'WEEKLY' , 'Weekly at'] ,\n         [ 'Montly' , 'Montly at'] \n]",
195                                                             "|fields": "['code', 'title']",
196                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
197                                                             "|xns": "Roo.data"
198                                                         }
199                                                     ]
200                                                 }
201                                             ]
202                                         }
203                                     ]
204                                 },
205                                 {
206                                     "*prop": "colModel[]",
207                                     "dataIndex": "freq_day",
208                                     "header": "on day(s)",
209                                     "width": 100,
210                                     "xtype": "ColumnModel",
211                                     "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_day_name || v); \n    \n}",
212                                     "|xns": "Roo.grid",
213                                     "items": [
214                                         {
215                                             "|xns": "Roo.grid",
216                                             "xtype": "GridEditor",
217                                             "*prop": "editor",
218                                             "items": [
219                                                 {
220                                                     "*prop": "field",
221                                                     "allowBlank": false,
222                                                     "displayField": "title",
223                                                     "editable": false,
224                                                     "fieldLabel": "Country",
225                                                     "hiddenName": "freq_day",
226                                                     "listWidth": 300,
227                                                     "mode": "local",
228                                                     "name": "freq_day_name",
229                                                     "pageSize": 40,
230                                                     "triggerAction": "all",
231                                                     "valueField": "code",
232                                                     "xtype": "ComboCheck",
233                                                     "|xns": "Roo.form",
234                                                     "items": [
235                                                         {
236                                                             "*prop": "store",
237                                                             "xtype": "SimpleStore",
238                                                             "|data": "(function() { \n    var ret = [];\n    Roo.each(Date.dayNames, function(d) {\n        ret.push([ d.substring(0,3).toUpperCase(), d ]);\n    });\n    return ret;\n})()",
239                                                             "|fields": "['code', 'title']",
240                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
241                                                             "|xns": "Roo.data"
242                                                         }
243                                                     ]
244                                                 }
245                                             ]
246                                         }
247                                     ]
248                                 },
249                                 {
250                                     "*prop": "colModel[]",
251                                     "dataIndex": "freq_hour",
252                                     "header": "at Hour(s)",
253                                     "width": 250,
254                                     "xtype": "ColumnModel",
255                                     "|renderer": "function(v) { return String.format('{0}', v); }",
256                                     "|xns": "Roo.grid",
257                                     "items": [
258                                         {
259                                             "|xns": "Roo.grid",
260                                             "xtype": "GridEditor",
261                                             "*prop": "editor",
262                                             "items": [
263                                                 {
264                                                     "*prop": "field",
265                                                     "allowBlank": false,
266                                                     "displayField": "title",
267                                                     "editable": false,
268                                                     "fieldLabel": "Country",
269                                                     "hiddenName": "freq_hour",
270                                                     "listWidth": 300,
271                                                     "mode": "local",
272                                                     "name": "freq_hour_name",
273                                                     "pageSize": 40,
274                                                     "triggerAction": "all",
275                                                     "valueField": "code",
276                                                     "xtype": "ComboCheck",
277                                                     "|xns": "Roo.form",
278                                                     "items": [
279                                                         {
280                                                             "*prop": "store",
281                                                             "xtype": "SimpleStore",
282                                                             "|data": "(function() { \n    var ret = [];\n    for (var i = 5; i < 25; i++) {\n        var h = i < 10 ? ('0' + i) : i;\n        var mer = i < 12 || i > 23 ? 'am' : 'pm';\n        var dh = i < 12 ? i : i-12;\n        \n        ret.push([ h+':00', dh+':00' + mer ]);\n        ret.push([ h+':00', dh+':30' + mer ]);        \n    }\n    return ret;\n})()",
283                                                             "|fields": "['code', 'title']",
284                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
285                                                             "|xns": "Roo.data"
286                                                         }
287                                                     ]
288                                                 }
289                                             ]
290                                         }
291                                     ]
292                                 },
293                                 {
294                                     "*prop": "colModel[]",
295                                     "dataIndex": "tz",
296                                     "header": "Timezone",
297                                     "width": 100,
298                                     "xtype": "ColumnModel",
299                                     "|renderer": "function(v) { return String.format('{0}', v); }",
300                                     "|xns": "Roo.grid"
301                                 },
302                                 {
303                                     "xtype": "ColumnModel",
304                                     "header": "Last event",
305                                     "width": 75,
306                                     "dataIndex": "last_event_id",
307                                     "|renderer": "function(v) { return String.format('{0}', v); }",
308                                     "|xns": "Roo.grid",
309                                     "*prop": "colModel[]"
310                                 }
311                             ]
312                         }
313                     ]
314                 },
315                 {
316                     "*prop": "buttons[]",
317                     "text": "Done",
318                     "xtype": "Button",
319                     "|xns": "Roo"
320                 }
321             ]
322         }
323     ],
324     "permname": "",
325     "modOrder": "001"
326 }