From 140ea17b67b5c4ab0305fc7e871277eef7b75210 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Wed, 17 Jun 2015 17:23:50 +0800 Subject: [PATCH] Pman.Dialog.CoreAutoSavePreview.bjs Pman.Dialog.CoreAutoSavePreview.js --- Pman.Dialog.CoreAutoSavePreview.bjs | 309 ++++++++-------- Pman.Dialog.CoreAutoSavePreview.js | 526 +++++++++++++++------------- 2 files changed, 448 insertions(+), 387 deletions(-) diff --git a/Pman.Dialog.CoreAutoSavePreview.bjs b/Pman.Dialog.CoreAutoSavePreview.bjs index 71f6550d..cac6b258 100644 --- a/Pman.Dialog.CoreAutoSavePreview.bjs +++ b/Pman.Dialog.CoreAutoSavePreview.bjs @@ -1,151 +1,166 @@ { - "id": "roo-file-208", - "name": "Pman.Dialog.CoreAutoSavePreview", - "parent": "", - "title": "", - "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs", - "items": [ + "name" : "Pman.Dialog.CoreAutoSavePreview", + "parent" : "", + "title" : "", + "path" : "/home/alan/gitlive/Pman.Core/Pman.Dialog.CoreAutoSavePreview.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "87f9f735a1d36793ceaecd4e47124b63" : "Events", + "ea4788705e6873b424c65e91c2846b19" : "Cancel", + "bd88a20b53a47f7b5704a83a15ff5506" : "Saved Version", + "44749712dbec183e983dcd78a7736c41" : "Date", + "e0aa021e21dddbd6d8cecec71e9cf564" : "OK" + }, + "items" : [ + { + "listeners" : { + "show" : "function (_self)\n{\n if(typeof(_this.data) != 'undefined'){\n _this.grid.footer.onClick('first');\n }\n \n}" + }, + "modal" : true, + "collapsible" : false, + "background" : false, + "title" : "Saved Version", + "xtype" : "LayoutDialog", + "width" : 800, + "$ xns" : "Roo", + "closable" : false, + "resizable" : false, + "height" : 500, + "items" : [ + { + "xtype" : "LayoutRegion", + "$ xns" : "Roo", + "* prop" : "center" + }, + { + "xtype" : "LayoutRegion", + "width" : 200, + "$ xns" : "Roo", + "split" : true, + "* prop" : "west" + }, + { + "listeners" : { + "|activate" : "function() {\n _this.panel = this;\n if (_this.grid) {\n _this.grid.footer.onClick('first');\n }\n}" + }, + "fitToframe" : true, + "background" : false, + "region" : "west", + "title" : "Events", + "xtype" : "GridPanel", + "fitContainer" : true, + "$ xns" : "Roo", + "tableName" : "Events", + "items" : [ + { + "listeners" : { + "|render" : "function() \n{\n _this.grid = this; \n \n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}" + }, + "autoExpandColumn" : "event_when", + "xtype" : "Grid", + "loadMask" : true, + "$ xns" : "Roo.grid", + "* prop" : "grid", + "items" : [ { - "listeners": { - "show": "function (_self)\n{\n if(typeof(_this.data) != 'undefined'){\n _this.grid.footer.onClick('first');\n }\n \n}" - }, - "background": false, - "closable": false, - "collapsible": false, - "height": 500, - "modal": true, - "resizable": false, - "title": "Saved Version", - "width": 800, - "xtype": "LayoutDialog", - "|xns": "Roo", - "items": [ - { - "*prop": "center", - "xtype": "LayoutRegion", - "|xns": "Roo" - }, - { - "*prop": "west", - "split": true, - "width": 200, - "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": "west", - "tableName": "Events", - "title": "Events", - "xtype": "GridPanel", - "|xns": "Roo", - "items": [ - { - "listeners": { - "|render": "function() \n{\n _this.grid = this; \n \n if (_this.panel.active) {\n this.footer.onClick('first');\n }\n}" - }, - "*prop": "grid", - "autoExpandColumn": "event_when", - "loadMask": true, - "xtype": "Grid", - "|xns": "Roo.grid", - "items": [ - { - "listeners": { - "afterselectionchange": "function (_self)\n{\n var selected = this.getSelected();\n \n _this.source = '';\n \n if(!selected){\n _this.viewPanel.setContent(\"Please select an saved version on the left\"); \n return;\n }\n \n _this.viewPanel.load( { url : baseURL + \"/Roo/Events\", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){\n \n var res = Roo.decode(oResponse.responseText);\n \n if(!bSuccess || !res.success){\n _this.viewPanel.setContent(\"Load data failed?!\");\n }\n \n if(typeof(res.data) === 'string'){\n _this.viewPanel.setContent(res.data);\n return;\n }\n \n if(!_this.data.successFn){\n Roo.MessageBox.alert('Error', 'Please setup the successFn');\n return;\n }\n \n _this.source = _this.data.successFn(res);\n\n _this.viewPanel.setContent(_this.source);\n \n });\n}" - }, - "*prop": "sm", - "singleSelect": true, - "xtype": "RowSelectionModel", - "|xns": "Roo.grid" - }, - { - "listeners": { - "beforeload": "function (_self, o)\n{\n o.params = o.params || {};\n \n if(typeof(_this.data) == 'undefined'){\n this.removeAll();\n return false;\n }\n\n var d = Roo.apply({}, _this.data);\n delete d.successFn;\n\n Roo.apply(o.params, d);\n \n}", - "load": "function (_self, records, options)\n{\n var sm = _this.grid.getSelectionModel();\n if (!sm.getSelections().length) {\n sm.selectFirstRow();\n \n sm.fireEvent('afterselectionchange', sm);\n }\n}" - }, - "*prop": "dataSource", - "remoteSort": true, - "xtype": "Store", - "|sortInfo": "{ field : 'event_when', direction: 'DESC' }", - "|xns": "Roo.data", - "items": [ - { - "*prop": "proxy", - "method": "GET", - "xtype": "HttpProxy", - "|url": "baseURL + '/Roo/Events.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': 'event_when',\n 'type': 'string'\n }\n]", - "|xns": "Roo.data" - } - ] - }, - { - "*prop": "footer", - "displayInfo": false, - "pageSize": 25, - "xtype": "PagingToolbar", - "|xns": "Roo" - }, - { - "*prop": "colModel[]", - "dataIndex": "event_when", - "header": "Date", - "width": 100, - "xtype": "ColumnModel", - "|renderer": "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }", - "|xns": "Roo.grid" - } - ] - } - ] - }, - { - "listeners": { - "render": "function (_self)\n{\n _this.viewPanel = _self;\n}" - }, - "autoScroll": true, - "background": false, - "fitContainer": true, - "fitToFrame": true, - "region": "center", - "xtype": "ContentPanel", - "|xns": "Roo" - }, - { - "listeners": { - "|click": "function() {\n _this.dialog.hide();\n}" - }, - "*prop": "buttons[]", - "text": "Cancel", - "xtype": "Button", - "|xns": "Roo" - }, - { - "listeners": { - "|click": "function() {\n\n _this.dialog.hide();\n \n if (_this.callback && _this.source != '') {\n _this.callback.call(this, _this.source);\n }\n}" - }, - "*prop": "buttons[]", - "text": "OK", - "xtype": "Button", - "|xns": "Roo" - } - ] + "listeners" : { + "afterselectionchange" : "function (_self)\n{\n var selected = this.getSelected();\n \n _this.source = '';\n \n if(!selected){\n _this.viewPanel.setContent(\"Please select an saved version on the left\"); \n return;\n }\n \n _this.viewPanel.load( { url : baseURL + \"/Roo/Events\", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){\n \n var res = Roo.decode(oResponse.responseText);\n \n if(!bSuccess || !res.success){\n _this.viewPanel.setContent(\"Load data failed?!\");\n }\n \n if(typeof(res.data) === 'string'){\n _this.viewPanel.setContent(res.data);\n return;\n }\n \n if(!_this.data.successFn){\n Roo.MessageBox.alert('Error', 'Please setup the successFn');\n return;\n }\n \n _this.source = _this.data.successFn(res);\n\n _this.viewPanel.setContent(_this.source);\n \n });\n}" + }, + "xtype" : "RowSelectionModel", + "singleSelect" : true, + "$ xns" : "Roo.grid", + "* prop" : "sm" + }, + { + "listeners" : { + "beforeload" : "function (_self, o)\n{\n o.params = o.params || {};\n \n if(typeof(_this.data) == 'undefined'){\n this.removeAll();\n return false;\n }\n\n var d = Roo.apply({}, _this.data);\n delete d.successFn;\n\n Roo.apply(o.params, d);\n \n}", + "load" : "function (_self, records, options)\n{\n var sm = _this.grid.getSelectionModel();\n if (!sm.getSelections().length) {\n sm.selectFirstRow();\n \n sm.fireEvent('afterselectionchange', sm);\n }\n}" + }, + "xtype" : "Store", + "remoteSort" : true, + "$ sortInfo" : "{ field : 'event_when', direction: 'DESC' }", + "$ xns" : "Roo.data", + "* prop" : "dataSource", + "items" : [ + { + "$ url" : "baseURL + '/Roo/Events.php'", + "xtype" : "HttpProxy", + "method" : "GET", + "$ xns" : "Roo.data", + "* prop" : "proxy" + }, + { + "id" : "id", + "root" : "data", + "xtype" : "JsonReader", + "$ fields" : "[\n {\n 'name': 'id',\n 'type': 'int'\n },\n {\n 'name': 'event_when',\n 'type': 'string'\n }\n]", + "$ xns" : "Roo.data", + "* prop" : "reader", + "totalProperty" : "total" + } + ] + }, + { + "pageSize" : 25, + "xtype" : "PagingToolbar", + "$ xns" : "Roo", + "displayInfo" : false, + "* prop" : "footer" + }, + { + "xtype" : "ColumnModel", + "width" : 100, + "header" : "Date", + "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "event_when" + }, + { + "xtype" : "ColumnModel", + "header" : "Date", + "width" : 100, + "$ renderer" : "function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }", + "$ xns" : "Roo.grid", + "* prop" : "colModel[]", + "dataIndex" : "event_when" } - ], - "permname": "", - "modOrder": "001" + ] + } + ] + }, + { + "listeners" : { + "render" : "function (_self)\n{\n _this.viewPanel = _self;\n}" + }, + "autoScroll" : true, + "background" : false, + "fitToFrame" : true, + "region" : "center", + "xtype" : "ContentPanel", + "fitContainer" : true, + "$ xns" : "Roo" + }, + { + "listeners" : { + "|click" : "function() {\n _this.dialog.hide();\n}" + }, + "text" : "Cancel", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + }, + { + "listeners" : { + "|click" : "function() {\n\n _this.dialog.hide();\n \n if (_this.callback && _this.source != '') {\n _this.callback.call(this, _this.source);\n }\n}" + }, + "text" : "OK", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Dialog.CoreAutoSavePreview.js b/Pman.Dialog.CoreAutoSavePreview.js index 1c9b5956..0476b19b 100644 --- a/Pman.Dialog.CoreAutoSavePreview.js +++ b/Pman.Dialog.CoreAutoSavePreview.js @@ -2,252 +2,298 @@ // Auto generated file - created by app.Builder.js- do not edit directly (at present!) +Roo.namespace('Pman.Dialog'); + Pman.Dialog.CoreAutoSavePreview = { - dialog : false, - callback: false, + _strings : { + '87f9f735a1d36793ceaecd4e47124b63' :"Events", + 'ea4788705e6873b424c65e91c2846b19' :"Cancel", + 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version", + '44749712dbec183e983dcd78a7736c41' :"Date", + 'e0aa021e21dddbd6d8cecec71e9cf564' :"OK" + }, + + dialog : false, + callback: false, + + 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 }); + } - show : function(data, cb) - { - if (!this.dialog) { - this.create(); + }, + + create : function() + { + var _this = this; + this.dialog = Roo.factory({ + center : { + '|xns' : 'Roo', + xns : Roo, + xtype : 'LayoutRegion' + }, + west : { + '|xns' : 'Roo', + split : true, + width : 200, + xns : Roo, + xtype : 'LayoutRegion' + }, + '|xns' : 'Roo', + background : false, + closable : false, + collapsible : false, + height : 500, + modal : true, + resizable : false, + title : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'], + width : 800, + xns : Roo, + xtype : 'LayoutDialog', + buttons : [ + { + '|xns' : 'Roo', + text : _this._strings['ea4788705e6873b424c65e91c2846b19'], + xns : Roo, + xtype : 'Button', + listeners : { + click : function() { + _this.dialog.hide(); + } + } + }, +{ + '|xns' : 'Roo', + text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'], + xns : Roo, + xtype : 'Button', + listeners : { + click : function() { + + _this.dialog.hide(); + + if (_this.callback && _this.source != '') { + _this.callback.call(this, _this.source); + } + } + } + } + ], + listeners : { + show : function (_self) + { + if(typeof(_this.data) != 'undefined'){ + _this.grid.footer.onClick('first'); + } + + } + }, + items : [ + { + grid : { + sm : { + '|xns' : 'Roo.grid', + singleSelect : true, + xns : Roo.grid, + xtype : 'RowSelectionModel', + listeners : { + afterselectionchange : function (_self) + { + var selected = this.getSelected(); + + _this.source = ''; + + if(!selected){ + _this.viewPanel.setContent("Please select an saved version on the left"); + return; + } + + _this.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){ + + var res = Roo.decode(oResponse.responseText); + + if(!bSuccess || !res.success){ + _this.viewPanel.setContent("Load data failed?!"); + } + + if(typeof(res.data) === 'string'){ + _this.viewPanel.setContent(res.data); + return; + } + + if(!_this.data.successFn){ + Roo.MessageBox.alert('Error', 'Please setup the successFn'); + return; + } + + _this.source = _this.data.successFn(res); + + _this.viewPanel.setContent(_this.source); + + }); + } } + }, + dataSource : { + proxy : { + '|xns' : 'Roo.data', + method : 'GET', + url : baseURL + '/Roo/Events.php', + xns : Roo.data, + xtype : 'HttpProxy' + }, + reader : { + '|xns' : 'Roo.data', + fields : [ + { + 'name': 'id', + 'type': 'int' + }, + { + 'name': 'event_when', + 'type': 'string' + } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + xtype : 'JsonReader' + }, + '|xns' : 'Roo.data', + remoteSort : true, + sortInfo : { field : 'event_when', direction: 'DESC' }, + xns : Roo.data, + xtype : 'Store', + listeners : { + beforeload : function (_self, o) + { + o.params = o.params || {}; + + if(typeof(_this.data) == 'undefined'){ + this.removeAll(); + return false; + } + + var d = Roo.apply({}, _this.data); + delete d.successFn; + + Roo.apply(o.params, d); + + }, + load : function (_self, records, options) + { + var sm = _this.grid.getSelectionModel(); + if (!sm.getSelections().length) { + sm.selectFirstRow(); + + sm.fireEvent('afterselectionchange', sm); + } + } + }, + items : [ + + ] + + }, + footer : { + '|xns' : 'Roo', + displayInfo : false, + pageSize : 25, + xns : Roo, + xtype : 'PagingToolbar' + }, + '|xns' : 'Roo.grid', + autoExpandColumn : 'event_when', + loadMask : true, + xns : Roo.grid, + xtype : 'Grid', + colModel : [ + { + '|xns' : 'Roo.grid', + dataIndex : 'event_when', + header : _this._strings['44749712dbec183e983dcd78a7736c41'], + renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }, + width : 100, + xns : Roo.grid, + xtype : 'ColumnModel' + }, +{ + '|xns' : 'Roo.grid', + dataIndex : 'event_when', + header : _this._strings['44749712dbec183e983dcd78a7736c41'], + renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }, + width : 100, + xns : Roo.grid, + xtype : 'ColumnModel' + } + ], + listeners : { + render : function() + { + _this.grid = this; + + if (_this.panel.active) { + this.footer.onClick('first'); + } + } + }, + items : [ + + ] - 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 }); + }, + '|xns' : 'Roo', + background : false, + fitContainer : true, + fitToframe : true, + region : 'west', + tableName : 'Events', + title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'], + xns : Roo, + xtype : 'GridPanel', + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } } + }, + items : [ - }, + ] + + }, + { + '|xns' : 'Roo', + autoScroll : true, + background : false, + fitContainer : true, + fitToFrame : true, + region : 'center', + xns : Roo, + xtype : 'ContentPanel', + listeners : { + render : function (_self) + { + _this.viewPanel = _self; + } + } + } + ] - create : function() - { - var _this = this; - this.dialog = Roo.factory({ - xtype: 'LayoutDialog', - xns: Roo, - listeners : { - show : function (_self) - { - if(typeof(_this.data) != 'undefined'){ - _this.grid.footer.onClick('first'); - } - - } - }, - background : false, - closable : false, - collapsible : false, - height : 500, - modal : true, - resizable : false, - title : "Saved Version", - width : 800, - items : [ - { - xtype: 'GridPanel', - xns: Roo, - listeners : { - activate : function() { - _this.panel = this; - if (_this.grid) { - _this.grid.footer.onClick('first'); - } - } - }, - background : false, - fitContainer : true, - fitToframe : true, - region : 'west', - tableName : 'Events', - title : "Events", - grid : { - xtype: 'Grid', - xns: Roo.grid, - listeners : { - render : function() - { - _this.grid = this; - - if (_this.panel.active) { - this.footer.onClick('first'); - } - } - }, - autoExpandColumn : 'event_when', - loadMask : true, - sm : { - xtype: 'RowSelectionModel', - xns: Roo.grid, - listeners : { - afterselectionchange : function (_self) - { - var selected = this.getSelected(); - - _this.source = ''; - - if(!selected){ - _this.viewPanel.setContent("Please select an saved version on the left"); - return; - } - - _this.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){ - - var res = Roo.decode(oResponse.responseText); - - if(!bSuccess || !res.success){ - _this.viewPanel.setContent("Load data failed?!"); - } - - if(typeof(res.data) === 'string'){ - _this.viewPanel.setContent(res.data); - return; - } - - if(!_this.data.successFn){ - Roo.MessageBox.alert('Error', 'Please setup the successFn'); - return; - } - - _this.source = _this.data.successFn(res); - - _this.viewPanel.setContent(_this.source); - - }); - } - }, - singleSelect : true - }, - dataSource : { - xtype: 'Store', - xns: Roo.data, - listeners : { - beforeload : function (_self, o) - { - o.params = o.params || {}; - - if(typeof(_this.data) == 'undefined'){ - this.removeAll(); - return false; - } - - var d = Roo.apply({}, _this.data); - delete d.successFn; - - Roo.apply(o.params, d); - - }, - load : function (_self, records, options) - { - var sm = _this.grid.getSelectionModel(); - if (!sm.getSelections().length) { - sm.selectFirstRow(); - - sm.fireEvent('afterselectionchange', sm); - } - } - }, - remoteSort : true, - sortInfo : { field : 'event_when', direction: 'DESC' }, - proxy : { - xtype: 'HttpProxy', - xns: Roo.data, - method : 'GET', - url : baseURL + '/Roo/Events.php' - }, - reader : { - xtype: 'JsonReader', - xns: Roo.data, - id : 'id', - root : 'data', - totalProperty : 'total', - fields : [ - { - 'name': 'id', - 'type': 'int' - }, - { - 'name': 'event_when', - 'type': 'string' - } - ] - } - }, - footer : { - xtype: 'PagingToolbar', - xns: Roo, - displayInfo : false, - pageSize : 25 - }, - colModel : [ - { - xtype: 'ColumnModel', - xns: Roo.grid, - dataIndex : 'event_when', - header : 'Date', - width : 100, - renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); } - } - ] - } - }, - { - xtype: 'ContentPanel', - xns: Roo, - listeners : { - render : function (_self) - { - _this.viewPanel = _self; - } - }, - autoScroll : true, - background : false, - fitContainer : true, - fitToFrame : true, - region : 'center' - } - ], - center : { - xtype: 'LayoutRegion', - xns: Roo - }, - west : { - xtype: 'LayoutRegion', - xns: Roo, - split : true, - width : 200 - }, - buttons : [ - { - xtype: 'Button', - xns: Roo, - listeners : { - click : function() { - _this.dialog.hide(); - } - }, - text : "Cancel" - }, - { - xtype: 'Button', - xns: Roo, - listeners : { - click : function() { - - _this.dialog.hide(); - - if (_this.callback && _this.source != '') { - _this.callback.call(this, _this.source); - } - } - }, - text : "OK" - } - ] - }); - } + }); + } }; -- 2.39.2