Code

Udpated server category
[gosa.git] / include / class_MultiSelectWindow.inc
index 6f939f96c1baf4237a09560ec0fd3231205ffa21..9aec3065250bb7bfea0b514db0804cb09ba554bc 100644 (file)
@@ -166,18 +166,19 @@ class MultiSelectWindow{
 
     /* Check if selectedBase = first available base */
     $deps = $ui->get_module_departments($this->module);
-    if($deps[0] == $this->selectedBase){
+
+    if(!count($deps) || $deps[0] == $this->selectedBase){
       $enable_back = FALSE;
       $enable_root = FALSE;
     }
    
     /* Check if we are in users home  department */ 
-    if($this->selectedBase == get_base_from_people($ui->dn)){
+    if(!count($deps) ||$this->selectedBase == get_base_from_people($ui->dn)){
       $enable_home = FALSE;
     }
 
     /* Create header with selected base */
-    $listhead = "<div style='background:#F0F0F9;padding:5px;'>";
+    $listhead = "<div style='background:white;padding:5px;'>";
 
     /* Draw root button */
     if($enable_root){
@@ -349,7 +350,7 @@ class MultiSelectWindow{
                                </label>
                                </td>
                                <td width=\"99%\">
-                               <input type=\"text\" style='width:99%' name=\"".$regex['name']."\" maxlength='20'
+                               <input id=\"".$regex['name']."\" type=\"text\" style='width:99%' name=\"".$regex['name']."\" maxlength='20'
                                value=\"".htmlentities($regex['value'])."\" title=\"".htmlentities($regex['string'])."\"> 
                                </td>
                                </tr>
@@ -596,7 +597,7 @@ class MultiSelectWindow{
 
 
        /* this function adds the sub-departments of the current tree to the list */
-       function AddDepartments($base = false,$numtabs = 3)
+       function AddDepartments($base = false,$numtabs = 3,$empty_tabs_in_front = 0)
        {
                $this->DepartmentsAdded = true;
 
@@ -634,6 +635,11 @@ class MultiSelectWindow{
                }
                natcasesort($this->departments);
 
+
+    if($empty_tabs_in_front){
+#      $numtabs -= $empty_tabs_in_front;
+    }
+  
                /* Add deps to this dialog object list */
                foreach($this->departments as $key=> $val){
 
@@ -655,19 +661,25 @@ class MultiSelectWindow{
 
                        /* Add to divlist */
                        $row = array();
+
+      if($empty_tabs_in_front){
+        for($i = 0; $i < $empty_tabs_in_front ; $i ++){
+          $row[] = array("string"=>"&nbsp;", "attach" => "style='text-align:center;width:20px;'");
+        }
+      }
+
                        $row[]=$field1=array("string"=>"<img src='images/".$non_empty."folder.png' alt='department'>","attach"=>"style='text-align:center;width:20px;'");
                        $row[]=$field2=array("string"=>sprintf($linkopen,base64_encode($key),$val), "attach" => "style=''");
 
                        if($numtabs > 2){       
-                               for($i = 2 ; $i <$numtabs;$i++){
-          if(isset( $this->array_Header[$i]['attach'])){
-            $row[] = array("string"=>"&nbsp;","attach" => $this->array_Header[$i]['attach']);
+                               for($i = 2 ; $i < $numtabs;$i++){
+          if(isset( $this->array_Header[$i + $empty_tabs_in_front]['attach'])){
+            $row[] = array("string"=>"&nbsp;","attach" => $this->array_Header[$i + $empty_tabs_in_front]['attach']);
           }else{
             $row[] = array("string"=>"&nbsp;");
           }
                                }
                        }
-
                        $this->AddElement($row);
                }
        }