php7 fixes
[Pman.Builder] / Pman.Tab.BuilderDatabase.bjs
1 {
2  "name" : "Pman.Tab.BuilderDatabase",
3  "parent" : "Pman.Tab.Builder",
4  "title" : "Pman.Tab.BuilderDatabase",
5  "path" : "/home/edward/gitlive/Pman.Builder/Pman.Tab.BuilderDatabase.bjs",
6  "permname" : "",
7  "modOrder" : "999",
8  "strings" : {
9   "dc45dca245ff2f7b0a897d8a21b1873b" : "Displaying Images{0} - {1} of {2}",
10   "64e05c1766219647a3861e1419c75b6e" : "TOP LEVEL",
11   "651ae5789ab776f2fcaf80b5e62801dc" : "Tables",
12   "0c81971f67c0bd4b33799c5365ec2bf5" : "No Images found",
13   "6a844388ad911a9a292ca8936cd01208" : "Remove Group",
14   "4de4baf3480c0029c625937efcc38c37" : "Add Table/Container",
15   "51c45b795d5d18a3e4e0c37e8b20a141" : "Table",
16   "2f1fb3d9f25082e7fdb0befdad16da5f" : "Export Data",
17   "73eaab781d40c3cc779790197fbaae86" : "Manage Database",
18   "e1a0e2b1f38b57a8dc5aa6fecf0d5174" : "Sync Tables",
19   "81906cf98aa73f3353f46859f79e7ba1" : "Refresh/Manage Tables",
20   "b112803ab9deb7deba2a6b24ef3bb91a" : "Add Group",
21   "c1218806136c5a6445dcc48cec641fec" : "Refresh Schema"
22  },
23  "items" : [
24   {
25    "listeners" : {
26     "activate" : "function (_self)\n{\n _this.treepanel.tree.root.reload();\n}"
27    },
28    "background" : true,
29    "region" : "center",
30    "title" : "Manage Database",
31    "xtype" : "NestedLayoutPanel",
32    "$ xns" : "Roo",
33    "items" : [
34     {
35      "xtype" : "BorderLayout",
36      "$ xns" : "Roo",
37      "* prop" : "layout",
38      "items" : [
39       {
40        "xtype" : "LayoutRegion",
41        "width" : 150,
42        "$ xns" : "Roo",
43        "split" : true,
44        "* prop" : "west"
45       },
46       {
47        "xtype" : "LayoutRegion",
48        "$ xns" : "Roo",
49        "* prop" : "center"
50       },
51       {
52        "listeners" : {
53         "render" : "function (_self)\n{\n   _this.treepanel = _self;\n}"
54        },
55        "region" : "west",
56        "xtype" : "TreePanel",
57        "$ xns" : "Roo",
58        "items" : [
59         {
60          "xtype" : "Toolbar",
61          "$ xns" : "Roo",
62          "* prop" : "toolbar",
63          "items" : [
64           {
65            "listeners" : {
66             "click" : "function (_self, e)\n{\n _this.treepanel.tree.root.reload();\n}"
67            },
68            "text" : "Refresh/Manage Tables",
69            "xtype" : "SplitButton",
70            "$ xns" : "Roo.Toolbar",
71            "items" : [
72             {
73              "xtype" : "Menu",
74              "$ xns" : "Roo.menu",
75              "* prop" : "menu",
76              "items" : [
77               {
78                "text" : "Add Table/Container",
79                "xtype" : "Item",
80                "$ xns" : "Roo.menu"
81               },
82               {
83                "xtype" : "Separator",
84                "$ xns" : "Roo.menu"
85               },
86               {
87                "listeners" : {
88                 "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}"
89                },
90                "text" : "Sync Tables",
91                "xtype" : "Item",
92                "$ xns" : "Roo.menu"
93               },
94               {
95                "xtype" : "Separator",
96                "$ xns" : "Roo.menu"
97               },
98               {
99                "listeners" : {
100                 "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}"
101                },
102                "text" : "Export Data",
103                "xtype" : "Item",
104                "$ xns" : "Roo.menu"
105               }
106              ]
107             }
108            ]
109           }
110          ]
111         },
112         {
113          "listeners" : {
114           "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}",
115           "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}",
116           "beforeload" : "function (node)\n{\n    if (!_this.panel.active) {\n        return false;\n    }\n}"
117          },
118          "xtype" : "TreePanel",
119          "enableDD" : true,
120          "ddGroup" : "dbtree",
121          "rootVisible" : false,
122          "$ xns" : "Roo.tree",
123          "containerScroll" : true,
124          "* prop" : "tree",
125          "items" : [
126           {
127            "listeners" : {
128             "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}"
129            },
130            "$ baseParams" : " { _tree: 1, 'sort': 'name', dir: 'ASC', limit : 9999 }",
131            "root" : "data",
132            "xtype" : "TreeLoader",
133            "requestMethod" : "GET",
134            "$ xns" : "Roo.tree",
135            "* prop" : "loader",
136            "queryParam" : "parent_id",
137            "$ dataUrl" : "baseURL + '/Roo/Builder_tables.php'"
138           },
139           {
140            "xtype" : "MultiSelectionModel",
141            "$ xns" : "Roo.tree",
142            "* prop" : "sm"
143           },
144           {
145            "text" : "TOP LEVEL",
146            "xtype" : "AsyncTreeNode",
147            "$ xns" : "Roo.tree",
148            "* prop" : "root"
149           },
150           {
151            "listeners" : {
152             "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}",
153             "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}"
154            },
155            "xtype" : "TreeEditor",
156            "$ xns" : "Roo.tree",
157            "* prop" : "editor"
158           }
159          ]
160         },
161         {
162          "xtype" : "Menu",
163          "$ xns" : "Roo.menu",
164          "* prop" : "menu",
165          "items" : [
166           {
167            "listeners" : {
168             "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}"
169            },
170            "text" : "Add Group",
171            "xtype" : "Item",
172            "$ xns" : "Roo.menu"
173           },
174           {
175            "xtype" : "Separator",
176            "$ xns" : "Roo.menu"
177           },
178           {
179            "listeners" : {
180             "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}"
181            },
182            "text" : "Remove Group",
183            "xtype" : "Item",
184            "$ xns" : "Roo.menu"
185           }
186          ]
187         }
188        ]
189       },
190       {
191        "listeners" : {
192         "|activate" : "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
193        },
194        "fitToframe" : true,
195        "background" : true,
196        "region" : "center",
197        "title" : "Tables",
198        "xtype" : "GridPanel",
199        "fitContainer" : true,
200        "$ xns" : "Roo",
201        "tableName" : "Tables",
202        "items" : [
203         {
204          "listeners" : {
205           "|rowdblclick" : "function (_self, rowIndex, e)\n{\n    if (!_this.dialog) {\n        return;\n    }\n    \n    _this.dialog.show( this.getDataSource().getAt(rowIndex), function() {\n        _this.grid.footer.onClick('first');\n    }); \n}\n",
206           "|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}"
207          },
208          "autoExpandColumn" : "table",
209          "xtype" : "Grid",
210          "loadMask" : true,
211          "$ xns" : "Roo.grid",
212          "* prop" : "grid",
213          "items" : [
214           {
215            "remoteSort" : true,
216            "xtype" : "Store",
217            "$ sortInfo" : "{ field : 'filename', direction: 'ASC' }",
218            "$ xns" : "Roo.data",
219            "* prop" : "dataSource",
220            "items" : [
221             {
222              "$ url" : "baseURL + '/Builder/ERM.php'",
223              "xtype" : "HttpProxy",
224              "method" : "GET",
225              "$ xns" : "Roo.data",
226              "* prop" : "proxy"
227             },
228             {
229              "id" : "id",
230              "root" : "data",
231              "xtype" : "JsonReader",
232              "$ xns" : "Roo.data",
233              "$ 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]",
234              "* prop" : "reader",
235              "totalProperty" : "total"
236             }
237            ]
238           },
239           {
240            "pageSize" : 25,
241            "xtype" : "PagingToolbar",
242            "emptyMsg" : "No Images found",
243            "$ xns" : "Roo",
244            "displayInfo" : true,
245            "displayMsg" : "Displaying Images{0} - {1} of {2}",
246            "* prop" : "footer"
247           },
248           {
249            "xtype" : "Toolbar",
250            "$ xns" : "Roo",
251            "* prop" : "toolbar",
252            "items" : [
253             {
254              "listeners" : {
255               "|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"
256              },
257              "text" : "Refresh Schema",
258              "xtype" : "Button",
259              "cls" : "x-btn-text-icon",
260              "$ icon" : "Roo.rootURL + 'images/default/dd/drop-add.gif'",
261              "$ xns" : "Roo.Toolbar"
262             }
263            ]
264           },
265           {
266            "xtype" : "ColumnModel",
267            "header" : "Table",
268            "width" : 200,
269            "$ renderer" : "function(v) { return String.format('{0}', v); }",
270            "$ xns" : "Roo.grid",
271            "* prop" : "colModel[]",
272            "dataIndex" : "table"
273           }
274          ]
275         }
276        ]
277       }
278      ]
279     }
280    ]
281   }
282  ]
283 }