Code

Added acls to mimetype
[gosa.git] / plugins / admin / fai / class_faiPackageNew.inc
index b90107a990fe52a31aa8f42feccd4e634a0b426a..0791fe11d9fefc4f4c7bfc0810954a6c42f5d241 100644 (file)
@@ -32,6 +32,8 @@ class faiPackageNew extends plugin
     $display = "";
     $smarty = get_smarty(); 
     $atr = $this->getServerInfos(); 
+
+    $releases= array();
     foreach($atr as $release => $sections){
       $releases[$release]=$release;
     }
@@ -49,7 +51,6 @@ class faiPackageNew extends plugin
     }
 
     $smarty->assign("releases"    ,$releases);
-    $smarty->assign("releaseKeys" ,array_flip($releases));
     $smarty->assign("release" ,$this->FAIdebianRelease);
     $smarty->assign("sections",$this->generateSections($sections));
 
@@ -61,13 +62,15 @@ class faiPackageNew extends plugin
   {
     $str = "";
     if(is_array($secs)){
-      $rel  = " onClick='document.mainform.submit();' ";
+      sort($secs);
+      $secs= array_unique($secs);
       foreach($secs as $section){
         if(in_array($section,$this->FAIdebianSection)){
-          $str .= "<input ".$rel." type='checkbox' value='".$section."' name='section_".$section."' checked>".$section."<br>";
+          $str .= "<input type='checkbox' value='".$section."' name='section_".$section."' checked>".$section."<br>";
         }else{
-          $str .= "<input ".$rel." type='checkbox' value='".$section."' name='section_".$section."'>".$section."<br>";
+          $str .= "<input type='checkbox' value='".$section."' name='section_".$section."'>".$section."<br>";
         }
+        $str .="<input type='hidden' name='wasOnPage_".$section."'>";
       }
     }
     return($str); 
@@ -102,17 +105,25 @@ class faiPackageNew extends plugin
   function save_object()
   {
     /* Post handling for Section, Release  Setup */
-    if((isset($_POST['FAIdebianReleaseS']))&&(!empty($_POST['FAIdebianReleaseS']))){
-      $this->FAIdebianRelease = $_POST['FAIdebianReleaseS'];
-    }
+    if(isset($_POST['YesItIsPostedPackages'])){
 
-    /* Get Sections */
-    foreach($_POST as $name => $value){
-      if(preg_match("/^section_/",$name)){
-        $this->FAIdebianSection[$value] = $value;
+      if((isset($_POST['FAIdebianReleaseS']))&&(!empty($_POST['FAIdebianReleaseS']))){
+        $this->FAIdebianRelease = $_POST['FAIdebianReleaseS'];
+      }
+        
+      foreach($_POST as $name => $value){
+        if(preg_match("/wasOnPage_/",$name)){
+          $nm = preg_replace("/wasOnPage_/","",$name);
+          if(isset($_POST['section_'.$nm])){
+            $this->FAIdebianSection[$nm] = $nm; 
+          }else{
+            if(isset($this->FAIdebianSection[$nm])){
+              unset($this->FAIdebianSection[$nm]);
+            }
+          }
+        }
       }
     }
-
     /* Remove all section that are not available at the currently selected server */ 
     $atr = $this->getServerInfos();
     foreach($this->FAIdebianSection as $section){
@@ -126,7 +137,9 @@ class faiPackageNew extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+
     return ($message);
   }