sync
[Pman.Admin] / Pman.Tab.StaffMgr.js
1 //<script type="text/javascript">
2
3 // Groupmanager 
4 // left - list of groups.
5 // right - Permissions | Members..
6 Pman.on('beforeload', function()
7 {
8  
9  
10     Pman.register({
11         part :  ["Admin","StaffManager"],
12         modKey : '020-pman-tab-staffmgr',
13         module : Pman.Tab.StaffMgr,
14         region : 'center',
15         parent : Pman.Tab.Admin,
16         name : "Staff Manager",
17         permname : 'Admin.Teams',
18         finalize : function() {
19             
20             var _this = Pman.Tab.StaffMgr;
21             if (!_this.layout) {
22                 return;
23             }
24             
25             _this.layout.endUpdate(); 
26             
27         }
28     });
29     
30 });
31
32 Pman.Tab.StaffMgr = {
33     grid : false,
34     panel : false,
35     title: false,
36     add : function(parentLayout, region) {
37         var _this = this;
38         if (this.panel) {
39             parentLayout.getRegion(region).showPanel(this.panel);
40             return;
41         }
42      
43         
44         this.layout = new Ext.BorderLayout(
45             parentLayout.getEl().createChild({tag:'div'}),
46             {
47                
48                 west : {
49                     autoScroll:true,
50                     hideTabs: true,
51                     titlebar: true,
52                     split:true,
53                     initialSize: 250
54                 },
55                 center: {
56                     autoScroll:true,
57                     hideTabs: false,
58                      tabPosition: 'top'
59                    
60                 }
61             }
62         );
63         
64         
65        
66         this.tab = parentLayout.add(region,  new Ext.NestedLayoutPanel(
67             this.layout, {title: this.title || "Staff / Teams", background: true}));
68         
69         this.tab.on('activate', function() {
70             _this.layout.getRegion('center').showPanel(0);
71             
72             if (_this.layout.getRegion('west').panels.length) {
73                 _this.layout.getRegion('west').showPanel(0); // forces a refresh..
74                 Pman.Tab.Teams.refresh();
75               // Pman.Tab.Teams.refresh();
76             } else {
77                  Pman.Tab.PersonStaff.loadFirst();
78                 
79             }
80             
81             
82         });
83         this.layout.beginUpdate();
84
85     }  
86 };