index 06336cd2e231b19302ff5051666c03444a612edc..89642ff57d9b66df0757447e42d714e02fd5ad27 100644 (file)
/* Save unit tags */
var $gosaUnitTag= "";
+ var $skipTagging= FALSE;
/*!
\brief Used standard values
unset($this->saved_attributes[$index]);
continue;
}
- if ($this->saved_attributes[$index]["count"] == 1){
+ if (isset($this->saved_attributes[$index][0]) || $this->saved_attributes[$index]["count"] == 1){
$tmp= $this->saved_attributes[$index][0];
unset($this->saved_attributes[$index]);
$this->saved_attributes[$index]= $tmp;
}
/* Handle tagging */
- $this->tag_attrs(&$this->attrs);
+ $this->tag_attrs($this->attrs);
}
{
/* Rename dn in possible object groups */
$ldap= $this->config->get_ldap_link();
- $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::preapre4filter($src_dn).'))',
+ $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::prepare4filter($src_dn).'))',
array('cn'));
while ($attrs= $ldap->fetch()){
$og= new ogroup($this->config, $ldap->getDN());
function move($src_dn, $dst_dn)
{
+ /* Do not copy if only upper- lowercase has changed */
+ if(strtolower($src_dn) == strtolower($dst_dn)){
+ return(TRUE);
+ }
+
/* Copy source to destination */
if (!$this->copy($src_dn, $dst_dn)){
return (FALSE);
return (FALSE);
}
- /* Perform a search for all objects to be moved */
- $objects= array();
- $ldap->cd($src_dn);
- $ldap->search("(objectClass=*)", array("dn"));
- while($attrs= $ldap->fetch()){
- $dn= $attrs['dn'];
- $objects[$dn]= strlen($dn);
- }
-
- /* Sort objects by indent level */
- asort($objects);
- reset($objects);
-
- /* Copy objects from small to big indent levels by replacing src_dn by dst_dn */
- foreach ($objects as $object => $len){
- $src= $object;
- $dst= preg_replace("/$src_dn$/", "$dst_dn", $object);
- if (!$this->copy($src, $dst)){
- return (FALSE);
- }
- }
+ $this->copy($src_dn, $dst_dn);
/* Remove src_dn */
$ldap->cd($src_dn);
- $ldap->recursive_remove();
+ $ldap->recursive_remove($src_dn);
return (TRUE);
}
}
}
- function tag_attrs($at, $dn= "", $tag= "", $show= false)
+ function tag_attrs(&$at, $dn= "", $tag= "", $show= false)
{
+ /* Skip tagging?
+ If this is called from departmentGeneric, we have to skip this
+ tagging procedure.
+ */
+ if($this->skipTagging){
+ return;
+ }
+
/* No dn? Self-operation... */
if ($dn == ""){
$dn= $this->dn;
}
/* Remove tags that may already be here... */
- remove_objectClass("gosaAdministrativeUnitTag", &$at);
+ remove_objectClass("gosaAdministrativeUnitTag", $at);
if (isset($at['gosaUnitTag'])){
unset($at['gosaUnitTag']);
}
/* Set tag? */
if ($tag != ""){
- add_objectClass("gosaAdministrativeUnitTag", &$at);
+ add_objectClass("gosaAdministrativeUnitTag", $at);
$at['gosaUnitTag']= $tag;
}
}