Code

Updated FAI class selection in startup tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Oct 2007 09:28:44 +0000 (09:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 17 Oct 2007 09:28:44 +0000 (09:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7581 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/workstationStartup.tpl

index ff071fe40366089aff3dd6a0d416d9b50bdb3c66..78a3d73f800f8e9c1ff4cb46ba5beda35a9c6bd9 100644 (file)
@@ -450,8 +450,15 @@ class workstartup extends plugin
         else select the first one ..
      */
     $tmp2 = $this->getFAIreleases();
-    if(!in_array($this->FAIrelease, $tmp2)){  
-      $this->FAIrelease = key($tmp2);
+    if(!isset($tmp2[$this->FAIrelease]) || !$tmp2[$this->FAIrelease]['USE']){
+      foreach($tmp2 as $key => $data){
+        if($data['USE']){
+          $this->FAIrelease = $key;
+        }
+      }
+    }
+    if(!in_array($this->FAIrelease, $tmp2)){
+#  $this->FAIrelease = key($tmp2);
     }
 
     /* Get all Packages for this server/release combination
@@ -911,10 +918,12 @@ class workstartup extends plugin
     /* Only add inherit option, if we are part in an object group 
      */
     if($this->member_of_ogroup)    {
-      $ret['inherited']="["._("inherited")."]";
+      $ret['inherited']['NAME']="["._("inherited")."]";
+      $ret['inherited']['USE'] = TRUE;
     }
 
-    $ret['auto']=_("automatic");
+    $ret['auto']['NAME']=_("automatic");
+    $ret['auto']['use'] = TRUE;
     $secs  = array();
 
     /* Walk through all available servers 
@@ -922,16 +931,14 @@ class workstartup extends plugin
         if not, dont't add them to our list
      */
     foreach($this->FAIServRepConfig as $mirror => $rest){
-
       $use = false;
-
       if(count($this->FAIclass) == 0){
         $use = true;
       }else{
         $tmp = $this->getFAIreleases();
-        foreach($tmp as $release){
+        foreach($tmp as $release => $data){
           if(isset($rest['RELEASE'][$release])){
-            $use =true;
+            $use = $data['USE']; 
           }
         } 
       }
@@ -939,9 +946,8 @@ class workstartup extends plugin
       /* If current server, doesn't support this class
           remove it from list
        */
-      if($use){
-        $ret[$mirror] = $mirror;
-      }
+      $ret[$mirror]['NAME'] = $mirror;
+      $ret[$mirror]['USE'] = $use;
     }
     return($ret);
   }
@@ -958,29 +964,36 @@ class workstartup extends plugin
 
     $errorClasses = array();  
 
-    if(is_array($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'])){
-    foreach($this->FAIServRepConfig[$this->FAIdebianMirror]['RELEASE'] as $release => $sections){
-      $use = true;
-      
-      if(!count($this->FAIclass) == 0){
-        foreach($this->FAIclass as $class){
-          if(!in_array($class, $sections['PACKAGES'])){
+    foreach($this->FAIServRepConfig as $mirror => $rest){
+      if(isset($this->FAIServRepConfig[$mirror]['RELEASE'])){
+        foreach($this->FAIServRepConfig[$mirror]['RELEASE'] as $release => $sections){
+          $use = true;
+
+          if(!count($this->FAIclass) == 0){
+            foreach($this->FAIclass as $class){
+              if(!in_array($class, $sections['PACKAGES'])){
+                $use = false;
+                $errorClasses[$class] = $class;
+              }else{
+                if(isset($errorClasses[$class])){
+                  unset($errorClasses[$class]);
+                }
+              }
+            }
+          }
+
+          if($mirror != $this->FAIdebianMirror){
             $use = false;
-            $errorClasses[$class] = $class;
           }else{
-            if(isset($errorClasses[$class])){
-              unset($errorClasses[$class]); 
-            }
+            $use = true;
           }
+          $ret[$release]['NAME']=$release;
+          $ret[$release]['USE']=$use;
         }
       }
-      if($use){
-        $ret[$release]=$release;
-      }
-    } 
     }
-    if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){
 
+    if((count($ret) == 0 ) && ($this->FAIdebianMirror != "auto")){
       $eClasses = " ";
       foreach($errorClasses as $class){
         $eClasses .= $class." ";
index 5fa898f78ba843683e05da02d36541c34c54ef84..ca5739033616a12837bf93c71da613069ed40938 100644 (file)
                                <tr>
                                        <td>
        {render acl=$FAIdebianMirrorACL}
-                                               <select name="FAIdebianMirror" onchange='document.mainform.submit()'>
-                                                       {html_options options=$FAIdebianMirrors output=$FAIdebianMirrors selected=$FAIdebianMirror}
+                                               <select name="FAIdebianMirror" {$FAIdebianMirrorACL} onchange='document.mainform.submit()'>
+                                                       {foreach from=$FAIdebianMirrors item=val key=key}
+                                                               {if $val.USE}
+                                                                       <option value="{$key}" {if $FAIdebianMirror == $key} selected {/if}>{$val.NAME}</option>
+                                                               {else}
+                                                                       <option value="auto" disabled>{$val.NAME}</option>
+                                                               {/if}
+                                                       {/foreach}
+                                                       <option disabled>&nbsp;</option>
                                                </select>
        {/render}
        {if $javascript eq 'false'}
                                        </td>
                                        <td>
        {render acl=$FAIreleaseACL}
-                                               <select name="FAIrelease"  onchange='document.mainform.submit()'>
-                                               {html_options options=$FAIreleases output=$FAIreleases selected=$FAIrelease}
+                                               <select name="FAIrelease"  onchange='document.mainform.submit()' {$FAIclassACL}>
+                                                       {foreach from=$FAIreleases item=val key=key}
+                                                               {if $val.USE}
+                                                                       <option value="{$val.NAME}" {if $FAIrelease == $key} selected {/if}>{$val.NAME}</option>
+                                                               {else}
+                                                                       <option value="auto" disabled>{$val.NAME}</option>
+                                                               {/if}
+                                                       {/foreach}
                                                </select>
        {/render}
                                        </td>