Code

Fixed broken fetch() call on non existing resources.
[gosa.git] / include / class_MultiSelectWindow.inc
index b7d4bb9166f0147f76dd2962075f9132019acf70..aefb8b8f365c2966ed39e0ed0ffe15059cde63fd 100644 (file)
@@ -13,6 +13,7 @@ class MultiSelectWindow{
 
        var $string_Title                         = "";
        var $string_ListHeader  = "";
+  var $string_ListDropDown= "";
        var $string_Summary                     = "";
        var $string_Information = "";
 
@@ -73,6 +74,34 @@ class MultiSelectWindow{
                $this->array_Regexes[] = $arr;
        }
 
+
+  function SetDropDownHeaderMenu($str)
+  {
+    $this->string_ListDropDown = $str;
+  }
+
+  function GetDropDownHeaderMenu()
+  {
+    if(!empty($this->string_ListDropDown)){
+      $mid = new LayersMenu(6, 7, 2, 1);
+      $mid->setImgwww("./images/");
+      $mid->setIcondir("./images/");
+      $mid->setDirroot("../include/php_layers_menu/");
+      $mid->setHorizontalMenuTpl("../ihtml/".get_template_path("",FALSE).'GOsa_MultiSelectHeader.ihtml');
+      $mid->setSubMenuTpl("../ihtml/".get_template_path("",FALSE).'GOsa_MultiSelectHeaderSubEntry.ihtml');
+      $mid->setMenuStructureString($this->string_ListDropDown);
+      $mid->parseStructureForMenu('menu');
+      $mid->newHorizontalMenu('menu');
+      $s = $mid->getHeader();
+      $s.= $mid->getMenu('menu');
+      $s.= $mid->getFooter('menu');
+      return($s);
+    }else{
+      return("");
+    }
+  }
+
+
        /* Contrucktion */
        function MultiSelectWindow(&$config, $filterName, $module)
        {
@@ -172,15 +201,14 @@ class MultiSelectWindow{
       $enable_back = FALSE;
       $enable_root = FALSE;
     }
-   
+  
+    $listhead ="";
     /* Check if we are in users home  department */ 
     if(!count($deps) ||$this->selectedBase == get_base_from_people($ui->dn)){
       $enable_home = FALSE;
     }
 
-    /* Create header with selected base */
-    $listhead = "<div style='background:white;padding:5px;'>";
-
     /* Draw root button */
     if($enable_root){
       $listhead .= " <input class='center' type='image' src='images/list_root.png' align='middle'
@@ -375,7 +403,8 @@ class MultiSelectWindow{
                 */     
                $smarty->assign("Display_alphabet",     $this->bool_DisplayAlpahabet);
                $smarty->assign("alphabet",             generate_alphabet());
-               $smarty->assign("Header"                        , $this->string_ListHeader );
+               $smarty->assign("Header"                        , $this->string_ListHeader);
+               $smarty->assign("HeaderDropDown", $this->GetDropDownHeaderMenu());
                $smarty->assign("Summary"                       , $this->string_Summary);
                $smarty->assign("Title"                         , $this->string_Title);
                $smarty->assign("Information"           , $this->string_Information);
@@ -560,7 +589,7 @@ class MultiSelectWindow{
 
 
   /* Create header snapshot value */
-  function get_snapshot_header()
+  function get_snapshot_header($layer_menu = FALSE)
   {
     $str = "&nbsp;";
     if($this->parent->snapshotEnabled()){
@@ -569,13 +598,20 @@ class MultiSelectWindow{
         $ok |= count($this->parent->getAllDeletedSnapshots($base)) >= 1 ;
       }
       if($ok){
-        $str = "<input class='center' type='image' align='middle' src='images/restore.png'
-          title='"._("Restore snapshopts of already deleted objects")."' 
-          alt='"._("Restore")."' name='RestoreDeletedSnapShot'>&nbsp;"; 
+        if($layer_menu){
+          $str = "..|<img class='center' src='images/restore.png' alt='"._("Restore")."'>&nbsp;"._("Restore")."|RestoreDeletedSnapShot|\n";
+        }else{
+          $str = "<input class='center' type='image' align='middle' src='images/restore.png'
+            title='"._("Restore snapshopts of already deleted objects")."' 
+            alt='"._("Restore")."' name='RestoreDeletedSnapShot'>&nbsp;"; 
+        }
       }else{
-        $str = "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+        if($layer_menu){
+          $str = "..|<img class='center' src='images/restore_grey.png' alt=''>&nbsp;"._("Restore")."||\n";
+        }else{
+          $str = "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+        }
       }
-
 #      $str .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
     }
     return($str);