1 <?php
3 class grouptabs extends tabs
4 {
6 function grouptabs($config, $data, $dn,$acl_category)
7 {
8 tabs::tabs($config, $data, $dn,$acl_category);
9 $baseobject= $this->by_object['group'];
10 foreach ($this->by_object as $name => $obj){
11 if(isset($obj->parent)){
12 $this->by_object[$name]->parent = $this;
13 }
14 }
16 /* Add references/acls/snapshots */
17 $this->addSpecialTabs();
18 }
20 function save_object($save_current= FALSE)
21 {
22 tabs::save_object($save_current);
24 /* Update reference, transfer variables */
25 $baseobject= $this->by_object['group'];
26 foreach ($this->by_object as $name => $obj){
27 /* Don't touch base object */
28 if ($name != 'group'){
29 $obj->parent= &$this;
30 $obj->cn= $baseobject->cn;
31 $this->by_object[$name]= $obj;
32 }
33 }
34 }
36 function delete()
37 {
38 /* Put baseobjects 'cn' to mailobjects 'uid' */
39 $baseobject= $this->by_object['group'];
40 if (isset($this->by_object['mailgroup'])){
41 $this->by_object['mailgroup']->uid= $baseobject->cn;
42 }
43 tabs::delete();
44 }
46 function save()
47 {
48 $baseobject= $this->by_object['group'];
50 /* Check for new 'dn', in order to propagate the
51 'dn' to all plugins */
52 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
54 /* Put baseobjects 'cn' to mailobjects 'uid' */
55 if (isset($this->by_object['mailgroup'])){
56 $this->by_object['mailgroup']->uid= $baseobject->cn;
57 }
60 /* Update reference, transfer variables */
61 foreach ($this->by_object as $name => $obj){
62 /* Transfer attributes for mailgroup account */
63 if ($name == 'mailgroup'){
64 $this->by_object['mailgroup']->members= $baseobject->memberUid;;
65 }
66 }
68 /* Move group? */
69 if ($this->dn != $new_dn){
71 /* Write entry on new 'dn' */
72 if ($this->dn != "new"){
73 $baseobject->move($this->dn, $new_dn);
74 $this->by_object['group']= $baseobject;
75 }
77 /* Happen to use the new one */
78 $this->dn= $new_dn;
79 }
81 $ret= tabs::save();
83 /* Fix tagging if needed */
84 $baseobject->dn= $new_dn;
85 $baseobject->handle_object_tagging();
87 return $ret;
88 }
90 function saveCopyDialog()
91 {
92 tabs::saveCopyDialog();
94 /* Update reference, transfer variables */
95 $baseobject= $this->by_object['group'];
96 foreach ($this->by_object as $name => $obj){
97 /* Don't touch base object */
98 if ($name != 'group'){
99 $obj->parent= &$this;
100 $obj->cn= $baseobject->cn;
101 $this->by_object[$name]= $obj;
102 }
103 }
104 }
106 }
108 ?>