Code

Starting move
[gosa.git] / gosa-core / 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,"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($ignore_account= FALSE)
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->update_acls($this->dn,$new_dn);
66                                 $baseobject->move($this->dn, $new_dn);
67                                 $this->by_object['group']= $baseobject;
68                         }
70                         /* Happen to use the new one */
71                         $this->dn= $new_dn;
72                 }
74                 $ret= tabs::save();
76                 /* Fix tagging if needed */
77                 $baseobject->dn= $new_dn;
78                 $baseobject->handle_object_tagging();
80                 return $ret;
81         }
83         function saveCopyDialog()
84         {
85                 tabs::saveCopyDialog();
86                 
87                 /* Update reference, transfer variables */
88                 $baseobject= $this->by_object['group'];
89                 foreach ($this->by_object as $name => $obj){
90                         /* Don't touch base object */
91                         if ($name != 'group'){
92                                 $obj->parent= &$this;
93                                 $obj->cn= $baseobject->cn;
94                                 $this->by_object[$name]= $obj;
95                         }
96                 }
97         }
98         
99 }
101 ?>