Code

Added toggling of remove flag for packages
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 May 2006 12:27:10 +0000 (12:27 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 31 May 2006 12:27:10 +0000 (12:27 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3585 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiPackage.inc
plugins/admin/fai/faiPackage.tpl

index 2a9e4043a31c4864af744d2bfc3aaf607f806d74..fb845ee416083f500297a89c8b306a45df252301 100644 (file)
@@ -273,6 +273,22 @@ class faiPackage extends plugin
       $this->is_dialog =true;
     }
 
+    /* Configuration dialog open*/
+    if((isset($_POST['Markpkg']))&&(isset($_POST['usedPackages']))&&(!empty($_POST['usedPackages']))){
+      foreach($_POST['usedPackages'] as $pkg){
+        if (isset($this->usedPackages[$pkg])){
+          unset($this->usedPackages[$pkg]);
+          if (preg_match('/^-/', $pkg)){
+            $pkg= preg_replace('/^-/', '', $pkg);
+          } else {
+            $pkg= preg_replace('/^/', '-', $pkg);
+          }
+          $this->usedPackages[$pkg]= $pkg;
+        }
+      }
+      print_a($this->usedPackages);
+    }
+
     /* Save Configuration */
     if(isset($_POST['SaveObjectConfig'])){
       if($this->FAIstate != "freeze"){
@@ -378,10 +394,17 @@ class faiPackage extends plugin
           $c_str = " - "._("package is configured");
         }
 
+        /* Adapt used name if we're marked for removal */
+        $dsc= "";
+        if (preg_match('/^-/', $usedName)){
+          $dsc= " - "._("Package marked for removal");
+          $usedName= preg_replace('/^-/', '! ', $usedName);
+        }
+
         if(isset($this->list[$usedName][1])){
-          $a_ret[$usedName] = $usedName." [".$this->list[$usedName][1]."]".$c_str;
+          $a_ret[$usedName] = $usedName." [".$this->list[$usedName][1]."]".$c_str.$dsc;
         }else{
-          $a_ret[$usedName] = $usedName.$c_str;
+          $a_ret[$usedName] = $usedName.$c_str.$dsc;
         }
       }
     }
index d88ff6443699bd7883b1db979d8ef7b89ac94eee..40c13313449725ec40d48aefcee36734627af23b 100644 (file)
@@ -71,6 +71,7 @@
                        <input type="submit" name="Addpkg" value="{t}Add{/t}" {$OptionsACL} {$cnACL}>
                        <input type="submit" name="Delpkg" value="{t}Remove{/t}"  {$OptionsACL} {$cnACL}>
                        <input type="submit" name="Conpkg" value="{t}Configure{/t}"  {$OptionsACL} >
+                       <input type="submit" name="Markpkg" value="{t}Toggle remove flag{/t}"  {$OptionsACL} >
                </td>
        </tr>
 </table>