Code

Updated faiSummary to be w3c conform
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiSummaryTab.inc
index 99e6043783299f6b674cfae43fc8813ef36fb672..9e6d68651fab9be3bf2e1020c5ffe696252f2b5b 100644 (file)
@@ -62,21 +62,27 @@ class faiSummaryTab extends plugin{
     /* Get classes & release name 
        There are 2 different tabs which use the summary tab
        faiProfile / Workstations */
-    
+   
     /* Check if given parent object is fai profile tabs */
     if(isset($this->parent->by_name['faiProfile'])){
       
       /* Get Classes and release */
       $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses;
       $this->base    = $this->parent->by_object['faiProfile']->parent->parent->fai_release;
-      $str = preg_replace("/^.*".normalizePreg(get_ou('faiProfileRDN'))."/","",$this->dn);
+      $str = preg_replace("/^.*".preg_quote(get_ou('faiProfileRDN'), '/')."/i","",$this->dn);
       $tmp  = $this->parent->by_object['faiProfile']->parent->parent->getBranches();
       $this->Release = $tmp[$this->base];
   
     /* Check if parent tab is work tab */
     }elseif(isset($this->parent->by_name['workstartup'])){
-      $this->Classes = $this->parent->by_object['workstartup']->FAIclass;
-      $this->Release = $this->parent->by_object['workstartup']->FAIrelease;
+
+      if($this->parent->by_object['workstartup']->FAIdebianMirror == "inherited"){
+        $this->Classes = $this->parent->by_object['workstartup']->InheritedFAIclass;
+        $this->Release = $this->parent->by_object['workstartup']->InheritedFAIrelease;
+      }else{
+        $this->Classes = $this->parent->by_object['workstartup']->FAIclass;
+        $this->Release = $this->parent->by_object['workstartup']->FAIrelease;
+      }
 
       /* Check if this is a workstation or an object group */
       if(isset($this->parent->by_object['workgeneric'])){
@@ -95,6 +101,9 @@ class faiSummaryTab extends plugin{
       }
     }
 
+    // All FAI stuff is located on the ldap base, isn't it?
+    $this->base = $this->config->current['BASE'];
+
     $tmp = array_flip($this->getBranches());
 
     $this->Classes[] = "LAST";
@@ -109,6 +118,7 @@ class faiSummaryTab extends plugin{
     $this->Releases = $tmp;
     $this->usedClasses = array();
 
+
     /* Check the configuration */
     if(count($this->Classes) && (!empty($this->Release))){
       foreach($this->Classes as $class){
@@ -151,9 +161,9 @@ class faiSummaryTab extends plugin{
         $value = preg_replace("/_.*$/","",$value); 
         unset($this->Result[$value]['Open']);
       }
-      if(preg_match("/^reloadList/",$name)){
-        $this->InitCalled = false;
-      }
+    }
+    if(isset($_POST['reloadList'])){
+      $this->InitCalled = false;
     }
   }
 
@@ -171,11 +181,12 @@ class faiSummaryTab extends plugin{
   /* This function calls all nescessary functions to generate the fai class summary tree */
   function execute() 
   {
+    plugin::execute();
 
     /* Skip this if fai is deactivated */
     $tmp = $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
     if(empty($tmp)){
-      $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
+      $str = "<h3>"._("You can't use this plugin until FAI is activated.")."</h3>";
       return $str;
     }    
 
@@ -214,32 +225,27 @@ class faiSummaryTab extends plugin{
   function createSummary($data)
   {
     /* Don't generate any output, if there is no result */ 
-    $str ="<table cellspacing=0 cellpadding=2 style='width:100%;background:#F5F5F5;'> ";
     if(!count($this->Result)){
-      $str.="<tr><td>"; 
-      $str.= (_("This object has no FAI classes assigned."));
-      $str.= "</tr></td></table>";
-      return($str);
+      return("<h3>"._("This object has no FAI classes assigned.")."</h3>");
     }
 
+    $str ="<table style='width:100%;' summary='"._("FAI summary")."'> ";
     /* walk through all classes */     
     foreach($data as $key => $entry){
       
-      $image = "<img src='".$this->objs[$key]['Image']."' class='center' alt='".$this->objs[$key]['Name']."' border=0>";
+      $image = image($this->objs[$key]['Image']);
       if(!isset($entry['Open'])){
         $str .= "<tr>
-                  <td colspan=2>
-                   <a href='?plug=".$_GET['plug']."&amp;expand&amp;id=".$key."'>
-                    <img border=0 class='center' src='images/lists/expand.png' alt='"._("Open")."'>&nbsp;";
-        $str .=     $image."&nbsp;";
-        $str .= "   <b>".$this->objs[$key]['Name']."</b></a></td></tr>";
+          <td colspan=2>".
+          image('images/lists/expand.png').$image."&nbsp;".
+          "<a href='?plug=".$_GET['plug']."&amp;expand&amp;id=".$key."'>".
+          "<b>".$this->objs[$key]['Name']."</b></a></td></tr>";
       }else{
-        $str .= "<tr><td colspan=2>
-                    <a href='?plug=".$_GET['plug']."&amp;compress&amp;id=".$key."'>
-                   <img border=0 class='center' src='images/lists/sort-down.png' alt='"._("Close")."'>&nbsp;";
-        $str .= $image."&nbsp;";
-        $str .= "<b>".$this->objs[$key]['Name']."</b></a></td></tr>";
-   
+        $str .= "<tr><td colspan=2>".
+          image('images/lists/sort-down.png').$image."&nbsp;".
+          "<a href='?plug=".$_GET['plug']."&amp;compress&amp;id=".$key."'>".
+          "<b>".$this->objs[$key]['Name']."</b></a></td></tr>";
+
         /* Display FAItemplate FAIhook FAIscript entries */ 
         if(in_array($key,array("FAItemplate","FAIhook","FAIscript"))){
 
@@ -561,7 +567,7 @@ class faiSummaryTab extends plugin{
   /* Create a new Profile entry */
   function prepare_FAIprofile($data)
   {
-    $classes = split("\ ",$data['FAIclass'][0]);
+    $classes = explode(" ",$data['FAIclass'][0]);
     foreach($classes as $class){
       $class = trim($class);
       $this->resolveObject($class);