Pman.Tab.BuilderDatabase.bjs
authoredward <edward@roojs.com>
Mon, 21 Nov 2016 07:54:32 +0000 (15:54 +0800)
committeredward <edward@roojs.com>
Mon, 21 Nov 2016 07:54:32 +0000 (15:54 +0800)
Pman.Tab.BuilderDatabase.js

Pman.Tab.BuilderDatabase.bjs
Pman.Tab.BuilderDatabase.js

index d62dea1..a224c9f 100644 (file)
 {
-    "id": "roo-file-201",
-    "name": "Pman.Tab.BuilderDatabase",
-    "parent": "Pman.Tab.Builder",
-    "title": "Pman.Tab.BuilderDatabase",
-    "path": "/home/edward/gitlive/Pman.Builder/Pman.Tab.BuilderDatabase.bjs",
-    "items": [
+ "name" : "Pman.Tab.BuilderDatabase",
+ "parent" : "Pman.Tab.Builder",
+ "title" : "Pman.Tab.BuilderDatabase",
+ "path" : "/home/edward/gitlive/Pman.Builder/Pman.Tab.BuilderDatabase.bjs",
+ "permname" : "",
+ "modOrder" : "999",
+ "strings" : {
+  "dc45dca245ff2f7b0a897d8a21b1873b" : "Displaying Images{0} - {1} of {2}",
+  "64e05c1766219647a3861e1419c75b6e" : "TOP LEVEL",
+  "651ae5789ab776f2fcaf80b5e62801dc" : "Tables",
+  "0c81971f67c0bd4b33799c5365ec2bf5" : "No Images found",
+  "6a844388ad911a9a292ca8936cd01208" : "Remove Group",
+  "4de4baf3480c0029c625937efcc38c37" : "Add Table/Container",
+  "51c45b795d5d18a3e4e0c37e8b20a141" : "Table",
+  "2f1fb3d9f25082e7fdb0befdad16da5f" : "Export Data",
+  "73eaab781d40c3cc779790197fbaae86" : "Manage Database",
+  "e1a0e2b1f38b57a8dc5aa6fecf0d5174" : "Sync Tables",
+  "81906cf98aa73f3353f46859f79e7ba1" : "Refresh/Manage Tables",
+  "b112803ab9deb7deba2a6b24ef3bb91a" : "Add Group",
+  "c1218806136c5a6445dcc48cec641fec" : "Refresh Schema"
+ },
+ "items" : [
+  {
+   "listeners" : {
+    "activate" : "function (_self)\n{\n _this.treepanel.tree.root.reload();\n}"
+   },
+   "background" : true,
+   "region" : "center",
+   "title" : "Manage Database",
+   "xtype" : "NestedLayoutPanel",
+   "$ xns" : "Roo",
+   "items" : [
+    {
+     "xtype" : "BorderLayout",
+     "$ xns" : "Roo",
+     "* prop" : "layout",
+     "items" : [
+      {
+       "xtype" : "LayoutRegion",
+       "width" : 150,
+       "$ xns" : "Roo",
+       "split" : true,
+       "* prop" : "west"
+      },
+      {
+       "xtype" : "LayoutRegion",
+       "$ xns" : "Roo",
+       "* prop" : "center"
+      },
+      {
+       "listeners" : {
+        "render" : "function (_self)\n{\n   _this.treepanel = _self;\n}"
+       },
+       "region" : "west",
+       "xtype" : "TreePanel",
+       "$ xns" : "Roo",
+       "items" : [
         {
-            "listeners": {
-                "activate": "function (_self)\n{\n _this.treepanel.tree.root.reload();\n}"
+         "xtype" : "Toolbar",
+         "$ xns" : "Roo",
+         "* prop" : "toolbar",
+         "items" : [
+          {
+           "listeners" : {
+            "click" : "function (_self, e)\n{\n _this.treepanel.tree.root.reload();\n}"
+           },
+           "text" : "Refresh/Manage Tables",
+           "xtype" : "SplitButton",
+           "$ xns" : "Roo.Toolbar",
+           "items" : [
+            {
+             "xtype" : "Menu",
+             "$ xns" : "Roo.menu",
+             "* prop" : "menu",
+             "items" : [
+              {
+               "text" : "Add Table/Container",
+               "xtype" : "Item",
+               "$ xns" : "Roo.menu"
+              },
+              {
+               "xtype" : "Separator",
+               "$ xns" : "Roo.menu"
+              },
+              {
+               "listeners" : {
+                "click" : "function (_self, e)\n{\n    new Pman.Request({\n        method: 'GET',\n        url: baseURL + '/Roo/Builder_tables.php',\n        params : {\n             _sync : 1\n        }\n    });\n        \n}"
+               },
+               "text" : "Sync Tables",
+               "xtype" : "Item",
+               "$ xns" : "Roo.menu"
+              },
+              {
+               "xtype" : "Separator",
+               "$ xns" : "Roo.menu"
+              },
+              {
+               "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"
+              }
+             ]
+            }
+           ]
+          }
+         ]
+        },
+        {
+         "listeners" : {
+          "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}",
+          "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}",
+          "beforeload" : "function (node)\n{\n    if (!_this.panel.active) {\n        return false;\n    }\n}"
+         },
+         "xtype" : "TreePanel",
+         "enableDD" : true,
+         "ddGroup" : "dbtree",
+         "rootVisible" : false,
+         "$ xns" : "Roo.tree",
+         "containerScroll" : true,
+         "* prop" : "tree",
+         "items" : [
+          {
+           "listeners" : {
+            "create" : "function (_self, attr)\n{\n    Roo.log(\"CREATE\");\n    try {\n        attr.text = attr.name.length ? attr.name : attr.descrip;\n        \n        attr.leaf = attr.name.length ? true : false;\n        attr.html = String.format('<B>{0}</B><i>{1}</i>',\n            attr.name,\n            attr.descrip\n        );\n    } catch(e) {\n        Roo.log(e);\n    }\n    \n    Roo.log(attr);\n\n}"
+           },
+           "$ baseParams" : " { _tree: 1, 'sort': 'name', dir: 'ASC', limit : 9999 }",
+           "root" : "data",
+           "xtype" : "TreeLoader",
+           "requestMethod" : "GET",
+           "$ xns" : "Roo.tree",
+           "* prop" : "loader",
+           "queryParam" : "parent_id",
+           "$ dataUrl" : "baseURL + '/Roo/Builder_tables.php'"
+          },
+          {
+           "xtype" : "MultiSelectionModel",
+           "$ xns" : "Roo.tree",
+           "* prop" : "sm"
+          },
+          {
+           "text" : "TOP LEVEL",
+           "xtype" : "AsyncTreeNode",
+           "$ xns" : "Roo.tree",
+           "* prop" : "root"
+          },
+          {
+           "listeners" : {
+            "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}",
+            "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}"
+           },
+           "xtype" : "TreeEditor",
+           "$ xns" : "Roo.tree",
+           "* prop" : "editor"
+          }
+         ]
+        },
+        {
+         "xtype" : "Menu",
+         "$ xns" : "Roo.menu",
+         "* prop" : "menu",
+         "items" : [
+          {
+           "listeners" : {
+            "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"
+          },
+          {
+           "xtype" : "Separator",
+           "$ xns" : "Roo.menu"
+          },
+          {
+           "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"
+          }
+         ]
+        }
+       ]
+      },
+      {
+       "listeners" : {
+        "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
+       },
+       "fitToframe" : true,
+       "background" : true,
+       "region" : "center",
+       "title" : "Tables",
+       "xtype" : "GridPanel",
+       "fitContainer" : true,
+       "$ xns" : "Roo",
+       "tableName" : "Tables",
+       "items" : [
+        {
+         "listeners" : {
+          "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
+          "|render" : "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}"
+         },
+         "autoExpandColumn" : "table",
+         "xtype" : "Grid",
+         "loadMask" : true,
+         "$ xns" : "Roo.grid",
+         "* prop" : "grid",
+         "items" : [
+          {
+           "remoteSort" : true,
+           "xtype" : "Store",
+           "$ sortInfo" : "{ field : 'filename', direction: 'ASC' }",
+           "$ xns" : "Roo.data",
+           "* prop" : "dataSource",
+           "items" : [
+            {
+             "$ url" : "baseURL + '/Builder/ERM.php'",
+             "xtype" : "HttpProxy",
+             "method" : "GET",
+             "$ xns" : "Roo.data",
+             "* prop" : "proxy"
             },
-            "background": true,
-            "region": "center",
-            "title": "Manage Database",
-            "xtype": "NestedLayoutPanel",
-            "|xns": "Roo",
-            "items": [
-                {
-                    "|xns": "Roo",
-                    "xtype": "BorderLayout",
-                    "*prop": "layout",
-                    "items": [
-                        {
-                            "*prop": "west",
-                            "split": true,
-                            "width": 150,
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
-                        },
-                        {
-                            "*prop": "center",
-                            "xtype": "LayoutRegion",
-                            "|xns": "Roo"
-                        },
-                        {
-                            "listeners": {
-                                "render": "function (_self)\n{\n   _this.treepanel = _self;\n}"
-                            },
-                            "region": "west",
-                            "xtype": "TreePanel",
-                            "|xns": "Roo",
-                            "items": [
-                                {
-                                    "|xns": "Roo",
-                                    "xtype": "Toolbar",
-                                    "*prop": "toolbar",
-                                    "items": [
-                                        {
-                                            "listeners": {
-                                                "click": "function (_self, e)\n{\n _this.treepanel.tree.root.reload();\n}"
-                                            },
-                                            "text": "Refresh/Manage Tables",
-                                            "xtype": "SplitButton",
-                                            "|xns": "Roo.Toolbar",
-                                            "items": [
-                                                {
-                                                    "|xns": "Roo.menu",
-                                                    "xtype": "Menu",
-                                                    "*prop": "menu",
-                                                    "items": [
-                                                        {
-                                                            "text": "Add Table/Container",
-                                                            "xtype": "Item",
-                                                            "|xns": "Roo.menu"
-                                                        },
-                                                        {
-                                                            "|xns": "Roo.menu",
-                                                            "xtype": "Separator"
-                                                        },
-                                                        {
-                                                            "listeners": {
-                                                                "click": "function (_self, e)\n{\n    new Pman.Request({\n        method: 'GET',\n        url: baseURL + '/Roo/Builder_tables.php',\n        params : {\n             _sync : 1\n        }\n    });\n        \n}"
-                                                            },
-                                                            "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"
-                                                        }
-                                                    ]
-                                                }
-                                            ]
-                                        }
-                                    ]
-                                },
-                                {
-                                    "listeners": {
-                                        "beforeload": "function (node)\n{\n    if (!_this.panel.active) {\n        return false;\n    }\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,
-                                    "ddGroup": "dbtree",
-                                    "enableDD": true,
-                                    "rootVisible": false,
-                                    "xtype": "TreePanel",
-                                    "|xns": "Roo.tree",
-                                    "items": [
-                                        {
-                                            "listeners": {
-                                                "create": "function (_self, attr)\n{\n    Roo.log(\"CREATE\");\n    try {\n        attr.text = attr.name.length ? attr.name : attr.descrip;\n        \n        attr.leaf = attr.name.length ? true : false;\n        attr.html = String.format('<B>{0}</B><i>{1}</i>',\n            attr.name,\n            attr.descrip\n        );\n    } catch(e) {\n        Roo.log(e);\n    }\n    Roo.log(attr);\n\n}"
-                                            },
-                                            "*prop": "loader",
-                                            "queryParam": "parent_id",
-                                            "requestMethod": "GET",
-                                            "root": "data",
-                                            "xtype": "TreeLoader",
-                                            "|baseParams": " { _tree: 1, 'sort': 'name', dir: 'ASC', limit : 9999 }",
-                                            "|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"
-                                        },
-                                        {
-                                            "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}",
-                                                "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",
-                                            "|xns": "Roo.tree"
-                                        }
-                                    ]
-                                },
-                                {
-                                    "|xns": "Roo.menu",
-                                    "xtype": "Menu",
-                                    "*prop": "menu",
-                                    "items": [
-                                        {
-                                            "listeners": {
-                                                "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"
-                                        }
-                                    ]
-                                }
-                            ]
-                        },
-                        {
-                            "listeners": {
-                                "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
-                            },
-                            "background": true,
-                            "fitContainer": true,
-                            "fitToframe": true,
-                            "region": "center",
-                            "tableName": "Tables",
-                            "title": "Tables",
-                            "xtype": "GridPanel",
-                            "|xns": "Roo",
-                            "items": [
-                                {
-                                    "listeners": {
-                                        "|render": "function() \n{\n    _this.grid = this; \n    //_this.dialog = Pman.Dialog.FILL_IN\n    if (_this.panel.active) {\n       this.footer.onClick('first');\n    }\n}",
-                                        "|rowdblclick": "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) return;\n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n"
-                                    },
-                                    "*prop": "grid",
-                                    "autoExpandColumn": "table",
-                                    "loadMask": true,
-                                    "xtype": "Grid",
-                                    "|xns": "Roo.grid",
-                                    "items": [
-                                        {
-                                            "*prop": "dataSource",
-                                            "xtype": "Store",
-                                            "remoteSort": true,
-                                            "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
-                                            "|xns": "Roo.data",
-                                            "items": [
-                                                {
-                                                    "*prop": "proxy",
-                                                    "method": "GET",
-                                                    "xtype": "HttpProxy",
-                                                    "|url": "baseURL + '/Builder/ERM.php'",
-                                                    "|xns": "Roo.data"
-                                                },
-                                                {
-                                                    "|xns": "Roo.data",
-                                                    "xtype": "JsonReader",
-                                                    "totalProperty": "total",
-                                                    "root": "data",
-                                                    "*prop": "reader",
-                                                    "id": "id",
-                                                    "|fields": "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'credit',\n        'type': 'string'\n    },\n    {\n        'name': 'source',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filename',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_onid',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_width',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_height',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_created',\n        'type': 'date'\n    },\n    {\n        'name': 'parent_image_id_imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_descript',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_credit',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_source',\n        'type': 'string'\n    }\n]"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "footer",
-                                            "xtype": "PagingToolbar",
-                                            "pageSize": 25,
-                                            "displayInfo": true,
-                                            "displayMsg": "Displaying Images{0} - {1} of {2}",
-                                            "emptyMsg": "No Images found",
-                                            "|xns": "Roo"
-                                        },
-                                        {
-                                            "*prop": "toolbar",
-                                            "xtype": "Toolbar",
-                                            "|xns": "Roo",
-                                            "items": [
-                                                {
-                                                    "listeners": {
-                                                        "|click": "function()\n{\n    Roo.MessageBox.alert(\"Updating\", \"Updating the cache\");\n    new Pman.Request({\n        url : baseURL + '/Core/RefreshDatabaseCache',\n        method : 'GET',\n        success : function() {\n            Roo.MessageBox.hide();\n        }\n    });\n}\n"
-                                                    },
-                                                    "cls": "x-btn-text-icon",
-                                                    "text": "Refresh Schema",
-                                                    "xtype": "Button",
-                                                    "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
-                                                    "|xns": "Roo.Toolbar"
-                                                }
-                                            ]
-                                        },
-                                        {
-                                            "*prop": "colModel[]",
-                                            "dataIndex": "table",
-                                            "header": "Table",
-                                            "width": 200,
-                                            "xtype": "ColumnModel",
-                                            "|renderer": "function(v) { return String.format('{0}', v); }",
-                                            "|xns": "Roo.grid"
-                                        }
-                                    ]
-                                }
-                            ]
-                        }
-                    ]
-                }
-            ]
+            {
+             "id" : "id",
+             "root" : "data",
+             "xtype" : "JsonReader",
+             "$ xns" : "Roo.data",
+             "$ fields" : "[\n    {\n        'name': 'id',\n        'type': 'int'\n    },\n    {\n        'name': 'filename',\n        'type': 'string'\n    },\n    {\n        'name': 'ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'onid',\n        'type': 'int'\n    },\n    {\n        'name': 'mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'width',\n        'type': 'int'\n    },\n    {\n        'name': 'height',\n        'type': 'int'\n    },\n    {\n        'name': 'filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'created',\n        'type': 'date',\n        'dateFormat': 'Y-m-d'\n    },\n    {\n        'name': 'imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'descript',\n        'type': 'string'\n    },\n    {\n        'name': 'title',\n        'type': 'string'\n    },\n    {\n        'name': 'credit',\n        'type': 'string'\n    },\n    {\n        'name': 'source',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filename',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_ontable',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_onid',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_mimetype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_width',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_height',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_filesize',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_displayorder',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_language',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_parent_image_id',\n        'type': 'int'\n    },\n    {\n        'name': 'parent_image_id_created',\n        'type': 'date'\n    },\n    {\n        'name': 'parent_image_id_imgtype',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_linkurl',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_descript',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_title',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_credit',\n        'type': 'string'\n    },\n    {\n        'name': 'parent_image_id_source',\n        'type': 'string'\n    }\n]",
+             "* prop" : "reader",
+             "totalProperty" : "total"
+            }
+           ]
+          },
+          {
+           "pageSize" : 25,
+           "xtype" : "PagingToolbar",
+           "emptyMsg" : "No Images found",
+           "$ xns" : "Roo",
+           "displayInfo" : true,
+           "displayMsg" : "Displaying Images{0} - {1} of {2}",
+           "* prop" : "footer"
+          },
+          {
+           "xtype" : "Toolbar",
+           "$ xns" : "Roo",
+           "* prop" : "toolbar",
+           "items" : [
+            {
+             "listeners" : {
+              "|click" : "function()\n{\n    Roo.MessageBox.alert(\"Updating\", \"Updating the cache\");\n    new Pman.Request({\n        url : baseURL + '/Core/RefreshDatabaseCache',\n        method : 'GET',\n        success : function() {\n            Roo.MessageBox.hide();\n        }\n    });\n}\n"
+             },
+             "text" : "Refresh Schema",
+             "xtype" : "Button",
+             "cls" : "x-btn-text-icon",
+             "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
+             "$ xns" : "Roo.Toolbar"
+            }
+           ]
+          },
+          {
+           "xtype" : "ColumnModel",
+           "header" : "Table",
+           "width" : 200,
+           "$ renderer" : "function(v) { return String.format('{0}', v); }",
+           "$ xns" : "Roo.grid",
+           "* prop" : "colModel[]",
+           "dataIndex" : "table"
+          }
+         ]
         }
-    ],
-    "permname": "",
-    "modOrder": "999"
+       ]
+      }
+     ]
+    }
+   ]
+  }
+ ]
 }
\ No newline at end of file
index 992c0ff..bc1347d 100644 (file)
 
 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
 
+Roo.namespace('Pman.Tab');
+
 Pman.Tab.BuilderDatabase = new Roo.XComponent({
-    part     :  ["Builder","Database"],
-    order    : '999-Pman.Tab.BuilderDatabase',
-    region   : 'center',
-    parent   : 'Pman.Tab.Builder',
-    name     : "Pman.Tab.BuilderDatabase",
-    disabled : false, 
-    permname : '', 
-    _tree : function()
-    {
-        var _this = this;
-        var MODULE = this;
-        return {
-            xtype: 'NestedLayoutPanel',
-            xns: Roo,
+
+ _strings : {
+  'dc45dca245ff2f7b0a897d8a21b1873b' :"Displaying Images{0} - {1} of {2}",
+  '64e05c1766219647a3861e1419c75b6e' :"TOP LEVEL",
+  '651ae5789ab776f2fcaf80b5e62801dc' :"Tables",
+  '0c81971f67c0bd4b33799c5365ec2bf5' :"No Images found",
+  '6a844388ad911a9a292ca8936cd01208' :"Remove Group",
+  '4de4baf3480c0029c625937efcc38c37' :"Add Table/Container",
+  '51c45b795d5d18a3e4e0c37e8b20a141' :"Table",
+  '2f1fb3d9f25082e7fdb0befdad16da5f' :"Export Data",
+  '73eaab781d40c3cc779790197fbaae86' :"Manage Database",
+  'e1a0e2b1f38b57a8dc5aa6fecf0d5174' :"Sync Tables",
+  '81906cf98aa73f3353f46859f79e7ba1' :"Refresh/Manage Tables",
+  'b112803ab9deb7deba2a6b24ef3bb91a' :"Add Group",
+  'c1218806136c5a6445dcc48cec641fec' :"Refresh Schema"
+ },
+
+  part     :  ["Builder", "Database" ],
+  order    : '999-Pman.Tab.BuilderDatabase',
+  region   : 'center',
+  parent   : 'Pman.Tab.Builder',
+  name     : "Pman.Tab.BuilderDatabase",
+  disabled : false, 
+  permname : '', 
+  _tree : function()
+  {
+   var _this = this;
+   var MODULE = this;
+   return {
+   xtype : 'NestedLayoutPanel',
+   background : true,
+   region : 'center',
+   title : _this._strings['73eaab781d40c3cc779790197fbaae86'] /* Manage Database */,
+   listeners : {
+    activate : function (_self)
+     {
+      _this.treepanel.tree.root.reload();
+     }
+   },
+   xns : Roo,
+   '|xns' : 'Roo',
+   layout : {
+    xtype : 'BorderLayout',
+    xns : Roo,
+    '|xns' : 'Roo',
+    center : {
+     xtype : 'LayoutRegion',
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    west : {
+     xtype : 'LayoutRegion',
+     split : true,
+     width : 150,
+     xns : Roo,
+     '|xns' : 'Roo'
+    },
+    items  : [
+     {
+      xtype : 'TreePanel',
+      region : 'west',
+      listeners : {
+       render : function (_self)
+        {
+           _this.treepanel = _self;
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      menu : {
+       xtype : 'Menu',
+       xns : Roo.menu,
+       '|xns' : 'Roo.menu',
+       items  : [
+        {
+         xtype : 'Item',
+         text : _this._strings['b112803ab9deb7deba2a6b24ef3bb91a'] /* Add Group */,
+         listeners : {
+          click : function (_self, e)
+           {
+               _this.nIndex =     _this.nIndex || 0;
+               
+               var m = _this.cxnode.firstChild ? 'insertBefore' : 'appendChild';
+               var tree =  _this.treepanel.tree;
+               
+               var n = tree.loader.createNode({
+                   id : -1,
+                   descrip :'New Group ' + (++_this.nIndex), 
+                   name : ''
+               }); 
+               
+               var node = _this.cxnode[m]( n , _this.cxnode.firstChild);
+               setTimeout(function(){
+                       tree.editor.editNode = node;
+                       tree.editor.startEdit(node.ui.textNode);
+                   }, 10);
+           }
+         },
+         xns : Roo.menu,
+         '|xns' : 'Roo.menu'
+        },
+        {
+         xtype : 'Separator',
+         xns : Roo.menu,
+         '|xns' : 'Roo.menu'
+        },
+        {
+         xtype : 'Item',
+         text : _this._strings['6a844388ad911a9a292ca8936cd01208'] /* Remove Group */,
+         listeners : {
+          click : function (_self, e)
+           {
+               _this.nIndex =     _this.nIndex || 0;
+               
+               _this.cxnode;
+               // try and delete it..
+               new Pman.Request({
+                   url : baseURL + '/Roo/Builder_tables',
+                   params : {
+                       _delete : _this.cxnode.attributes.id
+                   },
+                   success : function() {
+                       _this.cxnode.parentNode.removeChild(_this.cxnode);
+                       _this.cxnode = false;
+                   
+                   }
+               });
+               
+           }
+         },
+         xns : Roo.menu,
+         '|xns' : 'Roo.menu'
+        }
+       ]
+      },
+      toolbar : {
+       xtype : 'Toolbar',
+       xns : Roo,
+       '|xns' : 'Roo',
+       items  : [
+        {
+         xtype : 'SplitButton',
+         text : _this._strings['81906cf98aa73f3353f46859f79e7ba1'] /* Refresh/Manage Tables */,
+         listeners : {
+          click : function (_self, e)
+           {
+            _this.treepanel.tree.root.reload();
+           }
+         },
+         xns : Roo.Toolbar,
+         '|xns' : 'Roo.Toolbar',
+         menu : {
+          xtype : 'Menu',
+          xns : Roo.menu,
+          '|xns' : 'Roo.menu',
+          items  : [
+           {
+            xtype : 'Item',
+            text : _this._strings['4de4baf3480c0029c625937efcc38c37'] /* Add Table/Container */,
+            xns : Roo.menu,
+            '|xns' : 'Roo.menu'
+           },
+           {
+            xtype : 'Separator',
+            xns : Roo.menu,
+            '|xns' : 'Roo.menu'
+           },
+           {
+            xtype : 'Item',
+            text : _this._strings['e1a0e2b1f38b57a8dc5aa6fecf0d5174'] /* Sync Tables */,
             listeners : {
-                activate : function (_self)
-                {
-                 _this.treepanel.tree.root.reload();
-                }
+             click : function (_self, e)
+              {
+                  new Pman.Request({
+                      method: 'GET',
+                      url: baseURL + '/Roo/Builder_tables.php',
+                      params : {
+                           _sync : 1
+                      }
+                  });
+                      
+              }
             },
-            background : true,
-            region : 'center',
-            title : "Manage Database",
-            layout : {
-                xtype: 'BorderLayout',
-                xns: Roo,
-                items : [
-                    {
-                        xtype: 'TreePanel',
-                        xns: Roo,
-                        listeners : {
-                            render : function (_self)
-                            {
-                               _this.treepanel = _self;
-                            }
-                        },
-                        region : 'west',
-                        toolbar : {
-                            xtype: 'Toolbar',
-                            xns: Roo,
-                            items : [
-                                {
-                                    xtype: 'SplitButton',
-                                    xns: Roo.Toolbar,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                         _this.treepanel.tree.root.reload();
-                                        }
-                                    },
-                                    text : "Refresh/Manage Tables",
-                                    menu : {
-                                        xtype: 'Menu',
-                                        xns: Roo.menu,
-                                        items : [
-                                            {
-                                                xtype: 'Item',
-                                                xns: Roo.menu,
-                                                text : "Add Table/Container"
-                                            },
-                                            {
-                                                xtype: 'Separator',
-                                                xns: Roo.menu
-                                            },
-                                            {
-                                                xtype: 'Item',
-                                                xns: Roo.menu,
-                                                listeners : {
-                                                    click : function (_self, e)
-                                                    {
-                                                        new Pman.Request({
-                                                            method: 'GET',
-                                                            url: baseURL + '/Roo/Builder_tables.php',
-                                                            params : {
-                                                                 _sync : 1
-                                                            }
-                                                        });
-                                                            
-                                                    }
-                                                },
-                                                text : "Sync Tables"
-                                            },
-                                            {
-                                                xtype: 'Separator',
-                                                xns: Roo.menu
-                                            },
-                                            {
-                                                xtype: 'Item',
-                                                xns: Roo.menu,
-                                                listeners : {
-                                                    click : function (_self, e)
-                                                    {
-                                                    /*
-                                                        var node = _this.treepanel.tree.getSelectionModel().getSelectedNode();   
-                                                        
-                                                        if(!node){
-                                                            Roo.MessageBox.alert('Error', 'Please select a table');
-                                                            return;
-                                                        } 
-                                                        
-                                                        Roo.log(node.attributes.name);
-                                                        */
-                                                        new Pman.Download({
-                                                            url : baseURL + '/Roo/Builder_tables.php',
-                                                            timeout : 900000,
-                                                            params : {
-                                                                _dumpDatabase : 1
-                                                            },
-                                                            method : 'GET',
-                                                            success : function() {
-                                                            
-                                                            }
-                                                        });
-                                                    }
-                                                },
-                                                text : "Export Data"
-                                            }
-                                        ]
-                                    }
-                                }
-                            ]
-                        },
-                        tree : {
-                            xtype: 'TreePanel',
-                            xns: Roo.tree,
-                            listeners : {
-                                beforeload : function (node)
-                                {
-                                    if (!_this.panel.active) {
-                                        return false;
-                                    }
-                                },
-                                contextmenu : function (node, e)
-                                {
-                                    if (!node.expanded || node.leaf) {
-                                        return;
-                                    }
-                                
-                                   _this.treepanel.menu = Roo.factory(_this.treepanel.menu);
-                                   _this.treepanel.menu.show(node.ui.anchor,'tr');
-                                   _this.cxnode = node;
-                                },
-                                beforenodedrop : function (dropEvent)
-                                {
-                                    Roo.log(dropEvent);
-                                    var node = dropEvent.dropNode;
-                                    var targ = dropEvent.target;
-                                    var parent = dropEvent.target;
-                                    switch(dropEvent.point) {
-                                        case 'below': 
-                                         case 'above':  
-                                            parent = dropEvent.target.parentNode;
-                                            break;
-                                        default:
-                                            break;
-                                    }
-                                    // technically you should not be able to drag tables into other modules..
-                                    if (parent.attributes.id < 1) {
-                                        dropEvent.cancel = 1;
-                                    }
-                                    new Pman.Request({
-                                        url : baseURL + '/Roo/Builder_tables',
-                                        params : {
-                                            id : node.attributes.id,
-                                            parent_id : parent.attributes.id
-                                        }
-                                    });
-                                    
-                                    
-                                }
-                            },
-                            containerScroll : true,
-                            ddGroup : 'dbtree',
-                            enableDD : true,
-                            rootVisible : false,
-                            loader : {
-                                xtype: 'TreeLoader',
-                                xns: Roo.tree,
-                                listeners : {
-                                    create : function (_self, attr)
-                                    {
-                                        Roo.log("CREATE");
-                                        try {
-                                            attr.text = attr.name.length ? attr.name : attr.descrip;
-                                            
-                                            attr.leaf = attr.name.length ? true : false;
-                                            attr.html = String.format('<B>{0}</B><i>{1}</i>',
-                                                attr.name,
-                                                attr.descrip
-                                            );
-                                        } catch(e) {
-                                            Roo.log(e);
-                                        }
-                                        Roo.log(attr);
-                                    
-                                    }
-                                },
-                                queryParam : 'parent_id',
-                                requestMethod : 'GET',
-                                root : 'data',
-                                baseParams : { _tree: 1, 'sort': 'name', dir: 'ASC', limit : 9999 },
-                                dataUrl : baseURL + '/Roo/Builder_tables.php'
-                            },
-                            sm : {
-                                xtype: 'MultiSelectionModel',
-                                xns: Roo.tree
-                            },
-                            root : {
-                                xtype: 'AsyncTreeNode',
-                                xns: Roo.tree,
-                                text : "TOP LEVEL"
-                            },
-                            editor : {
-                                xtype: 'TreeEditor',
-                                xns: Roo.tree,
-                                listeners : {
-                                    beforenodeedit : function (_self,node)
-                                    {
-                                        Roo.log('before start edit');
-                                        Roo.log(this.editNode);
-                                        if (node.attributes.name.length) {
-                                            return false;
-                                        }
-                                        return true;
-                                        
-                                    },
-                                    complete : function (_self, value, startValue)
-                                    {
-                                        Roo.log(this.editNode);
-                                    
-                                        var attr = this.editNode.attributes;
-                                        
-                                        var pa = this.editNode.parentNode.attributes;
-                                        Roo.log(pa);
-                                        var pr =  {
-                                     
-                                            parent_id : pa.id,
-                                            descrip : value,
-                                            name : '',
-                                            dbschema : ''
-                                        };
-                                            
-                                        if (attr.id > 0) {
-                                            pr.id = attr.id;
-                                        }
-                                        
-                                        new Pman.Request({
-                                            url : baseURL + '/Roo/Builder_tables',
-                                            method : 'POST',
-                                            params : pr
-                                        });
-                                        
-                                        
-                                        
-                                    }
-                                }
-                            }
-                        },
-                        menu : {
-                            xtype: 'Menu',
-                            xns: Roo.menu,
-                            items : [
-                                {
-                                    xtype: 'Item',
-                                    xns: Roo.menu,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            _this.nIndex =     _this.nIndex || 0;
-                                            
-                                            var m = _this.cxnode.firstChild ? 'insertBefore' : 'appendChild';
-                                            var tree =  _this.treepanel.tree;
-                                            
-                                            var n = tree.loader.createNode({
-                                                id : -1,
-                                                descrip :'New Group ' + (++_this.nIndex), 
-                                                name : ''
-                                            }); 
-                                            
-                                            var node = _this.cxnode[m]( n , _this.cxnode.firstChild);
-                                            setTimeout(function(){
-                                                    tree.editor.editNode = node;
-                                                    tree.editor.startEdit(node.ui.textNode);
-                                                }, 10);
-                                        }
-                                    },
-                                    text : "Add Group"
-                                },
-                                {
-                                    xtype: 'Separator',
-                                    xns: Roo.menu
-                                },
-                                {
-                                    xtype: 'Item',
-                                    xns: Roo.menu,
-                                    listeners : {
-                                        click : function (_self, e)
-                                        {
-                                            _this.nIndex =     _this.nIndex || 0;
-                                            
-                                            _this.cxnode;
-                                            // try and delete it..
-                                            new Pman.Request({
-                                                url : baseURL + '/Roo/Builder_tables',
-                                                params : {
-                                                    _delete : _this.cxnode.attributes.id
-                                                },
-                                                success : function() {
-                                                    _this.cxnode.parentNode.removeChild(_this.cxnode);
-                                                    _this.cxnode = false;
-                                                
-                                                }
-                                            });
-                                            
-                                        }
-                                    },
-                                    text : "Remove Group"
-                                }
-                            ]
-                        }
-                    },
-                    {
-                        xtype: 'GridPanel',
-                        xns: Roo,
-                        listeners : {
-                            activate : function() {
-                                _this.panel = this;
-                                if (_this.grid) {
-                                    _this.grid.footer.onClick('first');
-                                }
-                            }
-                        },
-                        background : true,
-                        fitContainer : true,
-                        fitToframe : true,
-                        region : 'center',
-                        tableName : 'Tables',
-                        title : "Tables",
-                        grid : {
-                            xtype: 'Grid',
-                            xns: Roo.grid,
-                            listeners : {
-                                render : function() 
-                                {
-                                    _this.grid = this; 
-                                    //_this.dialog = Pman.Dialog.FILL_IN
-                                    if (_this.panel.active) {
-                                       this.footer.onClick('first');
-                                    }
-                                },
-                                rowdblclick : function (_self, rowIndex, e)
-                                {
-                                    if (!_this.dialog) return;
-                                    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
-                                        _this.grid.footer.onClick('first');
-                                    }); 
-                                }
-                            },
-                            autoExpandColumn : 'table',
-                            loadMask : true,
-                            dataSource : {
-                                xtype: 'Store',
-                                xns: Roo.data,
-                                remoteSort : true,
-                                sortInfo : { field : 'filename', direction: 'ASC' },
-                                proxy : {
-                                    xtype: 'HttpProxy',
-                                    xns: Roo.data,
-                                    method : 'GET',
-                                    url : baseURL + '/Builder/ERM.php'
-                                },
-                                reader : {
-                                    xtype: 'JsonReader',
-                                    xns: Roo.data,
-                                    totalProperty : 'total',
-                                    root : 'data',
-                                    id : 'id',
-                                    fields : [
-                                        {
-                                            'name': 'id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'filename',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'ontable',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'onid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'mimetype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'width',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'height',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'filesize',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'displayorder',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'language',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'created',
-                                            'type': 'date',
-                                            'dateFormat': 'Y-m-d'
-                                        },
-                                        {
-                                            'name': 'imgtype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'linkurl',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'descript',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'title',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'credit',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'source',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_filename',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_ontable',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_onid',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_mimetype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_width',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_height',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_filesize',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_displayorder',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_language',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_parent_image_id',
-                                            'type': 'int'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_created',
-                                            'type': 'date'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_imgtype',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_linkurl',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_descript',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_title',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_credit',
-                                            'type': 'string'
-                                        },
-                                        {
-                                            'name': 'parent_image_id_source',
-                                            'type': 'string'
-                                        }
-                                    ]
-                                }
-                            },
-                            footer : {
-                                xtype: 'PagingToolbar',
-                                xns: Roo,
-                                pageSize : 25,
-                                displayInfo : true,
-                                displayMsg : "Displaying Images{0} - {1} of {2}",
-                                emptyMsg : "No Images found"
-                            },
-                            toolbar : {
-                                xtype: 'Toolbar',
-                                xns: Roo,
-                                items : [
-                                    {
-                                        xtype: 'Button',
-                                        xns: Roo.Toolbar,
-                                        listeners : {
-                                            click : function()
-                                            {
-                                                Roo.MessageBox.alert("Updating", "Updating the cache");
-                                                new Pman.Request({
-                                                    url : baseURL + '/Core/RefreshDatabaseCache',
-                                                    method : 'GET',
-                                                    success : function() {
-                                                        Roo.MessageBox.hide();
-                                                    }
-                                                });
-                                            }
-                                        },
-                                        cls : 'x-btn-text-icon',
-                                        text : "Refresh Schema",
-                                        icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
-                                    }
-                                ]
-                            },
-                            colModel : [
-                                {
-                                    xtype: 'ColumnModel',
-                                    xns: Roo.grid,
-                                    dataIndex : 'table',
-                                    header : 'Table',
-                                    width : 200,
-                                    renderer : function(v) { return String.format('{0}', v); }
-                                }
-                            ]
-                        }
+            xns : Roo.menu,
+            '|xns' : 'Roo.menu'
+           },
+           {
+            xtype : 'Separator',
+            xns : Roo.menu,
+            '|xns' : 'Roo.menu'
+           },
+           {
+            xtype : 'Item',
+            text : _this._strings['2f1fb3d9f25082e7fdb0befdad16da5f'] /* Export Data */,
+            listeners : {
+             click : function (_self, e)
+              {
+              /*
+                  var node = _this.treepanel.tree.getSelectionModel().getSelectedNode();   
+                  
+                  if(!node){
+                      Roo.MessageBox.alert('Error', 'Please select a table');
+                      return;
+                  } 
+                  
+                  Roo.log(node.attributes.name);
+                  */
+                  new Pman.Download({
+                      url : baseURL + '/Roo/Builder_tables.php',
+                      timeout : 900000,
+                      params : {
+                          _dumpDatabase : 1
+                      },
+                      method : 'GET',
+                      success : function() {
+                      
+                      }
+                  });
+              }
+            },
+            xns : Roo.menu,
+            '|xns' : 'Roo.menu'
+           }
+          ]
+         }
+        }
+       ]
+      },
+      tree : {
+       xtype : 'TreePanel',
+       containerScroll : true,
+       ddGroup : 'dbtree',
+       enableDD : true,
+       rootVisible : false,
+       listeners : {
+        beforeload : function (node)
+         {
+             if (!_this.panel.active) {
+                 return false;
+             }
+         },
+        beforenodedrop : function (dropEvent)
+         {
+             Roo.log(dropEvent);
+             var node = dropEvent.dropNode;
+             var targ = dropEvent.target;
+             var parent = dropEvent.target;
+             switch(dropEvent.point) {
+                 case 'below': 
+                  case 'above':  
+                     parent = dropEvent.target.parentNode;
+                     break;
+                 default:
+                     break;
+             }
+             // technically you should not be able to drag tables into other modules..
+             if (parent.attributes.id < 1) {
+                 dropEvent.cancel = 1;
+             }
+             new Pman.Request({
+                 url : baseURL + '/Roo/Builder_tables',
+                 params : {
+                     id : node.attributes.id,
+                     parent_id : parent.attributes.id
+                 }
+             });
+             
+             
+         },
+        contextmenu : function (node, e)
+         {
+             if (!node.expanded || node.leaf) {
+                 return;
+             }
+         
+            _this.treepanel.menu = Roo.factory(_this.treepanel.menu);
+            _this.treepanel.menu.show(node.ui.anchor,'tr');
+            _this.cxnode = node;
+         }
+       },
+       xns : Roo.tree,
+       '|xns' : 'Roo.tree',
+       editor : {
+        xtype : 'TreeEditor',
+        listeners : {
+         beforenodeedit : function (_self,node)
+          {
+              Roo.log('before start edit');
+              Roo.log(this.editNode);
+              if (node.attributes.name.length) {
+                  return false;
+              }
+              return true;
+              
+          },
+         complete : function (_self, value, startValue)
+          {
+              Roo.log(this.editNode);
+          
+              var attr = this.editNode.attributes;
+              
+              var pa = this.editNode.parentNode.attributes;
+              Roo.log(pa);
+              var pr =  {
+           
+                  parent_id : pa.id,
+                  descrip : value,
+                  name : '',
+                  dbschema : ''
+              };
+                  
+              if (attr.id > 0) {
+                  pr.id = attr.id;
+              }
+              
+              new Pman.Request({
+                  url : baseURL + '/Roo/Builder_tables',
+                  method : 'POST',
+                  params : pr
+              });
+              
+              
+              
+          }
+        },
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree'
+       },
+       root : {
+        xtype : 'AsyncTreeNode',
+        text : _this._strings['64e05c1766219647a3861e1419c75b6e'] /* TOP LEVEL */,
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree'
+       },
+       loader : {
+        xtype : 'TreeLoader',
+        baseParams : { _tree: 1, 'sort': 'name', dir: 'ASC', limit : 9999 },
+        dataUrl : baseURL + '/Roo/Builder_tables.php',
+        queryParam : 'parent_id',
+        requestMethod : 'GET',
+        root : 'data',
+        listeners : {
+         create : function (_self, attr)
+          {
+              Roo.log("CREATE");
+              try {
+                  attr.text = attr.name.length ? attr.name : attr.descrip;
+                  
+                  attr.leaf = attr.name.length ? true : false;
+                  attr.html = String.format('<B>{0}</B><i>{1}</i>',
+                      attr.name,
+                      attr.descrip
+                  );
+              } catch(e) {
+                  Roo.log(e);
+              }
+              
+              Roo.log(attr);
+          
+          }
+        },
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree'
+       },
+       sm : {
+        xtype : 'MultiSelectionModel',
+        xns : Roo.tree,
+        '|xns' : 'Roo.tree'
+       }
+      }
+     },
+     {
+      xtype : 'GridPanel',
+      background : true,
+      fitContainer : true,
+      fitToframe : true,
+      region : 'center',
+      tableName : 'Tables',
+      title : _this._strings['651ae5789ab776f2fcaf80b5e62801dc'] /* Tables */,
+      listeners : {
+       activate : function() {
+            _this.panel = this;
+            if (_this.grid) {
+                _this.grid.footer.onClick('first');
+            }
+        }
+      },
+      xns : Roo,
+      '|xns' : 'Roo',
+      grid : {
+       xtype : 'Grid',
+       autoExpandColumn : 'table',
+       loadMask : true,
+       listeners : {
+        render : function() 
+         {
+             _this.grid = this; 
+             //_this.dialog = Pman.Dialog.FILL_IN
+             if (_this.panel.active) {
+                this.footer.onClick('first');
+             }
+         },
+        rowdblclick : function (_self, rowIndex, e)
+         {
+             if (!_this.dialog) return;
+             _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {
+                 _this.grid.footer.onClick('first');
+             }); 
+         }
+       },
+       xns : Roo.grid,
+       '|xns' : 'Roo.grid',
+       footer : {
+        xtype : 'PagingToolbar',
+        displayInfo : true,
+        displayMsg : _this._strings['dc45dca245ff2f7b0a897d8a21b1873b'] /* Displaying Images{0} - {1} of {2} */,
+        emptyMsg : _this._strings['0c81971f67c0bd4b33799c5365ec2bf5'] /* No Images found */,
+        pageSize : 25,
+        xns : Roo,
+        '|xns' : 'Roo'
+       },
+       toolbar : {
+        xtype : 'Toolbar',
+        xns : Roo,
+        '|xns' : 'Roo',
+        items  : [
+         {
+          xtype : 'Button',
+          cls : 'x-btn-text-icon',
+          icon : Roo.rootURL + 'images/default/dd/drop-add.gif',
+          text : _this._strings['c1218806136c5a6445dcc48cec641fec'] /* Refresh Schema */,
+          listeners : {
+           click : function()
+            {
+                Roo.MessageBox.alert("Updating", "Updating the cache");
+                new Pman.Request({
+                    url : baseURL + '/Core/RefreshDatabaseCache',
+                    method : 'GET',
+                    success : function() {
+                        Roo.MessageBox.hide();
                     }
-                ],
-                west : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo,
-                    split : true,
-                    width : 150
-                },
-                center : {
-                    xtype: 'LayoutRegion',
-                    xns: Roo
-                }
+                });
             }
-        };
-    }
+          },
+          xns : Roo.Toolbar,
+          '|xns' : 'Roo.Toolbar'
+         }
+        ]
+       },
+       dataSource : {
+        xtype : 'Store',
+        remoteSort : true,
+        sortInfo : { field : 'filename', direction: 'ASC' },
+        xns : Roo.data,
+        '|xns' : 'Roo.data',
+        proxy : {
+         xtype : 'HttpProxy',
+         method : 'GET',
+         url : baseURL + '/Builder/ERM.php',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        },
+        reader : {
+         xtype : 'JsonReader',
+         fields : [
+             {
+                 'name': 'id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'filename',
+                 'type': 'string'
+             },
+             {
+                 'name': 'ontable',
+                 'type': 'string'
+             },
+             {
+                 'name': 'onid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'mimetype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'width',
+                 'type': 'int'
+             },
+             {
+                 'name': 'height',
+                 'type': 'int'
+             },
+             {
+                 'name': 'filesize',
+                 'type': 'int'
+             },
+             {
+                 'name': 'displayorder',
+                 'type': 'int'
+             },
+             {
+                 'name': 'language',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'created',
+                 'type': 'date',
+                 'dateFormat': 'Y-m-d'
+             },
+             {
+                 'name': 'imgtype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'linkurl',
+                 'type': 'string'
+             },
+             {
+                 'name': 'descript',
+                 'type': 'string'
+             },
+             {
+                 'name': 'title',
+                 'type': 'string'
+             },
+             {
+                 'name': 'credit',
+                 'type': 'string'
+             },
+             {
+                 'name': 'source',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_filename',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_ontable',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_onid',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_mimetype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_width',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_height',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_filesize',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_displayorder',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_language',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_parent_image_id',
+                 'type': 'int'
+             },
+             {
+                 'name': 'parent_image_id_created',
+                 'type': 'date'
+             },
+             {
+                 'name': 'parent_image_id_imgtype',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_linkurl',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_descript',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_title',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_credit',
+                 'type': 'string'
+             },
+             {
+                 'name': 'parent_image_id_source',
+                 'type': 'string'
+             }
+         ],
+         id : 'id',
+         root : 'data',
+         totalProperty : 'total',
+         xns : Roo.data,
+         '|xns' : 'Roo.data'
+        }
+       },
+       colModel : [
+        {
+         xtype : 'ColumnModel',
+         dataIndex : 'table',
+         header : _this._strings['51c45b795d5d18a3e4e0c37e8b20a141'] /* Table */,
+         renderer : function(v) { return String.format('{0}', v); },
+         width : 200,
+         xns : Roo.grid,
+         '|xns' : 'Roo.grid'
+        }
+       ]
+      }
+     }
+    ]
+   }
+  };  }
 });