Code

Allow opsi host creation.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Aug 2008 11:12:09 +0000 (11:12 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 21 Aug 2008 11:12:09 +0000 (11:12 +0000)
-Fixed several index problems.

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

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

index 4c055b6cb7e7c69d4e45c100329ce70548954275..e764de2409dfceb279f37471eaaa8a0f3670a9a2 100644 (file)
@@ -133,7 +133,7 @@ class opsi extends gosaSupportDaemon
 
     $res    = $this->send_data("gosa_opsi_get_local_products",$this->target,$data,TRUE);
     $items  = array();
-    if($res['XML']['ITEM']['PRODUCTID']){
+    if(isset($res['XML']['ITEM']['PRODUCTID'])){
       if(!is_array($res['XML']['ITEM']['PRODUCTID'])){
         $items[$res['XML']['ITEM']['PRODUCTID']]['NAME'] = $res['XML']['ITEM']['PRODUCTID'];
         $items[$res['XML']['ITEM']['PRODUCTID']]['DESC'] = $res['XML']['ITEM']['DESCRIPTION'];
index 0b23871615c1fd2bd5cbe61cd97fd2f4a4037a01..a36c388469a19ff046f58a5d547a8866f7356698 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-class opsi_generic extends plugin
+class opsigeneric extends plugin
 {
   private $opsi;
   private $hostId;  
@@ -26,7 +26,9 @@ class opsi_generic extends plugin
     $this->initially_was_account = TRUE;
   
     /* Get hostId */
-    $this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId);
+    if($hostId != "new"){
+      $this->hostId = preg_replace("/^opsi:=([^,]*),.*$/","\\1",$hostId);
+    }
   
     /* Try to plugin */
     $this->init();
@@ -48,19 +50,19 @@ class opsi_generic extends plugin
     }
 
     /* Get selected products */
-    if(!$err) {
+    if(!$err && !empty($this->hostId)) {
       $tmp = array_keys($this->opsi->get_netboot_products($this->hostId));
       $this->s_selectedNetbootProduct = $tmp[0];
       $err |= $this->opsi->is_error();
     }
-    if(!$err) {
+    if(!$err && !empty($this->hostId)) {
       $tmp = $this->opsi->get_local_products($this->hostId);  
       $err |= $this->opsi->is_error();
       $this->a_selectedLocalProducts = $tmp;
     }
 
     /* Load product configuration */
-    if(!$err) {
+    if(!$err && !empty($this->hostId)) {
       foreach($this->a_selectedLocalProducts as $name => $data){
         $CFG = $this->opsi->get_product_properties($name,$this->hostId);
         $err |= $this->opsi->is_error();
@@ -205,7 +207,7 @@ class opsi_generic extends plugin
       $this->dialog = NULL;
     }
 
-    if(isset($_POST['opsi_generic'])){
+    if(isset($_POST['opsigeneric'])){
 
       if(isset($_POST['opsi_netboot_product'])){
         $SNP = trim($_POST['opsi_netboot_product']);