Code

Avoid initial reset of ocMapping. It is array() anyway.
[gosa.git] / plugins / admin / fai / class_divListFai.inc
index 2262fd8ae8c6e33b09d0d494ba4b74318261bb7e..58cd27a8ee39639287d2c65264df8510381be70b 100644 (file)
@@ -28,7 +28,7 @@ class divListFai extends MultiSelectWindow
 
   function divListFai ($config,$parent)
   {
-    MultiSelectWindow::MultiSelectWindow($config,"Fai");
+    MultiSelectWindow::MultiSelectWindow($config, "Fai", "fai");
     
     $this->parent       = $parent;
     $this->ui           = get_userinfo();
@@ -41,7 +41,7 @@ class divListFai extends MultiSelectWindow
 
     /* Set list strings */
     $this->SetTitle(_("List of FAI classes"));
-    $this->SetSummary(_("This table displays all systems, in the selected tree."));
+    $this->SetSummary(_("This table displays all FAI classes in the selected tree."));
 
     /* Result page will look like a headpage */
     $this->SetHeadpageMode();
@@ -53,11 +53,17 @@ class divListFai extends MultiSelectWindow
     $this->EnableCloseButton(false);
     $this->EnableSaveButton (false);
 
+   /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 50;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
     /* set Page header */
     $this->AddHeader(array("string" => " ",                "attach" => "style='text-align:center;width:20px;'"));
     $this->AddHeader(array("string" => _("Name of FAI class"),  "attach" => "style=''"));
     $this->AddHeader(array("string" => _("Class type"),         "attach" => "style='width:200px;'"));
-    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
+    $this->AddHeader(array("string" => _("Actions"),            "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
 
     $this->AddCheckBox("ShowProfiles"   , _("Display FAI profile objects")    ,_("Show profiles")     ,true);
     $this->AddCheckBox("ShowTemplates"  , _("Display FAI template objects")   ,_("Show templates")    ,true);
@@ -124,9 +130,9 @@ _("Submit")."'> ".
       " <input class='center' type='image' src='images/fai_new_profile.png' align='middle'
       title='"._("New profile")."' name='Create_profile' alt='"._("P")."'>&nbsp;".
 
-      "<img class='center' src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;".
-
-      " <input class='center' type='image' src='images/fai_new_partitionTable.png' align='middle'
+      "<img class='center' src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\">&nbsp;";
+      $listhead .= $this->get_snapshot_header($this->selectedBase);
+      $listhead .= " <input class='center' type='image' src='images/fai_new_partitionTable.png' align='middle'
       title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'>&nbsp;".
 
       " <input class='center' type='image' src='images/fai_new_script.png' align='middle'
@@ -179,6 +185,12 @@ _("Submit")."'>&nbsp;".
 
     $editlink ="<a href='?plug=".$_GET['plug']."&amp;edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
 
+    /* Dynamic action col, depending on snapshot icons */
+    $action_col_size = 50;
+    if($this->parent->snapshotEnabled()){
+      $action_col_size += 20;
+    }
+
     /********************
       Attach objects
      ********************/
@@ -206,14 +218,15 @@ _("Submit")."'>&nbsp;".
        }
 
        if($value['FAIstate'] == "freeze"){
-         $action  = "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
+         $action= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
            name='entry_edit_%KEY%' title='"._("Edit class")."'>";
          $edi = $editlink;
          $acti = $action;
        }else{
-         $action  = "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
+         $action= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
            name='entry_edit_%KEY%' title='"._("Edit class")."'>";
-         $action .= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
+         $action.= $this->GetSnapShotActions($value['dn']);;
+         $action.= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."'
            name='entry_delete_%KEY%' title='"._("Delete class")."'>";
          $acti = $action;
          $edi = $editlink;
@@ -222,9 +235,9 @@ _("Submit")."'>&nbsp;".
        $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
        $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$value['cn'].$desc,preg_replace('/ /', '&nbsp;', @LDAP::fix($value['dn']))),$edi) , "attach" => "style=''");
        $field3 = array("string" => $info, "attach" => "style='width:200px;'");
-       $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+       $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
        $this->AddElement(array($field1,$field2,$field3,$field4));
-    }
+     }
   }
 
   function Save()