X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_MultiSelectWindow.inc;h=8c75dd229719c039815539586f36a6104562a278;hb=3a308e40188042fb56365af23190514a85621963;hp=ebdd1a391ff2db4ec892b7dc7505c4d18c110df2;hpb=83b39a03b6a5f563b13ce6141f05903cb802881e;p=gosa.git
diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc
index ebdd1a391..8c75dd229 100644
--- a/gosa-core/include/class_MultiSelectWindow.inc
+++ b/gosa-core/include/class_MultiSelectWindow.inc
@@ -645,7 +645,7 @@ class MultiSelectWindow{
}
/* Save currenlty selected base in session */
- session::set("CurrentMainBase",$this->selectedBase);
+ session::global_set("CurrentMainBase",$this->selectedBase);
}
@@ -655,11 +655,16 @@ class MultiSelectWindow{
$this->DepartmentsAdded = true;
$this->Added_Departments = array();
$this->departments = array();
+
+ if(isset($this->Regex)){
+ $this->base_selection_regex = $this->Regex;
+ }
+
$linkopen = "post_id."&act=dep_open&dep_id=%s'>%s";
$types = departmentManagement::get_support_departments();
$ui = get_userinfo();
$module_deps = $ui->get_module_departments($this->module);
-
+ $found_deps = array();
/* check for a valid base */
if(!$base){
@@ -672,18 +677,17 @@ class MultiSelectWindow{
/* Get all departments within this subtree */
$s_filter = "";
- $s_attrs = array("description");
- $s_acls = array();
+ $s_attrs = array("description","objectClass");
+ $s_acls = $this->module;
foreach($types as $name => $data){
$s_filter.= "(&(objectClass=gosaDepartment)(objectClass=".$data['OC'].")(".$data['ATTR']."=".$this->base_selection_regex."))";
$s_attrs[]= $data['ATTR'];
- $s_acls[] = "department/".$data['ACL'];
}
- $tmp = get_list("(|".$s_filter.")",$s_acls,$this->selectedBase,$s_attrs,GL_NONE);
+ $tmp = get_list("(|".$s_filter.")",$s_acls,$this->selectedBase,$s_attrs,GL_NONE | GL_SIZELIMIT);
foreach($tmp as $attrs){
foreach($types as $name => $data){
- if(isset($attrs[$data['ATTR']][0])){
+ if(in_array($data['OC'],$attrs['objectClass']) && isset($attrs[$data['ATTR']][0])){
$attrs['NAME'] = $attrs[$data['ATTR']][0];
$attrs['TYPE'] = $data;
$name = $attrs['NAME']." ".$attrs['dn'];
@@ -693,29 +697,17 @@ class MultiSelectWindow{
}
}
}
- uksort($departments, 'strnatcasecmp');
/* Detect allowed departments
*/
$deps = array_intersect($found_deps,$module_deps);
+ uksort($deps, 'strnatcasecmp');
$key = 0;
foreach($deps as $name => $dn){
$key ++;
$val = $departments[$name];
$this->departments[$key] = $val;
-
- /* Check if this department contains sub-departments
- Display different image in this case
- */
- $img = $val['TYPE']['IMG'];
-# foreach($this->config->departments as $keyd){
-# if(preg_match("/,".normalizePreg($val['dn'])."$/",$keyd)){
-# $img = $val['TYPE']['IMG_FULL'];
-# }
-# }
-
-
- $img = "";
+ $img = "";
/* Add spacer cols to divlist
*/
@@ -757,45 +749,34 @@ class MultiSelectWindow{
function create_department_list($modules)
{
- /* Load possible departments */
+ $departments = array();
$ui= get_userinfo();
$first = "";
$found = FALSE;
+ $options ="";
- 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;
- }
- }
+ $d = $ui->get_module_departments($modules);
+ $k_ids = array_keys($ids);
+ $deps = array_intersect($d,$k_ids);
+ foreach($k_ids as $department){
+ $departments[$department] = $ids[$department];
}
- $first = "";
- $found = FALSE;
- $options ="";
- foreach($departments as $dep => $name){
+ foreach($departments as $value => $name){
/* Keep first base dn in mind, we could need this
* info if no valid base was found
*/
if(empty($first)) {
- $first = $dep['dn'];
+ $first = $value;
}
- $value = $ids[$dep];
- if ($this->selectedBase == $dep){
+ if ($this->selectedBase == $value){
$found = TRUE;
- $options.= "";
+ $options.= "";
} else {
- $options.= "";
+ $options.= "";
}
}