From f45e7424a36480768a6eca60e43bdfce0ca09b91 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 13 Jun 2008 09:14:34 +0000 Subject: [PATCH] Updated deparments git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@11320 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../class_departmentManagement.inc | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/gosa-core/plugins/admin/departments/class_departmentManagement.inc b/gosa-core/plugins/admin/departments/class_departmentManagement.inc index 27f9c5527..c5e818ef0 100644 --- a/gosa-core/plugins/admin/departments/class_departmentManagement.inc +++ b/gosa-core/plugins/admin/departments/class_departmentManagement.inc @@ -141,20 +141,48 @@ class departmentManagement extends plugin * The entry which will be edited is defined in $s_entry */ if (( $s_action=="edit") && (!isset($this->deptabs->config))){ + + /* Possible department types + */ + $types['country'] = array("ACL" => "country", "TAB" => "COUNTRY_TABS"); + $types['locality'] = array("ACL" => "locality", "TAB" => "LOCALITY_TABS"); + $types['organizationalUnit'] = array("ACL" => "department", "TAB" => "DEPTABS"); + $types['organization'] = array("ACL" => "organization", "TAB" => "ORGANIZATION_TABS"); + $types['Alias??'] = array("ACL" => "alias" , "TAB" => ""); + $types['Referal??'] = array("ACL" => "referal", "TAB" => ""); + $this->dn= $this->departments[trim($s_entry)]['dn']; + $entry = $this->departments[trim($s_entry)]; - if (($user= get_lock($this->dn)) != ""){ - return(gen_locked_message ($user, $this->dn)); + /* Detect department type + */ + $data = array(); + foreach($types as $oc => $type){ + if(in_array($oc,$entry['objectClass'])){ + $data = $type; + break; + } } - /* Lock the current entry, so everyone will get the above dialog */ - add_lock ($this->dn, $this->ui->dn); + /* Check if the department type was editable + */ + if(!count($data)){ + trigger_error("Unknown department type skipped '".$this->dn."'."); + }else{ + + if (($user= get_lock($this->dn)) != ""){ + return(gen_locked_message ($user, $this->dn)); + } + + /* Lock the current entry, so everyone will get the above dialog */ + add_lock ($this->dn, $this->ui->dn); - /* Register deptabs to trigger edit dialog */ - $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $this->dn,"department"); - $this->deptabs->set_acl_base($this->dn); + /* Register deptabs to trigger edit dialog */ + $this->deptabs= new deptabs($this->config,$this->config->data['TABS'][$data['TAB']], $this->dn,"department"); + $this->deptabs->set_acl_base($this->dn); - session::set('objectinfo',$this->dn); + session::set('objectinfo',$this->dn); + } } -- 2.30.2