Code

Better gray out handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Oct 2005 04:56:09 +0000 (04:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 7 Oct 2005 04:56:09 +0000 (04:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1517 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index aef188eb915c056fe31950fffd2c5ce386a0a8c7..de42cecfb929b592940532a6697e304d723fe129 100644 (file)
@@ -44,7 +44,7 @@ class faiPackage extends plugin
 
   var $mirrors          = array();  // The combination of server/release/section
   var $confDir          = "";
-  var $usedPackages      = array();
+  var $usedPackages     = array();
 
   function faiPackage ($config, $dn= NULL)
   {
@@ -65,7 +65,7 @@ class faiPackage extends plugin
         $this->usedPackages[$pkg] = $pkg;
       }
     }else{
-      $this->usedPackages = array();;
+      $this->usedPackages = array();
     }  
     $this->confDir = CONFIG_DIR."/fai/";
     $this->FAIpackage = array();
@@ -77,38 +77,55 @@ class faiPackage extends plugin
     $smarty= get_smarty();
     $display= "";
 
+    $disableRelease   = false;
+    $disableMirror    = false;
+    $disableOptions   = false;
+    $disableSection   = false;
+
     /* Assign variables */
     foreach($this->attributes as $attrs){
       $smarty->assign($attrs,$this->$attrs);
     }
 
-    $disableRelease = false;
-    $disableMirror  = false;
-    $disableOptions = false;
-    /* Gray out handling */
-    if(empty($this->FAIdebianSection)){
-      $disableRelease = $disableMirror = $disableOptions = true;
-    }else
+    /* Post handling for Section, Release and Mirror Setup */
+    if(isset($_POST['SetSection'])){
+      $this->FAIdebianSection = $_POST['FAIdebianSectionS'];
+    }
+    if(isset($_POST['SetRelease'])){
+      $this->FAIdebianRelease = $_POST['FAIdebianReleaseS'];
+    }
+    if(isset($_POST['SetMirror'])){
+      $this->FAIdebianMirror = $_POST['FAIdebianMirrorS'];
+    }
+
     if(empty($this->FAIdebianRelease)){
-      $disableMirror = $disableOptions = true;
-    }else
-    if(empty($this->FAIdebianMirror)){
-      $disableOptions = true;
+      $disableSection = $disableMirror  = $disableOptions = true;
+    }elseif(empty($this->FAIdebianSection)){
+      $disableRelease = $disableMirror  = $disableOptions = true;
+    }elseif(empty($this->FAIdebianMirror)){
+      $disableRelease = $disableSection = $disableOptions = true;
+    }else{
+      $disableRelease = $disableSection =  true;
     }
-   
-    $smarty->assign("ReleaseACL", "");
-    $smarty->assign("MirrorACL", "");
+
+    $smarty->assign("ReleaseACL"  , "");
+    $smarty->assign("MirrorACL"   , "");
+    $smarty->assign("OptionACL"   , "");
+    $smarty->assign("SectionACL"  , "");
+
     if($disableOptions){
       $smarty->assign("OptionACL"," disabled ");
-    }else{
-      $smarty->assign("OptionACL", "");
     } 
     if($disableRelease){
       $smarty->assign("ReleaseACL"," disabled ");
     } 
     if($disableMirror){
       $smarty->assign("MirrorACL"," disabled ");
+    }
+    if($disableSection){
+      $smarty->assign("SectionACL"," disabled ");
     } 
+
     $this->genMirror();
 
     $availableServer = array();
@@ -244,6 +261,7 @@ class faiPackage extends plugin
    */
   function save_object()
   {
+    
     plugin::save_object();
     foreach($this->attributes as $attrs){
       if(isset($_POST[$attrs])){
index 78b738f80cf31ec5474f243d792be0dc18a6dab1..4e8884cb267c5aca2c26b50986120f4a46833daf 100644 (file)
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <select name="FAIdebianRelease" title="{t}release{/t}" {$ReleaseACL}>
+                                                       <select name="FAIdebianReleaseS" title="{t}release{/t}" {$ReleaseACL}>
                                                                {html_options options=$releases selected=$release}
                                                        </select>
-                                                       <input type="submit" value="{t}refresh{/t}" name="SetRelease">
+                                                       <input type="submit" value="{t}set{/t}" name="SetRelease" {$ReleaseACL}>
                                                </td>
                                        </tr>
                                        <tr>
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <select name="FAIdebianSection" title="{t}section{/t}" {SsectionACL}>
+                                                       <select name="FAIdebianSectionS" title="{t}section{/t}" {$SectionACL}>
                                                                {html_options options=$sections selected=$section}
                                                        </select>
-                                                       <input type="submit" value="{t}refresh{/t}" name="SetSection">
+                                                       <input type="submit" value="{t}set{/t}" name="SetSection" {$SectionACL}>
                                                </td>
                                        </tr>
                                        <tr>
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <select name="FAIdebianMirror" title="{t}mirror{/t}" {$MirrorACL}>
+                                                       <select name="FAIdebianMirrorS" title="{t}mirror{/t}" {$MirrorACL}>
                                                                {html_options options=$mirrors selected=$mirror}
                                                        </select>
-                                                       <input type="submit" value="{t}refresh{/t}" name="SetMirror">
+                                                       <input type="submit" value="{t}set{/t}" name="SetMirror" {$MirrorACL}>
                                                </td>
                                        </tr>
                                </table>