Code

Upated Workstation Startup
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 10:11:57 +0000 (10:11 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 15 Apr 2008 10:11:57 +0000 (10:11 +0000)
-Fetch available kernel from si server

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

gosa-plugins/goto/admin/systems/goto/class_workstationStartup.inc
gosa-plugins/goto/admin/systems/goto/workstationStartup.tpl

index 4bc7db7968a9a0b50ae83046d43417c35139ad45..ff5eb0c095c138361034aa8ca56969f49f617bfd 100644 (file)
@@ -261,35 +261,35 @@ class workstartup extends plugin
       }
     }
 
       }
     }
 
-    /* Get list of boot kernels */
-    if (isset($this->config->data['TABS'])){
-      $command= $this->config->search(get_class($this), "KERNELS",array('tabs'));
-      if (!check_command($command)){
-        $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
-            get_class($this));
-      } else {
-        $fh= popen($command, "r");
-        while (!feof($fh)) {
-          $buffer= trim(fgets($fh, 256));
-          if(!empty($buffer)){
-            $name=$value = $buffer;
-            if(preg_match("/:/",$buffer)){
-              $name = preg_replace("/:.*$/","",$buffer);
-              $value= preg_replace("/^.*:/","",$buffer);
-              $this->gotoBootKernels[$name]= $name.":".$value;
-            }else{
-              $this->gotoBootKernels[$name]= $value;
-            }
-          }
-        }
-        pclose($fh);
-      }
-    }
-
-    /* Turn to default, if we've nothing to inherit */
-    if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){
-      $this->gotoBootKernel= "default";
-    }
+#   /* Get list of boot kernels */
+#   if (isset($this->config->data['TABS'])){
+#     $command= $this->config->search(get_class($this), "KERNELS",array('tabs'));
+#     if (!check_command($command)){
+#       $message[]= sprintf(_("Command '%s', specified as KERNELS hook for plugin '%s' doesn't seem to exist."), $command,
+#           get_class($this));
+#     } else {
+#       $fh= popen($command, "r");
+#       while (!feof($fh)) {
+#         $buffer= trim(fgets($fh, 256));
+#         if(!empty($buffer)){
+#           $name=$value = $buffer;
+#           if(preg_match("/:/",$buffer)){
+#             $name = preg_replace("/:.*$/","",$buffer);
+#             $value= preg_replace("/^.*:/","",$buffer);
+#             $this->gotoBootKernels[$name]= $name.":".$value;
+#           }else{
+#             $this->gotoBootKernels[$name]= $value;
+#           }
+#         }
+#       }
+#       pclose($fh);
+#     }
+#   }
+#
+#    /* Turn to default, if we've nothing to inherit */
+#    if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){
+#      $this->gotoBootKernel= "default";
+#    }
   }
 
   
   }
 
   
@@ -623,6 +623,16 @@ class workstartup extends plugin
       $smarty->assign("FAIrelease"  , $this->FAIrelease);
       $smarty->assign("FAIclasses"  , $this->selectable_classes());
 
       $smarty->assign("FAIrelease"  , $this->FAIrelease);
       $smarty->assign("FAIclasses"  , $this->selectable_classes());
 
+      /* Get classes for release from cache.
+       * Or build cache
+       */
+      if($this->FAIdebianMirror == "inherited"){
+        $release = $this->InheritedFAIrelease;
+      }else{
+        $release = $this->FAIrelease;
+      }
+
+      $smarty->assign("gotoBootKernels",$this->cache['KERNELS'][$release]);
       $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
 
       $div = new divSelectBox("WSFAIscriptClasses");
       $smarty->assign("InheritedFAIrelease",$this->InheritedFAIrelease);
 
       $div = new divSelectBox("WSFAIscriptClasses");
@@ -1182,7 +1192,23 @@ class workstartup extends plugin
         }
       }
     }
         }
       }
     }
-#    echo sprintf("Took %.6f <br> ",microtime(1) - $start);
+
+    /* Get list of available kernel for this release 
+     */
+    if($force || !isset($this->cache['KERNELS'][$release])){
+      $o_queue = new gosaSupportDaemon();
+      $tmp = $o_queue->FAI_get_kernels($release);
+      $this->cache['KERNELS'][$release] = array();
+
+      foreach($this->gotoBootKernels as $name => $default){
+        $this->cache['KERNELS'][$release][$name] = $default;
+      }
+
+      foreach($tmp as $kernel){
+        if(empty($kernel)) continue;
+        $this->cache['KERNELS'][$release][$kernel]=$kernel;
+      }
+    }
   }
 
 
   }
 
 
index 60fee23be0c93a95fdacc7b5b24b955a0637535e..e50e8a40216f25dc3628afbc49961fb7cfbbb7da 100644 (file)
@@ -10,7 +10,7 @@
 {render acl=$gotoBootKernelACL}
         <select id="gotoBootKernel" name="gotoBootKernel">
          {html_options options=$gotoBootKernels selected=$gotoBootKernel}
 {render acl=$gotoBootKernelACL}
         <select id="gotoBootKernel" name="gotoBootKernel">
          {html_options options=$gotoBootKernels selected=$gotoBootKernel}
-       </select>
+               </select>
 {/render}
       </td>
     </tr>
 {/render}
       </td>
     </tr>