Code

Added missing class var.
[gosa.git] / gosa-plugins / systems / admin / systems / tabs_server.inc
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;
73     /* cn is not case sensitive for ldap, but for php it is!! */
74     if($baseobject->orig_dn != "new"){
75       if($this->config->current['DNMODE'] == "cn"){
76         if (strtolower($baseobject->orig_dn) != (strtolower($this->dn))){
77           $baseobject->recursive_move($baseobject->orig_dn, $this->dn);
78         }
79       }else{
80         if ($baseobject->orig_dn != $this->dn){
81           $baseobject->recursive_move($baseobject->orig_dn, $this->dn);
82         }
83       }
84     }
86     $baseobject->dn= $this->dn;
88     foreach ($this->by_object as $key => $obj){
89       $this->by_object[$key]->dn= $this->dn;
90       $this->by_object[$key]->cn= $baseobject->cn;
91     }
93     tabs::save(FALSE);
95     /* Reload server settings after saving */
96     $config = session::get('config');
97     $config->load_servers();
98     session::set('config',$config);
99   }
103 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
104 ?>