diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc
index 08e47a82fcdb1cd5730357d2172e513abb0b300d..c77f07b6497d1a9e1619e30b16b17430bd96ee3c 100644 (file)
function ClearElementsList()
{
+ $ui =get_userinfo();
+ $deps = $ui->get_module_departments($this->module);
+ if(!in_array($this->selectedBase, $deps)){
+ $this->selectedBase = array_shift($deps);
+ }
$this->array_Elements = array();
}
}
uksort($this->departments, 'strnatcasecmp');
$this->departments = array_values($this->departments);
+
+ $ui = get_userinfo();
+ $module_deps = $ui->get_module_departments($this->module);
/* Add deps to this dialog object list */
foreach($this->departments as $key=> $val){
+ if(!in_array($val['dn'],$module_deps)) continue;
+
/* Check if this department contains sub-departments
Display different image in this case
*/
}
}
+
+ function create_department_list($modules)
+ {
+ /* Load possible departments */
+ $ui= get_userinfo();
+ $first = "";
+ $found = FALSE;
+
+ if(!is_array($modules)){
+ $modules = array($modules);
+ }
+
+ $department = $departments = array();
+ $ids = $this->config->idepartments;
+ foreach($modules as $module){
+ $d = $ui->get_module_departments($module);
+
+ foreach($ids as $department => $desc){
+ if(in_array($department,$d)){
+ $departments[$department] = $department;
+ }
+ }
+ }
+
+ $first = "";
+ $found = FALSE;
+ $options ="";
+ foreach($departments as $dep => $name){
+
+ /* Keep first base dn in mind, we could need this
+ * info if no valid base was found
+ */
+ if(empty($first)) {
+ $first = $dep['dn'];
+ }
+
+ $value = $ids[$dep];
+ if ($this->selectedBase == $dep){
+ $found = TRUE;
+ $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ } else {
+ $options.= "<option value='".$dep."'>$value</option>";
+ }
+ }
+
+ /* The currently used base is not visible with your acl setup.
+ * Set base to first useable base.
+ */
+ if(!$found){
+ $this->selectedBase = $first;
+ }
+
+ return($options);
+ }
+
function set_List_Bottom_Info($str)
{
$this->List_Bottom_Info = $str;