Code

Updated terminal/workstation
[gosa.git] / gosa-plugins / goto / admin / systems / goto / tabs_terminal.inc
1 <?php
3 class termtabs extends tabs
4 {
6   function termtabs($config, $data, $dn, $category)
7   {
8     /* Save dn */
9     $this->dn= $dn;
10     $this->config= $config;
12     $baseobject= NULL;
14     foreach ($data as $tab){
15       $this->by_name[$tab['CLASS']]= $tab['NAME'];
17       if ($baseobject === NULL){
18         $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
19         $this->by_object[$tab['CLASS']]= $baseobject;
20       } else {
21         $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
22       }
24       $this->by_object[$tab['CLASS']]->parent= &$this;
25       $this->by_object[$tab['CLASS']]->set_acl_category($category);
27       /* Initialize current */
28       if ($this->current == ""){
29         $this->current= $tab['CLASS'];
30       }
31     }
33     /* Add references/acls/snapshots */
34     $this->addSpecialTabs();
35   }
37   function save_object($save_current= FALSE)
38   {
39     tabs::save_object($save_current);
41     /* Update reference, transfer variables */
42     if(isset($this->by_object['termstartup'])){
43       $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
44     }
45     
46     $baseobject = $this->by_object['termgeneric'];
47     $baseobject->netConfigDNS->cn= $baseobject->cn;
48     foreach($this->by_object as $name => $plug){
49       $this->by_object[$name]->cn = $baseobject->cn;
50     }
51   }
54   function save($ignore_account= FALSE)
55   {
56     /* Check for new 'dn', in order to propagate the
57        'dn' to all plugins */
58     $baseobject= $this->by_object['termgeneric'];
59     $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalou').$baseobject->base;
60     $baseobject->dn= $this->dn;
62     if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
64       /* Udpate acls */
65       $baseobject->update_acls($baseobject->orig_dn,$this->dn);
66       $baseobject->move($baseobject->orig_dn,$this->dn);
67     }
69     foreach ($this->by_object as $key => $obj){
70       $this->by_object[$key]->dn= $this->dn;
71       $this->by_object[$key]->cn= $baseobject->cn;
72     }
74     tabs::save(TRUE);
75     if(isset($this->by_object['printgeneric'])){
76       if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
77         $this->by_object['printgeneric']->remove_from_parent();
78       }
79     }
80   }
82 }
84 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
85 ?>