Code

Fixed workstation starttab.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Nov 2007 14:14:13 +0000 (14:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Nov 2007 14:14:13 +0000 (14:14 +0000)
- We had to reload the FAIstarttab for newly created worktstations/servers to see all classes of "auto/some_release".
- Fixed class detection for selected release.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7943 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationStartup.inc

index d74d760eed4bcc99eee27d9c924e412f235684b3..8e9ed52409f43e3e3902f02a7e6929ea577efa83 100644 (file)
@@ -213,13 +213,14 @@ class workstartup extends plugin
       
               /* Result will be cached
                */
-              $test[$url]['RELEASE'][$release]['PACKAGES'] = $this->getAvailableClassesForThisRelease($release);
+              $rel_classes = $this->getAvailableClassesForThisRelease($release);
+              $test[$url]['RELEASE'][$release]['PACKAGES'] = $rel_classes;
               $test[$url]['SERVER'] = $server;
 
               /* auto gets all releases/classes 
                */
               $test['auto']['RELEASE'][$release]['SECTION'] = $sections;
-              $test['auto']['RELEASE'][$release]['PACKAGES'] = $this->getAvailableClassesForThisRelease($release);
+              $test['auto']['RELEASE'][$release]['PACKAGES'] = $rel_classes;
             }
           }
         }
@@ -405,6 +406,13 @@ class workstartup extends plugin
     if (!isset($this->gotoBootKernels['default-inherited']) && $this->gotoBootKernel == "default-inherited"){
       $this->gotoBootKernel= "default";
     }
+
+    /* Preselect release if none was selected yet */
+    if(empty($this->FAIrelease) && $this->FAIdebianMirror == "auto"){
+      if(isset($this->FAIServRepConfig['auto']['RELEASE']) && is_array($this->FAIServRepConfig['auto']['RELEASE'])){
+        $this->FAIrelease = key($this->FAIServRepConfig['auto']['RELEASE']);
+      }
+    }
   }
 
   
@@ -417,14 +425,13 @@ class workstartup extends plugin
   {
     /* There could be more than one server providing this release,
         so use cached result if available
-     */ 
+     */
     if(isset($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]))  {
       return($_SESSION['getAvailableClassesForThisRelease_CACHE'][$release]);
     }
 
     $test2  = array();
-#    $bb     = $this->generateDNSyn($release).$_SESSION['CurrentMainBase'];
-    $bb     = $this->generateDNSyn($release).$this->config->current['BASE'];
+    $bb     = $this->generateDNSyn($release);
 
     $ldap   = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
@@ -918,15 +925,22 @@ class workstartup extends plugin
     $str = "";
     $tmp = split("\/",$release);
     $tmp = array_reverse($tmp);
-
     $base = "ou=fai,ou=configs,ou=systems,";   
     foreach($tmp as $departmentname){
-      
       $str .= ",ou=".$departmentname;
     }
     $str = preg_replace("/^,/","",($str.",".$base));
-    
-    return($str);
+
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($this->config->current['BASE']);
+    $ldap->search("(&(objectClass=FAIbranch))",array("ou"));
+    while($attrs = $ldap->fetch()){
+      if(preg_match("/".normalizePreg($str)."/",$attrs['dn'])){
+        return($attrs['dn']);
+      }
+    }
+
+    return($str.$this->config->current['BASE']);
   }
 
   function getFAIdebianMirrors()