init
[Pman.Admin] / Pman.Tab.Group_Members.js
1 //<script type="text/javascript">
2 /**
3  *  group membershipg - for permissions..
4  */
5  
6  
7  Pman.on('beforeload', function()
8 {
9     //                case 1 : Pman.Tab.Projects.add(this.mainLayout, 'west'); break;
10     
11    
12     
13     Pman.register({
14         modKey : '001-pman-tab-groups-members',
15         module : Pman.Tab.Group_Members,
16         region : 'center',
17         parent : Pman.Tab.GroupMgr,
18         name : "Permission Group Membership"
19     });
20
21     
22 });
23
24 Pman.Tab.Group_Members = new  Pman.Tab.PersonList({
25     id : 'group_members',
26     type: 0,
27     title : "Staff Membership",
28     hideDelete: true, // as it's confusing..
29     getLeftSelections : function() {
30         return Pman.Tab.Groups.grid.getSelectionModel().getSelections();
31     },
32     
33     // beforeload handler... -- override on extended versions..
34     beforeload: function(t, o) {
35         //console.log(o.params);
36         // teams!?!
37         var tms = this.getLeftSelections();
38         
39         if (tms.length) {
40             o.params['query[in_group]'] = tms[0].data.id;
41         }
42         o.params['query[name]'] = this.searchBox.getValue();
43         o.params['query[type]'] = this.type; // group type..
44         o.params['query[person_internal_only_all]'] = 1;
45         o.params['query[person_inactive]'] = this.showInActive ? 0  : 1;
46         
47     },
48     
49     columns : function()
50     {
51         return [
52             this.c_name(),
53             this.c_office_id_name(),
54             this.c_role(),
55             this.c_phone(),
56             this.c_fax(),
57             this.c_email(),
58             this.c_active()
59         ]
60     },
61     
62     dialog: function () {
63         return Pman.Dialog.PersonStaff;
64     },
65     bulkAdd : function() {
66         //return Pman.Dialog.PersonBulkAdd
67         return false;
68     },
69     newDefaults : function() {
70         return {
71             
72             id : 0,
73             company_id : Pman.Login.authUser.company_id,
74             company_id_name : Pman.Login.authUser.company_id_name,
75             company_id_address : Pman.Login.authUser.company_id_address,
76             company_id_tel : Pman.Login.authUser.company_id_tel,
77             company_id_fax : Pman.Login.authUser.company_id_fax
78         };
79     }
80     
81 });