From cdcfc6a578a0faf8ee9859ca979fad64c09e6156 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 24 Oct 2006 07:45:43 +0000 Subject: [PATCH] Fixed baseSelect options git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4923 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_divListApplication.inc | 28 ++++++++++++++---- .../departments/class_divListDepartment.inc | 29 +++++++++++++++---- .../mimetypes/class_divListMimeTypes.inc | 26 +++++++++++++---- 3 files changed, 66 insertions(+), 17 deletions(-) diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc index 204a9a7dd..29745ad82 100755 --- a/plugins/admin/applications/class_divListApplication.inc +++ b/plugins/admin/applications/class_divListApplication.inc @@ -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.= ""; - } else { - $options.= ""; + + /* 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.= ""; + } else { + $options.= ""; + } } } diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc index 714570fd6..7ea33e775 100755 --- a/plugins/admin/departments/class_divListDepartment.inc +++ b/plugins/admin/departments/class_divListDepartment.inc @@ -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.= ""; - } else { - $options.= ""; + + /* 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.= ""; + } else { + $options.= ""; + } } } + /* Generate list head */ $ui = get_userinfo(); $acl = $ui->get_permissions("ou=dummy,".$this->selectedBase ,"department/department"); diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc index 0914cf819..d48ad3625 100755 --- a/plugins/admin/mimetypes/class_divListMimeTypes.inc +++ b/plugins/admin/mimetypes/class_divListMimeTypes.inc @@ -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.= ""; - } else { - $options.= ""; + + /* 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.= ""; + } else { + $options.= ""; + } } } -- 2.30.2