Code

Updated opsi generic to use new get_full_product method
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Dec 2009 12:12:06 +0000 (12:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Dec 2009 12:12:06 +0000 (12:12 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14958 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsi/class_opsi.inc
gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc

index 6fee101d78b684bf228ca0f1666c7823962f7eea..c963a783876bf4116d1556803d54d34e49428702 100644 (file)
@@ -297,8 +297,7 @@ class opsi extends gosaSupportDaemon
 
     $res    = $this->send_data("gosa_opsi_get_full_product_host_information",$this->target,$data,TRUE);
     $items = array();
-
-    $attrs = array("PRIORITY","ONCESCRIPT","LICENSEREQUIRED","PACKAGEVERSION","PRODUCTVERSION",
+    $attrs = array("TYPE","PRIORITY","ONCESCRIPT","LICENSEREQUIRED","PACKAGEVERSION","PRODUCTVERSION",
         "ADVICE","SETUPSCRIPT","WINDOWSSOFTWAREIDS","PXECONFIGTEMPLATE","NAME","CREATIONTIMESTAMP", "TYPE",
         "ALWAYSSCRIPT","PRODUCTID","DESCRIPTION","UNINSTALLSCRIPT","UPDATESCRIPT","PRODUCTCLASSNAMES");
 
index 174764002265534486dfa0ac93666073ddc28b15..a22ad30ee90a0852646608b9bad3867c8db9075a 100644 (file)
@@ -129,73 +129,34 @@ class opsiGeneric extends plugin
     if(!empty($this->hostId)){
       $list = $this->opsi->get_full_product_host_information($this->hostId);
     }
-    
+    $err |= $this->opsi->is_error();
 
     /* Read informations about available netboot products. 
-        If not already done, before.
+       If not already done, before.
      */
-    if(!$err && !count($this->a_availableNetbootProducts)){
-      $this->a_availableNetbootProducts = $this->opsi->get_netboot_products();
-      ksort($this->a_availableNetbootProducts);
-      $err |= $this->opsi->is_error();
-    }
+    if(!$err){
+      foreach($list as $key => $entry){
 
-    /* Read informations about available netboot products. 
-        If not already done, before.
-     */
-    foreach($list as $key => $entry){
-      if(!$entry['installed']){
-        $this->a_availableLocalProducts[$key] = array('DESC'=>$entry['data']['DESCRIPTION'],'NAME'=>$key);
-      }else{
-        $this->a_selectedLocalProducts[$key] = array('DESC'=>$entry['data']['DESCRIPTION'],'NAME'=>$key);
+        $tmp = array('DESC'=>$entry['data']['DESCRIPTION'],'NAME'=>$key);
         if($entry['configurable']){
-          $this->a_selectedLocalProducts[$key]['CFG'] = $entry['data']['PROPERTIES'];
-        }
-      }
-    }
-#   if(!$err && !count($this->a_availableLocalProducts)) {
-#     $this->a_availableLocalProducts   = $this->opsi->get_local_products();
-#     ksort($this->a_availableLocalProducts);
-#     $err |= $this->opsi->is_error();
-#   }
-
-    /* Get products selected by this host.
-     */
-    if(!$err && !empty($this->hostId)) {
-      $tmp = array_keys($this->opsi->get_netboot_products($this->hostId));
-      $err |= $this->opsi->is_error();
-      if(count($tmp) && !$err && !isset($this->a_availableNetbootProducts[$this->s_selectedNetbootProduct]['CFG'])){
-        $this->s_selectedNetbootProduct = $tmp[0];
-      
-        /* Read configuration for "Netboot Products" */
-        if(isset($this->a_availableNetbootProducts[$this->s_selectedNetbootProduct])){
-          $CFG = $this->opsi->get_product_properties($this->s_selectedNetbootProduct,$this->hostId);
-          $this->a_availableNetbootProducts[$this->s_selectedNetbootProduct]['CFG'] = $CFG;
+          $tmp['CFG'] = $entry['data']['PROPERTIES'];
+        } 
+
+        if($entry['data']['TYPE'] == "localboot"){
+          if(!$entry['installed']){
+            $this->a_availableLocalProducts[$key] = $tmp;
+          }else{
+            $this->a_selectedLocalProducts[$key] = $tmp;
+          }
+        }else{
+          $this->a_availableNetbootProducts[$key] = $tmp;
+          if($entry['installed']){
+            $this->s_selectedNetbootProduct= $key;
+          }
         }
       }
-      $err |= $this->opsi->is_error();
     }
 
-#   /* Get all selected local products 
-#    */
-#   if(!$err && !empty($this->hostId) && !count($this->a_selectedLocalProducts)) {
-#     $tmp = $this->opsi->get_local_products($this->hostId); 
-#     $err |= $this->opsi->is_error();
-#     $this->a_selectedLocalProducts = $tmp;
-#   }
-#
-#   /* Load product configuration for all already selected products.
-#    */
-#   if(!$err && !empty($this->hostId)) {
-#     foreach($this->a_selectedLocalProducts as $name => $data){
-#       if(!$err && !isset($this->a_selectedLocalProducts[$name]['CFG'])){
-#         $CFG = $this->opsi->get_product_properties($name,$this->hostId);
-#         $err |= $this->opsi->is_error();
-#         $this->a_selectedLocalProducts[$name]['CFG'] = $CFG;
-#       }
-#     }
-#   }
-
     /* Check if everything went fine else reset everything and display a retry button 
      */
     if($err){