X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fmimetypes%2Fclass_divListMimeTypes.inc;h=87b7bbaa4524b4e7c499c026164720767303b1b7;hb=6ae7a3503964fb97587cf21b9c1b4276b9db23fc;hp=91e60d29d427828adf693e04330c1957227daa5d;hpb=c59187bbd00e137911ad8d775a0e99e7d65c0683;p=gosa.git diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc index 91e60d29d..87b7bbaa4 100755 --- a/plugins/admin/mimetypes/class_divListMimeTypes.inc +++ b/plugins/admin/mimetypes/class_divListMimeTypes.inc @@ -23,7 +23,7 @@ class divListMimeTypes extends MultiSelectWindow function divListMimeTypes ($config,$parent) { /* Create divlist and setup */ - MultiSelectWindow::MultiSelectWindow($config,"Mimetypes"); + MultiSelectWindow::MultiSelectWindow($config, "Mimetypes", "mimetypes"); /* initialize required attributes */ $this->selectedRelease = "ou=mime,".$_SESSION['CurrentMainBase']; @@ -45,12 +45,17 @@ class divListMimeTypes extends MultiSelectWindow $this->EnableSaveButton (false); /* set Page header */ - $action_col_size = 70; + $action_col_size = 80; if($this->parent->snapshotEnabled()){ $action_col_size += 38; } + /* Toggle all selected / deselected */ + $chk = ""; + /* set Page header */ + $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'")); $this->AddHeader(array("string" => _("Mime type name")." / "._("Department"), "attach" => "style=''")); $this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'")); @@ -72,7 +77,7 @@ class divListMimeTypes extends MultiSelectWindow $smarty->assign("selectedRelease",$this->selectedRelease); $smarty->assign("branchimage","images/branch.png"); $smarty->assign("releases",$this->AvailableReleases); - $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE)); + $str = $smarty->fetch(get_template_path('release_select.tpl', TRUE,dirname(__FILE__))); } return($str); } @@ -85,43 +90,115 @@ class divListMimeTypes extends MultiSelectWindow which are shown in the listbox on top of the listbox */ $options= ""; - foreach ($this->config->idepartments as $key => $value){ - if ($this->selectedBase == $key){ - $options.= ""; - } else { - $options.= ""; + + /* Get all departments within this subtree */ + $ui= get_userinfo(); + $first = ""; + $found = FALSE; + $base = $this->config->current['BASE']; + + /* Add base */ + $tmp = array(); + $tmp[] = array("dn"=>$this->config->current['BASE']); + $tmp= array_merge($tmp,get_list("(&(|(ou=*)(description=*))(objectClass=gosaDepartment))", $this->module, $base, + array("ou", "description"), GL_SIZELIMIT | GL_SUBSEARCH)); + + $deps = array(); + foreach($tmp as $tm){ + $deps[$tm['dn']] = $tm['dn']; + } + + /* Load possible departments */ + $ui= get_userinfo(); + $tdeps= $ui->get_module_departments($this->module); + $ids = $this->config->idepartments; + $first = ""; + $found = FALSE; + foreach($ids as $dep => $name){ + if(isset($deps[$dep]) && in_array_ics($dep, $tdeps)){ + + /* 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; + } + + /* Get acls */ + $ui = get_userinfo(); + $acl = $ui->get_permissions("cn=dummy,ou=mimetypes,".$this->selectedBase,"mimetypes/mimetype"); + $acl_all = $ui->has_complete_category_acls($this->selectedBase,"mimetypes") ; + + + /* If this is true we add an additional seperator. Just look a few lines below */ + $add_sep = false; + /* Get copy & paste icon */ - if($this->parent->CopyPasteHandler){ + $Copy_Paste =""; + if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); - }else{ - $Copy_Paste =""; + $add_sep = true; } - /* Create listhead, it will be shown on top of the divlist. - * It provides general navigation and object creation - */ - $listhead = "