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 servtabs extends tabs
24 {
26 function servtabs($config, $data, $dn,$category)
27 {
28 /* Save dn */
29 $this->dn= $dn;
30 $this->config= $config;
32 $baseobject= NULL;
34 foreach ($data as $tab){
35 $this->by_name[$tab['CLASS']]= $tab['NAME'];
37 if ($baseobject === NULL){
38 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
39 $this->by_object[$tab['CLASS']]= $baseobject;
40 } else {
41 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
42 }
44 $this->by_object[$tab['CLASS']]->parent= &$this;
45 $this->by_object[$tab['CLASS']]->set_acl_category($category);
47 /* Initialize current */
48 if ($this->current == ""){
49 $this->current= $tab['CLASS'];
50 }
51 }
53 /* Add references/acls/snapshots */
54 $this->addSpecialTabs();
55 }
57 function save_object($save_current= FALSE)
58 {
59 tabs::save_object($save_current);
61 $baseobject = $this->by_object['servgeneric'];
62 $baseobject->netConfigDNS->cn= $baseobject->cn;
63 }
66 function save($ignore_account= FALSE)
67 {
68 /* Check for new 'dn', in order to propagate the
69 'dn' to all plugins */
70 $baseobject= $this->by_object['servgeneric'];
71 $this->dn= "cn=$baseobject->cn,".get_ou('serverou').$baseobject->base;
72 $baseobject->dn= $this->dn;
74 foreach ($this->by_object as $key => $obj){
75 $this->by_object[$key]->dn= $this->dn;
76 $this->by_object[$key]->cn= $baseobject->cn;
77 }
79 tabs::save(FALSE);
81 /* Reload server settings after saving */
82 $config = session::get('config');
83 $config->load_servers();
84 session::set('config',$config);
85 }
87 }
89 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
90 ?>