Pman.Tab.BuilderTop.bjs
[Pman.Builder] / Pman.Tab.BuilderTop.bjs
1 {
2     "id": "roo-file-165",
3     "name": "Pman.Tab.BuilderTop",
4     "parent": "Pman.Tab.BuilderTab",
5     "title": "Pman.Tab.BuilderTop",
6     "path": "/home/alan/gitlive/Pman.Builder/Pman.Tab.BuilderTop.bjs",
7     "items": [
8         {
9             "background": true,
10             "fitToFrame": true,
11             "region": "north",
12             "xtype": "ContentPanel",
13             "|xns": "Roo",
14             "items": [
15                 {
16                     "|xns": "Roo",
17                     "xtype": "Toolbar",
18                     "*prop": "toolbar",
19                     "items": [
20                         {
21                             "text": "Manage Modules",
22                             "xtype": "Button",
23                             "|xns": "Roo.Toolbar",
24                             "items": [
25                                 {
26                                     "|xns": "Roo.menu",
27                                     "xtype": "Menu",
28                                     "*prop": "menu",
29                                     "items": [
30                                         {
31                                             "listeners": {
32                                                 "click": "function (_self, e)\n{\n    Pman.Dialog.BuilderModule.show({\n         id : 0\n    },function(data) {\n        if (data) {\n           _this.modsel.setFromData(data);\n        }\n    });\n\n}"
33                                             },
34                                             "text": "Create",
35                                             "xtype": "Item",
36                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
37                                             "|xns": "Roo.menu"
38                                         },
39                                         {
40                                             "listeners": {
41                                                 "click": "function (_self, e)\n{\n \n    if (!_this.modsel.lastData || !_this.modsel.lastData.id) {\n        Roo.MessageBox.alert(\"Error\", \"Select Module\");\n        return false;\n    }\n    Pman.Dialog.BuilderModule.show( _this.modsel.lastData ,function(data) {\n        if (data) {\n            _this.modsel.setFromData(data);\n        }\n    });\n\n}"
42                                             },
43                                             "text": "Edit",
44                                             "xtype": "Item",
45                                             "|xns": "Roo.menu"
46                                         },
47                                         {
48                                             "listeners": {
49                                                 "click": "function (_self, e)\n{\n   \n\n}"
50                                             },
51                                             "text": "Delete",
52                                             "xtype": "Item",
53                                             "|xns": "Roo.menu"
54                                         }
55                                     ]
56                                 }
57                             ]
58                         },
59                         {
60                             "listeners": {
61                                 "select": "function (combo, record, index)\n{\n    _this.filesel.reset();\n   _this.filesel.fireEvent('select', false);\n\n}",
62                                 "render": "function (_self)\n{\n    _this.modsel = this;\n}"
63                             },
64                             "allowBlank": true,
65                             "alwaysQuery": true,
66                             "displayField": "name",
67                             "editable": false,
68                             "forceSelection": true,
69                             "listWidth": 300,
70                             "loadingText": "Searching...",
71                             "minChars": 2,
72                             "pageSize": 40,
73                             "queryParam": "query[name]",
74                             "selectOnFocus": true,
75                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b></div>",
76                             "triggerAction": "all",
77                             "typeAhead": true,
78                             "valueField": "name",
79                             "width": 100,
80                             "xtype": "ComboBox",
81                             "|xns": "Roo.form",
82                             "items": [
83                                 {
84                                     "*prop": "store",
85                                     "remoteSort": true,
86                                     "xtype": "Store",
87                                     "|sortInfo": "{ field : 'name' , direction : 'ASC' }",
88                                     "|xns": "Roo.data",
89                                     "items": [
90                                         {
91                                             "*prop": "proxy",
92                                             "method": "GET",
93                                             "xtype": "HttpProxy",
94                                             "|url": "baseURL + '/Roo/Builder_modules.php'",
95                                             "|xns": "Roo.data"
96                                         },
97                                         {
98                                             "*prop": "reader",
99                                             "id": "id",
100                                             "root": "data",
101                                             "totalProperty": "total",
102                                             "xtype": "JsonReader",
103                                             "|fields": "[\n \n    {\n        'name': 'name',\n        'type': 'string'\n    }\n    \n]",
104                                             "|xns": "Roo.data"
105                                         }
106                                     ]
107                                 }
108                             ]
109                         },
110                         {
111                             "text": "Manage Parts ",
112                             "xtype": "Button",
113                             "|xns": "Roo.Toolbar",
114                             "items": [
115                                 {
116                                     "|xns": "Roo.menu",
117                                     "xtype": "Menu",
118                                     "*prop": "menu",
119                                     "items": [
120                                         {
121                                             "listeners": {
122                                                 "click": "function (_self, e)\n{\n    if (!_this.modsel.lastData || !_this.modsel.lastData.id) {\n        Roo.MessageBox.alert(\"Error\", \"Select Module\");\n        return false;\n    }\n    \n    _this.filesel.reset();\n    Pman.Tab.BuilderTree.clearAll();\n    Pman.Tab.BuilderTree.setCurrentNode(Pman.Tab.BuilderTree.tree.root,true);\n    \n    var bp = Pman.Tab.BuilderPanel;\n    bp.redraw.defer(100,bp,[true]);\n\n}"
123                                             },
124                                             "|icon": "Roo.rootURL + 'images/default/dd/drop-add.gif'",
125                                             "text": "New Part",
126                                             "xtype": "Item",
127                                             "|xns": "Roo.menu"
128                                         },
129                                         {
130                                             "text": "Delete",
131                                             "xtype": "Item",
132                                             "|xns": "Roo.menu"
133                                         }
134                                     ]
135                                 }
136                             ]
137                         },
138                         {
139                             "listeners": {
140                                 "select": "function (combo, rec, index)\n{\n   //cb.lastData = rec.data;\n    \n    \n    \n    \n    var bt = Pman.Tab.BuilderTree.tree;\n    \n    \n    if (!rec) {\n        bt.clearAll();\n        bt.setCurrentNode(bt.root,true);\n       // var bv = Pman.Tab.BuilderView;\n       Pman.Tab.BuilderView.panel.clearAll();\n       // bv.panel.el.mask(\"select Module / Part\");\n        return;\n    }\n    //bv.panel.el.unmask();\n    \n    bt.loadBJS(_this.modsel.getValue(), rec.data.name)\n\n\n}",
141                                 "render": "function (_self)\n{\n    _this.filesel = this;\n}"
142                             },
143                             "allowBlank": true,
144                             "alwaysQuery": true,
145                             "displayField": "name",
146                             "editable": false,
147                             "forceSelection": true,
148                             "listWidth": 400,
149                             "loadingText": "Searching...",
150                             "minChars": 2,
151                             "pageSize": 40,
152                             "queryParam": "query[name]",
153                             "selectOnFocus": true,
154                             "tpl": "<div class=\"x-grid-cell-text x-btn button\"><b>{name}</b></div>",
155                             "triggerAction": "all",
156                             "typeAhead": true,
157                             "valueField": "name",
158                             "width": 200,
159                             "xtype": "ComboBox",
160                             "|xns": "Roo.form",
161                             "items": [
162                                 {
163                                     "listeners": {
164                                         "beforeload": "function (_self, o)\n{\n     o.params = o.params || {}; \n   // o.params.btype = 'FORM';\n    if (!_this.modsel.getValue().length) {\n        Roo.MessageBox.alert(\"Error\", \"Select Module\");\n        return false;\n    }\n    o.params.module = _this.modsel.getValue();\n\n}"
165                                     },
166                                     "*prop": "store",
167                                     "remoteSort": true,
168                                     "xtype": "Store",
169                                     "|sortInfo": "{ field : 'name' , direction : 'ASC' }",
170                                     "|xns": "Roo.data",
171                                     "items": [
172                                         {
173                                             "*prop": "proxy",
174                                             "method": "GET",
175                                             "xtype": "HttpProxy",
176                                             "|url": "baseURL + '/Builder/Parts.php'",
177                                             "|xns": "Roo.data"
178                                         },
179                                         {
180                                             "*prop": "reader",
181                                             "id": "id",
182                                             "root": "data",
183                                             "totalProperty": "total",
184                                             "xtype": "JsonReader",
185                                             "|fields": "[\n   \n    {\n        'name': 'name',\n        'type': 'string'\n    } \n]",
186                                             "|xns": "Roo.data"
187                                         }
188                                     ]
189                                 }
190                             ]
191                         },
192                         {
193                             "listeners": {
194                                 "click": "function (_self, e)\n{\n    this.save();\n}",
195                                 "render": "function (_self)\n{\n   _this.saveBtn = this;\n}"
196                             },
197                             "cls": "x-btn-text-icon",
198                             "text": "Save",
199                             "xtype": "Button",
200                             "|save": "function() {\n       // first see if first element has a name.. - we can not save otherwise..\n        var t = Pman.Tab.BuilderTree.tree;\n        if (!t.root.elConfig.name.length) {\n            Roo.MessageBox.alert(\"Error\", \"No name set for form\");\n            return;\n        }\n     \n        sid = (typeof(sid) == 'undefined') ?  (this.filesel.lastData ? this.filesel.lastData.id : 0) : sid;\n        \n        var js = Pman.Tab.BuilderTree.toJS();\n        var json = Roo.encode(js);\n       // console.log(js);\n       // console.log(json);\n        \n        // check the select box to see if that has been set... - save it with that id..\n        \n        var _this = this;\n        \n        Pman.request({\n            url: baseURL + '/Roo/Builder.php',\n            method : 'POST',\n            params : {\n                json : json,\n                name : t.root.elConfig.name,\n                module : t.root.elConfig['|module'],\n                app : t.root.elConfig.app,\n                btype : 'FORM',\n                id : sid\n            }, \n            success : function(data) {\n                // set the fileSel!!\n                console.log(data);\n                if (data) {\n                    _this.filesel.setFromData(data);\n                    if (cb) {\n                        cb.call(_this,data);\n                    }\n                    _this.postCode(data);\n                }\n            }\n        });\n}\n",
201                             "|icon": "rootURL + '/Pman/templates/images/save.gif'",
202                             "|xns": "Roo.Toolbar",
203                             "items": [
204                                 {
205                                     "|xns": "Roo.menu",
206                                     "xtype": "Menu",
207                                     "*prop": "menu",
208                                     "items": [
209                                         {
210                                             "listeners": {
211                                                 "click": "function (_self, e)\n{\n  _this.saveBtn.save(false,0);\n}"
212                                             },
213                                             "|icon": "rootURL + '/Pman/templates/images/save.gif'",
214                                             "text": "Save a copy as",
215                                             "xtype": "Item",
216                                             "|xns": "Roo.menu"
217                                         },
218                                         {
219                                             "listeners": {
220                                                 "click": "function (_self, e)\n{\n   _this.saveBtn.save(\n     function() {\n         Pman.Dialog.BuilderViewCode.show({ id : _this.filesel.getValue() } ); \n            \n\n  } );\n}"
221                                             },
222                                             "text": "Show JSON",
223                                             "xtype": "Item",
224                                             "|xns": "Roo.menu"
225                                         }
226                                     ]
227                                 }
228                             ]
229                         },
230                         {
231                             "|xns": "Roo.Toolbar",
232                             "xtype": "Separator"
233                         },
234                         {
235                             "listeners": {
236                                 "click": "function (_self, e)\n{\n   Pman.Tab.BuilderView.panel.redraw();\n}"
237                             },
238                             "text": "Redraw",
239                             "xtype": "SplitButton",
240                             "|xns": "Roo.Toolbar",
241                             "items": [
242                                 {
243                                     "|xns": "Roo.menu",
244                                     "xtype": "Menu",
245                                     "*prop": "menu",
246                                     "items": [
247                                         {
248                                             "listeners": {
249                                                 "click": "function (_self, e)\n{\n _this.redrawBtn.setText(\"Redraw (AUTO OFF)\");\n    _this.redrawBtn.auto = 0;\n\n}"
250                                             },
251                                             "text": "Auto redraw - OFF",
252                                             "xtype": "Item",
253                                             "|xns": "Roo.menu"
254                                         },
255                                         {
256                                             "listeners": {
257                                                 "click": "function (_self, e)\n{\n \n    _this.redrawBtn.setText(\"Redraw\");\n     _this.redrawBtn.auto = 1;\n    var bp = Pman.Tab.BuilderPanel;\n    bp.redraw.defer(100,bp,[true]);\n    \n\n}"
258                                             },
259                                             "text": "Auto redraw - On",
260                                             "xtype": "Item",
261                                             "|xns": "Roo.menu"
262                                         }
263                                     ]
264                                 }
265                             ]
266                         }
267                     ]
268                 }
269             ]
270         }
271     ],
272     "permname": "",
273     "modOrder": "001"
274 }