From: Edward Date: Fri, 17 Apr 2015 03:11:58 +0000 (+0800) Subject: Pman.Dialog.CoreEnum.bjs X-Git-Url: http://git.roojs.org/?p=Pman.Core;a=commitdiff_plain;h=9c3275db4e1631e6ecc0f20eace651a4df176821 Pman.Dialog.CoreEnum.bjs Pman.Dialog.CoreEnum.js --- diff --git a/Pman.Dialog.CoreEnum.bjs b/Pman.Dialog.CoreEnum.bjs index aeb298d0..6990ffbe 100644 --- a/Pman.Dialog.CoreEnum.bjs +++ b/Pman.Dialog.CoreEnum.bjs @@ -1,121 +1,130 @@ { - "id": "roo-file-217", - "name": "Pman.Dialog.CoreEnum", - "parent": "", - "title": "", - "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreEnum.bjs", - "items": [ + "name" : "Pman.Dialog.CoreEnum", + "parent" : "", + "title" : "", + "path" : "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreEnum.bjs", + "permname" : "", + "modOrder" : "001", + "strings" : { + "518ad9ed87d3ca17e223a91604b464d5" : "Add / Edit Core Enum", + "cfcd208495d565ef66e7dff9f98764da" : "0", + "ea4788705e6873b424c65e91c2846b19" : "Cancel", + "e0aa021e21dddbd6d8cecec71e9cf564" : "OK" + }, + "items" : [ + { + "listeners" : { + "show" : "function (_self)\n{\n \n}" + }, + "modal" : true, + "collapsible" : false, + "background" : true, + "title" : "Add / Edit Core Enum", + "xtype" : "LayoutDialog", + "width" : 400, + "$ xns" : "Roo", + "closable" : false, + "resizable" : false, + "height" : 150, + "items" : [ + { + "xtype" : "LayoutRegion", + "$ xns" : "Roo", + "titlebar" : false, + "* prop" : "center" + }, + { + "region" : "center", + "fitToFrame" : true, + "background" : true, + "xtype" : "ContentPanel", + "$ xns" : "Roo", + "items" : [ + { + "listeners" : { + "|actioncomplete" : "function (_self, action)\n{\n if (action.type == 'setdata') {\n\n if((typeof(_this.data.etype) == 'undefined') || !_this.data.etype.length){\n Roo.MessageBox.alert('Error', 'Missing etype');\n _this.dialog.hide();\n return;\n }\n \n if(_this.data.id){\n _this.dialog.el.mask(\"Loading\");\n this.load({ method: 'GET', params: { '_id' : _this.data.id }}); \n }\n \n return;\n }\n if (action.type == 'load') {\n _this.dialog.el.unmask();\n return;\n }\n if (action.type == 'submit' ) {\n _this.dialog.el.unmask();\n _this.dialog.hide();\n\n if (_this.callback) {\n _this.callback.call(_this, action.result.data);\n }\n _this.form.reset();\n }\n}\n", + "|rendered" : "function (form)\n{\n _this.form = form;\n}" + }, + "$ url" : "baseURL + '/Roo/core_enum.php'", + "method" : "POST", + "xtype" : "Form", + "style" : "margin: 5px", + "$ xns" : "Roo.form", + "items" : [ { - "listeners": { - "show": "function (_self)\n{\n \n}" - }, - "background": true, - "closable": false, - "collapsible": false, - "height": 150, - "modal": true, - "resizable": false, - "title": "Add / Edit Core Enum", - "width": 400, - "xtype": "LayoutDialog", - "|xns": "Roo", - "items": [ - { - "xtype": "LayoutRegion", - "*prop": "center", - "titlebar": false, - "|xns": "Roo" - }, - { - "xtype": "ContentPanel", - "background": true, - "fitToFrame": true, - "region": "center", - "listeners": {}, - "|xns": "Roo", - "items": [ - { - "listeners": { - "|actioncomplete": "function (_self, action)\n{\n if (action.type == 'setdata') {\n\n if((typeof(_this.data.etype) == 'undefined') || !_this.data.etype.length){\n Roo.MessageBox.alert('Error', 'Missing etype');\n _this.dialog.hide();\n return;\n }\n \n if(_this.data.id){\n _this.dialog.el.mask(\"Loading\");\n this.load({ method: 'GET', params: { '_id' : _this.data.id }}); \n }\n \n return;\n }\n if (action.type == 'load') {\n _this.dialog.el.unmask();\n return;\n }\n if (action.type == 'submit' ) {\n _this.dialog.el.unmask();\n _this.dialog.hide();\n\n if (_this.callback) {\n _this.callback.call(_this, action.result.data);\n }\n _this.form.reset();\n }\n}\n", - "|rendered": "function (form)\n{\n _this.form = form;\n}" - }, - "method": "POST", - "style": "margin: 5px", - "xtype": "Form", - "|url": "baseURL + '/Roo/core_enum.php'", - "|xns": "Roo.form", - "items": [ - { - "actionMode": "fieldEl", - "allowBlank": false, - "fieldLabel": "Name", - "hidden": true, - "name": "name", - "width": 200, - "xtype": "TextField", - "|xns": "Roo.form" - }, - { - "listeners": { - "keyup": "function (_self, e)\n{\n _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());\n \n}" - }, - "allowBlank": false, - "fieldLabel": "Display Name", - "name": "display_name", - "width": 200, - "xtype": "TextField", - "|xns": "Roo.form" - }, - { - "fieldLabel": "Active", - "inputValue": 1, - "name": "active", - "value": 0, - "valueOff": 0, - "xtype": "Checkbox", - "|xns": "Roo.form" - }, - { - "name": "etype", - "xtype": "Hidden", - "|xns": "Roo.form" - }, - { - "name": "seqid", - "value": 0, - "xtype": "Hidden", - "|xns": "Roo.form" - }, - { - "name": "id", - "xtype": "Hidden", - "|xns": "Roo.form" - } - ] - } - ] - }, - { - "listeners": { - "|click": "function() {\n _this.form.reset();\n _this.dialog.hide();\n}" - }, - "*prop": "buttons[]", - "text": "Cancel", - "xtype": "Button", - "|xns": "Roo" - }, - { - "listeners": { - "|click": "function() {\n\n var name = _this.form.findField('name').getValue();\n name = name.toUpperCase().replace(/[^A-Z]+/g, '');\n if (!name.length) {\n Roo.MessageBox.alert(\"Error\",\"Please fill in a valid name\");\n return;\n }\n _this.form.findField('name').setValue(name);\n \n _this.form.doAction('submit');\n \n}" - }, - "*prop": "buttons[]", - "text": "OK", - "xtype": "Button", - "|xns": "Roo" - } - ] + "fieldLabel" : "Name", + "hidden" : true, + "xtype" : "TextField", + "allowBlank" : false, + "actionMode" : "fieldEl", + "width" : 200, + "$ xns" : "Roo.form", + "name" : "name" + }, + { + "listeners" : { + "keyup" : "function (_self, e)\n{\n _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase());\n \n}" + }, + "fieldLabel" : "Display Name", + "xtype" : "TextField", + "allowBlank" : false, + "width" : 200, + "$ xns" : "Roo.form", + "name" : "display_name" + }, + { + "fieldLabel" : "Active", + "inputValue" : 1, + "value" : 0, + "xtype" : "Checkbox", + "valueOff" : 0, + "$ xns" : "Roo.form", + "name" : "active" + }, + { + "xtype" : "Hidden", + "$ xns" : "Roo.form", + "name" : "etype" + }, + { + "xtype" : "Hidden", + "$ xns" : "Roo.form", + "name" : "etype" + }, + { + "xtype" : "Hidden", + "value" : 0, + "$ xns" : "Roo.form", + "name" : "seqid" + }, + { + "xtype" : "Hidden", + "$ xns" : "Roo.form", + "name" : "id" } - ], - "permname": "", - "modOrder": "001" + ] + } + ] + }, + { + "listeners" : { + "|click" : "function() {\n _this.form.reset();\n _this.dialog.hide();\n}" + }, + "text" : "Cancel", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + }, + { + "listeners" : { + "|click" : "function() {\n\n var name = _this.form.findField('name').getValue();\n name = name.toUpperCase().replace(/[^A-Z]+/g, '');\n if (!name.length) {\n Roo.MessageBox.alert(\"Error\",\"Please fill in a valid name\");\n return;\n }\n _this.form.findField('name').setValue(name);\n \n _this.form.doAction('submit');\n \n}" + }, + "text" : "OK", + "xtype" : "Button", + "$ xns" : "Roo", + "* prop" : "buttons[]" + } + ] + } + ] } \ No newline at end of file diff --git a/Pman.Dialog.CoreEnum.js b/Pman.Dialog.CoreEnum.js index 9897e407..b9f57629 100644 --- a/Pman.Dialog.CoreEnum.js +++ b/Pman.Dialog.CoreEnum.js @@ -2,193 +2,223 @@ // Auto generated file - created by app.Builder.js- do not edit directly (at present!) +Roo.namespace('Pman.Dialog'); + Pman.Dialog.CoreEnum = { - dialog : false, - callback: false, + _strings : { + '518ad9ed87d3ca17e223a91604b464d5' :"Add / Edit Core Enum", + 'cfcd208495d565ef66e7dff9f98764da' :"0", + 'ea4788705e6873b424c65e91c2846b19' :"Cancel", + 'e0aa021e21dddbd6d8cecec71e9cf564' :"OK" + }, + + dialog : false, + callback: false, + + show : function(data, cb) + { + if (!this.dialog) { + this.create(); + } - 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 }); + } - 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', + titlebar : false, + xns : Roo, + xtype : 'LayoutRegion' }, + '|xns' : 'Roo', + background : true, + closable : false, + collapsible : false, + height : 150, + modal : true, + resizable : false, + title : _this._strings['518ad9ed87d3ca17e223a91604b464d5'], + width : 400, + xns : Roo, + xtype : 'LayoutDialog', + buttons : [ + { + '|xns' : 'Roo', + text : _this._strings['ea4788705e6873b424c65e91c2846b19'], + xns : Roo, + xtype : 'Button', + listeners : { + click : function() { + _this.form.reset(); + _this.dialog.hide(); + } + } + }, +{ + '|xns' : 'Roo', + text : _this._strings['e0aa021e21dddbd6d8cecec71e9cf564'], + xns : Roo, + xtype : 'Button', + listeners : { + click : function() { + + var name = _this.form.findField('name').getValue(); + name = name.toUpperCase().replace(/[^A-Z]+/g, ''); + if (!name.length) { + Roo.MessageBox.alert("Error","Please fill in a valid name"); + return; + } + _this.form.findField('name').setValue(name); + + _this.form.doAction('submit'); + + } + } + } + ], + listeners : { + show : function (_self) + { + + } + }, + items : [ + { + '|xns' : 'Roo', + background : true, + fitToFrame : true, + region : 'center', + xns : Roo, + xtype : 'ContentPanel', + items : [ + { + '|xns' : 'Roo.form', + method : 'POST', + style : 'margin: 5px', + url : baseURL + '/Roo/core_enum.php', + xns : Roo.form, + xtype : 'Form', + listeners : { + actioncomplete : function (_self, action) + { + if (action.type == 'setdata') { + + if((typeof(_this.data.etype) == 'undefined') || !_this.data.etype.length){ + Roo.MessageBox.alert('Error', 'Missing etype'); + _this.dialog.hide(); + return; + } + + if(_this.data.id){ + _this.dialog.el.mask("Loading"); + this.load({ method: 'GET', params: { '_id' : _this.data.id }}); + } + + return; + } + if (action.type == 'load') { + _this.dialog.el.unmask(); + return; + } + if (action.type == 'submit' ) { + _this.dialog.el.unmask(); + _this.dialog.hide(); + + if (_this.callback) { + _this.callback.call(_this, action.result.data); + } + _this.form.reset(); + } + }, + rendered : function (form) + { + _this.form = form; + } + }, + items : [ + { + '|xns' : 'Roo.form', + actionMode : 'fieldEl', + allowBlank : false, + fieldLabel : 'Name', + hidden : true, + name : 'name', + width : 200, + xns : Roo.form, + xtype : 'TextField' + }, + { + '|xns' : 'Roo.form', + allowBlank : false, + fieldLabel : 'Display Name', + name : 'display_name', + width : 200, + xns : Roo.form, + xtype : 'TextField', + listeners : { + keyup : function (_self, e) + { + _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase()); + + } + } + }, + { + '|xns' : 'Roo.form', + fieldLabel : 'Active', + inputValue : 1, + name : 'active', + value : 0, + valueOff : 0, + xns : Roo.form, + xtype : 'Checkbox' + }, + { + '|xns' : 'Roo.form', + name : 'etype', + xns : Roo.form, + xtype : 'Hidden' + }, + { + '|xns' : 'Roo.form', + name : 'etype', + xns : Roo.form, + xtype : 'Hidden' + }, + { + '|xns' : 'Roo.form', + name : 'seqid', + value : 0, + xns : Roo.form, + xtype : 'Hidden' + }, + { + '|xns' : 'Roo.form', + name : 'id', + xns : Roo.form, + xtype : 'Hidden' + } + ] + + } + ] + + } + ] - create : function() - { - var _this = this; - this.dialog = Roo.factory({ - xtype: 'LayoutDialog', - xns: Roo, - listeners : { - show : function (_self) - { - - } - }, - background : true, - closable : false, - collapsible : false, - height : 150, - modal : true, - resizable : false, - title : "Add / Edit Core Enum", - width : 400, - items : [ - { - xtype: 'ContentPanel', - xns: Roo, - background : true, - fitToFrame : true, - region : 'center', - items : [ - { - xtype: 'Form', - xns: Roo.form, - listeners : { - actioncomplete : function (_self, action) - { - if (action.type == 'setdata') { - - if((typeof(_this.data.etype) == 'undefined') || !_this.data.etype.length){ - Roo.MessageBox.alert('Error', 'Missing etype'); - _this.dialog.hide(); - return; - } - - if(_this.data.id){ - _this.dialog.el.mask("Loading"); - this.load({ method: 'GET', params: { '_id' : _this.data.id }}); - } - - return; - } - if (action.type == 'load') { - _this.dialog.el.unmask(); - return; - } - if (action.type == 'submit' ) { - _this.dialog.el.unmask(); - _this.dialog.hide(); - - if (_this.callback) { - _this.callback.call(_this, action.result.data); - } - _this.form.reset(); - } - }, - rendered : function (form) - { - _this.form = form; - } - }, - method : 'POST', - style : 'margin: 5px', - url : baseURL + '/Roo/core_enum.php', - items : [ - { - xtype: 'TextField', - xns: Roo.form, - actionMode : 'fieldEl', - allowBlank : false, - fieldLabel : 'Name', - hidden : true, - name : 'name', - width : 200 - }, - { - xtype: 'TextField', - xns: Roo.form, - listeners : { - keyup : function (_self, e) - { - _this.form.findField('name').setValue(this.getValue().replace(/[^a-z0-9]/ig, '').toUpperCase()); - - } - }, - allowBlank : false, - fieldLabel : 'Display Name', - name : 'display_name', - width : 200 - }, - { - xtype: 'Checkbox', - xns: Roo.form, - fieldLabel : 'Active', - inputValue : 1, - name : 'active', - value : 0, - valueOff : 0 - }, - { - xtype: 'Hidden', - xns: Roo.form, - name : 'etype' - }, - { - xtype: 'Hidden', - xns: Roo.form, - name : 'seqid', - value : 0 - }, - { - xtype: 'Hidden', - xns: Roo.form, - name : 'id' - } - ] - } - ] - } - ], - center : { - xtype: 'LayoutRegion', - xns: Roo, - titlebar : false - }, - buttons : [ - { - xtype: 'Button', - xns: Roo, - listeners : { - click : function() { - _this.form.reset(); - _this.dialog.hide(); - } - }, - text : "Cancel" - }, - { - xtype: 'Button', - xns: Roo, - listeners : { - click : function() { - - var name = _this.form.findField('name').getValue(); - name = name.toUpperCase().replace(/[^A-Z]+/g, ''); - if (!name.length) { - Roo.MessageBox.alert("Error","Please fill in a valid name"); - return; - } - _this.form.findField('name').setValue(name); - - _this.form.doAction('submit'); - - } - }, - text : "OK" - } - ] - }); - } + }); + } };