MOVED Pman.Dialog.CoreNotifyRefer.bjs to Pman.Dialog.CoreNotifyRecur.bjs
authorAlan Knowles <alan@akbkhome.com>
Wed, 16 May 2012 08:54:50 +0000 (16:54 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 16 May 2012 08:54:50 +0000 (16:54 +0800)
Pman.Dialog.CoreNotifyRecur.bjs [new file with mode: 0644]

diff --git a/Pman.Dialog.CoreNotifyRecur.bjs b/Pman.Dialog.CoreNotifyRecur.bjs
new file mode 100644 (file)
index 0000000..f52ac68
--- /dev/null
@@ -0,0 +1,330 @@
+{
+    "id": "roo-file-94",
+    "name": "Pman.Dialog.CoreNotifyRefer",
+    "parent": "",
+    "title": "",
+    "path": "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRefer.bjs",
+    "items": [
+        {
+            "height": 500,
+            "modal": true,
+            "resizable": false,
+            "title": "Modify Recurrent Notifications",
+            "width": 800,
+            "xtype": "LayoutDialog",
+            "|xns": "Roo",
+            "items": [
+                {
+                    "*prop": "center",
+                    "autoScroll": true,
+                    "loadOnce": true,
+                    "xtype": "LayoutRegion",
+                    "|xns": "Roo"
+                },
+                {
+                    "listeners": {
+                        "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+                    },
+                    "background": false,
+                    "fitContainer": true,
+                    "fitToFrame": true,
+                    "region": "center",
+                    "tableName": "core_notify_recur",
+                    "title": "core_notify_recur",
+                    "xtype": "GridPanel",
+                    "|xns": "Roo",
+                    "items": [
+                        {
+                            "listeners": {
+                                "|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}",
+                                "|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",
+                                "afteredit": "function (e)\n{\n   e.record.commit();\n}"
+                            },
+                            "*prop": "grid",
+                            "autoExpandColumn": "freq_day",
+                            "clicksToEdit": 1,
+                            "loadMask": true,
+                            "xtype": "EditorGrid",
+                            "|xns": "Roo.grid",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "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}"
+                                    },
+                                    "*prop": "dataSource",
+                                    "remoteSort": true,
+                                    "xtype": "Store",
+                                    "|sortInfo": "{ field : 'freq', direction: 'ASC' }",
+                                    "|xns": "Roo.data",
+                                    "items": [
+                                        {
+                                            "*prop": "proxy",
+                                            "xtype": "HttpProxy",
+                                            "method": "GET",
+                                            "|url": "baseURL + '/Roo/core_notify_recur.php'",
+                                            "|xns": "Roo.data"
+                                        },
+                                        {
+                                            "*prop": "reader",
+                                            "id": "id",
+                                            "root": "data",
+                                            "totalProperty": "total",
+                                            "xtype": "JsonReader",
+                                            "|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]",
+                                            "|xns": "Roo.data"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "footer",
+                                    "xtype": "PagingToolbar",
+                                    "pageSize": 25,
+                                    "displayInfo": true,
+                                    "displayMsg": "Displaying core_notify_recur{0} - {1} of {2}",
+                                    "emptyMsg": "No core_notify_recur found",
+                                    "|xns": "Roo"
+                                },
+                                {
+                                    "*prop": "toolbar",
+                                    "xtype": "Toolbar",
+                                    "|xns": "Roo",
+                                    "items": [
+                                        {
+                                            "listeners": {
+                                                "|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"
+                                            },
+                                            "cls": "x-btn-text-icon",
+                                            "text": "Add",
+                                            "xtype": "Button",
+                                            "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+                                            "|xns": "Roo.Toolbar"
+                                        },
+                                        {
+                                            "|xns": "Roo.Toolbar",
+                                            "xtype": "Fill"
+                                        },
+                                        {
+                                            "text": "Delete",
+                                            "cls": "x-btn-text-icon",
+                                            "|icon": "rootURL + '/Pman/templates/images/trash.gif'",
+                                            "xtype": "Button",
+                                            "listeners": {
+                                                "|click": "function()\n{\n     Pman.genericDelete(_this, 'core_notify_recur'); \n}\n        "
+                                            },
+                                            "|xns": "Roo.Toolbar"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "dtstart",
+                                    "header": "From",
+                                    "width": 75,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "|xns": "Roo.grid",
+                                            "xtype": "GridEditor",
+                                            "*prop": "editor",
+                                            "items": [
+                                                {
+                                                    "|xns": "Roo.form",
+                                                    "xtype": "DateField",
+                                                    "*prop": "field"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "dtend",
+                                    "header": "Until",
+                                    "width": 75,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "|xns": "Roo.grid",
+                                            "xtype": "GridEditor",
+                                            "*prop": "editor",
+                                            "items": [
+                                                {
+                                                    "|xns": "Roo.form",
+                                                    "xtype": "DateField",
+                                                    "*prop": "field"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "freq",
+                                    "header": "Frequency",
+                                    "width": 70,
+                                    "xtype": "ColumnModel",
+                                    "|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 }",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "|xns": "Roo.grid",
+                                            "xtype": "GridEditor",
+                                            "*prop": "editor",
+                                            "items": [
+                                                {
+                                                    "*prop": "field",
+                                                    "allowBlank": false,
+                                                    "displayField": "title",
+                                                    "editable": false,
+                                                    "fieldLabel": "Country",
+                                                    "hiddenName": "freq",
+                                                    "listWidth": 200,
+                                                    "mode": "local",
+                                                    "name": "freq_name",
+                                                    "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{title}</b> </div>",
+                                                    "triggerAction": "all",
+                                                    "valueField": "code",
+                                                    "width": 200,
+                                                    "xtype": "ComboBox",
+                                                    "|xns": "Roo.form",
+                                                    "items": [
+                                                        {
+                                                            "*prop": "store",
+                                                            "xtype": "SimpleStore",
+                                                            "|data": "[ \n    [ 'HOURLY' , 'Hourly at' ] ,\n       [ 'DAILY' , 'Daily at'] ,\n        [ 'WEEKLY' , 'Weekly at'] ,\n         [ 'Montly' , 'Montly at'] \n]",
+                                                            "|fields": "['code', 'title']",
+                                                            "|sortInfo": "{ field : 'title', direction: 'ASC' }",
+                                                            "|xns": "Roo.data"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "freq_day",
+                                    "header": "on day(s)",
+                                    "width": 100,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_day_name || v); \n    \n}",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "|xns": "Roo.grid",
+                                            "xtype": "GridEditor",
+                                            "*prop": "editor",
+                                            "items": [
+                                                {
+                                                    "*prop": "field",
+                                                    "allowBlank": false,
+                                                    "displayField": "title",
+                                                    "editable": false,
+                                                    "fieldLabel": "Country",
+                                                    "hiddenName": "freq_day",
+                                                    "listWidth": 300,
+                                                    "mode": "local",
+                                                    "name": "freq_day_name",
+                                                    "pageSize": 40,
+                                                    "triggerAction": "all",
+                                                    "valueField": "code",
+                                                    "xtype": "ComboCheck",
+                                                    "|xns": "Roo.form",
+                                                    "items": [
+                                                        {
+                                                            "*prop": "store",
+                                                            "xtype": "SimpleStore",
+                                                            "|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})()",
+                                                            "|fields": "['code', 'title']",
+                                                            "|sortInfo": "{ field : 'title', direction: 'ASC' }",
+                                                            "|xns": "Roo.data"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "freq_hour",
+                                    "header": "at Hour(s)",
+                                    "width": 250,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v,x,r) { \n    \n    return String.format('{0}', r.data.freq_hour_name || v); \n    \n}",
+                                    "|xns": "Roo.grid",
+                                    "items": [
+                                        {
+                                            "|xns": "Roo.grid",
+                                            "xtype": "GridEditor",
+                                            "*prop": "editor",
+                                            "items": [
+                                                {
+                                                    "*prop": "field",
+                                                    "allowBlank": false,
+                                                    "displayField": "title",
+                                                    "editable": false,
+                                                    "fieldLabel": "Country",
+                                                    "hiddenName": "freq_hour",
+                                                    "listWidth": 300,
+                                                    "mode": "local",
+                                                    "name": "freq_hour_name",
+                                                    "pageSize": 40,
+                                                    "triggerAction": "all",
+                                                    "valueField": "code",
+                                                    "xtype": "ComboCheck",
+                                                    "|xns": "Roo.form",
+                                                    "items": [
+                                                        {
+                                                            "*prop": "store",
+                                                            "xtype": "SimpleStore",
+                                                            "|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})()",
+                                                            "|fields": "['code', 'title']",
+                                                            "|sortInfo": "{ field : 'title', direction: 'ASC' }",
+                                                            "|xns": "Roo.data"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "*prop": "colModel[]",
+                                    "dataIndex": "tz",
+                                    "header": "Timezone",
+                                    "width": 100,
+                                    "xtype": "ColumnModel",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid"
+                                },
+                                {
+                                    "xtype": "ColumnModel",
+                                    "header": "Last event",
+                                    "width": 75,
+                                    "dataIndex": "last_event_id",
+                                    "|renderer": "function(v) { return String.format('{0}', v); }",
+                                    "|xns": "Roo.grid",
+                                    "*prop": "colModel[]"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "*prop": "buttons[]",
+                    "text": "Done",
+                    "xtype": "Button",
+                    "|xns": "Roo"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": "001"
+}
\ No newline at end of file