Code

improved copy & paste
[gosa.git] / plugins / admin / groups / tabs_group.inc
1 <?php
3 class grouptabs extends tabs
4 {
6         function grouptabs($config, $data, $dn)
7         {
8                 tabs::tabs($config, $data, $dn);
9         }
11         function save_object($save_current= FALSE)
12         {
13                 tabs::save_object($save_current);
15                 /* Update reference, transfer variables */
16                 $baseobject= $this->by_object['group'];
17                 foreach ($this->by_object as $name => $obj){
18                         /* Don't touch base object */
19                         if ($name != 'group'){
20                                 $obj->parent= &$this;
21                                 $obj->cn= $baseobject->cn;
22                                 $this->by_object[$name]= $obj;
23                         }
24                 }
25         }
27         function save()
28         {
29                 $baseobject= $this->by_object['group'];
31                 /* Check for new 'dn', in order to propagate the
32                    'dn' to all plugins */
33                 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
35                 /* Put baseobjects 'cn' to mailobjects 'uid' */
36                 if (isset($this->by_object['mailgroup'])){
37                         $this->by_object['mailgroup']->uid= $baseobject->cn;
38                 }
41                 /* Update reference, transfer variables */
42                 foreach ($this->by_object as $name => $obj){
43                         /* Transfer attributes for mailgroup account */
44                         if ($name == 'mailgroup'){
45                                 $this->by_object['mailgroup']->members= $baseobject->memberUid;;
46                         }
47                 }
49                 /* Move group? */
50                 if ($this->dn != $new_dn){
52                         /* Write entry on new 'dn' */
53                         if ($this->dn != "new"){
54                                 $baseobject->move($this->dn, $new_dn);
55                                 $this->by_object['group']= $baseobject;
56                         }
58                         /* Happen to use the new one */
59                         $this->dn= $new_dn;
60                 }
62                 return tabs::save();
63         }
65         function saveCopyDialog()
66         {
67                 tabs::saveCopyDialog();
68                 
69         /* Update reference, transfer variables */
70         $baseobject= $this->by_object['group'];
71         foreach ($this->by_object as $name => $obj){
72             /* Don't touch base object */
73             if ($name != 'group'){
74                 $obj->parent= &$this;
75                 $obj->cn= $baseobject->cn;
76                 $this->by_object[$name]= $obj;
77             }
78         }
79         }
80         
81 }
83 ?>