Pman.Dialog.CoreEnum.bjs
authorEdward <edward@roojs.com>
Mon, 3 Mar 2014 08:51:38 +0000 (16:51 +0800)
committerEdward <edward@roojs.com>
Mon, 3 Mar 2014 08:51:38 +0000 (16:51 +0800)
Pman.Dialog.CoreEnum.js

Pman.Dialog.CoreEnum.bjs [new file with mode: 0644]
Pman.Dialog.CoreEnum.js [new file with mode: 0644]

diff --git a/Pman.Dialog.CoreEnum.bjs b/Pman.Dialog.CoreEnum.bjs
new file mode 100644 (file)
index 0000000..10a7eca
--- /dev/null
@@ -0,0 +1,97 @@
+{
+    "id": "roo-file-323",
+    "name": "Pman.Dialog.CoreEnum",
+    "parent": "",
+    "title": "",
+    "path": "/home/edward/gitlive/Pman.Core/Pman.Dialog.CoreEnum.bjs",
+    "items": [
+        {
+            "listeners": {
+                "show": "function (_self)\n{\n    \n}"
+            },
+            "background": true,
+            "closable": false,
+            "collapsible": false,
+            "height": 100,
+            "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": {
+                                "|actionfailed": "function (_self, action)\n{\n    _this.dialog.el.unmask(); \n    Pman.standardActionFailed(_self, action);\n}\n",
+                                "|actioncomplete": "function (_self, action)\n{\n  if (action.type == 'setdata') {\n       //_this.dialog.el.mask(\"Loading\");\n       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});\n       \n       // this is 'new' only!!!\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": [
+                                {
+                                    "allowBlank": false,
+                                    "fieldLabel": "Name",
+                                    "name": "name",
+                                    "width": 200,
+                                    "xtype": "TextField",
+                                    "|xns": "Roo.form"
+                                },
+                                {
+                                    "allowBlank": false,
+                                    "fieldLabel": "Industry Name",
+                                    "name": "display_name",
+                                    "width": 200,
+                                    "xtype": "TextField",
+                                    "|xns": "Roo.form"
+                                },
+                                {
+                                    "name": "id",
+                                    "xtype": "Hidden",
+                                    "|xns": "Roo.form"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "text": "Cancel",
+                    "xtype": "Button",
+                    "|xns": "Roo",
+                    "listeners": {
+                        "|click": "function() {\n    _this.form.reset();\n    _this.dialog.hide();\n}"
+                    },
+                    "*prop": "buttons[]"
+                },
+                {
+                    "listeners": {
+                        "|click": "function() {\n\n    var name =     _this.form.findField('display_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 \n    _this.form.doAction('submit');\n    \n}"
+                    },
+                    "*prop": "buttons[]",
+                    "text": "OK",
+                    "xtype": "Button",
+                    "|xns": "Roo"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": "001"
+}
\ No newline at end of file
diff --git a/Pman.Dialog.CoreEnum.js b/Pman.Dialog.CoreEnum.js
new file mode 100644 (file)
index 0000000..2015dfd
--- /dev/null
@@ -0,0 +1,165 @@
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Pman.Dialog.CoreEnum = {
+
+    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 });
+        }
+
+    },
+
+    create : function()
+    {
+        var _this = this;
+        this.dialog = Roo.factory({
+            xtype: 'LayoutDialog',
+            xns: Roo,
+            listeners : {
+                show : function (_self)
+                {
+                    
+                }
+            },
+            background : true,
+            closable : false,
+            collapsible : false,
+            height : 100,
+            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 : {
+                                actionfailed : function (_self, action)
+                                {
+                                    _this.dialog.el.unmask(); 
+                                    Pman.standardActionFailed(_self, action);
+                                },
+                                actioncomplete : function (_self, action)
+                                {
+                                  if (action.type == 'setdata') {
+                                       //_this.dialog.el.mask("Loading");
+                                       //this.load({ method: 'GET', params: { '_id' : _this.data.id }});
+                                       
+                                       // this is 'new' only!!!
+                                
+                                       
+                                       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,
+                                    allowBlank : false,
+                                    fieldLabel : 'Name',
+                                    name : 'name',
+                                    width : 200
+                                },
+                                {
+                                    xtype: 'TextField',
+                                    xns: Roo.form,
+                                    allowBlank : false,
+                                    fieldLabel : 'Industry Name',
+                                    name : 'display_name',
+                                    width : 200
+                                },
+                                {
+                                    xtype: 'Hidden',
+                                    xns: Roo.form,
+                                    name : 'id'
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ],
+            center : {
+                xtype: 'LayoutRegion',
+                xns: Roo,
+                titlebar : false
+            },
+            buttons : [
+                {
+                    xtype: 'Button',
+                    xns: Roo,
+                    text : "Cancel",
+                    listeners : {
+                        click : function() {
+                            _this.form.reset();
+                            _this.dialog.hide();
+                        }
+                    }
+                },
+                {
+                    xtype: 'Button',
+                    xns: Roo,
+                    listeners : {
+                        click : function() {
+                        
+                            var name =     _this.form.findField('display_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"
+                }
+            ]
+        });
+    }
+};