Code

Moved ldap->error
[gosa.git] / plugins / admin / systems / class_workstationStartup.inc
index 9c12a77f64930f8e7e1a42c7044a9baa72ad73a2..f33fcae8f012307850614a0158dbb820a67efdbd 100644 (file)
@@ -8,16 +8,16 @@ class workstartup extends plugin
 
   /* Generic terminal attributes */
   var $bootmode             = "G";
-  var $goLdapServerList     = array("default");
-  var $gotoBootKernel       = "";
+  var $goLdapServerList     = array();
+  var $gotoBootKernel       = "default";
   var $gotoKernelParameters = "";
-  var $gotoLdapServer       = "";
+  var $gotoLdapServer       = "default";
   var $gotoModules          = array();
   var $gotoAutoFs           = array();
   var $gotoFilesystem       = array();
   var $gotoTerminalPath     = "";
   var $FAIstatus            = "";
-  var $gotoBootKernels      = array("default");
+  var $gotoBootKernels      = array();
 
   /* attribute list for save action */
   var $attributes     = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
@@ -53,7 +53,9 @@ class workstartup extends plugin
      */
     $ldap   = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
-    
+   
+    $this->goLdapServerList = array("default" =>"["._("inherited")."]");
+   
     $_SESSION['getAvailableClassesForThisRelease_CACHE'] = array();
     $_SESSION['getAvailableClassesForThisRelease_CACHED_CLASSES'] = array();
 
@@ -221,6 +223,9 @@ class workstartup extends plugin
 
     $this->orig_dn= $this->dn;
 
+    /* Handle inheritance value "default" */
+    $this->gotoBootKernels= array("%default%" => '['._("inherited").']');
+
     /* Get list of boot kernels */
     if (isset($this->config->data['TABS'])){
       $command= search_config($this->config->data['TABS'], get_class($this), "KERNELS");
@@ -238,10 +243,11 @@ class workstartup extends plugin
           }
         }
         pclose($fh);
-        sort($this->gotoBootKernels);
+        ksort($this->gotoBootKernels);
       }
       
     }
+
   }
 
   
@@ -553,7 +559,7 @@ class workstartup extends plugin
     /* Create divSelectBox for ldap server selection
      */
     $SelectBoxLdapServer = new divSelectBox("LdapServer");
-    $SelectBoxLdapServer->SetHeight(80);
+    $SelectBoxLdapServer->SetHeight(130);
 
     /* Set first entry as selected, if $this->gotoLdapServer is empty
      *  or given entry is no longer available ... 
@@ -574,9 +580,15 @@ class workstartup extends plugin
         $use = " checked ";
       };
 
+      if($server == "default"){
+        $display = "["._("inherited")."]";
+      }else{
+        $display = $server;
+      }
+
       $SelectBoxLdapServer->AddEntry(
           array(
-            array("string"=>$server),
+            array("string"=>$display),
             array("string"=>"<input type='radio' name='gotoLdapServer' value='".$server."' ".$use.">",
                   "attach"=>"style='border-right:0px;'")
             ));
@@ -794,9 +806,11 @@ class workstartup extends plugin
      * if we are currently editing from ogroup menu we use (array("gotWorkstationTemplate","GOhard", "FAIobject"))
      */
     if(isset($this->parent->by_object['ogroup'])){
-      $this->objectclasses = array("gotoWorkstationTemplate","GOhard", "FAIobject");
+      $this->objectclasses = array("gotoWorkstationTemplate", "FAIobject");
     }elseif(isset($this->parent->by_object['workgeneric'])){
       $this->objectclasses = array("GOhard", "FAIobject");
+    }elseif(isset($this->parent->by_object['servgeneric'])){
+      $this->objectclasses = array("GOhard", "FAIobject");
     }else{
       print "Object Type Configuration : unknown";
       exit();
@@ -818,7 +832,7 @@ class workstartup extends plugin
         $tmp= preg_replace ("/^[^,]+,/", "", $tmp);
 
         $ldap->cat("cn=default,ou=terminals,ou=systems,$tmp".
-            $this->config->current['BASE']);
+            $this->config->current['BASE'], array('gotoTerminalPath'));
         $attrs= $ldap->fetch();
         if (isset($attrs['gotoTerminalPath'])){
           $this->gotoTerminalPath= $attrs['gotoTerminalPath'][0];
@@ -874,15 +888,20 @@ class workstartup extends plugin
     }
     /* Strip out 'default' values */
     if ($this->attrs['gotoLdapServer'] == "default"){
-      unset ($this->attrs['gotoLdapServer']);
+      $this->attrs['gotoLdapServer']= array();
+    }
+
+    if ($this->attrs['gotoBootKernel'] == "%default%" || $this->attrs['gotoBootKernel'] == "default"){
+      $this->attrs['gotoBootKernel']= array();
     }
 
     /* if mirror == none stop saving this attribute */
     if($this->FAIdebianMirror == "none"){
       $this->FAIdebianMirror = "";
     }
-    
-    if((count($this->attrs['FAIclass'])==0)&&(empty($this->FAIdebianMirror))){
+   
+    /* Remove FAI objects if no FAI class is selected */ 
+    if(count($this->FAIclass)==0){
       $tmp = array();
       foreach($this->attrs['objectClass'] as $class){
         if($class != "FAIobject"){
@@ -906,9 +925,9 @@ class workstartup extends plugin
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($this->dn);
     $this->cleanup();
-$ldap->modify ($this->attrs); 
+    $ldap->modify ($this->attrs); 
 
-    show_ldap_error($ldap->get_error());
+    show_ldap_error($ldap->get_error(), _("Saving workstation startup settings failed"));
     $this->handle_post_events("modify");
   }