Pman.Dialog.AdminGenericName.js
authorAlan Knowles <alan@akbkhome.com>
Wed, 10 Nov 2010 08:05:54 +0000 (16:05 +0800)
committerAlan Knowles <alan@akbkhome.com>
Wed, 10 Nov 2010 08:05:54 +0000 (16:05 +0800)
Pman.Dialog.AdminGenericName.js

index c227083..3e0c68f 100644 (file)
@@ -1 +1,133 @@
-0
\ No newline at end of file
+//<script type="text/javascript">
+
+// Auto generated file - created by app.Builder.js- do not edit directly (at present!)
+
+Pman.Dialog.AdminGenericName = {
+
+    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,
+            closable : false,
+            collapsible : false,
+            height : 80,
+            resizable : false,
+            title : "Edit / Create core_company_type",
+            width : 400,
+            items : [
+                {
+                    xtype: 'ContentPanel',
+                    xns: Roo,
+                    region : 'center',
+                    items : [
+                        {
+                            xtype: 'Form',
+                            xns: Roo.form,
+                            listeners : {
+                                actioncomplete : function(_self,action)
+                                {
+                                    if (action.type == 'setdata') {
+                                       //_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, _this.form.getValues());
+                                         }
+                                         _this.form.reset();
+                                         return;
+                                    }
+                                },
+                                rendered : function (form)
+                                {
+                                    _this.form= form;
+                                }
+                            },
+                            method : 'POST',
+                            style : 'margin:10px;',
+                            url : baseURL + '/Roo/core_company_type.php',
+                            items : [
+                                {
+                                    xtype: 'TextField',
+                                    xns: Roo.form,
+                                    fieldLabel : 'Name',
+                                    name : 'name',
+                                    width : 200
+                                },
+                                {
+                                    xtype: 'Hidden',
+                                    xns: Roo.form,
+                                    name : 'id'
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ],
+            center : {
+                xtype: 'LayoutRegion',
+                xns: Roo
+            },
+            buttons : [
+                {
+                    xtype: 'Button',
+                    xns: Roo,
+                    listeners : {
+                        click : function (_self, e)
+                        {
+                            _this.dialog.hide();
+                        }
+                    },
+                    text : "Cancel"
+                },
+                {
+                    xtype: 'Button',
+                    xns: Roo,
+                    listeners : {
+                        click : function (_self, e)
+                        {
+                            // do some checks?
+                             
+                            
+                            _this.dialog.el.mask("Saving");
+                            _this.form.doAction("submit");
+                        
+                        }
+                    },
+                    text : "Save"
+                }
+            ]
+        });
+    }
+};