From: Edward Date: Mon, 4 May 2015 05:39:59 +0000 (+0800) Subject: Pman.Dialog.CoreNotifyRecur.bjs X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=c8657ae3e5255720009417bc25b3699a5bd7fb74 Pman.Dialog.CoreNotifyRecur.bjs Pman.Dialog.CoreNotifyRecur.js --- diff --git a/Pman.Dialog.CoreNotifyRecur.bjs b/Pman.Dialog.CoreNotifyRecur.bjs index 89475d03..654eefc0 100644 --- a/Pman.Dialog.CoreNotifyRecur.bjs +++ b/Pman.Dialog.CoreNotifyRecur.bjs @@ -1,416 +1,433 @@ { - "id": "roo-file-183", - "name": "Pman.Dialog.CoreNotifyRecur", - "parent": "", - "title": "", - "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRecur.bjs", - "items": [ + "name" : "Pman.Dialog.CoreNotifyRecur", + "parent" : "", + "title" : "", + "path" : "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreNotifyRecur.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "3728af837fe70019577ddb0ed7125ee5" : "Until", + "ec211f7c20af43e742bf2570c3cb84f9" : "Add", + "023a5dfa857c4aa0156e6685231a1dbd" : "Select Type", + "6c768695a8efb18436d5b7b4374cdb45" : "Select core_enum", + "157e432ec303efd7d537b653cb255ccc" : "on day(s)", + "236df51bb0e6416236e255b528346fca" : "Timezone", + "44c68bed631ff6e62aecc4a4d32176e6" : "Select timezone", + "1243daf593fa297e07ab03bf06d925af" : "Searching...", + "b26686c0a708faee42861d8b905e882e" : "Last Sent", + "c1d32776cd2d2afcd2c45a52f58679f4" : "Modify Recurrent Notifications", + "5da618e8e4b89c66fe86e32cdafde142" : "From", + "ce527d7432bab413730f25c794648e46" : "at Hour(s)", + "c7179f16884513c990b6cbf44aef7fc3" : "core_notify_recur", + "f2a6c498fb90ee345d997f888fce3b18" : "Delete", + "a1fa27779242b4902f7ae3bdd5c6d508" : "Type", + "f92965e2c8a7afb3c1b9a5c09a263636" : "Done" + }, + "items" : [ + { + "listeners" : { + "show" : "function (_self)\n{\n _this.grid.ds.load({});\n}" + }, + "modal" : true, + "title" : "Modify Recurrent Notifications", + "xtype" : "LayoutDialog", + "width" : 800, + "$ xns" : "Roo", + "resizable" : false, + "height" : 550, + "items" : [ + { + "loadOnce" : true, + "autoScroll" : true, + "xtype" : "LayoutRegion", + "$ xns" : "Roo", + "* prop" : "center" + }, + { + "listeners" : { + "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n// _this.grid.footer.onClick('first');\n }\n}" + }, + "fitToFrame" : true, + "background" : false, + "region" : "center", + "title" : "core_notify_recur", + "xtype" : "GridPanel", + "fitContainer" : true, + "$ xns" : "Roo", + "tableName" : "core_notify_recur", + "items" : [ + { + "listeners" : { + "|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", + "|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}", + "afteredit" : "function (e)\n{\n e.record.commit();\n}" + }, + "autoExpandColumn" : "freq_day", + "xtype" : "EditorGrid", + "loadMask" : true, + "clicksToEdit" : 1, + "$ xns" : "Roo.grid", + "* prop" : "grid", + "items" : [ { - "listeners": { - "show": "function (_self)\n{\n _this.grid.ds.load({});\n}" - }, - "height": 550, - "modal": true, - "resizable": false, - "title": "Modify Recurrent Notifications", - "width": 800, - "xtype": "LayoutDialog", - "|xns": "Roo", - "items": [ + "listeners" : { + "update" : "function (_self, record, operation)\n{\n //Roo.log(operation);\n if (operation != 'commit') {\n return;\n }\n var p = Roo.apply({}, record.data);\n p.dtstart = record.data.dtstart.format('Y-m-d');\n p.dtend = record.data.dtend.format('Y-m-d'); \n \n \n new Pman.Request({\n url : baseURL + '/Roo/Core_notify_recur',\n method :'POST',\n params : p,\n success : function(data)\n {\n //Roo.log(data);\n record.set('id', data.data.id);\n },\n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"There was a problem saving\");\n }\n });\n \n \n \n}", + "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}" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ field : 'freq', direction: 'ASC' }", + "$ xns" : "Roo.data", + "* prop" : "dataSource", + "items" : [ + { + "$ url" : "baseURL + '/Roo/core_notify_recur.php'", + "method" : "GET", + "xtype" : "HttpProxy", + "$ xns" : "Roo.data", + "* prop" : "proxy" + }, + { + "id" : "id", + "root" : "data", + "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" : "reader", + "totalProperty" : "total" + } + ] + }, + { + "xtype" : "Toolbar", + "$ xns" : "Roo", + "* prop" : "toolbar", + "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(),\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, // default...\n \n method_id : _this.data.method_id, // default...\n method_id_display_name : _this.data.method_id_display_name, // default... \n \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" + }, + "text" : "Add", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'", + "$ xns" : "Roo.Toolbar" + }, + { + "xtype" : "Fill", + "$ xns" : "Roo.Toolbar" + }, + { + "listeners" : { + "|click" : "function()\n{\n _this.grid.stopEditing();\n var s = _this.grid.selModel.getSelectedCell();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select row\");\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/core_notify_recur',\n method : 'POST',\n params : {\n _delete : _this.grid.ds.getAt(s[0]).data.id\n }, \n success : function() {\n _this.grid.ds.load({});\n },\n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"Deleting failed - try reloading\");\n }\n });\n \n}\n " + }, + "text" : "Delete", + "xtype" : "Button", + "cls" : "x-btn-text-icon", + "$ icon" : "rootURL + '/Pman/templates/images/trash.gif'", + "$ xns" : "Roo.Toolbar" + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "Type", + "width" : 120, + "$ renderer" : "function(v,x,r) {\n return String.format('{0}', r.data.method_id_display_name); \n}", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "method_id", + "items" : [ + { + "xtype" : "GridEditor", + "$ xns" : "Roo.grid", + "* prop" : "editor", + "items" : [ + { + "listWidth" : 400, + "triggerAction" : "all", + "fieldLabel" : "core_enum", + "forceSelection" : true, + "selectOnFocus" : true, + "pageSize" : 20, + "displayField" : "display_name", + "emptyText" : "Select Type", + "hiddenName" : "method_id", + "valueField" : "id", + "xtype" : "ComboBox", + "allowBlank" : false, + "typeAhead" : true, + "editable" : false, + "width" : 300, + "$ xns" : "Roo.form", + "* prop" : "field", + "name" : "method_id_display_name", + "qtip" : "Select core_enum", + "tpl" : "
{display_name}
", + "loadingText" : "Searching...", + "items" : [ + { + "listeners" : { + "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params.etype = 'core_notify_recur';\n}\n" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ direction : 'ASC', field: 'id' }", + "$ xns" : "Roo.data", + "* prop" : "store", + "items" : [ { - "*prop": "center", - "autoScroll": true, - "loadOnce": true, - "xtype": "LayoutRegion", - "|xns": "Roo" + "$ url" : "baseURL + '/Roo/core_enum.php'", + "method" : "GET", + "xtype" : "HttpProxy", + "$ xns" : "Roo.data", + "* prop" : "proxy" }, { - "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 var p = Roo.apply({}, record.data);\n p.dtstart = record.data.dtstart.format('Y-m-d');\n p.dtend = record.data.dtend.format('Y-m-d'); \n \n \n new Pman.Request({\n url : baseURL + '/Roo/Core_notify_recur',\n method :'POST',\n params : p,\n success : function(data)\n {\n //Roo.log(data);\n record.set('id', data.data.id);\n },\n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"There was a problem saving\");\n }\n });\n \n \n \n}", - "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}" - }, - "*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": "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(),\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, // default...\n \n method_id : _this.data.method_id, // default...\n method_id_display_name : _this.data.method_id_display_name, // default... \n \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" - }, - "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" - }, - { - "listeners": { - "|click": "function()\n{\n _this.grid.stopEditing();\n var s = _this.grid.selModel.getSelectedCell();\n if (!s) {\n Roo.MessageBox.alert(\"Error\", \"Select row\");\n return;\n }\n \n new Pman.Request({\n url : baseURL + '/Roo/core_notify_recur',\n method : 'POST',\n params : {\n _delete : _this.grid.ds.getAt(s[0]).data.id\n }, \n success : function() {\n _this.grid.ds.load({});\n },\n failure : function() {\n Roo.MessageBox.alert(\"Error\", \"Deleting failed - try reloading\");\n }\n });\n \n}\n " - }, - "cls": "x-btn-text-icon", - "text": "Delete", - "xtype": "Button", - "|icon": "rootURL + '/Pman/templates/images/trash.gif'", - "|xns": "Roo.Toolbar" - } - ] - }, - { - "*prop": "colModel[]", - "dataIndex": "method_id", - "header": "Type", - "width": 120, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) {\n return String.format('{0}', r.data.method_id_display_name); \n}", - "|xns": "Roo.grid", - "items": [ - { - "|xns": "Roo.grid", - "xtype": "GridEditor", - "*prop": "editor", - "items": [ - { - "*prop": "field", - "allowBlank": "false", - "displayField": "display_name", - "editable": false, - "emptyText": "Select Type", - "fieldLabel": "core_enum", - "forceSelection": true, - "hiddenName": "method_id", - "listWidth": 400, - "loadingText": "Searching...", - "name": "method_id_display_name", - "pageSize": 20, - "qtip": "Select core_enum", - "selectOnFocus": true, - "tpl": "
{display_name}
", - "triggerAction": "all", - "typeAhead": true, - "valueField": "id", - "width": 300, - "xtype": "ComboBox", - "|xns": "Roo.form", - "items": [ - { - "listeners": { - "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n o.params.etype = 'core_notify_recur';\n}\n" - }, - "*prop": "store", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ direction : 'ASC', field: 'id' }", - "|xns": "Roo.data", - "items": [ - { - "*prop": "proxy", - "xtype": "HttpProxy", - "method": "GET", - "|xns": "Roo.data", - "|url": "baseURL + '/Roo/core_enum.php'" - }, - { - "*prop": "reader", - "xtype": "JsonReader", - "|xns": "Roo.data", - "id": "id", - "root": "data", - "totalProperty": "total", - "|fields": "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]" - } - ] - } - ] - } - ] - } - ] - }, - { - "*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_day", - "header": "on day(s)", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v,x,r) { \n \n if (v.length) {\n \n var cm = _this.grid.colModel;\n \n var ci = cm.getColumnByDataIndex(this.name);\n \n var tv = [];\n var vals = Roo.decode(v);\n Roo.each(vals, function(k) {\n var r = this.findRecord(this.valueField, k);\n if(r){\n tv.push(r.data[this.displayField]);\n }else if(this.valueNotFoundText !== undefined){\n tv.push( this.valueNotFoundText );\n }\n },ci.editor.field);\n\n r.data[this.name + '_name'] = tv.join(', ');\n return String.format('{0}',tv.join(', '));\n\n \n \n }\n r.data[this.name + '_name'] = '';\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 \n if (v.length) {\n \n var cm = _this.grid.colModel;\n \n var ci = cm.getColumnByDataIndex(this.name);\n \n var tv = [];\n var vals = Roo.decode(v);\n Roo.each(vals, function(k) {\n var r = this.findRecord(this.valueField, k);\n if(r){\n tv.push(r.data[this.displayField]);\n }else if(this.valueNotFoundText !== undefined){\n tv.push( this.valueNotFoundText );\n }\n },ci.editor.field);\n\n r.data[this.name + '_name'] = tv.join(', ');\n return String.format('{0}',tv.join(', '));\n\n \n \n }\n r.data[this.name + '_name'] = '';\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+':30', 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", - "items": [ - { - "|xns": "Roo.grid", - "xtype": "GridEditor", - "*prop": "editor", - "items": [ - { - "*prop": "field", - "allowBlank": "false", - "displayField": "tz", - "editable": true, - "emptyText": "Select timezone", - "fieldLabel": "core_enum", - "forceSelection": true, - "listWidth": 400, - "loadingText": "Searching...", - "minChars": 2, - "name": "tz", - "pageSize": 999, - "qtip": "Select timezone", - "queryParam": "q", - "selectOnFocus": true, - "tpl": "
{tz}
", - "triggerAction": "all", - "typeAhead": true, - "width": 300, - "xtype": "ComboBox", - "|xns": "Roo.form", - "items": [ - { - "listeners": { - "|beforeload": "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n" - }, - "*prop": "store", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ direction : 'ASC', field: 'tz' }", - "|xns": "Roo.data", - "items": [ - { - "*prop": "proxy", - "method": "GET", - "xtype": "HttpProxy", - "|url": "baseURL + '/Core/I18n/Timezone.php'\n", - "|xns": "Roo.data" - }, - { - "*prop": "reader", - "id": "id", - "root": "data", - "totalProperty": "total", - "xtype": "JsonReader", - "|fields": "[{\"name\":\"tz\",\"type\":\"string\"}]", - "|xns": "Roo.data" - } - ] - } - ] - } - ] - } - ] - }, - { - "*prop": "colModel[]", - "dataIndex": "last_event_id", - "header": "Last Sent", - "width": 75, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v ? v : 'never'); }", - "|xns": "Roo.grid" - } - ] - } - ] + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ xns" : "Roo.data", + "$ fields" : "[{\"name\":\"id\",\"type\":\"int\"},{\"name\":\"etype\",\"type\":\"string\"}]", + "* prop" : "reader", + "totalProperty" : "total" + } + ] + } + ] + } + ] + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "From", + "width" : 75, + "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "dtstart", + "items" : [ + { + "xtype" : "GridEditor", + "$ xns" : "Roo.grid", + "* prop" : "editor", + "items" : [ + { + "xtype" : "DateField", + "$ xns" : "Roo.form", + "* prop" : "field" + } + ] + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "Until", + "width" : 75, + "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "dtend", + "items" : [ + { + "xtype" : "GridEditor", + "$ xns" : "Roo.grid", + "* prop" : "editor", + "items" : [ + { + "xtype" : "DateField", + "$ xns" : "Roo.form", + "* prop" : "field" + } + ] + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "on day(s)", + "width" : 100, + "$ renderer" : "function(v,x,r) { \n \n if (v.length) {\n \n var cm = _this.grid.colModel;\n \n var ci = cm.getColumnByDataIndex(this.name);\n \n var tv = [];\n var vals = Roo.decode(v);\n Roo.each(vals, function(k) {\n var r = this.findRecord(this.valueField, k);\n if(r){\n tv.push(r.data[this.displayField]);\n }else if(this.valueNotFoundText !== undefined){\n tv.push( this.valueNotFoundText );\n }\n },ci.editor.field);\n\n r.data[this.name + '_name'] = tv.join(', ');\n return String.format('{0}',tv.join(', '));\n\n \n \n }\n r.data[this.name + '_name'] = '';\n return String.format('{0}', r.data.freq_day_name || v); \n \n}", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "freq_day", + "items" : [ + { + "xtype" : "GridEditor", + "$ xns" : "Roo.grid", + "* prop" : "editor", + "items" : [ + { + "listWidth" : 300, + "triggerAction" : "all", + "fieldLabel" : "Country", + "pageSize" : 40, + "displayField" : "title", + "hiddenName" : "freq_day", + "valueField" : "code", + "xtype" : "ComboCheck", + "allowBlank" : false, + "editable" : false, + "$ xns" : "Roo.form", + "* prop" : "field", + "mode" : "local", + "name" : "freq_day_name", + "items" : [ + { + "| 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})()", + "xtype" : "SimpleStore", + "$ fields" : "['code', 'title']", + "$ sortInfo" : "{ field : 'title', direction: 'ASC' }", + "$ xns" : "Roo.data", + "* prop" : "store" + } + ] + } + ] + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "at Hour(s)", + "width" : 250, + "$ renderer" : "function(v,x,r) { \n \n \n if (v.length) {\n \n var cm = _this.grid.colModel;\n \n var ci = cm.getColumnByDataIndex(this.name);\n \n var tv = [];\n var vals = Roo.decode(v);\n Roo.each(vals, function(k) {\n var r = this.findRecord(this.valueField, k);\n if(r){\n tv.push(r.data[this.displayField]);\n }else if(this.valueNotFoundText !== undefined){\n tv.push( this.valueNotFoundText );\n }\n },ci.editor.field);\n\n r.data[this.name + '_name'] = tv.join(', ');\n return String.format('{0}',tv.join(', '));\n\n \n \n }\n r.data[this.name + '_name'] = '';\n return String.format('{0}', r.data.freq_hour_name || v); \n \n}", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "freq_hour", + "items" : [ + { + "xtype" : "GridEditor", + "$ xns" : "Roo.grid", + "* prop" : "editor", + "items" : [ + { + "listWidth" : 300, + "triggerAction" : "all", + "fieldLabel" : "Country", + "pageSize" : 40, + "displayField" : "title", + "hiddenName" : "freq_hour", + "valueField" : "code", + "xtype" : "ComboCheck", + "allowBlank" : false, + "editable" : false, + "$ xns" : "Roo.form", + "* prop" : "field", + "mode" : "local", + "name" : "freq_hour_name", + "items" : [ + { + "| 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+':30', dh+':30' + mer ]); \n }\n return ret;\n})()", + "xtype" : "SimpleStore", + "$ fields" : "['code', 'title']", + "$ sortInfo" : "{ field : 'title', direction: 'ASC' }", + "$ xns" : "Roo.data", + "* prop" : "store" + } + ] + } + ] + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "Timezone", + "width" : 100, + "$ renderer" : "function(v) { return String.format('{0}', v); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "tz", + "items" : [ + { + "xtype" : "GridEditor", + "$ xns" : "Roo.grid", + "* prop" : "editor", + "items" : [ + { + "listWidth" : 400, + "triggerAction" : "all", + "fieldLabel" : "core_enum", + "forceSelection" : true, + "selectOnFocus" : true, + "pageSize" : 999, + "displayField" : "tz", + "emptyText" : "Select timezone", + "minChars" : 2, + "xtype" : "ComboBox", + "allowBlank" : false, + "typeAhead" : true, + "editable" : true, + "width" : 300, + "$ xns" : "Roo.form", + "* prop" : "field", + "name" : "tz", + "qtip" : "Select timezone", + "queryParam" : "q", + "tpl" : "
{tz}
", + "loadingText" : "Searching...", + "items" : [ + { + "listeners" : { + "|beforeload" : "function (_self, o){\n o.params = o.params || {};\n // set more here\n}\n" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ direction : 'ASC', field: 'tz' }", + "$ xns" : "Roo.data", + "* prop" : "store", + "items" : [ + { + "$ url" : "baseURL + '/Core/I18n/Timezone.php'\n", + "xtype" : "HttpProxy", + "method" : "GET", + "$ xns" : "Roo.data", + "* prop" : "proxy" }, { - "listeners": { - "click": "function (_self, e)\n{\n _this.dialog.hide();\n}" - }, - "*prop": "buttons[]", - "text": "Done", - "xtype": "Button", - "|xns": "Roo" + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ fields" : "[{\"name\":\"tz\",\"type\":\"string\"}]", + "$ xns" : "Roo.data", + "* prop" : "reader", + "totalProperty" : "total" } - ] + ] + } + ] + } + ] + } + ] + }, + { + "xtype" : "ColumnModel", + "header" : "Last Sent", + "width" : 75, + "$ renderer" : "function(v) { return String.format('{0}', v ? v : 'never'); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "last_event_id" } - ], - "permname": "", - "modOrder": "001" + ] + } + ] + }, + { + "listeners" : { + "click" : "function (_self, e)\n{\n _this.dialog.hide();\n}" + }, + "text" : "Done", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Dialog.CoreNotifyRecur.js b/Pman.Dialog.CoreNotifyRecur.js index fb124819..d89c3264 100644 --- a/Pman.Dialog.CoreNotifyRecur.js +++ b/Pman.Dialog.CoreNotifyRecur.js @@ -2,611 +2,757 @@ // Auto generated file - created by app.Builder.js- do not edit directly (at present!) +Roo.namespace('Pman.Dialog'); + Pman.Dialog.CoreNotifyRecur = { - dialog : false, - callback: false, + _strings : { + '3728af837fe70019577ddb0ed7125ee5' :"Until", + 'ec211f7c20af43e742bf2570c3cb84f9' :"Add", + '023a5dfa857c4aa0156e6685231a1dbd' :"Select Type", + '6c768695a8efb18436d5b7b4374cdb45' :"Select core_enum", + '157e432ec303efd7d537b653cb255ccc' :"on day(s)", + '236df51bb0e6416236e255b528346fca' :"Timezone", + '44c68bed631ff6e62aecc4a4d32176e6' :"Select timezone", + '1243daf593fa297e07ab03bf06d925af' :"Searching...", + 'b26686c0a708faee42861d8b905e882e' :"Last Sent", + 'c1d32776cd2d2afcd2c45a52f58679f4' :"Modify Recurrent Notifications", + '5da618e8e4b89c66fe86e32cdafde142' :"From", + 'ce527d7432bab413730f25c794648e46' :"at Hour(s)", + 'c7179f16884513c990b6cbf44aef7fc3' :"core_notify_recur", + 'f2a6c498fb90ee345d997f888fce3b18' :"Delete", + 'a1fa27779242b4902f7ae3bdd5c6d508' :"Type", + 'f92965e2c8a7afb3c1b9a5c09a263636' :"Done" + }, - show : function(data, cb) - { - if (!this.dialog) { - this.create(); - } + dialog : false, + callback: false, - this.callback = cb; - this.data = data; - this.dialog.show(this.data._el); - if (this.form) { - this.form.reset(); - this.form.setValues(data); - this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data }); - } + show : function(data, cb) + { + if (!this.dialog) { + this.create(); + } + + this.callback = cb; + this.data = data; + this.dialog.show(this.data._el); + if (this.form) { + this.form.reset(); + this.form.setValues(data); + this.form.fireEvent('actioncomplete', this.form, { type: 'setdata', data: data }); + } + + }, + create : function() + { + var _this = this; + this.dialog = Roo.factory({ + center : { + '|xns' : 'Roo', + autoScroll : true, + loadOnce : true, + xns : Roo, + xtype : 'LayoutRegion' }, + '|xns' : 'Roo', + height : 550, + modal : true, + resizable : false, + title : _this._strings['c1d32776cd2d2afcd2c45a52f58679f4'], + width : 800, + xns : Roo, + xtype : 'LayoutDialog', + buttons : [ + { + '|xns' : 'Roo', + text : _this._strings['f92965e2c8a7afb3c1b9a5c09a263636'], + xns : Roo, + xtype : 'Button', + listeners : { + click : function (_self, e) + { + _this.dialog.hide(); + } + } + } + ], + listeners : { + show : function (_self) + { + _this.grid.ds.load({}); + } + }, + items : [ + { + grid : { + dataSource : { + proxy : { + '|xns' : 'Roo.data', + method : 'GET', + url : baseURL + '/Roo/core_notify_recur.php', + xns : Roo.data, + xtype : 'HttpProxy' + }, + reader : { + '|xns' : 'Roo.data', + fields : [ + { + 'name': 'id', + 'type': 'int' + }, + { + 'name': 'person_id', + 'type': 'int' + }, + { + 'name': 'dtstart', + 'type': 'date', + 'dateFormat': 'Y-m-d' + }, + { + 'name': 'dtend', + 'type': 'date', + 'dateFormat': 'Y-m-d' + }, + { + 'name': 'tz', + 'type': 'float' + }, + { + 'name': 'last_applied_dt', + 'type': 'date', + 'dateFormat': 'Y-m-d' + }, + { + 'name': 'freq', + 'type': 'string' + }, + { + 'name': 'freq_day', + 'type': 'string' + }, + { + 'name': 'freq_hour', + 'type': 'string' + }, + { + 'name': 'last_event_id', + 'type': 'int' + }, + { + 'name': 'method', + 'type': 'string' + } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + xtype : 'JsonReader' + }, + '|xns' : 'Roo.data', + remoteSort : true, + sortInfo : { field : 'freq', direction: 'ASC' }, + xns : Roo.data, + xtype : 'Store', + listeners : { + beforeload : function (_self, o) + { + if (!_this.data) { + return false; + } + o.params = Roo.apply(o.params || {}, { + person_id : _this.data.person_id, + onid : _this.data.onid, + ontable : _this.data.ontable, + method : _this.data.method + }); + + }, + update : function (_self, record, operation) + { + //Roo.log(operation); + if (operation != 'commit') { + return; + } + var p = Roo.apply({}, record.data); + p.dtstart = record.data.dtstart.format('Y-m-d'); + p.dtend = record.data.dtend.format('Y-m-d'); + + + new Pman.Request({ + url : baseURL + '/Roo/Core_notify_recur', + method :'POST', + params : p, + success : function(data) + { + //Roo.log(data); + record.set('id', data.data.id); + }, + failure : function() { + Roo.MessageBox.alert("Error", "There was a problem saving"); + } + }); + + + + } + }, + items : [ + + ] - create : function() - { - var _this = this; - this.dialog = Roo.factory({ - xtype: 'LayoutDialog', - xns: Roo, - listeners : { - show : function (_self) - { - _this.grid.ds.load({}); + }, + toolbar : { + '|xns' : 'Roo', + xns : Roo, + xtype : 'Toolbar', + items : [ + { + '|xns' : 'Roo.Toolbar', + cls : 'x-btn-text-icon', + icon : Roo.rootURL + 'images/default/dd/drop-add.gif', + text : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'], + xns : Roo.Toolbar, + xtype : 'Button', + listeners : { + click : function() + { + var grid = _this.grid; + var r = grid.getDataSource().reader.newRow({ + // defaults.. + person_id : _this.data.person_id, + dtstart : new Date(), + dtend : Date.parseDate('2050-01-01', 'Y-m-d'), + tz : 'Asia/Hong_Kong', + onid : _this.data.onid, + ontable : _this.data.ontable, + method : _this.data.method, // default... + + method_id : _this.data.method_id, // default... + method_id_display_name : _this.data.method_id_display_name, // default... + + last_event_id : 0, + freq_day_name : '', + freq_hour_name : '', + freq_name : '' + + + }); + grid.stopEditing(); + grid.getDataSource().insert(0, r); + grid.startEditing(0, 2); + + + } + } + }, + { + '|xns' : 'Roo.Toolbar', + xns : Roo.Toolbar, + xtype : 'Fill' + }, + { + '|xns' : 'Roo.Toolbar', + cls : 'x-btn-text-icon', + icon : rootURL + '/Pman/templates/images/trash.gif', + text : _this._strings['f2a6c498fb90ee345d997f888fce3b18'], + xns : Roo.Toolbar, + xtype : 'Button', + listeners : { + click : function() + { + _this.grid.stopEditing(); + var s = _this.grid.selModel.getSelectedCell(); + if (!s) { + Roo.MessageBox.alert("Error", "Select row"); + return; } - }, - height : 550, - modal : true, - resizable : false, - title : "Modify Recurrent Notifications", - width : 800, - items : [ - { - xtype: 'GridPanel', - xns: Roo, - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - // _this.grid.footer.onClick('first'); - } - } + + new Pman.Request({ + url : baseURL + '/Roo/core_notify_recur', + method : 'POST', + params : { + _delete : _this.grid.ds.getAt(s[0]).data.id + }, + success : function() { + _this.grid.ds.load({}); }, - background : false, - fitContainer : true, - fitToFrame : true, - region : 'center', - tableName : 'core_notify_recur', - title : "core_notify_recur", - grid : { - xtype: 'EditorGrid', - xns: Roo.grid, - listeners : { - render : function() - { - _this.grid = this; - //_this.dialog = Pman.Dialog.FILL_IN - if (_this.panel.active) { - // this.footer.onClick('first'); - } - }, - rowdblclick : function (_self, rowIndex, e) - { - if (!_this.dialog) return; - _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() { - _this.grid.footer.onClick('first'); - }); - }, - afteredit : function (e) - { - e.record.commit(); - } - }, - autoExpandColumn : 'freq_day', - clicksToEdit : 1, - loadMask : true, - dataSource : { - xtype: 'Store', - xns: Roo.data, - listeners : { - update : function (_self, record, operation) - { - //Roo.log(operation); - if (operation != 'commit') { - return; - } - var p = Roo.apply({}, record.data); - p.dtstart = record.data.dtstart.format('Y-m-d'); - p.dtend = record.data.dtend.format('Y-m-d'); - - - new Pman.Request({ - url : baseURL + '/Roo/Core_notify_recur', - method :'POST', - params : p, - success : function(data) - { - //Roo.log(data); - record.set('id', data.data.id); - }, - failure : function() { - Roo.MessageBox.alert("Error", "There was a problem saving"); - } - }); - - - - }, - beforeload : function (_self, o) - { - if (!_this.data) { - return false; - } - o.params = Roo.apply(o.params || {}, { - person_id : _this.data.person_id, - onid : _this.data.onid, - ontable : _this.data.ontable, - method : _this.data.method - }); - - } - }, - remoteSort : true, - sortInfo : { field : 'freq', direction: 'ASC' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/core_notify_recur.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [ - { - 'name': 'id', - 'type': 'int' - }, - { - 'name': 'person_id', - 'type': 'int' - }, - { - 'name': 'dtstart', - 'type': 'date', - 'dateFormat': 'Y-m-d' - }, - { - 'name': 'dtend', - 'type': 'date', - 'dateFormat': 'Y-m-d' - }, - { - 'name': 'tz', - 'type': 'float' - }, - { - 'name': 'last_applied_dt', - 'type': 'date', - 'dateFormat': 'Y-m-d' - }, - { - 'name': 'freq', - 'type': 'string' - }, - { - 'name': 'freq_day', - 'type': 'string' - }, - { - 'name': 'freq_hour', - 'type': 'string' - }, - { - 'name': 'last_event_id', - 'type': 'int' - }, - { - 'name': 'method', - 'type': 'string' - } - ] - } - }, - toolbar : { - xtype: 'Toolbar', - xns: Roo, - items : [ - { - xtype: 'Button', - xns: Roo.Toolbar, - listeners : { - click : function() - { - var grid = _this.grid; - var r = grid.getDataSource().reader.newRow({ - // defaults.. - person_id : _this.data.person_id, - dtstart : new Date(), - dtend : Date.parseDate('2050-01-01', 'Y-m-d'), - tz : 'Asia/Hong_Kong', - onid : _this.data.onid, - ontable : _this.data.ontable, - method : _this.data.method, // default... - - method_id : _this.data.method_id, // default... - method_id_display_name : _this.data.method_id_display_name, // default... - - last_event_id : 0, - freq_day_name : '', - freq_hour_name : '', - freq_name : '' - - - }); - grid.stopEditing(); - grid.getDataSource().insert(0, r); - grid.startEditing(0, 2); - - - } - }, - cls : 'x-btn-text-icon', - text : "Add", - icon : Roo.rootURL + 'images/default/dd/drop-add.gif' - }, - { - xtype: 'Fill', - xns: Roo.Toolbar - }, - { - xtype: 'Button', - xns: Roo.Toolbar, - listeners : { - click : function() - { - _this.grid.stopEditing(); - var s = _this.grid.selModel.getSelectedCell(); - if (!s) { - Roo.MessageBox.alert("Error", "Select row"); - return; - } - - new Pman.Request({ - url : baseURL + '/Roo/core_notify_recur', - method : 'POST', - params : { - _delete : _this.grid.ds.getAt(s[0]).data.id - }, - success : function() { - _this.grid.ds.load({}); - }, - failure : function() { - Roo.MessageBox.alert("Error", "Deleting failed - try reloading"); - } - }); - - } - }, - cls : 'x-btn-text-icon', - text : "Delete", - icon : rootURL + '/Pman/templates/images/trash.gif' - } - ] - }, - colModel : [ - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'method_id', - header : 'Type', - width : 120, - renderer : function(v,x,r) { - return String.format('{0}', r.data.method_id_display_name); - }, - editor : { - xtype: 'GridEditor', - xns: Roo.grid, - field : { - xtype: 'ComboBox', - xns: Roo.form, - allowBlank : 'false', - displayField : 'display_name', - editable : false, - emptyText : "Select Type", - fieldLabel : 'core_enum', - forceSelection : true, - hiddenName : 'method_id', - listWidth : 400, - loadingText : "Searching...", - name : 'method_id_display_name', - pageSize : 20, - qtip : "Select core_enum", - selectOnFocus : true, - tpl : '
{display_name}
', - triggerAction : 'all', - typeAhead : true, - valueField : 'id', - width : 300, - store : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o){ - o.params = o.params || {}; - // set more here - o.params.etype = 'core_notify_recur'; - } - }, - remoteSort : true, - sortInfo : { direction : 'ASC', field: 'id' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/core_enum.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}] - } - } - } - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'dtstart', - header : 'From', - width : 75, - renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }, - editor : { - xtype: 'GridEditor', - xns: Roo.grid, - field : { - xtype: 'DateField', - xns: Roo.form - } - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'dtend', - header : 'Until', - width : 75, - renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }, - editor : { - xtype: 'GridEditor', - xns: Roo.grid, - field : { - xtype: 'DateField', - xns: Roo.form - } - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'freq_day', - header : 'on day(s)', - width : 100, - renderer : function(v,x,r) { - - if (v.length) { - - var cm = _this.grid.colModel; - - var ci = cm.getColumnByDataIndex(this.name); - - var tv = []; - var vals = Roo.decode(v); - Roo.each(vals, function(k) { - var r = this.findRecord(this.valueField, k); - if(r){ - tv.push(r.data[this.displayField]); - }else if(this.valueNotFoundText !== undefined){ - tv.push( this.valueNotFoundText ); - } - },ci.editor.field); - - r.data[this.name + '_name'] = tv.join(', '); - return String.format('{0}',tv.join(', ')); - - - - } - r.data[this.name + '_name'] = ''; - return String.format('{0}', r.data.freq_day_name || v); - - }, - editor : { - xtype: 'GridEditor', - xns: Roo.grid, - field : { - xtype: 'ComboCheck', - xns: Roo.form, - 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', - store : { - xtype: 'SimpleStore', - xns: Roo.data, - data : (function() { - var ret = []; - Roo.each(Date.dayNames, function(d) { - ret.push([ d.substring(0,3).toUpperCase(), d ]); - }); - return ret; - })(), - fields : ['code', 'title'], - sortInfo : { field : 'title', direction: 'ASC' } - } - } - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'freq_hour', - header : 'at Hour(s)', - width : 250, - renderer : function(v,x,r) { - - - if (v.length) { - - var cm = _this.grid.colModel; - - var ci = cm.getColumnByDataIndex(this.name); - - var tv = []; - var vals = Roo.decode(v); - Roo.each(vals, function(k) { - var r = this.findRecord(this.valueField, k); - if(r){ - tv.push(r.data[this.displayField]); - }else if(this.valueNotFoundText !== undefined){ - tv.push( this.valueNotFoundText ); - } - },ci.editor.field); - - r.data[this.name + '_name'] = tv.join(', '); - return String.format('{0}',tv.join(', ')); - - - - } - r.data[this.name + '_name'] = ''; - return String.format('{0}', r.data.freq_hour_name || v); - - }, - editor : { - xtype: 'GridEditor', - xns: Roo.grid, - field : { - xtype: 'ComboCheck', - xns: Roo.form, - 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', - store : { - xtype: 'SimpleStore', - xns: Roo.data, - data : (function() { - var ret = []; - for (var i = 5; i < 25; i++) { - var h = i < 10 ? ('0' + i) : i; - var mer = i < 12 || i > 23 ? 'am' : 'pm'; - var dh = i < 13 ? i : i-12; - - ret.push([ h+':00', dh+':00' + mer ]); - ret.push([ h+':30', dh+':30' + mer ]); - } - return ret; - })(), - fields : ['code', 'title'], - sortInfo : { field : 'title', direction: 'ASC' } - } - } - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'tz', - header : 'Timezone', - width : 100, - renderer : function(v) { return String.format('{0}', v); }, - editor : { - xtype: 'GridEditor', - xns: Roo.grid, - field : { - xtype: 'ComboBox', - xns: Roo.form, - allowBlank : 'false', - displayField : 'tz', - editable : true, - emptyText : "Select timezone", - fieldLabel : 'core_enum', - forceSelection : true, - listWidth : 400, - loadingText : "Searching...", - minChars : 2, - name : 'tz', - pageSize : 999, - qtip : "Select timezone", - queryParam : 'q', - selectOnFocus : true, - tpl : '
{tz}
', - triggerAction : 'all', - typeAhead : true, - width : 300, - store : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o){ - o.params = o.params || {}; - // set more here - } - }, - remoteSort : true, - sortInfo : { direction : 'ASC', field: 'tz' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Core/I18n/Timezone.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [{"name":"tz","type":"string"}] - } - } - } - } - }, - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'last_event_id', - header : 'Last Sent', - width : 75, - renderer : function(v) { return String.format('{0}', v ? v : 'never'); } - } - ] + failure : function() { + Roo.MessageBox.alert("Error", "Deleting failed - try reloading"); } - } - ], - center : { - xtype: 'LayoutRegion', - xns: Roo, - autoScroll : true, - loadOnce : true + }); + + } + } + } + ] + + }, + '|xns' : 'Roo.grid', + autoExpandColumn : 'freq_day', + clicksToEdit : 1, + loadMask : true, + xns : Roo.grid, + xtype : 'EditorGrid', + colModel : [ + { + editor : { + field : { + store : { + proxy : { + '|xns' : 'Roo.data', + method : 'GET', + url : baseURL + '/Roo/core_enum.php', + xns : Roo.data, + xtype : 'HttpProxy' + }, + reader : { + '|xns' : 'Roo.data', + fields : [{"name":"id","type":"int"},{"name":"etype","type":"string"}], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + xtype : 'JsonReader' + }, + '|xns' : 'Roo.data', + remoteSort : true, + sortInfo : { direction : 'ASC', field: 'id' }, + xns : Roo.data, + xtype : 'Store', + listeners : { + beforeload : function (_self, o){ + o.params = o.params || {}; + // set more here + o.params.etype = 'core_notify_recur'; + } + }, + items : [ + + ] + }, - buttons : [ - { - xtype: 'Button', - xns: Roo, - listeners : { - click : function (_self, e) - { - _this.dialog.hide(); - } - }, - text : "Done" - } + '|xns' : 'Roo.form', + allowBlank : false, + displayField : 'display_name', + editable : false, + emptyText : _this._strings['023a5dfa857c4aa0156e6685231a1dbd'], + fieldLabel : 'core_enum', + forceSelection : true, + hiddenName : 'method_id', + listWidth : 400, + loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'], + name : 'method_id_display_name', + pageSize : 20, + qtip : _this._strings['6c768695a8efb18436d5b7b4374cdb45'], + selectOnFocus : true, + tpl : '
{display_name}
', + triggerAction : 'all', + typeAhead : true, + valueField : 'id', + width : 300, + xns : Roo.form, + xtype : 'ComboBox', + items : [ + ] - }); - } + + }, + '|xns' : 'Roo.grid', + xns : Roo.grid, + xtype : 'GridEditor', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + dataIndex : 'method_id', + header : _this._strings['a1fa27779242b4902f7ae3bdd5c6d508'], + renderer : function(v,x,r) { + return String.format('{0}', r.data.method_id_display_name); + }, + width : 120, + xns : Roo.grid, + xtype : 'ColumnModel', + items : [ + + ] + + }, +{ + editor : { + field : { + '|xns' : 'Roo.form', + xns : Roo.form, + xtype : 'DateField' + }, + '|xns' : 'Roo.grid', + xns : Roo.grid, + xtype : 'GridEditor', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + dataIndex : 'dtstart', + header : _this._strings['5da618e8e4b89c66fe86e32cdafde142'], + renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }, + width : 75, + xns : Roo.grid, + xtype : 'ColumnModel', + items : [ + + ] + + }, +{ + editor : { + field : { + '|xns' : 'Roo.form', + xns : Roo.form, + xtype : 'DateField' + }, + '|xns' : 'Roo.grid', + xns : Roo.grid, + xtype : 'GridEditor', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + dataIndex : 'dtend', + header : _this._strings['3728af837fe70019577ddb0ed7125ee5'], + renderer : function(v) { return String.format('{0}', v ? v.format('d/M/Y') : ''); }, + width : 75, + xns : Roo.grid, + xtype : 'ColumnModel', + items : [ + + ] + + }, +{ + editor : { + field : { + store : { + '|xns' : 'Roo.data', + data : (function() { + var ret = []; + Roo.each(Date.dayNames, function(d) { + ret.push([ d.substring(0,3).toUpperCase(), d ]); + }); + return ret; + })(), + fields : ['code', 'title'], + sortInfo : { field : 'title', direction: 'ASC' }, + xns : Roo.data, + xtype : 'SimpleStore' + }, + '|xns' : 'Roo.form', + 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', + xns : Roo.form, + xtype : 'ComboCheck', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + xns : Roo.grid, + xtype : 'GridEditor', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + dataIndex : 'freq_day', + header : _this._strings['157e432ec303efd7d537b653cb255ccc'], + renderer : function(v,x,r) { + + if (v.length) { + + var cm = _this.grid.colModel; + + var ci = cm.getColumnByDataIndex(this.name); + + var tv = []; + var vals = Roo.decode(v); + Roo.each(vals, function(k) { + var r = this.findRecord(this.valueField, k); + if(r){ + tv.push(r.data[this.displayField]); + }else if(this.valueNotFoundText !== undefined){ + tv.push( this.valueNotFoundText ); + } + },ci.editor.field); + + r.data[this.name + '_name'] = tv.join(', '); + return String.format('{0}',tv.join(', ')); + + + + } + r.data[this.name + '_name'] = ''; + return String.format('{0}', r.data.freq_day_name || v); + + }, + width : 100, + xns : Roo.grid, + xtype : 'ColumnModel', + items : [ + + ] + + }, +{ + editor : { + field : { + store : { + '|xns' : 'Roo.data', + data : (function() { + var ret = []; + for (var i = 5; i < 25; i++) { + var h = i < 10 ? ('0' + i) : i; + var mer = i < 12 || i > 23 ? 'am' : 'pm'; + var dh = i < 13 ? i : i-12; + + ret.push([ h+':00', dh+':00' + mer ]); + ret.push([ h+':30', dh+':30' + mer ]); + } + return ret; + })(), + fields : ['code', 'title'], + sortInfo : { field : 'title', direction: 'ASC' }, + xns : Roo.data, + xtype : 'SimpleStore' + }, + '|xns' : 'Roo.form', + 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', + xns : Roo.form, + xtype : 'ComboCheck', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + xns : Roo.grid, + xtype : 'GridEditor', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + dataIndex : 'freq_hour', + header : _this._strings['ce527d7432bab413730f25c794648e46'], + renderer : function(v,x,r) { + + + if (v.length) { + + var cm = _this.grid.colModel; + + var ci = cm.getColumnByDataIndex(this.name); + + var tv = []; + var vals = Roo.decode(v); + Roo.each(vals, function(k) { + var r = this.findRecord(this.valueField, k); + if(r){ + tv.push(r.data[this.displayField]); + }else if(this.valueNotFoundText !== undefined){ + tv.push( this.valueNotFoundText ); + } + },ci.editor.field); + + r.data[this.name + '_name'] = tv.join(', '); + return String.format('{0}',tv.join(', ')); + + + + } + r.data[this.name + '_name'] = ''; + return String.format('{0}', r.data.freq_hour_name || v); + + }, + width : 250, + xns : Roo.grid, + xtype : 'ColumnModel', + items : [ + + ] + + }, +{ + editor : { + field : { + store : { + proxy : { + '|xns' : 'Roo.data', + method : 'GET', + url : baseURL + '/Core/I18n/Timezone.php', + xns : Roo.data, + xtype : 'HttpProxy' + }, + reader : { + '|xns' : 'Roo.data', + fields : [{"name":"tz","type":"string"}], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + xtype : 'JsonReader' + }, + '|xns' : 'Roo.data', + remoteSort : true, + sortInfo : { direction : 'ASC', field: 'tz' }, + xns : Roo.data, + xtype : 'Store', + listeners : { + beforeload : function (_self, o){ + o.params = o.params || {}; + // set more here + } + }, + items : [ + + ] + + }, + '|xns' : 'Roo.form', + allowBlank : false, + displayField : 'tz', + editable : true, + emptyText : _this._strings['44c68bed631ff6e62aecc4a4d32176e6'], + fieldLabel : 'core_enum', + forceSelection : true, + listWidth : 400, + loadingText : _this._strings['1243daf593fa297e07ab03bf06d925af'], + minChars : 2, + name : 'tz', + pageSize : 999, + qtip : _this._strings['44c68bed631ff6e62aecc4a4d32176e6'], + queryParam : 'q', + selectOnFocus : true, + tpl : '
{tz}
', + triggerAction : 'all', + typeAhead : true, + width : 300, + xns : Roo.form, + xtype : 'ComboBox', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + xns : Roo.grid, + xtype : 'GridEditor', + items : [ + + ] + + }, + '|xns' : 'Roo.grid', + dataIndex : 'tz', + header : _this._strings['236df51bb0e6416236e255b528346fca'], + renderer : function(v) { return String.format('{0}', v); }, + width : 100, + xns : Roo.grid, + xtype : 'ColumnModel', + items : [ + + ] + + }, +{ + '|xns' : 'Roo.grid', + dataIndex : 'last_event_id', + header : _this._strings['b26686c0a708faee42861d8b905e882e'], + renderer : function(v) { return String.format('{0}', v ? v : 'never'); }, + width : 75, + xns : Roo.grid, + xtype : 'ColumnModel' + } + ], + listeners : { + afteredit : function (e) + { + e.record.commit(); + }, + render : function() + { + _this.grid = this; + //_this.dialog = Pman.Dialog.FILL_IN + if (_this.panel.active) { + // this.footer.onClick('first'); + } + }, + rowdblclick : function (_self, rowIndex, e) + { + if (!_this.dialog) return; + _this.dialog.show( this.getDataSource().getAt(rowIndex).data, function() { + _this.grid.footer.onClick('first'); + }); + } + }, + items : [ + + ] + + }, + '|xns' : 'Roo', + background : false, + fitContainer : true, + fitToFrame : true, + region : 'center', + tableName : 'core_notify_recur', + title : _this._strings['c7179f16884513c990b6cbf44aef7fc3'], + xns : Roo, + xtype : 'GridPanel', + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + // _this.grid.footer.onClick('first'); + } + } + }, + items : [ + + ] + + } + ] + + }); + } };