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