Pman.Tab.BuilderView.bjs
[Pman.Builder] / Pman.Tab.BuilderDatabase.bjs
index fafa0c7..d62dea1 100644 (file)
@@ -1,9 +1,9 @@
 {
-    "id": "roo-file-92",
+    "id": "roo-file-201",
     "name": "Pman.Tab.BuilderDatabase",
     "parent": "Pman.Tab.Builder",
     "title": "Pman.Tab.BuilderDatabase",
-    "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderDatabase.bjs",
+    "path": "/home/edward/gitlive/Pman.Builder/Pman.Tab.BuilderDatabase.bjs",
     "items": [
         {
             "listeners": {
                                                             "text": "Sync Tables",
                                                             "xtype": "Item",
                                                             "|xns": "Roo.menu"
+                                                        },
+                                                        {
+                                                            "|xns": "Roo.menu",
+                                                            "xtype": "Separator"
+                                                        },
+                                                        {
+                                                            "listeners": {
+                                                                "click": "function (_self, e)\n{\n/*\n    var node = _this.treepanel.tree.getSelectionModel().getSelectedNode();   \n    \n    if(!node){\n        Roo.MessageBox.alert('Error', 'Please select a table');\n        return;\n    } \n    \n    Roo.log(node.attributes.name);\n    */\n    new Pman.Download({\n        url : baseURL + '/Roo/Builder_tables.php',\n        timeout : 900000,\n        params : {\n            _dumpDatabase : 1\n        },\n        method : 'GET',\n        success : function() {\n        \n        }\n    });\n}"
+                                                            },
+                                                            "text": "Export Data",
+                                                            "xtype": "Item",
+                                                            "|xns": "Roo.menu"
                                                         }
                                                     ]
                                                 }
@@ -84,7 +96,8 @@
                                 {
                                     "listeners": {
                                         "beforeload": "function (node)\n{\n    if (!_this.panel.active) {\n        return false;\n    }\n}",
-                                        "contextmenu": "function (node, e)\n{\n   _this.treepanel.menu = Roo.factory(_this.treepanel.menu);\n   _this.treepanel.menu.show(node.ui.anchor,'tr');\n   _this.cxnode = node;\n}"
+                                        "contextmenu": "function (node, e)\n{\n    if (!node.expanded || node.leaf) {\n        return;\n    }\n\n   _this.treepanel.menu = Roo.factory(_this.treepanel.menu);\n   _this.treepanel.menu.show(node.ui.anchor,'tr');\n   _this.cxnode = node;\n}",
+                                        "beforenodedrop": "function (dropEvent)\n{\n    Roo.log(dropEvent);\n    var node = dropEvent.dropNode;\n    var targ = dropEvent.target;\n    var parent = dropEvent.target;\n    switch(dropEvent.point) {\n        case 'below': \n         case 'above':  \n            parent = dropEvent.target.parentNode;\n            break;\n        default:\n            break;\n    }\n    // technically you should not be able to drag tables into other modules..\n    if (parent.attributes.id < 1) {\n        dropEvent.cancel = 1;\n    }\n    new Pman.Request({\n        url : baseURL + '/Roo/Builder_tables',\n        params : {\n            id : node.attributes.id,\n            parent_id : parent.attributes.id\n        }\n    });\n    \n    \n}"
                                     },
                                     "*prop": "tree",
                                     "containerScroll": true,
                                             "|dataUrl": "baseURL + '/Roo/Builder_tables.php'",
                                             "|xns": "Roo.tree"
                                         },
+                                        {
+                                            "|xns": "Roo.tree",
+                                            "xtype": "MultiSelectionModel",
+                                            "*prop": "sm"
+                                        },
                                         {
                                             "*prop": "root",
                                             "text": "TOP LEVEL",
                                             "xtype": "AsyncTreeNode",
                                             "|xns": "Roo.tree"
                                         },
-                                        {
-                                            "|xns": "Roo.tree",
-                                            "xtype": "DefaultSelectionModel",
-                                            "*prop": "sm"
-                                        },
                                         {
                                             "listeners": {
-                                                "beforenodeedit": "function (_self,node)\n{\n    Roo.log('before start edit');\n    Roo.log(this.editNode);\n    if (node.attributes.name.length) {\n        return false;\n    }\n    return true;\n    \n}"
+                                                "beforenodeedit": "function (_self,node)\n{\n    Roo.log('before start edit');\n    Roo.log(this.editNode);\n    if (node.attributes.name.length) {\n        return false;\n    }\n    return true;\n    \n}",
+                                                "complete": "function (_self, value, startValue)\n{\n    Roo.log(this.editNode);\n\n    var attr = this.editNode.attributes;\n    \n    var pa = this.editNode.parentNode.attributes;\n    Roo.log(pa);\n    var pr =  {\n \n        parent_id : pa.id,\n        descrip : value,\n        name : '',\n        dbschema : ''\n    };\n        \n    if (attr.id > 0) {\n        pr.id = attr.id;\n    }\n    \n    new Pman.Request({\n        url : baseURL + '/Roo/Builder_tables',\n        method : 'POST',\n        params : pr\n    });\n    \n    \n    \n}"
                                             },
                                             "*prop": "editor",
                                             "xtype": "TreeEditor",
                                     "items": [
                                         {
                                             "listeners": {
-                                                "click": "function (_self, e)\n{\n    _this.nIndex =     _this.nIndex || 0;\n    \n    var m = _this.cxnode.firstChild ? 'insertBefore' : 'appendChild';\n    var node = this.cxnode[m](\n        new Roo.tree.TreeNode({\n            text:'New Group ' + (++_this.nIndex), \n            cls:'album-node', \n            allowDrag:false,\n            leaf : false,\n        }), _this.cxnode.firstChild);\n}"
+                                                "click": "function (_self, e)\n{\n    _this.nIndex =     _this.nIndex || 0;\n    \n    var m = _this.cxnode.firstChild ? 'insertBefore' : 'appendChild';\n    var tree =  _this.treepanel.tree;\n    \n    var n = tree.loader.createNode({\n        id : -1,\n        descrip :'New Group ' + (++_this.nIndex), \n        name : ''\n    }); \n    \n    var node = _this.cxnode[m]( n , _this.cxnode.firstChild);\n    setTimeout(function(){\n            tree.editor.editNode = node;\n            tree.editor.startEdit(node.ui.textNode);\n        }, 10);\n}"
                                             },
                                             "text": "Add Group",
                                             "xtype": "Item",
                                             "|xns": "Roo.menu"
+                                        },
+                                        {
+                                            "|xns": "Roo.menu",
+                                            "xtype": "Separator"
+                                        },
+                                        {
+                                            "listeners": {
+                                                "click": "function (_self, e)\n{\n    _this.nIndex =     _this.nIndex || 0;\n    \n    _this.cxnode;\n    // try and delete it..\n    new Pman.Request({\n        url : baseURL + '/Roo/Builder_tables',\n        params : {\n            _delete : _this.cxnode.attributes.id\n        },\n        success : function() {\n            _this.cxnode.parentNode.removeChild(_this.cxnode);\n            _this.cxnode = false;\n        \n        }\n    });\n    \n}"
+                                            },
+                                            "text": "Remove Group",
+                                            "xtype": "Item",
+                                            "|xns": "Roo.menu"
                                         }
                                     ]
                                 }