Code

Updated Workstation
[gosa.git] / gosa-plugins / goto / admin / systems / goto / tabs_terminal.inc
1 <?php
3 class termtabs extends tabs
4 {
5   public $was_activated = FALSE;
7   function termtabs($config, $data, $dn, $category)
8   {
9     /* Save dn */
10     $this->dn= $dn;
11     $this->config= $config;
13     $baseobject= NULL;
15     foreach ($data as $tab){
16       if(!class_available($tab['CLASS'])) continue;  
18       $this->by_name[$tab['CLASS']]= $tab['NAME'];
20       if ($baseobject === NULL){
21         $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
22         $this->by_object[$tab['CLASS']]= $baseobject;
23       } else {
24         $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
25       }
27       $this->by_object[$tab['CLASS']]->parent= &$this;
28       $this->by_object[$tab['CLASS']]->set_acl_category($category);
30       /* Initialize current */
31       if ($this->current == ""){
32         $this->current= $tab['CLASS'];
33       }
34     }
36     /* Add references/acls/snapshots */
37     $this->addSpecialTabs();
38   }
41   /*! \brief Reinitializes the tab classes with fresh ldap values.
42     This maybe usefull if for example the apply button was pressed.
43    */
44   function re_init()
45   {
46     $baseobject= NULL;
47     foreach($this->by_object as $name => $object){
48       $class = get_class($object);
49       if(in_array($class,array("reference","acl"))) continue;
50       if ($baseobject === NULL){
51         $baseobject= new $class($this->config, $this->dn,NULL,$this);
52         $baseobject->enable_CSN_check();
53         $this->by_object[$name]= $baseobject;
54       } else {
55         $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
56       }
57       $this->by_object[$name]->parent= &$this;
58       $this->by_object[$name]->set_acl_category($this->acl_category);
59     }
60   }
63   function save_object($save_current= FALSE)
64   {
65     tabs::save_object($save_current);
67     /* Update reference, transfer variables */
68     if(isset($this->by_object['termstartup'])){
69       $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
70     }
71     
72     $baseobject = $this->by_object['termgeneric'];
73     $baseobject->netConfigDNS->cn= $baseobject->cn;
74     foreach($this->by_object as $name => $plug){
75       $this->by_object[$name]->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['termgeneric'];
85     $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalRDN').$baseobject->base;
86     $baseobject->dn= $this->dn;
88     if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
90       /* Udpate acls */
91       $baseobject->update_acls($baseobject->orig_dn,$this->dn);
92       $baseobject->move($baseobject->orig_dn,$this->dn);
93     }
95     foreach ($this->by_object as $key => $obj){
96       $this->by_object[$key]->dn= $this->dn;
97       $this->by_object[$key]->cn= $baseobject->cn;
98     }
100     tabs::save(TRUE);
101     if(isset($this->by_object['printgeneric'])){
102       if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
103         $this->by_object['printgeneric']->remove_from_parent();
104       }
105     }
106   }
110 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
111 ?>