Code

Better Repository selection, not ready yet...
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Oct 2005 13:09:20 +0000 (13:09 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 6 Oct 2005 13:09:20 +0000 (13:09 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1513 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 2e44d8c33d8d0b8cacccd5e2a356d0dd104eaa0c..aef188eb915c056fe31950fffd2c5ce386a0a8c7 100644 (file)
@@ -42,8 +42,6 @@ class faiPackage extends plugin
   var $releases         = array();  // All possible releases 
   var $sections         = array();  // All section types
 
-  var $disableRepository = false;
-
   var $mirrors          = array();  // The combination of server/release/section
   var $confDir          = "";
   var $usedPackages      = array();
@@ -61,10 +59,6 @@ class faiPackage extends plugin
       $this->dn =$dn;
     }
 
-    if(isset($this->attrs['FAIdebianSection'])){
-      $this->disableRepository=true;
-    }
-
     if(isset($this->attrs['FAIpackage'])){
       unset($this->attrs['FAIpackage']['count']);
       foreach($this->attrs['FAIpackage'] as $pkg){
@@ -88,6 +82,33 @@ class faiPackage extends plugin
       $smarty->assign($attrs,$this->$attrs);
     }
 
+    $disableRelease = false;
+    $disableMirror  = false;
+    $disableOptions = false;
+    /* Gray out handling */
+    if(empty($this->FAIdebianSection)){
+      $disableRelease = $disableMirror = $disableOptions = true;
+    }else
+    if(empty($this->FAIdebianRelease)){
+      $disableMirror = $disableOptions = true;
+    }else
+    if(empty($this->FAIdebianMirror)){
+      $disableOptions = true;
+    }
+   
+    $smarty->assign("ReleaseACL", "");
+    $smarty->assign("MirrorACL", "");
+    if($disableOptions){
+      $smarty->assign("OptionACL"," disabled ");
+    }else{
+      $smarty->assign("OptionACL", "");
+    } 
+    if($disableRelease){
+      $smarty->assign("ReleaseACL"," disabled ");
+    } 
+    if($disableMirror){
+      $smarty->assign("MirrorACL"," disabled ");
+    } 
     $this->genMirror();
 
     $availableServer = array();
@@ -97,6 +118,10 @@ class faiPackage extends plugin
       }
     }
 
+    if($disableMirror){
+      $availableServer[$mir['mirror']]=array("---");
+    }
+
     if(isset($_POST['Addpkg'])){
       $this->dialog = new faiPackageEntry($this->config, $this->dn,$this->confDir.$this->FAIdebianMirror."/".$this->FAIdebianRelease."/".$this->FAIdebianSection,$this->usedPackages);
       $this->is_dialog =true;
@@ -122,7 +147,6 @@ class faiPackage extends plugin
         $this->usedPackages = $use;
         $this->dialog = false;
         $this->is_dialog=false;
-        $this->disableRepository =true;
       }
     }
  
@@ -130,15 +154,6 @@ class faiPackage extends plugin
       return $this->dialog->execute();
     }
 
-    if($this->disableRepository == true){
-      $smarty->assign("mirrorACL"  ," disabled ");
-      $smarty->assign("releaseACL" ," disabled ");
-      $smarty->assign("sectionACL" ," disabled ");
-    }else{
-      $smarty->assign("mirrorACL"  ,"");
-      $smarty->assign("releaseACL" ,"");
-      $smarty->assign("sectionACL" ,"");
-    }
     $smarty->assign("mirrors" ,$availableServer);
     $smarty->assign("mirror"  ,$this->FAIdebianMirror);
     $smarty->assign("releases",$this->releases);
@@ -159,6 +174,10 @@ class faiPackage extends plugin
       /* Try to catch all available mirrors 
          Possibly check if each server is reachable
        */
+
+      $this->servers= array();
+      $this->releases=array();  
+      $this->sections=array(); 
       $this->mirrors= array();
       $fd = opendir($confDir);
       while($mirror = readdir($fd)){
@@ -180,11 +199,11 @@ class faiPackage extends plugin
                   $this->releases[$release]=$release;
                   $this->sections[$section]=$section;
 
-                  if(empty($this->FAIdebianMirror)){
-                    $this->FAIdebianMirror= $mirror;
-                  }
                   if(empty($this->FAIdebianRelease)){
-                    $this->FAIdebianRelease = $release;
+                    $this->servers= array("---");
+                  }
+                  if(empty($this->FAIdebianSection)){
+                    $this->releases= array("---");
                   }
                   if(empty($this->FAIdebianSection)){
                     $this->FAIdebianSection = $section;
index 6ad8acb450df5d45033cabe36698ac1182b09591..074601a2810cfb0ce8279f65f17688912ae41714 100644 (file)
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <select name="FAIdebianSection" title="{t}section{/t}" {$sectionACL}>
+                                                       <select name="FAIdebianSection" title="{t}section{/t}" {SsectionACL}>
                                                                {html_options options=$sections selected=$section}
                                                        </select>
-                                                       <input type="submit" value="{t}refresh{/t}" name="refresh2">
+                                                       <input type="submit" value="{t}refresh{/t}" name="SetSection">
                                                </td>
                                        </tr>
                                        <tr>
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <select name="FAIdebianRelease" title="{t}release{/t}" {$releaseACL}>
+                                                       <select name="FAIdebianRelease" title="{t}release{/t}" {$ReleaseACL}>
                                                                {html_options options=$releases selected=$release}
                                                        </select>
-                                                       <input type="submit" value="{t}refresh{/t}" name="refresh1">
+                                                       <input type="submit" value="{t}refresh{/t}" name="SetRelease">
                                                </td>
                                        </tr>
                                        <tr>
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <select name="FAIdebianMirror" title="{t}mirror{/t}" {$mirrorACL}>
+                                                       <select name="FAIdebianMirror" title="{t}mirror{/t}" {$MirrorACL}>
                                                                {html_options options=$mirrors selected=$mirror}
                                                        </select>
-                                                       <input type="submit" value="{t}refresh{/t}" name="refresh3">
+                                                       <input type="submit" value="{t}refresh{/t}" name="SetMirror">
                                                </td>
                                        </tr>
                                </table>
@@ -80,9 +80,9 @@
                                {html_options options=$usedPackages}
                </select>
                        <br>
-                       <input type="submit" name="Addpkg" value="+">
-                       <input type="submit" name="Delpkg" value="-">
-                       <input type="submit" name="Conpkg" value="Configure">
+                       <input type="submit" name="Addpkg" value="+" {$OptionACL}>
+                       <input type="submit" name="Delpkg" value="-" {$OptionACL}>
+                       <input type="submit" name="Conpkg" value="Configure" {$OptionACL}>
                </td>
        </tr>
 </table>