Code

Remove the tabs::tabs call from tabs_printers.inc because
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / tabs_workstation.inc
1 <?php
3 class worktabs extends tabs
4 {
6   public $was_activated = FALSE;
8   function worktabs($config, $data, $dn,$category)
9   {
10     tabs::tabs($config, $data, $dn,$category);    
12     /* Save dn */
13     $this->dn= $dn;
14     $this->config= $config;
16     $baseobject= NULL;
18     foreach ($data as $tab){
20       if(!class_available($tab['CLASS'])) continue;
21       $this->by_name[$tab['CLASS']]= $tab['NAME'];
23       if ($baseobject === NULL){
24         $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
25         $this->by_object[$tab['CLASS']]= $baseobject;
26       } else {
27         $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
28       }
30       $this->by_object[$tab['CLASS']]->parent= &$this;
31       $this->by_object[$tab['CLASS']]->set_acl_category($category);
32       $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;
34       /* Initialize current */
35       if ($this->current == ""){
36         $this->current= $tab['CLASS'];
37       }
38     }
40     /* Add references/acls/snapshots */
41     $this->addSpecialTabs();
42   }
45   /*! \brief Reinitializes the tab classes with fresh ldap values.
46     This maybe usefull if for example the apply button was pressed.
47    */
48   function re_init()
49   {
50     $baseobject= NULL;
51     foreach($this->by_object as $name => $object){
52       $class = get_class($object);
53       if(in_array($class,array("reference","acl"))) continue;
54       if ($baseobject === NULL){
55         $baseobject= new $class($this->config, $this->dn,NULL,$this);
56         $baseobject->enable_CSN_check();
57         $this->by_object[$name]= $baseobject;
58       } else {
59         $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
60       }
61       $this->by_object[$name]->parent= &$this;
62       $this->by_object[$name]->set_acl_category($this->acl_category);
63     }
64   }
67   function save_object($save_current= FALSE)
68   {
69     tabs::save_object($save_current);
71     /* Assign current cn */
72     $baseobject= $this->by_object['workgeneric'];
73     $baseobject->netConfigDNS->cn= $baseobject->cn;
74     foreach ($this->by_object as $key => $obj){
75       $this->by_object[$key]->cn= $baseobject->cn;
76     }
77   }
80   function save($ignore_account= FALSE)
81   {
82     /* Check for new 'dn', in order to propagate the
83        'dn' to all plugins */
84     $baseobject= $this->by_object['workgeneric'];
85     $this->dn= "cn=".$baseobject->cn.",".get_ou('workstationRDN').$baseobject->base;
87     if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
89       /* Udpate acls */
90       $baseobject->update_acls($baseobject->orig_dn,$this->dn);
91       $baseobject->move($baseobject->orig_dn,$this->dn);
92     }
94     $baseobject->dn= $this->dn;
96     foreach ($this->by_object as $key => $obj){
97       $this->by_object[$key]->dn= $this->dn;
98       $this->by_object[$key]->cn= $baseobject->cn;
99     }
101     tabs::save(TRUE);
103     if(isset($this->by_object['printgeneric'])){
104       if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
105         $this->by_object['printgeneric']->remove_from_parent();
106       }
107     }
108   }
112 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
113 ?>