Code

Removed debug output
[gosa.git] / plugins / admin / users / class_divListUsers.inc
index 2f0d670547445a3e40e88bb48df8ac836e009fcd..d239375b8c7c9ed2a457f5a2c0ff10b298a6dd1e 100644 (file)
@@ -79,15 +79,27 @@ class divListUsers extends MultiSelectWindow
        which are shown in the listbox on top of the listbox
      */
     $options= "";
-#print_a($this->config->idepartments);
-#$ui= get_userinfo();
-#$t= $ui->get_module_departments("users");
-#print_a($t);
-    foreach ($this->config->idepartments as $key => $value){
-      if ($this->selectedBase == $key){
-        $options.= "<option selected='selected' value='$key'>$value</option>";
-      } else {
-        $options.= "<option value='$key'>$value</option>";
+
+    /* Get all departments within this subtree */ 
+    $base = $this->config->current['BASE'];
+    $deps= get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base,
+                    array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH);
+
+    /* Load possible departments */
+    $ui= get_userinfo();
+    $tdeps= $ui->get_module_departments("users");
+
+    $ids = $this->config->idepartments;
+    foreach($deps as $dep){
+      if(isset($ids[$dep['dn']]) && in_array_ics($dep['dn'], $tdeps)){
+
+        $value = $ids[$dep['dn']]; 
+        if ($this->selectedBase == $dep['dn']){
+          $options.= "<option selected='selected' value='".$dep['dn']."'>$value</option>";
+        } else {
+          $options.= "<option value='".$dep['dn']."'>$value</option>";
+        }
       }
     }
 
@@ -107,15 +119,15 @@ class divListUsers extends MultiSelectWindow
       " <input class='center' type='image' align='middle' src='images/list_home.png' 
       title='"._("Go to users department")."' alt='"._("Home")."'            name='dep_home'>&nbsp;".
       " <input class='center' type='image' src='images/list_reload.png' align='middle' 
-      title='"._("Reload list")."' name='submit_department' alt='".        _("Submit")."'>&nbsp;".
-      " <img   class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+      title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
+      " <img   class='center' src='images/list_seperator.png' align='middle' alt='-' height='16' width='1'>&nbsp;";
     $listhead .= $this->get_snapshot_header($this->selectedBase);
     $listhead .= " <input class='center' type='image' align='middle' src='images/list_new_user.png' 
       title='"._("Create new user")."' alt='"._("New user")."'           name='user_new'>&nbsp;".
       " <input class='center' type='image' align='middle' src='images/list_new.png' 
       title='"._("Create new template")."' alt='"._("New template")."'        name='user_tplnew'>&nbsp;".
       $Copy_Paste.
-      " <img   class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
+      " <img   class='center' src='images/list_seperator.png' align='middle' alt='-' height='16' width='1'>&nbsp;".
       _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' 
       title='"._("Submit department")."' name='submit_department' alt='".  _("Submit")."'>&nbsp;".
@@ -139,7 +151,7 @@ class divListUsers extends MultiSelectWindow
 
     /* Variable initialation */
     $enviro     = $posix = $maila = $faxac = $samba = $netatalk = "";
-    $empty      = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt=''>";
+    $empty      = "<img class='center' src='images/empty.png' style='width:16px;height:16px;' alt='-'>";
     $userimg    = "<img class='center' src='images/select_user.png' alt='User' title='%s'>";
     $tplimg     = "<img class='center' src='images/select_template.png' alt='Template' title='%s'>";
     $editlink   = "<a href='?plug=".validate($_GET['plug'])."&amp;id=%s&amp;act=edit_entry'>%s</a>";