Code

Added check for different type of parent tabs (Faiprofile/Workstation)
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 3 May 2006 09:18:08 +0000 (09:18 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 3 May 2006 09:18:08 +0000 (09:18 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3191 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiSummaryTab.inc
plugins/admin/fai/faiSummary.tpl

index 3b292f75b77288b02c1be83f8f53712c6650fb57..7d08cfa274087b056586aed34450d0b06ffe2abc 100644 (file)
@@ -12,6 +12,10 @@ class faiSummaryTab extends plugin{
   var $FAIclass;
   var $attributes = array("FAIclass");
 
+  var $is_dialog = false;
+
+  var $InitCalled = false;
+  
   function faiSummaryTab($config,$dn)
   {
     plugin::plugin($config,$dn);
@@ -30,28 +34,33 @@ class faiSummaryTab extends plugin{
           "Tree"       =>"ou=packages,") ,
         "FAIprofile"           => array(       "Image" =>"images/fai_profile.png",
           "Tree"       =>"ou=profiles,"));
+  }
 
-    if(count($this->FAIclass)){
-
-
-      /* Set Release */
-      if(preg_match("/:/",$this->FAIclass)){
-        if(preg_match("/:/",$this->FAIclass)){
-          $this->Release =trim( preg_replace("/^.*:/","",$this->FAIclass));
-        }
+  function init()
+  {
+    $this->InitCalled = true;
+    $this->Result = array();
+    $_SESSION['faiSummaryTab']['UniqueID'] = 0; 
+    
+    /* Get classes & release name 
+       There are 2 different tabs which use the summary tab
+       faiProfile / Workstations */
+    $tmp = $this->getBranches();
+    if(isset($this->parent->by_name['faiProfile'])){
+      $this->Classes = $this->parent->by_object['faiProfile']->FAIclasses;
+      $str = preg_replace("/^.*ou=profiles,/","",$this->dn);
+      if(isset($tmp[$str])){
+        $this->Release = $tmp[$str];
       }
-
-      /* Get classes */
-      $tmp = split("\ ", preg_replace("/:.*$/","",$this->FAIclass));
-      foreach($tmp as $class){
-        if(!empty($class)){
-          $this->Classes[]= trim($class);
-        }
+    }elseif(isset($this->parent->by_name['workgeneric'])){
+      $this->Classes = $this->parent->by_object['workstartup']->FAIclass;
+      $this->Release = $this->parent->by_object['workstartup']->FAIrelease;
+      $tmp = array_flip($tmp);
+      if(!isset($tmp[$this->Release])) {
+        $this->Release = "";
       }
     }
 
-    $_SESSION['faiSummaryTab']['UniqueID'] = 0; 
-
     $this->Releases = array_flip($this->getBranches());
 
     if(count($this->Classes) && (!empty($this->Release))){
@@ -84,6 +93,10 @@ class faiSummaryTab extends plugin{
 
   function execute() 
   {
+    if(!$this->InitCalled){
+      $this->init();
+    }
+
     $display = "";     
     $smarty = get_smarty();
     $this->ObjectList = $this->createSummary($this->Result);
@@ -565,6 +578,9 @@ class faiSummaryTab extends plugin{
         $value = preg_replace("/_.*$/","",$value); 
         $this->Result = $this->closeTag($this->Result,$value);
       }
+      if(preg_match("/^reloadList/",$name)){
+        $this->InitCalled = false;
+      }
     }
   }
 }
index 0b1ba3e253a79a8020d98b468c75bf7b78fa2298..9a5cca2c19dc51948b522f004c1ab9a059862ea3 100644 (file)
@@ -3,6 +3,12 @@
  <tr style="background-color: #E8E8E8; height:26px;font-weight:bold;">
   <td style="padding:5px;">{t}FAI object tree{/t}</td>
  </tr>
+ <tr>
+       <td style="padding-left:5px;padding-top:5px;padding-bottom:12px;">
+               <input type="image" src="images/list_reload.png" name="reloadList" class="center">      
+               {t}Reload class and release configuration from parent object.{/t}
+       </td>
+ </tr>
  <tr style="background-color: #E8E8E8; ">
        <td>
  {$objectList}