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);
29 $this->read_only |= $this->by_object[$tab['CLASS']]->read_only;
31 /* Initialize current */
32 if ($this->current == ""){
33 $this->current= $tab['CLASS'];
34 }
35 }
37 /* Add references/acls/snapshots */
38 $this->addSpecialTabs();
39 }
42 /*! \brief Reinitializes the tab classes with fresh ldap values.
43 This maybe usefull if for example the apply button was pressed.
44 */
45 function re_init()
46 {
47 $baseobject= NULL;
48 foreach($this->by_object as $name => $object){
49 $class = get_class($object);
50 if(in_array($class,array("reference","acl"))) continue;
51 if ($baseobject === NULL){
52 $baseobject= new $class($this->config, $this->dn,NULL,$this);
53 $baseobject->enable_CSN_check();
54 $this->by_object[$name]= $baseobject;
55 } else {
56 $this->by_object[$name]= new $class($this->config, $this->dn, $baseobject,$this);
57 }
58 $this->by_object[$name]->parent= &$this;
59 $this->by_object[$name]->set_acl_category($this->acl_category);
60 }
61 }
64 function save_object($save_current= FALSE)
65 {
66 tabs::save_object($save_current);
68 /* Update reference, transfer variables */
69 if(isset($this->by_object['termstartup'])){
70 $this->by_object['termstartup']->gotoTerminalPath= $this->by_object['termgeneric']->gotoTerminalPath;
71 }
73 $baseobject = $this->by_object['termgeneric'];
74 $baseobject->netConfigDNS->cn= $baseobject->cn;
75 foreach($this->by_object as $name => $plug){
76 $this->by_object[$name]->cn = $baseobject->cn;
77 }
78 }
81 function save($ignore_account= FALSE)
82 {
83 /* Check for new 'dn', in order to propagate the
84 'dn' to all plugins */
85 $baseobject= $this->by_object['termgeneric'];
86 $this->dn= "cn=".$baseobject->cn.",".get_ou('terminalRDN').$baseobject->base;
87 $baseobject->dn= $this->dn;
89 if($this->dn != $baseobject->orig_dn && $baseobject->orig_dn != "new"){
91 /* Udpate acls */
92 $baseobject->update_acls($baseobject->orig_dn,$this->dn);
93 $baseobject->move($baseobject->orig_dn,$this->dn);
94 }
96 foreach ($this->by_object as $key => $obj){
97 $this->by_object[$key]->dn= $this->dn;
98 $this->by_object[$key]->cn= $baseobject->cn;
99 }
101 tabs::save(TRUE);
102 if(isset($this->by_object['printgeneric'])){
103 if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){
104 $this->by_object['printgeneric']->remove_from_parent();
105 }
106 }
107 }
109 }
111 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
112 ?>