1 <?php
3 class termtabs extends tabs
4 {
5 public $was_activated = FALSE;
7 function termtabs($config, $data, $dn, $category,$hide_refs = FALSE, $hide_acls = FALSE)
8 {
9 /* Save dn */
10 $this->dn= $dn;
11 $this->config= $config;
13 $this->hide_refs = $hide_refs;
14 $this->hide_acls = $hide_acls;
16 $baseobject= NULL;
18 foreach ($data as $tab){
19 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 /* Update reference, transfer variables */
72 if(isset($this->by_object['termstartup'])){
73 $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
74 }
76 $baseobject = $this->by_object['termgeneric'];
77 $baseobject->netConfigDNS->cn= $baseobject->cn;
78 foreach($this->by_object as $name => $plug){
79 $this->by_object[$name]->cn = $baseobject->cn;
80 }
81 }
84 function save($ignore_account= FALSE)
85 {
86 /* Check for new 'dn', in order to propagate the
87 'dn' to all plugins */
88 $baseobject= $this->by_object['termgeneric'];
89 $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalRDN').$baseobject->base;
90 $baseobject->dn= $this->dn;
92 if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
94 /* Udpate acls */
95 $baseobject->update_acls($baseobject->orig_dn,$this->dn);
96 $baseobject->move($baseobject->orig_dn,$this->dn);
97 }
99 foreach ($this->by_object as $key => $obj){
100 $this->by_object[$key]->dn= $this->dn;
101 $this->by_object[$key]->cn= $baseobject->cn;
102 }
104 tabs::save(TRUE);
105 if(isset($this->by_object['printgeneric'])){
106 if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
107 $this->by_object['printgeneric']->remove_from_parent();
108 }
109 }
110 }
112 }
114 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
115 ?>