X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fdepartments%2Fclass_departmentManagement.inc;h=2a1e2e523a85bdc5efbe9d061dff3a96d6cc2b7f;hb=68c8306203abd7ee288216ceed2c085ff3bf90ee;hp=67c6ca84cc7be6f63a1869fd1c1181b2693ea9dd;hpb=9a06dfe9233c6e7c80b49ccddf9a23355db2df51;p=gosa.git diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc index 67c6ca84c..2a1e2e523 100644 --- a/plugins/admin/departments/class_departmentManagement.inc +++ b/plugins/admin/departments/class_departmentManagement.inc @@ -56,6 +56,9 @@ class departmentManagement extends plugin function execute() { + /* Call parent execute */ + plugin::execute(); + /* Reload departments */ $this->config->departments = get_departments(); $smarty = get_smarty(); @@ -99,18 +102,15 @@ class departmentManagement extends plugin if(isset($_POST['depselect']) && $_POST['depselect']){ $depfilter['depselect']= $_POST['depselect']; - $this->reload(); } if($s_action=="root"){ $depfilter['depselect']=($this->config->current['BASE']); - $this->reload(); } if($s_action=="home"){ $depfilter['depselect']=(preg_replace("/^[^,]+,/","",$this->ui->dn)); $depfilter['depselect']=(preg_replace("/^[^,]+,/","",$depfilter['depselect'])); - $this->reload(); } if($s_action=="back"){ @@ -122,14 +122,12 @@ class departmentManagement extends plugin }else{ $depfilter['depselect']= $this->config->departments["/"]; } - $this->reload(); } if(isset($_GET['act'])&&($_GET['act']=="dep_open")){ $s_action="open"; $s_entry = base64_decode($_GET['dep_id']); $depfilter['depselect']= $this->config->departments[trim($s_entry)]; - $this->reload(); } if (isset($_GET['search'])){ @@ -144,12 +142,9 @@ class departmentManagement extends plugin /* New Entry if Posted action (s_action) == new */ if ($s_action=="new"){ - $this->acl= array(":all"); $this->dn= "new"; - $this->deptabs= new deptabs($this->config, $this->config->data['TABS']['DEPTABS'], $this->dn); - $this->deptabs->set_acl($this->acl); } /* Edit Entry if Posted action (s_action) == edit @@ -187,7 +182,7 @@ class departmentManagement extends plugin return(gen_locked_message($user, $this->dn)); } else { add_lock ($this->dn, $this->ui->dn); - $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), $this->dn)); + $smarty->assign("info", sprintf(_("You're about to delete the whole LDAP subtree placed under '%s'."), LDAP::fix($this->dn))); $display.= $smarty->fetch (get_template_path('remove.tpl', TRUE)); return ($display); } @@ -199,7 +194,7 @@ class departmentManagement extends plugin if (isset($_POST['delete_department_confirm'])){ $acl= get_permissions ($this->dn, $this->ui->subtreeACL); $acl= get_module_permission($acl, "department", $this->dn); - if (chkacl($acl, "all") == ""){ + if (chkacl($acl, "delete") == ""){ $this->remove_from_parent(); gosa_log ("Department object'".$this->dn."' has been removed"); $this->reload (); @@ -279,36 +274,47 @@ class departmentManagement extends plugin /* Generate list head */ $listhead = "
". - "  ". - "  ". - "  ". - "  ". - "  ". - "  ". - _("Current base")." ". - "  ". + "  ". + "  ". + "  ". + "  ". + "  ". + "  ". + _("Base")." ". + "  ". "
"; /* Show main page */ - $divlist = new divlist(); + $divlist = new divlist("departmenttabs"); $divlist->SetSummary(_("This table displays all departments, in the selected tree.")); - $divlist->SetEntriesPerPage(20); - $actions= ""; - $actions.= ""; + $divlist->SetEntriesPerPage(0); + $actions= ""; + $actions.= ""; $linkopen = "%s"; - $divlist->SetHeader(array(array("string" => " "), - array("string"=>_("Department name")), - array("string" =>_("Actions"), "attach" => "style='text-align: right;border:none'"))); + $divlist->SetHeader(array( + array("string" => " ", "attach" => "style='text-align:center;width:20px;'"), + array("string"=>_("Department name"), "attach" => "style=''"), + array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"))); foreach($this->departments as $key => $val) { if(!isset($this->config->departments[trim($key)])){ $this->config->departments[trim($key)]=""; } - $field0 = array("string" => "department","attach"=>"style='width:20px;'"); - $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "width='100%'"); - $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions),"attach"=>"style='text-align:right;border:none'"); + + $non_empty=""; + $keys= str_replace("/","\/",$key); + foreach($this->config->departments as $keyd=>$vald ){ + if(preg_match("/".$keys."\/.*/",$keyd)){ + $non_empty="full"; + } + } + + $title = $this->config->departments[$key]; + $field0 = array("string" => "department", "attach" => "style='text-align:center;width:20px;'"); + $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'"); + $field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:right;'"); $divlist->AddEntry( array($field0,$field1,$field2)); @@ -400,14 +406,17 @@ class departmentManagement extends plugin $this->departments= array(); foreach ($res as $value){ - if($value["description"][0]!=".."){ + if(isset($value["description"][0])){ $this->departments[$value['dn']]= convert_department_dn2($value['dn'])." - [".$value["description"][0]."]"; }else{ - $this->departments[$value['dn']]=$value["description"][0]; + $this->departments[$value['dn']]= convert_department_dn2($value['dn']);//$value["description"][0]; } } natcasesort ($this->departments); reset ($this->departments); + + /* Unset global department list */ + unset($_SESSION['cached_departments']); } function remove_from_parent()