From c51e06337a8a8c4a541b953658eb21911dbda307 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 19 Sep 2006 08:31:41 +0000 Subject: [PATCH] Updated workstation && printer tabs, to use new parent parameter correctly git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4722 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_printGeneric.inc | 16 +++++++++---- plugins/admin/systems/tabs_printers.inc | 24 ++++++++++++-------- plugins/admin/systems/tabs_workstation.inc | 24 ++++++++++++-------- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 44fc8330d..e1f34fceb 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -49,11 +49,13 @@ class printgeneric extends plugin "gotoUserAdminPrinter","gotoGroupAdminPrinter","gotoUserPrinter","gotoGroupPrinter"); var $objectclasses = array("top", "gotoPrinter"); - function printgeneric ($config, $dn,$parent) + var $parent; + + function printgeneric ($config, $dn,$parent_init,$parent) { $this->config = $config; $this->dn = $dn; - + /* If parent was posted(the tabs object) we can detect the printer type. */ if($parent){ $this->parent = $parent; @@ -75,7 +77,7 @@ class printgeneric extends plugin $this->orig_dn = $this->dn; /* Get printer settings, possibly dn has changed */ - plugin::plugin ($config, $this->dn); + plugin::plugin ($config, $this->dn,$parent_init); /* Get is_account initially_was_account status */ $this->getTypeOfPrinter(true); @@ -161,6 +163,9 @@ class printgeneric extends plugin /* Detect type of printer via parent tabs. */ + + $class = get_class($this->parent); + echo $class; if(isset($this->parent->by_object['workgeneric'])){ /* Exclude templates @@ -585,7 +590,10 @@ class printgeneric extends plugin function save_object() { plugin::save_object(); - $this->netConfigDNS->save_object(); + + if(is_object($this->netConfigDNS)){ + $this->netConfigDNS->save_object(); + } /* Save base, since this is no LDAP attribute */ if((isset($_POST['base'])) && ($this->acl_is_moveable()) ) { diff --git a/plugins/admin/systems/tabs_printers.inc b/plugins/admin/systems/tabs_printers.inc index 2c264234e..92c9fbb33 100644 --- a/plugins/admin/systems/tabs_printers.inc +++ b/plugins/admin/systems/tabs_printers.inc @@ -5,22 +5,26 @@ class printtabs extends tabs function printtabs($config, $data, $dn,$category) { + /* Save dn */ $this->dn= $dn; $this->config= $config; + $baseobject= NULL; + foreach ($data as $tab){ - if($tab['CLASS'] == "printgeneric"){ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn,$this); - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); - }else{ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn); - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); + $this->by_name[$tab['CLASS']]= $tab['NAME']; + + if ($baseobject == NULL){ + $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); + $this->by_object[$tab['CLASS']]= $baseobject; + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); } + + $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_object[$tab['CLASS']]->set_acl_category($category); + /* Initialize current */ if ($this->current == ""){ $this->current= $tab['CLASS']; diff --git a/plugins/admin/systems/tabs_workstation.inc b/plugins/admin/systems/tabs_workstation.inc index d5bab394b..138c2d4ed 100644 --- a/plugins/admin/systems/tabs_workstation.inc +++ b/plugins/admin/systems/tabs_workstation.inc @@ -5,22 +5,26 @@ class worktabs extends tabs function worktabs($config, $data, $dn,$category) { + /* Save dn */ $this->dn= $dn; $this->config= $config; + $baseobject= NULL; + foreach ($data as $tab){ - if($tab['CLASS'] == "printgeneric"){ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn,$this); - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); - }else{ - $this->by_name[$tab['CLASS']]= $tab['NAME']; - $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn); - $this->by_object[$tab['CLASS']]->parent= &$this; - $this->by_object[$tab['CLASS']]->set_acl_category($category); + $this->by_name[$tab['CLASS']]= $tab['NAME']; + + if ($baseobject == NULL){ + $baseobject= new $tab['CLASS']($this->config, $this->dn,NULL,$this); + $this->by_object[$tab['CLASS']]= $baseobject; + } else { + $this->by_object[$tab['CLASS']]= new $tab['CLASS']($this->config, $this->dn, $baseobject,$this); } + + $this->by_object[$tab['CLASS']]->parent= &$this; + $this->by_object[$tab['CLASS']]->set_acl_category($category); + /* Initialize current */ if ($this->current == ""){ $this->current= $tab['CLASS']; -- 2.30.2