Pman.Tab.BAdminIPAccess.bjs
[Pman.BAdmin] / Pman.Tab.BAdminIPAccess.js
1 //<script type="text/javascript">
2
3 // Auto generated file - created by app.Builder.js- do not edit directly (at present!)
4
5 Roo.namespace('Pman.Tab');
6
7 Pman.Tab.BAdminIPAccess = new Roo.XComponent({
8
9  _strings : {
10   'ec211f7c20af43e742bf2570c3cb84f9' :"Add",
11   '7dce122004969d56ae2e0245cb754d35' :"Edit",
12   '01abfc750a0c942167651c40d088531d' :"#",
13   'dae8ace18bdcbcc6ae5aece263e14fe8' :"Options",
14   'b48968e1c912da07df5e8d6d246291ec' :"Display Name",
15   'f2d346b1bb7c1c85ab6f7f21e3666b9f' :"Types",
16   '49ee3087348e8d44e1feda1917443987' :"Name",
17   'f2a6c498fb90ee345d997f888fce3b18' :"Delete",
18   '4d3d769b812b6faa6b76e1a8abaece2d' :"Active",
19   'e3030abfa75de4573fb37032affa11e7' :"IP Access"
20  },
21
22   part     :  ["BAdmin", "IPAccess" ],
23   order    : '006-Pman.Tab.BAdminIPAccess',
24   region   : 'center',
25   parent   : false,
26   name     : "unnamed module",
27   disabled : false, 
28   permname : '', 
29   _tree : function(_data)
30   {
31    var _this = this;
32    var MODULE = this;
33    return {
34    xtype : 'Nest',
35    background : true,
36    title : _this._strings['e3030abfa75de4573fb37032affa11e7'] /* IP Access */,
37    xns : Roo.bootstrap.panel,
38    '|xns' : 'Roo.bootstrap.panel',
39    layout : {
40     xtype : 'Border',
41     xns : Roo.bootstrap.layout,
42     '|xns' : 'Roo.bootstrap.layout',
43     center : {
44      xtype : 'Region',
45      hideTabs : true,
46      tabPosition : 'top',
47      xns : Roo.bootstrap.layout,
48      '|xns' : 'Roo.bootstrap.layout'
49     },
50     items  : [
51      {
52       xtype : 'Grid',
53       background : false,
54       closable : false,
55       fitContainer : true,
56       fitToFrame : true,
57       region : 'center',
58       title : _this._strings['f2d346b1bb7c1c85ab6f7f21e3666b9f'] /* Types */,
59       listeners : {
60        activate : function (_self)
61         {
62             _this.type_edit_btn.hide();
63             
64             if(_this.type_grid) {
65                 _this.type_grid.footer.onClick('first');
66             }
67         },
68        render : function (_self)
69         {
70             _this.type_panel = _self; 
71         }
72       },
73       xns : Roo.bootstrap.panel,
74       '|xns' : 'Roo.bootstrap.panel',
75       toolbar : {
76        xtype : 'NavSimplebar',
77        xns : Roo.bootstrap,
78        '|xns' : 'Roo.bootstrap',
79        items  : [
80         {
81          xtype : 'NavGroup',
82          xns : Roo.bootstrap,
83          '|xns' : 'Roo.bootstrap',
84          items  : [
85           {
86            xtype : 'NavItem',
87            xns : Roo.bootstrap,
88            '|xns' : 'Roo.bootstrap',
89            items  : [
90             {
91              xtype : 'Element',
92              xns : Roo.bootstrap,
93              '|xns' : 'Roo.bootstrap',
94              items  : [
95               {
96                xtype : 'Row',
97                cls : 'roo-toolbar',
98                xns : Roo.bootstrap,
99                '|xns' : 'Roo.bootstrap',
100                items  : [
101                 {
102                  xtype : 'Column',
103                  md : 12,
104                  xns : Roo.bootstrap,
105                  '|xns' : 'Roo.bootstrap',
106                  items  : [
107                   {
108                    xtype : 'Button',
109                    cls : 'roo-toolbar-button',
110                    glyphicon : 'plus',
111                    html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
112                    weight : 'default',
113                    listeners : {
114                     click : function (_self, e)
115                      {
116                          Pman.Dialog.BAdminCoreEnum.show({ 
117                              id : 0
118                          }, function(res) {
119                              _this.type_grid.footer.onClick('first');
120                          });
121                      
122                      }
123                    },
124                    xns : Roo.bootstrap,
125                    '|xns' : 'Roo.bootstrap'
126                   },
127                   {
128                    xtype : 'Button',
129                    cls : 'roo-toolbar-button',
130                    glyphicon : 'edit',
131                    html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
132                    weight : 'default',
133                    listeners : {
134                     click : function (_self, e)
135                      {
136                          var sel = _this.type_grid.getSelectionModel().getSelected();
137                          
138                          if(!sel || sel.data.id * 1 < 1){
139                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
140                              return;
141                          }
142                      
143                          Pman.Dialog.BAdminCoreEnum.show({ 
144                              id : sel.data.id
145                          }, function(res) {
146                              _this.type_grid.footer.onClick('first');
147                          });
148                      },
149                     render : function (_self)
150                      {
151                          _this.type_edit_btn = this;
152                          
153                          this.hide();
154                      }
155                    },
156                    xns : Roo.bootstrap,
157                    '|xns' : 'Roo.bootstrap'
158                   }
159                  ]
160                 }
161                ]
162               }
163              ]
164             }
165            ]
166           }
167          ]
168         }
169        ]
170       },
171       grid : {
172        xtype : 'Table',
173        cellSelection : true,
174        cls : 'table-fixed',
175        hover : true,
176        loadMask : true,
177        responsive : true,
178        rowSelection : true,
179        striped : false,
180        listeners : {
181         render : function (_self)
182          {
183              _this.type_grid = _self; 
184             
185          },
186         rowdblclick : function (_self, el, rowIndex, e)
187          {
188              var r = _this.type_grid.store.getAt(rowIndex);
189              
190              if(!r || r.data.id * 1 < 1){
191                  return;
192              }
193              
194              Pman.Dialog.BAdminCoreEnum.show({ 
195                  id : r.data.id
196              }, function(res) {
197                  _this.type_grid.footer.onClick('first');
198              });
199          }
200        },
201        xns : Roo.bootstrap,
202        '|xns' : 'Roo.bootstrap',
203        footer : {
204         xtype : 'PagingToolbar',
205         displayInfo : false,
206         name : 'footer',
207         pageSize : 100,
208         xns : Roo.bootstrap,
209         '|xns' : 'Roo.bootstrap'
210        },
211        store : {
212         xtype : 'Store',
213         remoteSort : true,
214         sortInfo : { field : 'display_name', direction: 'ASC' },
215         listeners : {
216          beforeload : function (_self, o)
217           {
218               o.params = o.params || {};
219               
220               o.params['query[empty_etype]'] = 1;
221               
222           },
223          load : function (_self, records, options)
224           {
225               _this.type_edit_btn.hide();
226           }
227         },
228         xns : Roo.data,
229         '|xns' : 'Roo.data',
230         proxy : {
231          xtype : 'HttpProxy',
232          method : 'GET',
233          url : baseURL + '/Roo/core_enum.php',
234          xns : Roo.data,
235          '|xns' : 'Roo.data'
236         },
237         reader : {
238          xtype : 'JsonReader',
239          fields : [
240              {
241                  'name': 'id',
242                  'type': 'int'
243              },
244              {
245                  'name': 'etype',
246                  'type': 'string'
247              },
248              {
249                  'name': 'name',
250                  'type': 'string'
251              },
252              {
253                  'name': 'display_name',
254                  'type': 'string'
255              },
256              {
257                  'name': 'active',
258                  'type': 'int'
259              },
260              {
261                  'name': 'seqid',
262                  'type': 'int'
263              }
264          ],
265          id : 'id',
266          root : 'data',
267          totalProperty : 'total',
268          xns : Roo.data,
269          '|xns' : 'Roo.data'
270         }
271        },
272        sm : {
273         xtype : 'RowSelectionModel',
274         singleSelect : true,
275         listeners : {
276          selectionchange : function (_self)
277           {
278               _this.type_edit_btn.hide();
279               
280               if(this.getSelected()){
281                   _this.type_edit_btn.show();
282               }
283               
284               _this.option_grid.store.load({});
285           }
286         },
287         xns : Roo.bootstrap.Table,
288         '|xns' : 'Roo.bootstrap.Table'
289        },
290        cm : [
291         {
292          xtype : 'ColumnModel',
293          cursor : 'pointer',
294          dataIndex : 'display_name',
295          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
296          renderer : function(v,x,r) {
297              if (v.match(/Coba/g) || v.match(/Risk Question/g)) {
298                  return String.format('<span tooltip="{1}">Coba: {0}</span>', v, r.data.name);
299              }
300              
301              return String.format('<span tooltip="{1}">{0}</span>', v, r.data.name); 
302          },
303          sortable : true,
304          xs : 12,
305          xns : Roo.grid,
306          '|xns' : 'Roo.grid'
307         }
308        ]
309       }
310      },
311      {
312       xtype : 'Grid',
313       background : false,
314       fitContainer : true,
315       fitToFrame : true,
316       region : 'center',
317       title : _this._strings['dae8ace18bdcbcc6ae5aece263e14fe8'] /* Options */,
318       listeners : {
319        activate : function (_self)
320         {
321             _this.edit_btn.hide();
322             _this.delete_btn.hide();
323             
324             if (_this.option_grid) {
325                 _this.option_grid.store.load({});
326             }
327         },
328        render : function (_self)
329         {
330             _this.option_panel = _self;
331         }
332       },
333       xns : Roo.bootstrap.panel,
334       '|xns' : 'Roo.bootstrap.panel',
335       toolbar : {
336        xtype : 'NavSimplebar',
337        xns : Roo.bootstrap,
338        '|xns' : 'Roo.bootstrap',
339        items  : [
340         {
341          xtype : 'NavGroup',
342          xns : Roo.bootstrap,
343          '|xns' : 'Roo.bootstrap',
344          items  : [
345           {
346            xtype : 'NavItem',
347            xns : Roo.bootstrap,
348            '|xns' : 'Roo.bootstrap',
349            items  : [
350             {
351              xtype : 'Element',
352              xns : Roo.bootstrap,
353              '|xns' : 'Roo.bootstrap',
354              items  : [
355               {
356                xtype : 'Row',
357                cls : 'roo-toolbar',
358                xns : Roo.bootstrap,
359                '|xns' : 'Roo.bootstrap',
360                items  : [
361                 {
362                  xtype : 'Column',
363                  md : 12,
364                  xns : Roo.bootstrap,
365                  '|xns' : 'Roo.bootstrap',
366                  items  : [
367                   {
368                    xtype : 'Button',
369                    cls : 'roo-toolbar-button',
370                    glyphicon : 'plus',
371                    html : _this._strings['ec211f7c20af43e742bf2570c3cb84f9'] /* Add */,
372                    weight : 'default',
373                    listeners : {
374                     click : function (_self, e)
375                      {
376                          var sel = _this.type_grid.getSelectionModel().getSelected();
377                          
378                          if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length ){
379                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a type');
380                              return;
381                          }
382                      
383                          Pman.Dialog.BAdminCoreEnum.show({ 
384                              id : 0,
385                              etype : sel.data.name
386                          }, function(res) {
387                              _this.option_grid.store.load({});
388                          });
389                      
390                      }
391                    },
392                    xns : Roo.bootstrap,
393                    '|xns' : 'Roo.bootstrap'
394                   },
395                   {
396                    xtype : 'Button',
397                    cls : 'roo-toolbar-button',
398                    glyphicon : 'edit',
399                    html : _this._strings['7dce122004969d56ae2e0245cb754d35'] /* Edit */,
400                    weight : 'default',
401                    listeners : {
402                     click : function (_self, e)
403                      {
404                          var sel = _this.option_grid.getSelectionModel().getSelected();
405                          
406                          if(!sel || sel.data.id * 1 < 1){
407                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
408                              return;
409                          }
410                      
411                          Pman.Dialog.BAdminCoreEnum.show({ 
412                              id : sel.data.id
413                          }, function(res) {
414                              _this.option_grid.store.load({});
415                          });
416                      
417                      },
418                     render : function (_self)
419                      {
420                          _this.edit_btn = this;
421                          
422                          this.hide();
423                      }
424                    },
425                    xns : Roo.bootstrap,
426                    '|xns' : 'Roo.bootstrap'
427                   },
428                   {
429                    xtype : 'Button',
430                    cls : 'roo-toolbar-button',
431                    glyphicon : 'trash',
432                    html : _this._strings['f2a6c498fb90ee345d997f888fce3b18'] /* Delete */,
433                    weight : 'primary',
434                    listeners : {
435                     click : function (_self, e)
436                      {
437                          var sel = _this.option_grid.getSelectionModel().getSelected();
438                          
439                          if(!sel || sel.data.id * 1 < 1){
440                              Roo.bootstrap.MessageBox.alert('Error', 'Please select a option');
441                              return;
442                          }
443                      
444                          new Pman.Request({
445                              url: baseURL + '/Roo/Core_enum.php',
446                              method : 'POST',
447                              params : {
448                                  _delete : sel.data.id
449                              }, 
450                              success : function(res) {
451                                  _this.option_grid.store.load({});
452                              }
453                          });
454                      
455                      },
456                     render : function (_self)
457                      {
458                          _this.delete_btn = this;
459                          
460                          this.hide();
461                      }
462                    },
463                    xns : Roo.bootstrap,
464                    '|xns' : 'Roo.bootstrap'
465                   }
466                  ]
467                 }
468                ]
469               }
470              ]
471             }
472            ]
473           }
474          ]
475         }
476        ]
477       },
478       grid : {
479        xtype : 'Table',
480        cellSelection : true,
481        cls : 'table-fixed',
482        footerShow : false,
483        hover : true,
484        loadMask : true,
485        responsive : true,
486        rowSelection : true,
487        striped : true,
488        listeners : {
489         cellclick : function (_self, el, rowIndex, columnIndex, e)
490          {
491              var di = _this.option_grid.colModel.getDataIndex(columnIndex);
492              
493              if (di != 'active') {
494                  return;
495              }
496               
497              var rec = _this.option_grid.store.getAt(rowIndex);
498              
499              rec.set('active', rec.data.active ? 0 : 1);
500              
501              rec.commit();
502          },
503         render : function (_self)
504          {
505              _this.option_grid = _self; 
506          
507          },
508         rowdblclick : function (_self, el, rowIndex, e)
509          {
510              var sel = _this.option_grid.store.getAt(rowIndex);
511              
512              if(!sel || sel.data.id * 1 < 1){
513                  return;
514              }
515              
516              Pman.Dialog.BAdminCoreEnum.show({ 
517                  id : sel.data.id
518              }, function(res) {
519                  _this.option_grid.store.load({});
520              });
521              
522          }
523        },
524        xns : Roo.bootstrap,
525        '|xns' : 'Roo.bootstrap',
526        store : {
527         xtype : 'Store',
528         remoteSort : true,
529         sortinfo : { field : 'display_name', direction: 'ASC' },
530         listeners : {
531          beforeload : function (_self, o)
532           {
533               o.params = o.params || {};
534               
535               var sel = _this.type_grid.getSelectionModel().getSelected();
536               
537               if(!sel || sel.data.id * 1 < 1 || !sel.data.name.length){
538                   this.removeAll();
539                   return false;
540               }
541               
542               o.params.etype = sel.data.name;
543               
544           },
545          load : function (_self, records, options)
546           {
547               _this.edit_btn.hide();
548               _this.delete_btn.hide();
549           },
550          update : function (_self, record, operation)
551           {
552               if (operation != 'commit') {
553                   return;
554               }
555           
556               new Pman.Request({
557                   url : baseURL + '/Roo/Core_enum',
558                   method :'POST',
559                   params : {
560                       id : record.data.id,
561                       active: record.data.active
562                   },
563                   success : function() {
564           
565                   },
566                   failure : function() 
567                   {
568                       Roo.bootstrap.MessageBox.alert("Error", "saving failed", function() {
569                           _this.grid.footer.onClick('first');
570                       });
571                   }
572               });
573           }
574         },
575         xns : Roo.data,
576         '|xns' : 'Roo.data',
577         proxy : {
578          xtype : 'HttpProxy',
579          method : 'GET',
580          url : baseURL + '/Roo/core_enum.php',
581          xns : Roo.data,
582          '|xns' : 'Roo.data'
583         },
584         reader : {
585          xtype : 'JsonReader',
586          fields : [
587              {
588                  'name': 'id',
589                  'type': 'int'
590              },
591              {
592                  'name': 'etype',
593                  'type': 'string'
594              },
595              {
596                  'name': 'name',
597                  'type': 'string'
598              },
599              {
600                  'name': 'display_name',
601                  'type': 'string'
602              },
603              {
604                  'name': 'active',
605                  'type': 'int'
606              },
607              {
608                  'name': 'seqid',
609                  'type': 'int'
610              }
611          ],
612          id : 'id',
613          root : 'data',
614          totalProperty : 'total',
615          xns : Roo.data,
616          '|xns' : 'Roo.data'
617         }
618        },
619        sm : {
620         xtype : 'RowSelectionModel',
621         singleSelect : true,
622         listeners : {
623          selectionchange : function (_self)
624           {
625               _this.edit_btn.hide();
626               _this.delete_btn.hide();
627               
628               if (!this.getSelected()) {
629                   return;
630               }
631               
632               _this.edit_btn.show();
633               _this.delete_btn.show();
634               
635           }
636         },
637         xns : Roo.bootstrap.Table,
638         '|xns' : 'Roo.bootstrap.Table'
639        },
640        cm : [
641         {
642          xtype : 'ColumnModel',
643          cursor : 'pointer',
644          dataIndex : 'id',
645          header : _this._strings['01abfc750a0c942167651c40d088531d'] /* # */,
646          md : 2,
647          renderer : function(v,x,r) {
648              //console.log(r.data.seqid);
649              //return String.format('{0}', v ? v : '');
650              
651              return 
652                  String.format('{0}', r.data.seqid ? r.data.seqid : '')
653                  +" <span style='color:lightgrey'>"
654                  + String.format('{0}', r.data.id ? r.data.id : '')
655                  +"</span>";
656          },
657          sm : 2,
658          sortable : false,
659          xs : 2,
660          xns : Roo.grid,
661          '|xns' : 'Roo.grid'
662         },
663         {
664          xtype : 'ColumnModel',
665          cursor : 'pointer',
666          dataIndex : 'name',
667          header : _this._strings['49ee3087348e8d44e1feda1917443987'] /* Name */,
668          md : 4,
669          renderer : function(v,x,r) { 
670              return String.format('{0}', v ? v : '');
671          },
672          sm : 4,
673          sortable : false,
674          xs : 4,
675          xns : Roo.grid,
676          '|xns' : 'Roo.grid'
677         },
678         {
679          xtype : 'ColumnModel',
680          cursor : 'pointer',
681          dataIndex : 'display_name',
682          header : _this._strings['b48968e1c912da07df5e8d6d246291ec'] /* Display Name */,
683          md : 4,
684          renderer : function(v,x,r) { 
685              return String.format('{0}', v ? v : '');
686          },
687          sm : 4,
688          sortable : false,
689          xs : 4,
690          xns : Roo.grid,
691          '|xns' : 'Roo.grid'
692         },
693         {
694          xtype : 'ColumnModel',
695          cursor : 'pointer',
696          dataIndex : 'active',
697          header : _this._strings['4d3d769b812b6faa6b76e1a8abaece2d'] /* Active */,
698          md : 2,
699          renderer : function(v,x,r) { 
700              var state = v > 0 ?  '-checked' : '';
701          
702              return '<img class="x-grid-check-icon' + state + '" src="' + Roo.BLANK_IMAGE_URL + '"/>';
703          },
704          sm : 2,
705          sortable : false,
706          xs : 2,
707          xns : Roo.grid,
708          '|xns' : 'Roo.grid'
709         }
710        ]
711       }
712      }
713     ]
714    }
715   };  }
716 });