1 <?php
2 /*
3 * This code is part of GOsa (http://www.gosa-project.org)
4 * Copyright (C) 2003-2008 GONICUS GmbH
5 *
6 * ID: $$Id$$
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
23 class grouptabs extends tabs
24 {
26 function grouptabs($config, $data, $dn, $cat = "", $hide_refs = FALSE, $hide_acls = FALSE)
27 {
28 tabs::tabs($config, $data, $dn,"groups", $hide_refs, $hide_acls);
29 $this->addSpecialTabs();
30 }
32 function save_object($save_current= FALSE)
33 {
34 tabs::save_object($save_current);
36 /* Update reference, transfer variables */
37 $baseobject= $this->by_object['group'];
38 foreach ($this->by_object as $name => $obj){
39 /* Don't touch base object */
40 if ($name != 'group'){
41 $obj->parent= &$this;
42 $obj->cn= $baseobject->cn;
43 $this->by_object[$name]= $obj;
44 }
45 }
46 }
48 function delete()
49 {
50 /* Put baseobjects 'cn' to mailobjects 'uid' */
51 $baseobject= $this->by_object['group'];
52 if (isset($this->by_object['mailgroup'])){
53 $this->by_object['mailgroup']->uid= $baseobject->cn;
54 }
55 tabs::delete();
56 }
58 function save($ignore_account= FALSE)
59 {
60 $baseobject= $this->by_object['group'];
62 /* Check for new 'dn', in order to propagate the
63 'dn' to all plugins */
64 $new_dn= 'cn='.$baseobject->cn.','.get_groups_ou().$baseobject->base;
66 /* Put baseobjects 'cn' to mailobjects 'uid' */
67 if (isset($this->by_object['mailgroup'])){
68 $this->by_object['mailgroup']->uid= $baseobject->cn;
69 }
72 /* Update reference, transfer variables */
73 foreach ($this->by_object as $name => $obj){
74 /* Transfer attributes for mailgroup account */
75 if ($name == 'mailgroup'){
76 $this->by_object['mailgroup']->members= $baseobject->memberUid;;
77 }
78 }
80 /* Move group? */
81 if ($this->dn != $new_dn){
83 /* Write entry on new 'dn' */
84 if ($this->dn != "new"){
85 $baseobject->update_acls($this->dn,$new_dn);
86 $baseobject->move($this->dn, $new_dn);
87 $this->by_object['group']= $baseobject;
88 }
90 /* Happen to use the new one */
91 $this->dn= $new_dn;
92 }
94 $ret= tabs::save();
96 return $ret;
97 }
99 function saveCopyDialog()
100 {
101 tabs::saveCopyDialog();
103 /* Update reference, transfer variables */
104 $baseobject= $this->by_object['group'];
105 foreach ($this->by_object as $name => $obj){
106 /* Don't touch base object */
107 if ($name != 'group'){
108 $obj->parent= &$this;
109 $obj->cn= $baseobject->cn;
110 $this->by_object[$name]= $obj;
111 }
112 }
113 }
115 }
117 ?>