From c1e278e85a5ff75ebc17b49a33392db4535491a9 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 1 Sep 2005 06:25:11 +0000 Subject: [PATCH] Filtered department list. Hide all subtrees in base selection, which are subtrees of the edited entry. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1278 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/departments/class_departmentGeneric.inc | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index d7f709f80..3b50131db 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -70,15 +70,22 @@ class department extends plugin $this->config->make_idepartments(); $smarty= get_smarty(); - - /* Show main page */ - $smarty->assign("bases", $this->config->idepartments); + /* Hide all departments, that are subtrees of this department */ + $bases = $this->config->idepartments; + $tmp = array(); + foreach($bases as $dn=>$base){ + + /* Only attach departments which are not a subtree of this one */ + if(!preg_match("/".$this->dn."/",$dn)){ + $tmp[$dn]=$base; + } + } + $smarty->assign("bases", $tmp); foreach ($this->attributes as $val){ $smarty->assign("$val", $this->$val); $smarty->assign("$val"."ACL", chkacl($this->acl, "$val")); } - $smarty->assign("bases", $this->config->idepartments); $smarty->assign("base_select", $this->base); return($smarty->fetch (get_template_path('generic.tpl', TRUE))); } -- 2.30.2