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 if(!class_available($tab['CLASS'])) continue;
17 $this->by_name[$tab['CLASS']]= $tab['NAME'];
19 if ($baseobject === NULL){
20 $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this);
21 $this->by_object[$tab['CLASS']]= $baseobject;
22 } else {
23 $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this);
24 }
26 $this->by_object[$tab['CLASS']]->parent= &$this;
27 $this->by_object[$tab['CLASS']]->set_acl_category($category);
29 /* Initialize current */
30 if ($this->current == ""){
31 $this->current= $tab['CLASS'];
32 }
33 }
35 /* Add references/acls/snapshots */
36 $this->addSpecialTabs();
37 }
40 /*! \brief Reinitializes the tab classes with fresh ldap values.
41 This maybe usefull if for example the apply button was pressed.
42 */
43 function re_init()
44 {
45 $baseobject= NULL;
46 foreach($this->by_object as $name => $object){
47 $class = get_class($object);
48 if(in_array($class,array("reference","acl"))) continue;
49 if ($baseobject === NULL){
50 $baseobject= new $class($this->config, $this->dn,NULL,$this);
51 $baseobject->enable_CSN_check();
52 $this->by_object[$name]= $baseobject;
53 } else {
54 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
55 }
56 $this->by_object[$name]->parent= &$this;
57 $this->by_object[$name]->set_acl_category($this->acl_category);
58 }
59 }
62 function save_object($save_current= FALSE)
63 {
64 tabs::save_object($save_current);
66 /* Update reference, transfer variables */
67 if(isset($this->by_object['termstartup'])){
68 $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
69 }
71 $baseobject = $this->by_object['termgeneric'];
72 $baseobject->netConfigDNS->cn= $baseobject->cn;
73 foreach($this->by_object as $name => $plug){
74 $this->by_object[$name]->cn = $baseobject->cn;
75 }
76 }
79 function save($ignore_account= FALSE)
80 {
81 /* Check for new 'dn', in order to propagate the
82 'dn' to all plugins */
83 $baseobject= $this->by_object['termgeneric'];
84 $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalRDN').$baseobject->base;
85 $baseobject->dn= $this->dn;
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 foreach ($this->by_object as $key => $obj){
95 $this->by_object[$key]->dn= $this->dn;
96 $this->by_object[$key]->cn= $baseobject->cn;
97 }
99 tabs::save(TRUE);
100 if(isset($this->by_object['printgeneric'])){
101 if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
102 $this->by_object['printgeneric']->remove_from_parent();
103 }
104 }
105 }
107 }
109 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
110 ?>