Pman.Dialog.BuilderAdd.bjs
authorAlan Knowles <alan@roojs.com>
Tue, 17 Feb 2015 08:13:49 +0000 (16:13 +0800)
committerAlan Knowles <alan@roojs.com>
Tue, 17 Feb 2015 08:13:49 +0000 (16:13 +0800)
Pman.Dialog.BuilderAdd.js

Pman.Dialog.BuilderAdd.bjs
Pman.Dialog.BuilderAdd.js

index c5a0073..05db2f3 100644 (file)
 {
-    "name" : "Pman.Dialog.BuilderAdd",
-    "parent" : "",
-    "title" : "Pman.Dialog.BuilderAdd",
-    "path" : "/home/alan/gitlive/Pman.Builder/Pman.Dialog.BuilderAdd.bjs",
-    "permname" : "",
-    "modOrder" : "001",
-    "items" : [
+ "name" : "Pman.Dialog.BuilderAdd",
+ "parent" : "",
+ "title" : "Pman.Dialog.BuilderAdd",
+ "path" : "/home/alan/gitlive/Pman.Builder/Pman.Dialog.BuilderAdd.bjs",
+ "permname" : "",
+ "modOrder" : "001",
+ "items" : [
+  {
+   "modal" : true,
+   "title" : "Add Node",
+   "xtype" : "LayoutDialog",
+   "width" : 400,
+   "$ xns" : "Roo",
+   "closable" : false,
+   "resizable" : false,
+   "height" : 170,
+   "items" : [
+    {
+     "region" : "center",
+     "xtype" : "ContentPanel",
+     "$ xns" : "Roo",
+     "items" : [
+      {
+       "listeners" : {
+        "actioncomplete" : "function (_self, action)\n{\n     if (action.type == 'setdata') {\n         // check if element can be templated or databased..\n         \n          \n     }\n}",
+        "rendered" : "function (form)\n{\n  _this.form  = form;\n}"
+       },
+       "xtype" : "Form",
+       "$ xns" : "Roo.form",
+       "items" : [
         {
-            "modal" : true,
-            "title" : "Add Node",
-            "xtype" : "LayoutDialog",
-            "width" : 400,
-            "$ xns" : "Roo",
-            "closable" : false,
-            "resizable" : false,
-            "height" : 170,
-            "items" : [
-                {
-                    "region" : "center",
-                    "xtype" : "ContentPanel",
-                    "$ xns" : "Roo",
-                    "items" : [
-                        {
-                            "listeners" : {
-                                "actioncomplete" : "function (_self, action)\n{\n     if (action.type == 'setdata') {\n         // check if element can be templated or databased..\n         \n          \n     }\n}",
-                                "rendered" : "function (form)\n{\n  _this.form  = form;\n}"
-                            },
-                            "xtype" : "Form",
-                            "$ xns" : "Roo.form",
-                            "items" : [
-                                {
-                                    "style" : "width:350px",
-                                    "legend" : "Do you want to create the element : ",
-                                    "xtype" : "FieldSet",
-                                    "labelWidth" : 140,
-                                    "$ xns" : "Roo.form",
-                                    "items" : [
-                                        {
-                                            "fieldLabel" : "From Template",
-                                            "xtype" : "ComboBox",
-                                            "$ xns" : "Roo.form",
-                                            "name" : "template",
-                                            "items" : [
-                                                {
-                                                    "xtype" : "Store",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "alwaysQuery" : true,
-                                            "listWidth" : 400,
-                                            "triggerAction" : "all",
-                                            "fieldLabel" : "From Database Table",
-                                            "displayField" : "name",
-                                            "xtype" : "ComboBox",
-                                            "allowBlank" : true,
-                                            "$ xns" : "Roo.form",
-                                            "name" : "table",
-                                            "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> {desc}</div>",
-                                            "items" : [
-                                                {
-                                                    "xtype" : "Store",
-                                                    "$ xns" : "Roo.data",
-                                                    "* prop" : "store",
-                                                    "items" : [
-                                                        {
-                                                            "$ url" : "baseURL + '/Builder/ERM.php'",
-                                                            "xtype" : "HttpProxy",
-                                                            "method" : "GET",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "proxy"
-                                                        },
-                                                        {
-                                                            "root" : "data",
-                                                            "xtype" : "JsonReader",
-                                                            "$ fields" : "[  'name' , 'desc' ]\n  ",
-                                                            "$ xns" : "Roo.data",
-                                                            "* prop" : "reader",
-                                                            "totalProperty" : "total"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                },
-                {
-                    "xtype" : "LayoutRegion",
-                    "$ xns" : "Roo",
-                    "* prop" : "center"
-                },
-                {
-                    "listeners" : {
-                        "click" : "function (_self, e)\n{\n    var vals = _this.form.getValues();\n    \n    _this.dialog.hide();\n    \n   if (vals.table.length) {\n      Pman.Dialog.BuilderAddTable.show( \n       Roo.apply({  table : vals.table } , _this.data),  \n       \n       function(data) {\n            _this.dialog.hide();\n            var cls = data['|xns'] + '.' + data['xtype'];\n            \n            var res = Pman.Builder.Wizard[cls](data);\n           _this.callback(res); \n       });\n        return;\n    }\n   \n    // otherwise, call back with template??\n   \n     \n     _this.callback(_this.data);\n}"
-                    },
-                    "text" : "OK",
-                    "xtype" : "Button",
-                    "$ xns" : "Roo",
-                    "* prop" : "buttons[]"
-                },
-                {
-                    "listeners" : {
-                        "click" : "function (_self, e)\n{\n   _this.dialog.hide();\n}"
-                    },
-                    "text" : "Cancel",
-                    "xtype" : "Button",
-                    "$ xns" : "Roo",
-                    "* prop" : "buttons[]"
-                }
-            ]
+         "xtype" : "FieldSet",
+         "style" : "width:350px",
+         "legend" : "Do you want to create the element ?",
+         "labelWidth" : 140,
+         "$ xns" : "Roo.form",
+         "items" : [
+          {
+           "fieldLabel" : "From Template",
+           "xtype" : "ComboBox",
+           "$ xns" : "Roo.form",
+           "name" : "template",
+           "items" : [
+            {
+             "xtype" : "Store",
+             "$ xns" : "Roo.data",
+             "* prop" : "store"
+            }
+           ]
+          },
+          {
+           "alwaysQuery" : true,
+           "listWidth" : 400,
+           "triggerAction" : "all",
+           "fieldLabel" : "From Database Table",
+           "displayField" : "name",
+           "xtype" : "ComboBox",
+           "allowBlank" : true,
+           "$ xns" : "Roo.form",
+           "name" : "table",
+           "tpl" : "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> {desc}</div>",
+           "items" : [
+            {
+             "xtype" : "Store",
+             "$ xns" : "Roo.data",
+             "* prop" : "store",
+             "items" : [
+              {
+               "$ url" : "baseURL + '/Builder/ERM.php'",
+               "xtype" : "HttpProxy",
+               "method" : "GET",
+               "$ xns" : "Roo.data",
+               "* prop" : "proxy"
+              },
+              {
+               "root" : "data",
+               "xtype" : "JsonReader",
+               "$ fields" : "[  'name' , 'desc' ]\n  ",
+               "$ xns" : "Roo.data",
+               "* prop" : "reader",
+               "totalProperty" : "total"
+              }
+             ]
+            }
+           ]
+          }
+         ]
         }
-    ]
+       ]
+      }
+     ]
+    },
+    {
+     "xtype" : "LayoutRegion",
+     "$ xns" : "Roo",
+     "* prop" : "center"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n    var vals = _this.form.getValues();\n    \n    _this.dialog.hide();\n    \n   if (vals.table.length) {\n      Pman.Dialog.BuilderAddTable.show( \n       Roo.apply({  table : vals.table } , _this.data),  \n       \n       function(data) {\n            _this.dialog.hide();\n            var cls = data['|xns'] + '.' + data['xtype'];\n            \n            var res = Pman.Builder.Wizard[cls](data);\n           _this.callback(res); \n       });\n        return;\n    }\n   \n    // otherwise, call back with template??\n   \n     \n     _this.callback(_this.data);\n}"
+     },
+     "text" : "OK",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    },
+    {
+     "listeners" : {
+      "click" : "function (_self, e)\n{\n   _this.dialog.hide();\n}"
+     },
+     "text" : "Cancel",
+     "xtype" : "Button",
+     "$ xns" : "Roo",
+     "* prop" : "buttons[]"
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file
index 12011a1..5137ee1 100644 (file)
@@ -6,193 +6,193 @@ Roo.namespace('Pman.Dialog');
 
 Pman.Dialog.BuilderAdd = {
 
-    dialog : false,
-    callback:  false,
-
-    show : function(data, cb)
-    {
-        if (!this.dialog) {
-            this.create();
+ 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({
+   center : {
+    '|xns' : 'Roo',
+    xtype : 'LayoutRegion',
+    xns : Roo
+   },
+   '|xns' : 'Roo',
+   modal : true,
+   title : "Add Node",
+   xtype : 'LayoutDialog',
+   width : 400,
+   xns : Roo,
+   closable : false,
+   resizable : false,
+   height : 170,
+   buttons : [
+     {
+      '|xns' : 'Roo',
+      text : "OK",
+      xtype : 'Button',
+      xns : Roo,
+      listeners : {
+       click : function (_self, e)
+        {
+            var vals = _this.form.getValues();
+            
+            _this.dialog.hide();
+            
+           if (vals.table.length) {
+              Pman.Dialog.BuilderAddTable.show( 
+               Roo.apply({  table : vals.table } , _this.data),  
+               
+               function(data) {
+                    _this.dialog.hide();
+                    var cls = data['|xns'] + '.' + data['xtype'];
+                    
+                    var res = Pman.Builder.Wizard[cls](data);
+                   _this.callback(res); 
+               });
+                return;
+            }
+           
+            // otherwise, call back with template??
+           
+             
+             _this.callback(_this.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 });
+      }
+     },
+{
+      '|xns' : 'Roo',
+      text : "Cancel",
+      xtype : 'Button',
+      xns : Roo,
+      listeners : {
+       click : function (_self, e)
+        {
+           _this.dialog.hide();
         }
-
-    },
-
-    create : function()
+      }
+     }
+   ],
+   items : [
     {
-        var _this = this;
-        this.dialog = Roo.factory({
-            center : {
-                '|xns' : 'Roo',
-                xtype : 'LayoutRegion',
-                xns : Roo
+     '|xns' : 'Roo',
+     region : 'center',
+     xtype : 'ContentPanel',
+     xns : Roo,
+     items : [
+      {
+       '|xns' : 'Roo.form',
+       xtype : 'Form',
+       xns : Roo.form,
+       listeners : {
+        actioncomplete : function (_self, action)
+         {
+              if (action.type == 'setdata') {
+                  // check if element can be templated or databased..
+                  
+                   
+              }
+         },
+        rendered : function (form)
+         {
+           _this.form  = form;
+         }
+       },
+       items : [
+        {
+         '|xns' : 'Roo.form',
+         xtype : 'FieldSet',
+         style : 'width:350px',
+         legend : "Do you want to create the element ?",
+         labelWidth : 140,
+         xns : Roo.form,
+         items : [
+          {
+           store : {
+            '|xns' : 'Roo.data',
+            xtype : 'Store',
+            xns : Roo.data
+           },
+           '|xns' : 'Roo.form',
+           fieldLabel : 'From Template',
+           xtype : 'ComboBox',
+           xns : Roo.form,
+           name : 'template',
+           items : [
+
+           ]
+
+          },
+          {
+           store : {
+            proxy : {
+             '|xns' : 'Roo.data',
+             url : baseURL + '/Builder/ERM.php',
+             xtype : 'HttpProxy',
+             method : 'GET',
+             xns : Roo.data
             },
-            '|xns' : 'Roo',
-            modal : true,
-            title : "Add Node",
-            xtype : 'LayoutDialog',
-            width : 400,
-            xns : Roo,
-            closable : false,
-            resizable : false,
-            height : 170,
-            buttons : [
-                {
-                       '|xns' : 'Roo',
-                       text : "OK",
-                       xtype : 'Button',
-                       xns : Roo,
-                       listeners : {
-                               click : function (_self, e)
-                                  {
-                                      var vals = _this.form.getValues();
-                                      
-                                      _this.dialog.hide();
-                                      
-                                     if (vals.table.length) {
-                                        Pman.Dialog.BuilderAddTable.show( 
-                                         Roo.apply({  table : vals.table } , _this.data),  
-                                         
-                                         function(data) {
-                                              _this.dialog.hide();
-                                              var cls = data['|xns'] + '.' + data['xtype'];
-                                              
-                                              var res = Pman.Builder.Wizard[cls](data);
-                                             _this.callback(res); 
-                                         });
-                                          return;
-                                      }
-                                     
-                                      // otherwise, call back with template??
-                                     
-                                       
-                                       _this.callback(_this.data);
-                                  }
-                       }
-                   },
-{
-                       '|xns' : 'Roo',
-                       text : "Cancel",
-                       xtype : 'Button',
-                       xns : Roo,
-                       listeners : {
-                               click : function (_self, e)
-                                  {
-                                     _this.dialog.hide();
-                                  }
-                       }
-                   }
-            ],
+            reader : {
+             '|xns' : 'Roo.data',
+             root : 'data',
+             xtype : 'JsonReader',
+             fields : [  'name' , 'desc' ],
+             xns : Roo.data,
+             totalProperty : 'total'
+            },
+            '|xns' : 'Roo.data',
+            xtype : 'Store',
+            xns : Roo.data,
             items : [
-               {
-                    '|xns' : 'Roo',
-                    region : 'center',
-                    xtype : 'ContentPanel',
-                    xns : Roo,
-                    items : [
-                       {
-                            '|xns' : 'Roo.form',
-                            xtype : 'Form',
-                            xns : Roo.form,
-                            listeners : {
-                               actioncomplete : function (_self, action)
-                                  {
-                                       if (action.type == 'setdata') {
-                                           // check if element can be templated or databased..
-                                           
-                                            
-                                       }
-                                  },
-                               rendered : function (form)
-                                  {
-                                    _this.form  = form;
-                                  }
-                            },
-                            items : [
-                               {
-                                    '|xns' : 'Roo.form',
-                                    style : 'width:350px',
-                                    legend : "Do you want to create the element : ",
-                                    xtype : 'FieldSet',
-                                    labelWidth : 140,
-                                    xns : Roo.form,
-                                    items : [
-                                       {
-                                            store : {
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                xns : Roo.data
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            fieldLabel : 'From Template',
-                                            xtype : 'ComboBox',
-                                            xns : Roo.form,
-                                            name : 'template',
-                                            items : [
-
-                                            ]
-
-                                        },
-                                       {
-                                            store : {
-                                                proxy : {
-                                                    '|xns' : 'Roo.data',
-                                                    url : baseURL + '/Builder/ERM.php',
-                                                    xtype : 'HttpProxy',
-                                                    method : 'GET',
-                                                    xns : Roo.data
-                                                },
-                                                reader : {
-                                                    '|xns' : 'Roo.data',
-                                                    root : 'data',
-                                                    xtype : 'JsonReader',
-                                                    fields : [  'name' , 'desc' ],
-                                                    xns : Roo.data,
-                                                    totalProperty : 'total'
-                                                },
-                                                '|xns' : 'Roo.data',
-                                                xtype : 'Store',
-                                                xns : Roo.data,
-                                                items : [
-
-                                                ]
-
-                                            },
-                                            '|xns' : 'Roo.form',
-                                            alwaysQuery : true,
-                                            listWidth : 400,
-                                            triggerAction : 'all',
-                                            fieldLabel : 'From Database Table',
-                                            displayField : 'name',
-                                            xtype : 'ComboBox',
-                                            allowBlank : true,
-                                            xns : Roo.form,
-                                            name : 'table',
-                                            tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> {desc}</div>',
-                                            items : [
-
-                                            ]
-
-                                        }
-                                    ]
-
-                                }
-                            ]
-
-                        }
-                    ]
-
-                }
+
             ]
 
-        });
+           },
+           '|xns' : 'Roo.form',
+           alwaysQuery : true,
+           listWidth : 400,
+           triggerAction : 'all',
+           fieldLabel : 'From Database Table',
+           displayField : 'name',
+           xtype : 'ComboBox',
+           allowBlank : true,
+           xns : Roo.form,
+           name : 'table',
+           tpl : '<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b> {desc}</div>',
+           items : [
+
+           ]
+
+          }
+         ]
+
+        }
+       ]
+
+      }
+     ]
+
     }
+   ]
+
+  });
+ }
 };