Pman.Tab.BuilderDatabase.bjs
[Pman.Builder] / Pman.Tab.BuilderDatabase.bjs
1 {
2     "id": "roo-file-92",
3     "name": "Pman.Tab.BuilderDatabase",
4     "parent": "Pman.Tab.Builder",
5     "title": "Pman.Tab.BuilderDatabase",
6     "path": "/home/alan/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                                                 }
80                                             ]
81                                         }
82                                     ]
83                                 },
84                                 {
85                                     "listeners": {
86                                         "beforeload": "function (node)\n{\n    if (!_this.panel.active) {\n        return false;\n    }\n}",
87                                         "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}"
88                                     },
89                                     "*prop": "tree",
90                                     "containerScroll": true,
91                                     "ddGroup": "dbtree",
92                                     "enableDD": true,
93                                     "rootVisible": false,
94                                     "xtype": "TreePanel",
95                                     "|xns": "Roo.tree",
96                                     "items": [
97                                         {
98                                             "listeners": {
99                                                 "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}"
100                                             },
101                                             "*prop": "loader",
102                                             "queryParam": "parent_id",
103                                             "requestMethod": "GET",
104                                             "root": "data",
105                                             "xtype": "TreeLoader",
106                                             "|baseParams": " { _tree: 1, 'sort': 'name', dir: 'ASC', limit : 9999 }",
107                                             "|dataUrl": "baseURL + '/Roo/Builder_tables.php'",
108                                             "|xns": "Roo.tree"
109                                         },
110                                         {
111                                             "*prop": "root",
112                                             "text": "TOP LEVEL",
113                                             "xtype": "AsyncTreeNode",
114                                             "|xns": "Roo.tree"
115                                         },
116                                         {
117                                             "|xns": "Roo.tree",
118                                             "xtype": "DefaultSelectionModel",
119                                             "*prop": "sm"
120                                         },
121                                         {
122                                             "listeners": {
123                                                 "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}"
124                                             },
125                                             "*prop": "editor",
126                                             "xtype": "TreeEditor",
127                                             "|xns": "Roo.tree"
128                                         }
129                                     ]
130                                 },
131                                 {
132                                     "|xns": "Roo.menu",
133                                     "xtype": "Menu",
134                                     "*prop": "menu",
135                                     "items": [
136                                         {
137                                             "listeners": {
138                                                 "click": "function (_self, e)\n{\n    _this.nIndex =     _this.nIndex || 0;\n    \n    var m = _this.cxnode.firstChild ? 'insertBefore' : 'appendChild';\n    var node = _this.cxnode[m](\n        new Roo.tree.AsyncTreeNode({\n            text:'New Group ' + (++_this.nIndex), \n            cls:'album-node', \n            allowDrag:false,\n            leaf : false,\n        }), _this.cxnode.firstChild);\n}"
139                                             },
140                                             "text": "Add Group",
141                                             "xtype": "Item",
142                                             "|xns": "Roo.menu"
143                                         }
144                                     ]
145                                 }
146                             ]
147                         },
148                         {
149                             "listeners": {
150                                 "|activate": "function() {\n    _this.panel = this;\n    if (_this.grid) {\n        _this.grid.footer.onClick('first');\n    }\n}"
151                             },
152                             "background": true,
153                             "fitContainer": true,
154                             "fitToframe": true,
155                             "region": "center",
156                             "tableName": "Tables",
157                             "title": "Tables",
158                             "xtype": "GridPanel",
159                             "|xns": "Roo",
160                             "items": [
161                                 {
162                                     "listeners": {
163                                         "|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}",
164                                         "|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"
165                                     },
166                                     "*prop": "grid",
167                                     "autoExpandColumn": "table",
168                                     "loadMask": true,
169                                     "xtype": "Grid",
170                                     "|xns": "Roo.grid",
171                                     "items": [
172                                         {
173                                             "*prop": "dataSource",
174                                             "xtype": "Store",
175                                             "remoteSort": true,
176                                             "|sortInfo": "{ field : 'filename', direction: 'ASC' }",
177                                             "|xns": "Roo.data",
178                                             "items": [
179                                                 {
180                                                     "*prop": "proxy",
181                                                     "method": "GET",
182                                                     "xtype": "HttpProxy",
183                                                     "|url": "baseURL + '/Builder/ERM.php'",
184                                                     "|xns": "Roo.data"
185                                                 },
186                                                 {
187                                                     "|xns": "Roo.data",
188                                                     "xtype": "JsonReader",
189                                                     "totalProperty": "total",
190                                                     "root": "data",
191                                                     "*prop": "reader",
192                                                     "id": "id",
193                                                     "|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]"
194                                                 }
195                                             ]
196                                         },
197                                         {
198                                             "*prop": "footer",
199                                             "xtype": "PagingToolbar",
200                                             "pageSize": 25,
201                                             "displayInfo": true,
202                                             "displayMsg": "Displaying Images{0} - {1} of {2}",
203                                             "emptyMsg": "No Images found",
204                                             "|xns": "Roo"
205                                         },
206                                         {
207                                             "*prop": "toolbar",
208                                             "xtype": "Toolbar",
209                                             "|xns": "Roo",
210                                             "items": [
211                                                 {
212                                                     "listeners": {
213                                                         "|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"
214                                                     },
215                                                     "cls": "x-btn-text-icon",
216                                                     "text": "Refresh Schema",
217                                                     "xtype": "Button",
218                                                     "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
219                                                     "|xns": "Roo.Toolbar"
220                                                 }
221                                             ]
222                                         },
223                                         {
224                                             "*prop": "colModel[]",
225                                             "dataIndex": "table",
226                                             "header": "Table",
227                                             "width": 200,
228                                             "xtype": "ColumnModel",
229                                             "|renderer": "function(v) { return String.format('{0}', v); }",
230                                             "|xns": "Roo.grid"
231                                         }
232                                     ]
233                                 }
234                             ]
235                         }
236                     ]
237                 }
238             ]
239         }
240     ],
241     "permname": "",
242     "modOrder": "999"
243 }