Code

Added sorting to workstation startup. FAI server/release
[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   }
38   /*! \brief Reinitializes the tab classes with fresh ldap values.
39     This maybe usefull if for example the apply button was pressed.
40    */
41   function re_init()
42   {
43     $baseobject= NULL;
44     foreach($this->by_object as $name => $object){
45       $class = get_class($object);
46       if(in_array($class,array("reference","acl"))) continue;
47       if ($baseobject === NULL){
48         $baseobject= new $class($this->config, $this->dn,NULL,$this);
49         $baseobject->enable_CSN_check();
50         $this->by_object[$name]= $baseobject;
51       } else {
52         $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
53       }
54       $this->by_object[$name]->parent= &$this;
55       $this->by_object[$name]->set_acl_category($this->acl_category);
56     }
57   }
60   function save_object($save_current= FALSE)
61   {
62     tabs::save_object($save_current);
64     /* Update reference, transfer variables */
65     if(isset($this->by_object['termstartup'])){
66       $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
67     }
68     
69     $baseobject = $this->by_object['termgeneric'];
70     $baseobject->netConfigDNS->cn= $baseobject->cn;
71     foreach($this->by_object as $name => $plug){
72       $this->by_object[$name]->cn = $baseobject->cn;
73     }
74   }
77   function save($ignore_account= FALSE)
78   {
79     /* Check for new 'dn', in order to propagate the
80        'dn' to all plugins */
81     $baseobject= $this->by_object['termgeneric'];
82     $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalou').$baseobject->base;
83     $baseobject->dn= $this->dn;
85     if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
87       /* Udpate acls */
88       $baseobject->update_acls($baseobject->orig_dn,$this->dn);
89       $baseobject->move($baseobject->orig_dn,$this->dn);
90     }
92     foreach ($this->by_object as $key => $obj){
93       $this->by_object[$key]->dn= $this->dn;
94       $this->by_object[$key]->cn= $baseobject->cn;
95     }
97     tabs::save(TRUE);
98     if(isset($this->by_object['printgeneric'])){
99       if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
100         $this->by_object['printgeneric']->remove_from_parent();
101       }
102     }
103   }
107 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
108 ?>