Code

Updated FAI packages.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 25 Mar 2008 10:54:19 +0000 (10:54 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 25 Mar 2008 10:54:19 +0000 (10:54 +0000)
-Partly implemented GOsa-si FAI packages support

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9966 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiPackage.inc
gosa-plugins/fai/admin/fai/class_faiPackageConfiguration.inc

index dba5a7a20e228f951823408d48ca3481f19a2046..79cd57a0b87ca3d8a235fe422bf1bfa469758aba 100644 (file)
@@ -421,39 +421,53 @@ class faiPackage extends plugin
 
   function genPkgs()
   {
-    /* Generate a list off available packages for this mirror, section and release
-     */
-    /* Only read this file if it wasn't read before */
-    if($this->buffer === NULL){
-      $this->buffer=array();
-      $a_ret = array();
-      foreach($this->FAIdebianSection as $sec){
-        $strID= CONFIG_DIR."/fai/".$this->FAIdebianRelease."/".$sec;
-
-        if(!is_file($strID)){
-          msg_dialog::display(_("Error"), sprintf(_("Package file '%s' does not exist!"), $strID), ERROR_DIALOG);
-          unset($this->buffer);
-          return(array());
-        }
-        $fp = fopen($strID,"r");
-
-        /* Parse every line and create an array */
-        while(!feof($fp)){
-          $str= fgets($fp,512);
-          $stra= split("\|",$str);
-          if(count($stra)==4){
-            $a_ret[$stra[0]] = $stra;
-          }
-        }
-        fclose($fp);
-        /* Save our Data, to avoid reading it again */
+    if($this->buffer === NULL || !count($this->buffer)){
+      $this->buffer = array();
+      $q = new gosaSupportDaemon();
+      $ret = $q->FAI_get_packages($this->FAIdebianRelease);
+      foreach($ret as $attr){
+        $this->buffer[$attr['PACKAGE']] = array($attr['PACKAGE'],$attr['VERSION'],$attr['SECTION'],$attr['DESCRIPTION']);
       }
-      $this->buffer = $a_ret;
-      ksort($a_ret);
-      return($a_ret);
-    }else{
-      return $this->buffer;
     }
+    return $this->buffer;
+#   /* Generate a list off available packages for this mirror, section and release
+#    */
+#   /* Only read this file if it wasn't read before */
+#   $this->buffer = NULL;
+#   if($this->buffer === NULL){
+#     $this->buffer=array();
+#     $a_ret = array();
+#     foreach($this->FAIdebianSection as $sec){
+#       $strID= CONFIG_DIR."/fai/".$this->FAIdebianRelease."/".$sec;
+#
+#       if(!is_file($strID)){
+#         msg_dialog::display(_("Error"), sprintf(_("Package file '%s' does not exist!"), $strID), ERROR_DIALOG);
+#         unset($this->buffer);
+#         return(array());
+#       }
+#       $fp = fopen($strID,"r");
+#
+#       /* Parse every line and create an array */
+#       while(!feof($fp)){
+#         $str= fgets($fp,512);
+#         $stra= split("\|",$str);
+#         if(count($stra)==4){
+#           $a_ret[$stra[0]] = $stra;
+#         break;
+#         }
+#       }
+#       fclose($fp);
+#       /* Save our Data, to avoid reading it again */
+#     }
+#     $this->buffer = $a_ret;
+#     ksort($a_ret);
+#     print_a($this->buffer);
+#     return($a_ret);
+#   }else{
+#     print_a($this->buffer);
+#     return $this->buffer;
+#   }
   }
 
 
index 0a371a8e86fb7ab452e56b676faff004cb829d9d..f132c3b04ccc9df760c9ff3bcd0966eb0769e049 100644 (file)
@@ -15,18 +15,18 @@ class faiPackageConfiguration extends plugin
   {
     plugin::plugin ($config, $dn);
     $this->obj = $obj;
-    $this->Debconf_handle = new debconf();
-    $this->Debconf_handle->set_template_directory($path);
-    $this->Debconf_handle->set_package($this->obj);
-    $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
-
-    if( $this->Debconf_handle->load() ) {
-      $this->pkg_config = $pkg_config;
-
-      foreach($this->pkg_config as $var){
-        $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
-      }
-    }
+#   $this->Debconf_handle = new debconf();
+#   $this->Debconf_handle->set_template_directory($path);
+#   $this->Debconf_handle->set_package($this->obj);
+#   $this->Debconf_handle->set_language(preg_replace('/_.*$/', '', get_browser_language()));
+#
+#   if( $this->Debconf_handle->load() ) {
+#     $this->pkg_config = $pkg_config;
+#
+#     foreach($this->pkg_config as $var){
+#       $this->Debconf_handle->SetDefault($var['Name'],$var['Value']);
+#     }
+#   }
   }
 
   function execute()
@@ -34,6 +34,8 @@ class faiPackageConfiguration extends plugin
     /* Call parent execute */
     plugin::execute();
 
+    return("Not implemented yet<input type='submit' name='CancelObjectConfig' value='back'>");
+
     /* Fill templating stuff */
     $smarty     = get_smarty();
     $display = "";