Code

Fixed remove from parent, for k=kolab entry.
[gosa.git] / include / class_plugin.inc
index b2428de68e9f138bf0578f9ad7c5e6eb4ee37b36..15180d73cbd1719b2805435b63ce8ae03a597d83 100644 (file)
@@ -738,7 +738,15 @@ class plugin
     /* Save copy */
     $ldap->connect();
     $ldap->cd($this->config->current['BASE']);
+    
     $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dst_dn));
+
+    /* FAIvariable=.../..., cn=.. 
+        could not be saved, because the attribute FAIvariable was different to 
+        the dn FAIvariable=..., cn=... */
+    if(in_array_ics("FAIdebconfInfo",$new['objectClass'])){
+      $new['FAIvariable'] = $ldap->fix($new['FAIvariable']);
+    }
     $ldap->cd($dst_dn);
     $ldap->add($new);
 
@@ -854,7 +862,7 @@ class plugin
   }
 
 
-  function handle_object_tagging($dn= "", $tag= "")
+  function handle_object_tagging($dn= "", $tag= "", $show= false)
   {
     //FIXME: How to optimize this? We have at least two
     //       LDAP accesses per object. It would be a good
@@ -905,11 +913,17 @@ class plugin
       $ldap->cat($dn, array('gosaUnitTag', 'objectClass'));
       $attrs= $ldap->fetch();
       if(isset($attrs['gosaUnitTag'][0]) && $attrs['gosaUnitTag'][0] == $tag){
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "$dn is already tagged", "Tagging");
+        if ($show) {
+          echo sprintf(_("Object '%s' is already tagged"), @LDAP::fix($dn))."<br>";
+          flush();
+        }
         return;
       }
       if (count($attrs)){
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Add tagging ($tag) to $dn", "Tagging");
+        if ($show){
+          echo sprintf(_("Adding tag (%s) to object '%s'"), $tag, @LDAP::fix($dn))."<br>";
+          flush();
+        }
         $nattrs= array("gosaUnitTag" => $this->gosaUnitTag);
         $nattrs['objectClass']= array();
         for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
@@ -921,6 +935,7 @@ class plugin
         $nattrs['objectClass'][]= "gosaAdministrativeUnitTag";
         $ldap->cd($dn);
         $ldap->modify($nattrs);
+        show_ldap_error($ldap->get_error(), _("Handle object tagging failed"));
       } else {
         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not tagging ($tag) $dn - seems to have moved away", "Tagging");
       }
@@ -935,7 +950,10 @@ class plugin
         return;
       }
       if (count($attrs)){
-        @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Remove tagging from $dn", "Tagging");
+        if ($show){
+          echo sprintf(_("Removing tag from object '%s'"), @LDAP::fix($dn))."<br>";
+          flush();
+        }
         $nattrs= array("gosaUnitTag" => array());
         $nattrs['objectClass']= array();
         for ($i= 0; $i<$attrs['objectClass']['count']; $i++){
@@ -946,7 +964,7 @@ class plugin
         }
         $ldap->cd($dn);
         $ldap->modify($nattrs);
-        show_ldap_error($ldap->get_error());
+        show_ldap_error($ldap->get_error(), _("Handle object tagging failed"));
       } else {
         @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, "Not removing tag ($tag) $dn - seems to have moved away", "Tagging");
       }