1 <?php
3 class grouptabs extends tabs
4 {
6 function grouptabs($config, $data, $dn)
7 {
8 tabs::tabs($config, $data, $dn,"groups");
9 $this->addSpecialTabs();
10 }
12 function save_object($save_current= FALSE)
13 {
14 tabs::save_object($save_current);
16 /* Update reference, transfer variables */
17 $baseobject= $this->by_object['group'];
18 foreach ($this->by_object as $name => $obj){
19 /* Don't touch base object */
20 if ($name != 'group'){
21 $obj->parent= &$this;
22 $obj->cn= $baseobject->cn;
23 $this->by_object[$name]= $obj;
24 }
25 }
26 }
28 function delete()
29 {
30 /* Put baseobjects 'cn' to mailobjects 'uid' */
31 $baseobject= $this->by_object['group'];
32 if (isset($this->by_object['mailgroup'])){
33 $this->by_object['mailgroup']->uid= $baseobject->cn;
34 }
35 tabs::delete();
36 }
38 function save()
39 {
40 $baseobject= $this->by_object['group'];
42 /* Check for new 'dn', in order to propagate the
43 'dn' to all plugins */
44 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
46 /* Put baseobjects 'cn' to mailobjects 'uid' */
47 if (isset($this->by_object['mailgroup'])){
48 $this->by_object['mailgroup']->uid= $baseobject->cn;
49 }
52 /* Update reference, transfer variables */
53 foreach ($this->by_object as $name => $obj){
54 /* Transfer attributes for mailgroup account */
55 if ($name == 'mailgroup'){
56 $this->by_object['mailgroup']->members= $baseobject->memberUid;;
57 }
58 }
60 /* Move group? */
61 if ($this->dn != $new_dn){
63 /* Write entry on new 'dn' */
64 if ($this->dn != "new"){
65 $baseobject->move($this->dn, $new_dn);
66 $this->by_object['group']= $baseobject;
67 }
69 /* Happen to use the new one */
70 $this->dn= $new_dn;
71 }
73 $ret= tabs::save();
75 /* Fix tagging if needed */
76 $baseobject->dn= $new_dn;
77 $baseobject->handle_object_tagging();
79 return $ret;
80 }
82 function saveCopyDialog()
83 {
84 tabs::saveCopyDialog();
86 /* Update reference, transfer variables */
87 $baseobject= $this->by_object['group'];
88 foreach ($this->by_object as $name => $obj){
89 /* Don't touch base object */
90 if ($name != 'group'){
91 $obj->parent= &$this;
92 $obj->cn= $baseobject->cn;
93 $this->by_object[$name]= $obj;
94 }
95 }
96 }
98 }
100 ?>