X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Fplugins%2Fadmin%2Fdepartments%2Ftabs_department.inc;h=86f0acd65053e2613b59e6bfb7b7b2541b94a665;hb=698cb9465f35d82d587bcb73c21be149cbaabc13;hp=7e9b45c3ac4d7ea87643c2959358fcae868b0aa8;hpb=2023afefe1399aab013f52c14d1425432a6040b1;p=gosa.git diff --git a/gosa-core/plugins/admin/departments/tabs_department.inc b/gosa-core/plugins/admin/departments/tabs_department.inc index 7e9b45c3a..86f0acd65 100644 --- a/gosa-core/plugins/admin/departments/tabs_department.inc +++ b/gosa-core/plugins/admin/departments/tabs_department.inc @@ -24,11 +24,21 @@ class deptabs extends tabs { var $base= ""; var $moved = FALSE; + var $base_name = "department"; function deptabs($config, $data, $dn,$category) { tabs::tabs($config, $data, $dn,$category); - $this->base= $this->by_object['department']->base; + + /* Detect the base class (The classs which extends from department) + */ + foreach($this->by_object as $name => $object){ + if($object instanceOf department){ + $this->base_name = get_class($object); + break; + } + } + /* Add references/acls/snapshots */ $this->addSpecialTabs(); @@ -48,11 +58,19 @@ class deptabs extends tabs { return(FALSE); if($this->moved) return(FALSE); - $baseobject= &$this->by_object['department']; - $ou = preg_replace('/,/', '\,', $baseobject->ou); - $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base); - $old_ou = preg_replace('/,/', '\,', $baseobject->orig_ou); - $old_dn = @LDAP::convert('ou='.$ou.','.$baseobject->orig_base); + $baseobject= &$this->by_object[$this->base_name]; + + $namingAttr = $baseobject->namingAttr; + $orig_namingAttr = $baseobject->orig_namingAttr; + + $value = preg_replace('/,/', '\,', $baseobject->$namingAttr); + $orig_value = preg_replace('/,/', '\,', $baseobject->$orig_namingAttr); + + $new_dn = @LDAP::convert($namingAttr.'='.$value.','.$baseobject->base); + $old_dn = @LDAP::convert($namingAttr.'='.$orig_value.','.$baseobject->orig_base); + + print_a(array($new_dn,$old_dn)); + if ($this->dn != $new_dn && $this->dn != "new"){ return(TRUE); } @@ -74,7 +92,7 @@ class deptabs extends tabs function move_me() { if(!$this->am_i_moved()) return; - $baseobject= &$this->by_object['department']; + $baseobject= &$this->by_object[$this->base_name]; $ou = preg_replace('/,/', '\,', $baseobject->ou); $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base); $old_ou = preg_replace('/,/', '\,', $baseobject->orig_ou); @@ -88,9 +106,12 @@ class deptabs extends tabs function save($ignore_account= FALSE) { - $baseobject= &$this->by_object['department']; - $ou = preg_replace('/,/', '\,', $baseobject->ou); - $new_dn = @LDAP::convert('ou='.$ou.','.$baseobject->base); + $baseobject= &$this->by_object[$this->base_name]; + + $namingAttr = $baseobject->namingAttr; + + $nAV = preg_replace('/,/', '\,', $baseobject->$namingAttr); + $new_dn = @LDAP::convert($namingAttr.'='.$nAV.','.$baseobject->base); /* Move group? */ if ($this->dn != $new_dn && $this->dn != "new"){