X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_MultiSelectWindow.inc;h=c77f07b6497d1a9e1619e30b16b17430bd96ee3c;hb=f5a365f5ce54675a7b990f4a6cfa02485f1926cc;hp=cf509983efbd16e8c2663bfb5a140c4cfa963791;hpb=02c93b2d0f815cba77c8cbb1c30e653219d0730c;p=gosa.git
diff --git a/gosa-core/include/class_MultiSelectWindow.inc b/gosa-core/include/class_MultiSelectWindow.inc
index cf509983e..c77f07b64 100644
--- a/gosa-core/include/class_MultiSelectWindow.inc
+++ b/gosa-core/include/class_MultiSelectWindow.inc
@@ -63,6 +63,11 @@ class MultiSelectWindow{
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();
}
@@ -672,10 +677,15 @@ class MultiSelectWindow{
}
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
*/
@@ -695,11 +705,18 @@ class MultiSelectWindow{
}
}
+ /* Create entry name
+ */
+ $name = $val['ou'][0];
+ if(isset($val['description'])){
+ $name .= " - [".$val["description"][0]."]";
+ }
+
/* Add departments
*/
$img = "
";
$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
*/
@@ -717,6 +734,61 @@ class MultiSelectWindow{
}
}
+
+ 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.= "";
+ } else {
+ $options.= "";
+ }
+ }
+
+ /* 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;