Pman.Dialog.CoreNotifyRecur.bjs
[Pman.Core] / Pman.Dialog.CoreNotifyRecur.bjs
1 {
2     "id": "roo-file-94",
3     "name": "Pman.Dialog.CoreNotifyRecur",
4     "parent": "",
5     "title": "",
6     "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRecur.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                                 "afteredit": "function (e)\n{\n   e.record.commit();\n}"
42                             },
43                             "*prop": "grid",
44                             "autoExpandColumn": "freq_day",
45                             "clicksToEdit": 1,
46                             "loadMask": true,
47                             "xtype": "EditorGrid",
48                             "|xns": "Roo.grid",
49                             "items": [
50                                 {
51                                     "listeners": {
52                                         "update": "function (_self, record, operation)\n{\n    Roo.log(operation);\n    if (operation != 'commit') {\n        return;\n    }\n    new Pman.Request({\n        url : baseURL + '/Roo/Core_notify_recur',\n        method :'POST',\n        params : record.data,\n        success : function()\n        {\n            //??\n        },\n        failure : function() {\n            Roo.MessageBox.alert(\"Error\", \"There was a problem saving\");\n        }\n    });\n       \n    \n    \n}",
53                                         "beforeload": "function (_self, o)\n{\n    if (!_this.data) {\n        return false;\n    }\n    o.params =  Roo.apply(o.params, {\n        person_id : _this.data.person_id,\n        onid : _this.data.onid,\n        ontable : _this.data.ontable,\n        method : _this.data.method\n    });\n        \n}"
54                                     },
55                                     "*prop": "dataSource",
56                                     "remoteSort": true,
57                                     "xtype": "Store",
58                                     "|sortInfo": "{ field : 'freq', direction: 'ASC' }",
59                                     "|xns": "Roo.data",
60                                     "items": [
61                                         {
62                                             "*prop": "proxy",
63                                             "xtype": "HttpProxy",
64                                             "method": "GET",
65                                             "|url": "baseURL + '/Roo/core_notify_recur.php'",
66                                             "|xns": "Roo.data"
67                                         },
68                                         {
69                                             "*prop": "reader",
70                                             "id": "id",
71                                             "root": "data",
72                                             "totalProperty": "total",
73                                             "xtype": "JsonReader",
74                                             "|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]",
75                                             "|xns": "Roo.data"
76                                         }
77                                     ]
78                                 },
79                                 {
80                                     "*prop": "footer",
81                                     "xtype": "PagingToolbar",
82                                     "pageSize": 25,
83                                     "displayInfo": true,
84                                     "displayMsg": "Displaying core_notify_recur{0} - {1} of {2}",
85                                     "emptyMsg": "No core_notify_recur found",
86                                     "|xns": "Roo"
87                                 },
88                                 {
89                                     "*prop": "toolbar",
90                                     "xtype": "Toolbar",
91                                     "|xns": "Roo",
92                                     "items": [
93                                         {
94                                             "listeners": {
95                                                 "|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}\n"
96                                             },
97                                             "cls": "x-btn-text-icon",
98                                             "text": "Add",
99                                             "xtype": "Button",
100                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
101                                             "|xns": "Roo.Toolbar"
102                                         },
103                                         {
104                                             "|xns": "Roo.Toolbar",
105                                             "xtype": "Fill"
106                                         },
107                                         {
108                                             "text": "Delete",
109                                             "cls": "x-btn-text-icon",
110                                             "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
111                                             "xtype": "Button",
112                                             "listeners": {
113                                                 "|click": "function()\n{\n     Pman.genericDelete(_this, 'core_notify_recur'); \n}\n        "
114                                             },
115                                             "|xns": "Roo.Toolbar"
116                                         }
117                                     ]
118                                 },
119                                 {
120                                     "*prop": "colModel[]",
121                                     "dataIndex": "dtstart",
122                                     "header": "From",
123                                     "width": 75,
124                                     "xtype": "ColumnModel",
125                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
126                                     "|xns": "Roo.grid",
127                                     "items": [
128                                         {
129                                             "|xns": "Roo.grid",
130                                             "xtype": "GridEditor",
131                                             "*prop": "editor",
132                                             "items": [
133                                                 {
134                                                     "|xns": "Roo.form",
135                                                     "xtype": "DateField",
136                                                     "*prop": "field"
137                                                 }
138                                             ]
139                                         }
140                                     ]
141                                 },
142                                 {
143                                     "*prop": "colModel[]",
144                                     "dataIndex": "dtend",
145                                     "header": "Until",
146                                     "width": 75,
147                                     "xtype": "ColumnModel",
148                                     "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
149                                     "|xns": "Roo.grid",
150                                     "items": [
151                                         {
152                                             "|xns": "Roo.grid",
153                                             "xtype": "GridEditor",
154                                             "*prop": "editor",
155                                             "items": [
156                                                 {
157                                                     "|xns": "Roo.form",
158                                                     "xtype": "DateField",
159                                                     "*prop": "field"
160                                                 }
161                                             ]
162                                         }
163                                     ]
164                                 },
165                                 {
166                                     "*prop": "colModel[]",
167                                     "dataIndex": "freq_day",
168                                     "header": "on day(s)",
169                                     "width": 100,
170                                     "xtype": "ColumnModel",
171                                     "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_day_name || v); \n    \n}",
172                                     "|xns": "Roo.grid",
173                                     "items": [
174                                         {
175                                             "|xns": "Roo.grid",
176                                             "xtype": "GridEditor",
177                                             "*prop": "editor",
178                                             "items": [
179                                                 {
180                                                     "*prop": "field",
181                                                     "allowBlank": false,
182                                                     "displayField": "title",
183                                                     "editable": false,
184                                                     "fieldLabel": "Country",
185                                                     "hiddenName": "freq_day",
186                                                     "listWidth": 300,
187                                                     "mode": "local",
188                                                     "name": "freq_day_name",
189                                                     "pageSize": 40,
190                                                     "triggerAction": "all",
191                                                     "valueField": "code",
192                                                     "xtype": "ComboCheck",
193                                                     "|xns": "Roo.form",
194                                                     "items": [
195                                                         {
196                                                             "*prop": "store",
197                                                             "xtype": "SimpleStore",
198                                                             "|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})()",
199                                                             "|fields": "['code', 'title']",
200                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
201                                                             "|xns": "Roo.data"
202                                                         }
203                                                     ]
204                                                 }
205                                             ]
206                                         }
207                                     ]
208                                 },
209                                 {
210                                     "*prop": "colModel[]",
211                                     "dataIndex": "freq_hour",
212                                     "header": "at Hour(s)",
213                                     "width": 250,
214                                     "xtype": "ColumnModel",
215                                     "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_hour_name || v); \n    \n}",
216                                     "|xns": "Roo.grid",
217                                     "items": [
218                                         {
219                                             "|xns": "Roo.grid",
220                                             "xtype": "GridEditor",
221                                             "*prop": "editor",
222                                             "items": [
223                                                 {
224                                                     "*prop": "field",
225                                                     "allowBlank": false,
226                                                     "displayField": "title",
227                                                     "editable": false,
228                                                     "fieldLabel": "Country",
229                                                     "hiddenName": "freq_hour",
230                                                     "listWidth": 300,
231                                                     "mode": "local",
232                                                     "name": "freq_hour_name",
233                                                     "pageSize": 40,
234                                                     "triggerAction": "all",
235                                                     "valueField": "code",
236                                                     "xtype": "ComboCheck",
237                                                     "|xns": "Roo.form",
238                                                     "items": [
239                                                         {
240                                                             "*prop": "store",
241                                                             "xtype": "SimpleStore",
242                                                             "|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 < 13 ? 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})()",
243                                                             "|fields": "['code', 'title']",
244                                                             "|sortInfo": "{ field : 'title', direction: 'ASC' }",
245                                                             "|xns": "Roo.data"
246                                                         }
247                                                     ]
248                                                 }
249                                             ]
250                                         }
251                                     ]
252                                 },
253                                 {
254                                     "*prop": "colModel[]",
255                                     "dataIndex": "tz",
256                                     "header": "Timezone",
257                                     "width": 100,
258                                     "xtype": "ColumnModel",
259                                     "|renderer": "function(v) { return String.format('{0}', v); }",
260                                     "|xns": "Roo.grid",
261                                     "items": [
262                                         {
263                                             "|xns": "Roo.grid",
264                                             "xtype": "GridEditor",
265                                             "*prop": "editor",
266                                             "items": [
267                                                 {
268                                                     "*prop": "field",
269                                                     "allowBlank": "false",
270                                                     "displayField": "tz",
271                                                     "editable": true,
272                                                     "emptyText": "Select timezone",
273                                                     "fieldLabel": "core_enum",
274                                                     "forceSelection": true,
275                                                     "hiddenName": "tz",
276                                                     "listWidth": 400,
277                                                     "loadingText": "Searching...",
278                                                     "minChars": 2,
279                                                     "name": "tz_name",
280                                                     "pageSize": 999,
281                                                     "qtip": "Select timezone",
282                                                     "queryParam": "q",
283                                                     "selectOnFocus": true,
284                                                     "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{tz}</b> </div>",
285                                                     "triggerAction": "all",
286                                                     "typeAhead": true,
287                                                     "valueField": "tz",
288                                                     "width": 300,
289                                                     "xtype": "ComboBox",
290                                                     "|xns": "Roo.form",
291                                                     "items": [
292                                                         {
293                                                             "listeners": {
294                                                                 "|beforeload": "function (_self, o){\n    o.params = o.params || {};\n    // set more here\n}\n"
295                                                             },
296                                                             "*prop": "store",
297                                                             "remoteSort": true,
298                                                             "xtype": "Store",
299                                                             "|sortInfo": "{ direction : 'ASC', field: 'tz' }",
300                                                             "|xns": "Roo.data",
301                                                             "items": [
302                                                                 {
303                                                                     "*prop": "proxy",
304                                                                     "method": "GET",
305                                                                     "xtype": "HttpProxy",
306                                                                     "|url": "baseURL + '/Core/I18n/Timezone.php'\n",
307                                                                     "|xns": "Roo.data"
308                                                                 },
309                                                                 {
310                                                                     "*prop": "reader",
311                                                                     "id": "id",
312                                                                     "root": "data",
313                                                                     "totalProperty": "total",
314                                                                     "xtype": "JsonReader",
315                                                                     "|fields": "[{\"name\":\"tz\",\"type\":\"string\"}]",
316                                                                     "|xns": "Roo.data"
317                                                                 }
318                                                             ]
319                                                         }
320                                                     ]
321                                                 }
322                                             ]
323                                         }
324                                     ]
325                                 },
326                                 {
327                                     "xtype": "ColumnModel",
328                                     "header": "Last event",
329                                     "width": 75,
330                                     "dataIndex": "last_event_id",
331                                     "|renderer": "function(v) { return String.format('{0}', v); }",
332                                     "|xns": "Roo.grid",
333                                     "*prop": "colModel[]"
334                                 }
335                             ]
336                         }
337                     ]
338                 },
339                 {
340                     "*prop": "buttons[]",
341                     "text": "Done",
342                     "xtype": "Button",
343                     "|xns": "Roo"
344                 }
345             ]
346         }
347     ],
348     "permname": "",
349     "modOrder": "001"
350 }