Code

Updated package selection
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 28 Jan 2010 13:14:30 +0000 (13:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 28 Jan 2010 13:14:30 +0000 (13:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15418 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 86830bfc9b8e04f1ce9dafde8c3c6014fe64a490..f96c889d6fe22b9c6f851e909bb3a98d9afc1920 100644 (file)
@@ -276,23 +276,41 @@ class faiPackage extends plugin
     // Open the packageSelect dialog to allow adding packages out of a list.
     if(isset($_POST['Addpkg']) && $this->acl_is_writeable("FAIpackage") && !preg_match("/freeze/",$this->FAIstate)){
       $this->packageSelect = new packageSelect($this->config, get_userinfo());
-      $this->is_dialog =true;
+      $this->dialog =true;
     }
 
     // Close packageSelect dialog.
     if(isset($_POST['packageSelect_cancel'])){
       $this->packageSelect = FALSE;
-      $this->is_dialog =FALSE;
+      $this->dialog =FALSE;
     }
 
     // Close packageSelect dialog and add the selected packages.
-    if(isset($_POST['packageSelect_save'])){
+    if(isset($_POST['packageSelect_save']) && $this->packageSelect instanceOf packageSelect){
+      if(!preg_match("/freeze/i", $this->FAIstate)){
+        $use = $this->packageSelect->save();
+
+        foreach($use as $pkg){
+          $item = array();
+          for($i =0; $i < $pkg['count']; $i++){
+            $item[$pkg[$i]] = $pkg[$pkg[$i]][0];
+          }
+          $this->usedPackages[$item['PACKAGE']] = $item['PACKAGE']; 
+        }
+
+        ksort($this->usedPackages);
+
+        /* Generate package list */
+        $this->list= $this->genPkgs(TRUE);
+      }
       $this->packageSelect = FALSE;
-      $this->is_dialog =FALSE;
+      $this->dialog =FALSE;
     }
 
     // Display package add dialog 
     if($this->packageSelect instanceOf packageSelect){
+
+      session::set('filterBlacklist', array('PACKAGE' => $this->usedPackages));
       return $this->packageSelect->execute();
     }
 
@@ -356,30 +374,6 @@ class faiPackage extends plugin
       $this->is_dialog=false;
     }
 
-    /* attach new packages */
-    if(isset($_POST['SaveSubObject'])) {
-      if(!preg_match("/freeze/i", $this->FAIstate)){
-        $this->dialog->save_object();
-        if(count($this->dialog->check())){
-          foreach($this->dialog->check() as $msgs){
-            msg_dialog::display(_("Error"), $msgs, ERROR_DIALOG);
-          }
-        }else{
-          $use = $this->dialog->save();
-          $this->usedPackages = $use;
-          $this->dialog = false;
-          $this->is_dialog=false;
-          ksort($this->usedPackages);
-
-          /* Generate package list */
-          $this->list= $this->genPkgs(TRUE);
-        }
-      }else{
-        $this->dialog = false;
-        $this->is_dialog=false;
-      }
-    }
-
     /* Save Configuration */
     if(isset($_POST['SaveObjectConfig'])){
       if(!preg_match("/^freeze/", $this->FAIstate)){