summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5a11b09)
raw | patch | inline | side by side (parent: 5a11b09)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 9 May 2006 10:42:54 +0000 (10:42 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 9 May 2006 10:42:54 +0000 (10:42 +0000) |
* Fixed removing of tags
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3230 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3230 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_plugin.inc | patch | blob | history |
index 4e761fbaa65dd73dd4da311e2ac517351d73e74f..7884026d7b31a94f131b3c3f7e1117f98d5c2970 100644 (file)
--- a/include/class_plugin.inc
+++ b/include/class_plugin.inc
function handle_object_tagging($dn= "", $tag= "")
{
/* Skip if nothing has changed */
- if (!$this->is_modified){
+ if ($dn == "" && !$this->is_modified){
return;
}
/* No dn? Self-operation... */
if ($dn == ""){
$dn= $this->dn;
- }
- /* No tag? Find it yourself... */
- if ($tag == ""){
- $len= strlen($this->dn);
- $fix= true;
- foreach ($this->config->adepartments as $key => $tag){
- /* This one is shorter than our dn, its not relevant... */
- if ($len >= strlen($key)){
- continue;
+ /* No tag? Find it yourself... */
+ if ($tag == ""){
+ $len= strlen($dn);
+
+ echo "No tag for $dn - looking for one...<br>";
+ $relevant= array();
+ foreach ($this->config->adepartments as $key => $ntag){
+
+ /* This one is bigger than our dn, its not relevant... */
+ if ($len <= strlen($key)){
+ continue;
+ }
+
+ /* This one matches with the latter part. Break and don't fix this entry */
+ if (preg_match('/(^|,)'.normalizePreg($key).'$/', $dn)){
+ echo "Possibly relevant: $key<br>";
+ $relevant[strlen($key)]= $ntag;
+ continue;
+ }
+
}
- /* This one matches with the latter part. Break and don't fix this entry */
- if (preg_match('/(^|,)'.normalizePreg($key).'$/', $dn)){
- $fix= false;
- break;
+ /* If we've some relevant tags to set, just get the longest one */
+ if (count($relevant)){
+ ksort($relevant);
+ $tmp= array_keys($relevant);
+ $idx= end($tmp);
+ $tag= $relevant[$idx];
+ $this->gosaUnitTag= $tag;
}
}
- $this->gosaUnitTag= $tag;
}
/* Set tag? */
if ($tag != ""){
- #echo "Add tagging ($tag) to $dn.<br>";
+ echo "Add tagging ($tag) to $dn.<br>";
/* Set objectclass and attribute */
$ldap= $this->config->get_ldap_link();
print_red($ldap->get_error());
}
} else {
- #echo "Remove tagging from $dn.<br>";
+ echo "Remove tagging from $dn.<br>";
/* Remove objectclass and attribute */
$ldap= $this->config->get_ldap_link();