X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=blobdiff_plain;f=Pman.Dialog.CoreAutoSavePreview.js;h=96d2178c630d23dcb1b30e2d8b5f55155d0d5799;hp=fbef917d3f95e2a3c8e7f6293676a3e97d4e6db8;hb=586e4eb470252d837ba18b67e4c3c1702131fd1d;hpb=e5c4498c2305d7f2b59b1ae2928adcfdce457b36 diff --git a/Pman.Dialog.CoreAutoSavePreview.js b/Pman.Dialog.CoreAutoSavePreview.js index fbef917d..96d2178c 100644 --- a/Pman.Dialog.CoreAutoSavePreview.js +++ b/Pman.Dialog.CoreAutoSavePreview.js @@ -2,243 +2,286 @@ // 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 : { + '53e5aa2c97fef1555d2511de8218c544' :"By", + '87f9f735a1d36793ceaecd4e47124b63' :"Events", + 'ea4788705e6873b424c65e91c2846b19' :"Cancel", + 'bd88a20b53a47f7b5704a83a15ff5506' :"Saved Version", + '44749712dbec183e983dcd78a7736c41' :"Date", + 'e0aa021e21dddbd6d8cecec71e9cf564' :"OK" + }, - 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({ - xtype: 'LayoutDialog', - xns: Roo, - listeners : { - show : function (_self) - { - if(typeof(_this.data) != 'undefined'){ - _this.grid.footer.onClick('first'); - } - - if (!_this.grid.getSelectionModel().getSelected()) { - _this.source = ''; - _this.viewPanel.setContent("Please select a version on the left"); - } - - } - }, - 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 : 'Images', - title : "Images", - 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.viewPanel.load( { url : baseURL + "/Roo/Events", method : 'GET' }, {_id : selected.data.id, _retrieve_source : 1}, function(oElement, bSuccess, oResponse){ - - _this.source = ''; - - 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); - - } - }, - 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" - } - ] - }); - } + }, + + create : function() + { + var _this = this; + this.dialog = Roo.factory({ + xtype : 'LayoutDialog', + background : false, + closable : false, + collapsible : false, + height : 500, + modal : true, + resizable : false, + title : _this._strings['bd88a20b53a47f7b5704a83a15ff5506'] /* Saved Version */, + width : 800, + listeners : { + show : function (_self) + { + if(typeof(_this.data) != 'undefined'){ + _this.grid.footer.onClick('first'); + } + + } + }, + xns : Roo, + '|xns' : 'Roo', + center : { + xtype : 'LayoutRegion', + xns : Roo, + '|xns' : 'Roo' + }, + west : { + xtype : 'LayoutRegion', + split : true, + width : 200, + xns : Roo, + '|xns' : 'Roo' + }, + buttons : [ + { + xtype : 'Button', + text : _this._strings['ea4788705e6873b424c65e91c2846b19'] /* Cancel */, + listeners : { + click : function() { + _this.dialog.hide(); + } + }, + xns : Roo, + '|xns' : 'Roo' + }, + { + xtype : 'Button', + text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'] /* OK */, + listeners : { + click : function() { + + _this.dialog.hide(); + + if (_this.callback && _this.source != '') { + _this.callback.call(this, _this.source); + } + } + }, + xns : Roo, + '|xns' : 'Roo' + } + ], + items : [ + { + xtype : 'GridPanel', + background : false, + fitContainer : true, + fitToframe : true, + region : 'west', + tableName : 'Events', + title : _this._strings['87f9f735a1d36793ceaecd4e47124b63'] /* Events */, + listeners : { + activate : function() { + _this.panel = this; + if (_this.grid) { + _this.grid.footer.onClick('first'); + } + } + }, + xns : Roo, + '|xns' : 'Roo', + grid : { + xtype : 'Grid', + autoExpandColumn : 'event_when', + loadMask : true, + listeners : { + render : function() + { + _this.grid = this; + + if (_this.panel.active) { + this.footer.onClick('first'); + } + } + }, + xns : Roo.grid, + '|xns' : 'Roo.grid', + footer : { + xtype : 'PagingToolbar', + displayInfo : false, + pageSize : 25, + xns : Roo, + '|xns' : 'Roo' + }, + dataSource : { + xtype : 'Store', + remoteSort : true, + sortInfo : { field : 'event_when', direction: 'DESC' }, + 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); + } + } + }, + xns : Roo.data, + '|xns' : 'Roo.data', + proxy : { + xtype : 'HttpProxy', + method : 'GET', + url : baseURL + '/Roo/Events.php', + xns : Roo.data, + '|xns' : 'Roo.data' + }, + reader : { + xtype : 'JsonReader', + fields : [ + { + 'name': 'id', + 'type': 'int' + }, + { + 'name': 'event_when', + 'type': 'string' + } + ], + id : 'id', + root : 'data', + totalProperty : 'total', + xns : Roo.data, + '|xns' : 'Roo.data' + } + }, + sm : { + xtype : 'RowSelectionModel', + singleSelect : true, + 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); + + }); + } + }, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + colModel : [ + { + xtype : 'ColumnModel', + dataIndex : 'event_when', + header : _this._strings['44749712dbec183e983dcd78a7736c41'] /* Date */, + renderer : function(v) { return String.format('{0}', v ? v.format('Y-m-d H:i:s') : ''); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + }, + { + xtype : 'ColumnModel', + dataIndex : 'person_id_name', + header : _this._strings['53e5aa2c97fef1555d2511de8218c544'] /* By */, + renderer : function(v) { return String.format('{0}', v ); }, + width : 100, + xns : Roo.grid, + '|xns' : 'Roo.grid' + } + ] + } + }, + { + xtype : 'ContentPanel', + autoScroll : true, + background : false, + fitContainer : true, + fitToFrame : true, + region : 'center', + listeners : { + render : function (_self) + { + _this.viewPanel = _self; + } + }, + xns : Roo, + '|xns' : 'Roo' + } + ] + }); + } };