Pman.Tab.Admin.js
[Pman.Admin] / Pman.Tab.Admin.js
1 //<script type="text/javascript">
2
3
4 /**
5 * Tab for fax stuff..
6 */
7
8 Pman.on('beforeload', function()
9 {
10     
11     // only the system admin company can see this!!
12     if (Pman.Login.authUser.company_id_isOwner * 1 < 1) {
13         return;
14     }
15     Pman.register({
16         modKey : '900-pman-tab-admin',
17         module : Pman.Tab.Admin,
18         region : 'center',
19         parent : Pman,
20         name : "Administration"
21     });
22      if (Pman.hasPerm('Core.Projects_All', 'E')) {
23         
24         Pman.subMenuItems.push({
25                 seqid : 401,
26                 text: "Add Project",
27                 cls: 'x-btn-text-icon',
28                 icon: Ext.rootURL + 'images/default/dd/drop-add.gif',
29                 
30                 handler : function() {
31                     Pman.Dialog.Projects.show( 
32                         { 
33                             id : 0
34                         },
35                         function(data) {
36                             Pman.refreshActivePanel();
37                     }); 
38                 }
39         });
40         Pman.subMenuItems.push( new Roo.menu.Separator({
41             seqid : 402
42         }));
43         
44     }
45 });
46  
47 Pman.Tab.Admin = {
48     
49     tab : false,
50     
51     add : function(parentLayout, region)
52     {
53         
54         if (!Pman.hasPerm('Admin.Admin_Tab', 'S')) {
55             return;
56         }
57         if (this.tab) {
58             return;
59         }
60                 
61         
62         this.layout = new Ext.BorderLayout(
63             parentLayout.getEl().createChild({tag:'div'}),
64             {
65                 center: {
66                     autoScroll:true,
67                     hideTabs: false,
68                     tabPosition: 'top'
69                 }
70             }
71         );
72             
73                 //this.mainTab.on('activate', function() {
74                 //    Pman.adminLayout.showPanel(0);
75                   //  Pman.Tab.Documents_In.paging.onClick('first');
76                // });
77
78         var _this = this;
79         this.tab = parentLayout.add('center',  
80             new Ext.NestedLayoutPanel(
81                 this.layout, {
82                     title: "Admin",
83                     background : true
84                 }));
85
86         this.tab.on('activate', function() {
87             try {
88                 this.layout.showPanel(0)
89             } catch(e) { }
90             
91             //_this.layout.getRegion('center').showPanel(0);
92             
93             //try {
94             //    Pman.Tab.ProjectsMgr.paging.onClick('first');
95             //} catch(e) {
96             // do nothing .. - if projects is not avail...
97             //}
98             
99             // auto loads?!?!
100             //Pman.Tab.ProjectsMgr.paging.onClick('first');
101         });
102         //this.adminLayout.beginUpdate();
103     },
104
105  
106     
107     buildAdminLayout : function() 
108     {
109          
110         if (isDev) {
111             Pman.Translation.add(this.layout, 'center');
112         }
113        
114         
115     }
116 };
117         
118