Code

Updated workstation && printer tabs, to use new parent parameter correctly
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Sep 2006 08:31:41 +0000 (08:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 19 Sep 2006 08:31:41 +0000 (08:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4722 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/tabs_printers.inc
plugins/admin/systems/tabs_workstation.inc

index 44fc8330dfdd74825da5ed5cf95439e64bebbfd6..e1f34fcebde0079fe4564d0b01bb94d6b6e57c62 100644 (file)
@@ -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()) ) {
index 2c264234e377fc88542a3e3c6caf0b64a56ab9cb..92c9fbb33ec0c9f141e807acb8f118fec3ac1859 100644 (file)
@@ -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'];
index d5bab394b9dd6344d78821bd6ef71a949d5113a5..138c2d4ede2fb2b4c50040aa83abb88713cbdc38 100644 (file)
@@ -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'];