Code

Fixed baseSelect options
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Oct 2006 07:45:43 +0000 (07:45 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 24 Oct 2006 07:45:43 +0000 (07:45 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4923 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_divListApplication.inc
plugins/admin/departments/class_divListDepartment.inc
plugins/admin/mimetypes/class_divListMimeTypes.inc

index 204a9a7dd66040d46ef2a3bd1a40dd3cf079f097..29745ad82390aaafa1cd6fa98b88122c2b7c2a07 100755 (executable)
@@ -74,13 +74,29 @@ class divListApplication extends MultiSelectWindow
   {
     /* Prepare departments,
        which are shown in the listbox on top of the listbox
-     */
+    */
     $options= "";
-    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("application");
+
+    $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>";
+        }
       }
     }
 
index 714570fd6978c769b7925ddd2951870ab18f5f31..7ea33e77518d3c22c64363495e2268cea1fed25c 100755 (executable)
@@ -54,16 +54,33 @@ class divListDepartment extends MultiSelectWindow
   {
     /* Prepare departments,
        which are shown in the listbox on top of the listbox
-     */
+    */
     $options= "";
-    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("department");
+
+    $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>";
+        }
       }
     }
 
+
     /* Generate list head */
     $ui = get_userinfo();
     $acl = $ui->get_permissions("ou=dummy,".$this->selectedBase  ,"department/department");
index 0914cf8190d2aa9f4f1b074eca67a41dca7acab2..d48ad362527e599be279fa7b78c07ce7dd62ba35 100755 (executable)
@@ -85,11 +85,27 @@ class divListMimeTypes extends MultiSelectWindow
        which are shown in the listbox on top of the listbox
      */
     $options= "";
-    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("fai");
+
+    $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>";
+        }
       }
     }