diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc
index cf509983efbd16e8c2663bfb5a140c4cfa963791..c77f07b6497d1a9e1619e30b16b17430bd96ee3c 100644 (file)
function ClearElementsList()
{
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();
}
$this->array_Elements = array();
}
}
uksort($this->departments, 'strnatcasecmp');
$this->departments = array_values($this->departments);
}
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){
/* 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
*/
/* Check if this department contains sub-departments
Display different image in this case
*/
}
}
}
}
+ /* Create entry name
+ */
+ $name = $val['ou'][0];
+ if(isset($val['description'])){
+ $name .= " - [".$val["description"][0]."]";
+ }
+
/* Add departments
*/
$img = "<img src='images/lists/folder".$non_empty.".png' alt='department'>";
$row[]=$field1=array("string"=> $img,"attach"=>"style='text-align:center;width:20px;'");
/* Add departments
*/
$img = "<img src='images/lists/folder".$non_empty.".png' alt='department'>";
$row[]=$field1=array("string"=> $img,"attach"=>"style='text-align:center;width:20px;'");
- $row[]=$field2=array("string"=>sprintf($linkopen,$key,$val['ou'][0]), "attach" => "style=''");
+ $row[]=$field2=array("string"=>sprintf($linkopen,$key,$name), "attach" => "style=''");
/* Add spacer tabs
*/
/* Add spacer tabs
*/
}
}
}
}
+
+ 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;
function set_List_Bottom_Info($str)
{
$this->List_Bottom_Info = $str;