diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc
index 38e1557b757776ff1033815509ee35d9edb87b99..8c75dd229719c039815539586f36a6104562a278 100644 (file)
}
/* Save currenlty selected base in session */
}
/* Save currenlty selected base in session */
- session::set("CurrentMainBase",$this->selectedBase);
+ session::global_set("CurrentMainBase",$this->selectedBase);
}
}
$this->DepartmentsAdded = true;
$this->Added_Departments = array();
$this->departments = array();
$this->DepartmentsAdded = true;
$this->Added_Departments = array();
$this->departments = array();
+
+ if(isset($this->Regex)){
+ $this->base_selection_regex = $this->Regex;
+ }
+
$linkopen = "<a href='?plug=".$_GET['plug']."&post_id=".$this->post_id."&act=dep_open&dep_id=%s'>%s</a>";
$types = departmentManagement::get_support_departments();
$ui = get_userinfo();
$module_deps = $ui->get_module_departments($this->module);
$linkopen = "<a href='?plug=".$_GET['plug']."&post_id=".$this->post_id."&act=dep_open&dep_id=%s'>%s</a>";
$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){
/* check for a valid base */
if(!$base){
/* Get all departments within this subtree */
$s_filter = "";
/* 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){
foreach($types as $name => $data){
- $s_filter.= "(&(objectClass=".$data['OC'].")(".$data['ATTR']."=".$this->base_selection_regex."))";
+ $s_filter.= "(&(objectClass=gosaDepartment)(objectClass=".$data['OC'].")(".$data['ATTR']."=".$this->base_selection_regex."))";
$s_attrs[]= $data['ATTR'];
$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){
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'];
$attrs['NAME'] = $attrs[$data['ATTR']][0];
$attrs['TYPE'] = $data;
$name = $attrs['NAME']." ".$attrs['dn'];
}
}
}
}
}
}
- uksort($departments, 'strnatcasecmp');
/* Detect allowed departments
*/
$deps = array_intersect($found_deps,$module_deps);
/* 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;
$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 = "<image src='".$img."' class='center'>";
+ $img = "<image src='".$val['TYPE']['IMG']."' class='center'>";
/* Add spacer cols to divlist
*/
/* Add spacer cols to divlist
*/
function create_department_list($modules)
{
function create_department_list($modules)
{
- /* Load possible departments */
+ $departments = array();
$ui= get_userinfo();
$first = "";
$found = FALSE;
$ui= get_userinfo();
$first = "";
$found = FALSE;
+ $options ="";
- if(!is_array($modules)){
- $modules = array($modules);
- }
-
- $department = $departments = array();
$ids = $this->config->idepartments;
$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)) {
/* 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;
$found = TRUE;
- $options.= "<option selected='selected' value='".$dep."'>$value</option>";
+ $options.= "<option selected='selected' value='".$value."'>$name</option>";
} else {
} else {
- $options.= "<option value='".$dep."'>$value</option>";
+ $options.= "<option value='".$value."'>$name</option>";
}
}
}
}