php7 fixes
[Pman.Builder] / Pman.Tab.BuilderTop.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Pman.Tab.BuilderTop = new Roo.XComponent({
6     part     :  ["Builder","Top"],
7     order    : '001-Pman.Tab.BuilderTop',
8     region   : 'center',
9     parent   : 'Pman.Tab.BuilderTab',
10     name     : "Pman.Tab.BuilderTop",
11     disabled : false, 
12     permname : '', 
13     _tree : function()
14     {
15         var _this = this;
16         var MODULE = this;
17         return {
18             xtype: 'ContentPanel',
19             xns: Roo,
20             background : true,
21             fitToFrame : true,
22             region : 'north',
23             toolbar : {
24                 xtype: 'Toolbar',
25                 xns: Roo,
26                 items : [
27                     {
28                         xtype: 'Button',
29                         xns: Roo.Toolbar,
30                         text : "Manage Modules",
31                         menu : {
32                             xtype: 'Menu',
33                             xns: Roo.menu,
34                             items : [
35                                 {
36                                     xtype: 'Item',
37                                     xns: Roo.menu,
38                                     listeners : {
39                                         click : function (_self, e)
40                                         {
41                                             Pman.Dialog.BuilderModule.show({
42                                                  id : 0
43                                             },function(data) {
44                                                 if (data) {
45                                                    _this.modsel.setFromData(data);
46                                                 }
47                                             });
48                                         
49                                         }
50                                     },
51                                     text : "Create",
52                                     icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
53                                 },
54                                 {
55                                     xtype: 'Item',
56                                     xns: Roo.menu,
57                                     listeners : {
58                                         click : function (_self, e)
59                                         {
60                                          
61                                             if (!_this.modsel.getValue()) {
62                                                 Roo.MessageBox.alert("Error", "Select Module");
63                                                 return false;
64                                             }
65                                             Pman.Dialog.BuilderModule.show( { id : _this.modsel.getValue() } ,function(data) {
66                                                 if (data) {
67                                                     _this.modsel.setFromData(data);
68                                                 }
69                                             });
70                                         
71                                         }
72                                     },
73                                     text : "Edit"
74                                 },
75                                 {
76                                     xtype: 'Item',
77                                     xns: Roo.menu,
78                                     listeners : {
79                                         click : function (_self, e)
80                                         {
81                                            
82                                         
83                                         }
84                                     },
85                                     text : "Delete"
86                                 },
87                                 {
88                                     xtype: 'Separator',
89                                     xns: Roo.menu
90                                 },
91                                 {
92                                     xtype: 'Item',
93                                     xns: Roo.menu,
94                                     listeners : {
95                                         click : function (_self, e)
96                                         {
97                                             new Pman.Request({
98                                                 method : 'GET',
99                                                 url : baseURL + '/Roo/Builder_modules.php',
100                                                 params : {
101                                                     'query[_sync]' : 1
102                                                 },
103                                                 success : function() {
104                                                     Roo.MessageBox.alert("Done", "Re-syned modules");
105                                                 }
106                                             });
107                                         }
108                                     },
109                                     text : "Sync"
110                                 }
111                             ]
112                         }
113                     },
114                     {
115                         xtype: 'ComboBox',
116                         xns: Roo.form,
117                         listeners : {
118                             select : function (combo, record, index)
119                             {
120                                 _this.filesel.reset();
121                                 _this.filesel.fireEvent('select', false);
122                             
123                             },
124                             render : function (_self)
125                             {
126                                 _this.modsel = this;
127                             }
128                         },
129                         allowBlank : true,
130                         alwaysQuery : true,
131                         displayField : 'name',
132                         editable : false,
133                         forceSelection : true,
134                         listWidth : 300,
135                         loadingText : "Searching...",
136                         minChars : 2,
137                         pageSize : 40,
138                         queryParam : 'query[name]',
139                         selectOnFocus : true,
140                         tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b></div>',
141                         triggerAction : 'all',
142                         typeAhead : true,
143                         valueField : 'id',
144                         width : 100,
145                         store : {
146                             xtype: 'Store',
147                             xns: Roo.data,
148                             remoteSort : true,
149                             sortInfo : { field : 'name' , direction : 'ASC' },
150                             proxy : {
151                                 xtype: 'HttpProxy',
152                                 xns: Roo.data,
153                                 method : 'GET',
154                                 url : baseURL + '/Roo/Builder_modules.php'
155                             },
156                             reader : {
157                                 xtype: 'JsonReader',
158                                 xns: Roo.data,
159                                 id : 'id',
160                                 root : 'data',
161                                 totalProperty : 'total',
162                                 fields : [
163                                  
164                                     {
165                                         'name': 'name',
166                                         'type': 'string'
167                                     }
168                                     
169                                 ]
170                             }
171                         }
172                     },
173                     {
174                         xtype: 'Button',
175                         xns: Roo.Toolbar,
176                         text : "Manage Parts ",
177                         menu : {
178                             xtype: 'Menu',
179                             xns: Roo.menu,
180                             items : [
181                                 {
182                                     xtype: 'Item',
183                                     xns: Roo.menu,
184                                     listeners : {
185                                         click : function (_self, e)
186                                         {
187                                             if (!_this.modsel.getValue()) {
188                                                 Roo.MessageBox.alert("Error", "Select Module");
189                                                 return false;
190                                             }
191                                              if (!_this.filesel.getValue()) {
192                                                 Roo.MessageBox.alert("Error", "Select Part");
193                                                 return false;
194                                             }
195                                             Pman.Dialog.BuilderPart.show( {
196                                                      id : _this.filesel.getValue(),
197                                                      module_id: _this.modsel.getValue() 
198                                                  } ,
199                                                  function(data) {
200                                                     //_this.filesel.reset();
201                                                     if (!data.id) {
202                                                         return;
203                                                     }
204                                                     _this.filesel.setFromData(data);
205                                                     // set the part name on the json..
206                                                     
207                                                     
208                                                     pt.loadBJS(_this.modsel.getValue(), _this.filesel.getValue())
209                                             });
210                                         
211                                         }
212                                     },
213                                     text : "Rename",
214                                     icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
215                                 },
216                                 {
217                                     xtype: 'Separator',
218                                     xns: Roo.menu
219                                 },
220                                 {
221                                     xtype: 'Item',
222                                     xns: Roo.menu,
223                                     listeners : {
224                                         click : function (_self, e)
225                                         {
226                                             if (!_this.modsel.getValue()) {
227                                                 Roo.MessageBox.alert("Error", "Select Module");
228                                                 return false;
229                                             }
230                                             
231                                             Pman.Dialog.BuilderPart.show( {
232                                                      id : 0, 
233                                                      module_id: _this.modsel.getValue() 
234                                                  } ,
235                                                  function(data) {
236                                                     _this.filesel.reset();
237                                                     if (!data.id) {
238                                                         return;
239                                                     }
240                                                     _this.filesel.setfromdata(data);
241                                                     Pman.Builder.Tree.clearAll();
242                                                     Pman.Builder.Tree.setCurrentNode(Pman.Tab.BuilderTree.tree.root,true);
243                                                      
244                                                     Pman.Tab.BuilderPanel.redraw.defer(100,Pman.Tab.BuilderPanel,[true]);
245                                             });
246                                         
247                                         }
248                                     },
249                                     text : "New Part",
250                                     icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
251                                 },
252                                 {
253                                     xtype: 'Item',
254                                     xns: Roo.menu,
255                                     listeners : {
256                                         click : function (_self, e)
257                                         {
258                                             Roo.MessageBox.confirm("Confirm", "Are you sure you want to delete it?", function(a) {
259                                                 if (a != 'yes') {
260                                                     return;
261                                                 }
262                                                     
263                                                
264                                                new Pman.Request({
265                                                     url : baseURL + '/Roo/Builder_part',
266                                                     method : 'POST',
267                                                     params : {
268                                                         _delete :  _this.filesel.getValue()
269                                                     },
270                                                     success : function() {
271                                                         _this.filesel.setValue('');
272                                                         // unload stuff..
273                                                          _this.filesel.fireEvent('select', false);
274                                         //                Pman.Tab.BuilderTab.layout.getRegion('west').el.mask("select part");
275                                                     
276                                                     }
277                                                
278                                                
279                                                });
280                                            });
281                                         }
282                                     },
283                                     text : "Delete"
284                                 },
285                                 {
286                                     xtype: 'Separator',
287                                     xns: Roo.menu
288                                 },
289                                 {
290                                     xtype: 'Item',
291                                     xns: Roo.menu,
292                                     listeners : {
293                                         click : function (_self, e)
294                                         {
295                                             if (!_this.modsel.getValue()) {
296                                                 Roo.MessageBox.alert("Error", "Select Module");
297                                                 return false;
298                                             }
299                                              if (!_this.filesel.getValue()) {
300                                                 Roo.MessageBox.alert("Error", "Select Part");
301                                                 return false;
302                                             }
303                                             Pman.Dialog.BuilderImport.show( {
304                                                      id : _this.filesel.getValue(), 
305                                                      module_id: _this.modsel.getValue() 
306                                                  } ,
307                                                  function(data) {
308                                                      var bt = Pman.Tab.BuilderTree.tree;
309                                                     var pt = Pman.Builder.Tree;
310                                                     
311                                                     
312                                                     //bv.panel.el.unmask();
313                                                     Pman.Tab.BuilderTab.layout.getRegion('west').el.unmask();
314                                                     pt.loadBJS(_this.modsel.getValue(), _this.filesel.getValue())
315                                         
316                                                      
317                                             });
318                                         
319                                         }
320                                     },
321                                     text : "Import (by pasting)",
322                                     icon : Roo.rootURL + 'images/default/dd/drop-add.gif'
323                                 }
324                             ]
325                         }
326                     },
327                     {
328                         xtype: 'ComboBox',
329                         xns: Roo.form,
330                         listeners : {
331                             select : function (combo, rec, index)
332                             {
333                                //cb.lastData = rec.data;
334                                 
335                                 
336                                 
337                                 
338                                 var bt = Pman.Tab.BuilderTree.tree;
339                                 var pt = Pman.Builder.Tree;
340                                 
341                                 if (!rec) {
342                                     pt.clearAll();
343                                     pt.setCurrentNode(bt.root,true);
344                                    // var bv = Pman.Tab.BuilderView;
345                                     Pman.Tab.BuilderView.panel.clearAll();
346                                     Pman.Tab.BuilderTab.layout.getRegion('west').el.mask("select part");
347                                    // bv.panel.el.mask("select Module / Part");
348                                     return;
349                                 }
350                                 //bv.panel.el.unmask();
351                                 Pman.Tab.BuilderTab.layout.getRegion('west').el.unmask();
352                                 pt.loadBJS(_this.modsel.getValue(), rec.data.id)
353                             
354                             
355                             },
356                             render : function (_self)
357                             {
358                                 _this.filesel = this;
359                             }
360                         },
361                         allowBlank : true,
362                         alwaysQuery : true,
363                         displayField : 'name',
364                         editable : false,
365                         forceSelection : true,
366                         listWidth : 400,
367                         loadingText : "Searching...",
368                         minChars : 2,
369                         pageSize : 40,
370                         queryParam : 'query[name]',
371                         selectOnFocus : true,
372                         tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b></div>',
373                         triggerAction : 'all',
374                         typeAhead : true,
375                         valueField : 'id',
376                         width : 200,
377                         store : {
378                             xtype: 'Store',
379                             xns: Roo.data,
380                             listeners : {
381                                 beforeload : function (_self, o)
382                                 {
383                                      o.params = o.params || {}; 
384                                    // o.params.btype = 'FORM';
385                                     if (!_this.modsel.getValue()) {
386                                         Roo.MessageBox.alert("Error", "Select Module");
387                                         return false;
388                                     }
389                                     o.params.module_id = _this.modsel.getValue();
390                                     o.params._columns = 'id,name';
391                                 }
392                             },
393                             remoteSort : true,
394                             sortInfo : { field : 'name' , direction : 'ASC' },
395                             proxy : {
396                                 xtype: 'HttpProxy',
397                                 xns: Roo.data,
398                                 method : 'GET',
399                                 url : baseURL + '/Roo/Builder_part.php'
400                             },
401                             reader : {
402                                 xtype: 'JsonReader',
403                                 xns: Roo.data,
404                                 id : 'id',
405                                 root : 'data',
406                                 totalProperty : 'total',
407                                 fields : [
408                                    
409                                     {
410                                         'name': 'name',
411                                         'type': 'string'
412                                     } 
413                                 ]
414                             }
415                         }
416                     },
417                     {
418                         xtype: 'SplitButton',
419                         xns: Roo.Toolbar,
420                         listeners : {
421                             click : function (_self, e)
422                             {
423                                 Pman.Builder.save();
424                             },
425                             render : function (_self)
426                             {
427                                _this.saveBtn = this;
428                             }
429                         },
430                         cls : 'x-btn-text-icon',
431                         text : "Save",
432                         icon : rootURL + '/Pman/templates/images/save.gif',
433                         menu : {
434                             xtype: 'Menu',
435                             xns: Roo.menu,
436                             items : [
437                                 {
438                                     xtype: 'Item',
439                                     xns: Roo.menu,
440                                     listeners : {
441                                         click : function (_self, e)
442                                         {
443                                               Pman.Builder.save(false,0);
444                                         }
445                                     },
446                                     text : "Save a copy as",
447                                     icon : rootURL + '/Pman/templates/images/save.gif'
448                                 },
449                                 {
450                                     xtype: 'Item',
451                                     xns: Roo.menu,
452                                     listeners : {
453                                         click : function (_self, e)
454                                         {
455                                            Pman.Builder.save(
456                                              function(data) {
457                                                  Roo.log("JSON GOT");
458                                                       Roo.log(data);
459                                                      Pman.Dialog.BuilderViewCode.show(data ); 
460                                                         
461                                         
462                                               } );
463                                         }
464                                     },
465                                     text : "Show JSON / Javascript HTML"
466                                 }
467                             ]
468                         }
469                     },
470                     {
471                         xtype: 'Separator',
472                         xns: Roo.Toolbar
473                     },
474                     {
475                         xtype: 'SplitButton',
476                         xns: Roo.Toolbar,
477                         listeners : {
478                             click : function (_self, e)
479                             {
480                                Pman.Tab.BuilderView.panel.redraw();
481                             }
482                         },
483                         text : "Redraw",
484                         menu : {
485                             xtype: 'Menu',
486                             xns: Roo.menu,
487                             items : [
488                                 {
489                                     xtype: 'Item',
490                                     xns: Roo.menu,
491                                     listeners : {
492                                         click : function (_self, e)
493                                         {
494                                          _this.redrawBtn.setText("Redraw (AUTO OFF)");
495                                             _this.redrawBtn.auto = 0;
496                                         
497                                         }
498                                     },
499                                     text : "Auto redraw - OFF"
500                                 },
501                                 {
502                                     xtype: 'Item',
503                                     xns: Roo.menu,
504                                     listeners : {
505                                         click : function (_self, e)
506                                         {
507                                          
508                                             _this.redrawBtn.setText("Redraw");
509                                              _this.redrawBtn.auto = 1;
510                                             var bp = Pman.Tab.BuilderPanel;
511                                             bp.redraw.defer(100,bp,[true]);
512                                             
513                                         
514                                         }
515                                     },
516                                     text : "Auto redraw - On"
517                                 }
518                             ]
519                         }
520                     },
521                     {
522                         xtype: 'Fill',
523                         xns: Roo.Toolbar
524                     },
525                     {
526                         xtype: 'ComboBox',
527                         xns: Roo.form,
528                         listeners : {
529                             select : function (combo, record, index)
530                             {
531                                 Pman.Builder.View.frameUpdateTheme(record.data.name);
532                             }
533                         },
534                         allowBlank : false,
535                         displayField : 'name',
536                         editable : false,
537                         emptyText : "Select Theme",
538                         forceSelection : true,
539                         hiddenName : 'name',
540                         listWidth : 200,
541                         loadingText : "Searching...",
542                         minChars : 2,
543                         name : 'name',
544                         pageSize : 20,
545                         qtip : "Select Theme",
546                         queryParam : '',
547                         selectOnFocus : true,
548                         tpl : '<div class="x-grid-cell-text x-btn button"><b>{name}</b> </div>',
549                         triggerAction : 'all',
550                         typeAhead : true,
551                         valueField : 'name',
552                         width : 200,
553                         store : {
554                             xtype: 'Store',
555                             xns: Roo.data,
556                             listeners : {
557                                 beforeload : function (_self, o){
558                                     o.params = o.params || {};
559                                     // set more here
560                                 }
561                             },
562                             remoteSort : false,
563                             sortInfo : { direction : 'ASC', field: 'name' },
564                             proxy : {
565                                 xtype: 'HttpProxy',
566                                 xns: Roo.data,
567                                 method : 'GET',
568                                 url : baseURL + '/Builder/Themes'
569                             },
570                             reader : {
571                                 xtype: 'JsonReader',
572                                 xns: Roo.data,
573                                 id : 'name',
574                                 root : 'data',
575                                 totalProperty : 'total',
576                                 fields : ["name"]
577                             }
578                         }
579                     }
580                 ]
581             }
582         };
583     }
584 });