Code

Updated Post handling
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Sep 2007 10:05:51 +0000 (10:05 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Sep 2007 10:05:51 +0000 (10:05 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7226 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servDNS.inc
plugins/admin/systems/class_servDNSeditZone.inc
plugins/admin/systems/class_servDNSeditZoneEntries.inc

index 489ebfd113904c5929f59d0dc4fe373b46575535..703f3d30312a90ae909e1b2c58ddc2dc781c5fa4 100644 (file)
@@ -265,6 +265,7 @@ class servdns extends plugin
   function remove_from_parent()
   {
     if($this->DNSinitially_was_account){
+      $this->is_account = FALSE;
       $bool = true;
       foreach($this->Zones as $key => $zone){
         $bool= $bool & $this->RemoveZone($key);
@@ -318,10 +319,17 @@ class servdns extends plugin
     /* Delete dns 
      */
     foreach($tmp['del'] as $dn => $del){
+      $for = getNameFromMix($del['InitialzoneName']);
+      $rev = FlipIp(getNameFromMix($del['InitialReverseZone'])).".in-addr.arpa";
       $ldap->cd($dn);
       $ldap->rmdir_recursive($dn);
       show_ldap_error($ldap->get_error(), _("Removing DNS entries failed"));
-      $this->handle_post_events("remove",array("dn" => $dn));
+
+      /* Handle Post events */
+      if(preg_match("/^zoneName=/",$dn)){
+        $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $for));
+        $this->handle_post_events("remove",array("dn" => $dn,"zoneName" => $rev));
+      }
     }
 
     /* move follwoing entries
@@ -339,12 +347,20 @@ class servdns extends plugin
         $ldap->cd($dn);
         $ldap->modify ($attrs);
         show_ldap_error($ldap->get_error(), _("Saving DNS entries failed"));
-        $this->handle_post_events("modify",array("dn" => $dn));
+
+        /* Handle Post events */
+        if(preg_match("/^zoneName=/",$dn)){
+          $this->handle_post_events("modify",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+        }
       }else{
         $ldap->cd($dn);
         $ldap->add($attrs);
         show_ldap_error($ldap->get_error(), _("Saving DNS entries failed"));
-        $this->handle_post_events("add",array("dn" => $dn));
+
+        /* Handle Post events */
+        if(preg_match("/^zoneName=/",$dn)){
+          $this->handle_post_events("add",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+        }
       }
     }
   }
index a8abbf8c9e43922df3b64d0a7fb490479c0b8333..02a887407c8096cd61d60eff0d1c173277805aad 100644 (file)
@@ -225,6 +225,11 @@ class servdnseditZone extends plugin
         }
       }else{
         $this->dialog->save();
+        $rev = FlipIp(getNameFromMix($this->InitialReverseZone)).".in-addr.arpa";
+        $for = getNameFromMix($this->InitialzoneName);
+       
+        $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $rev));
+        $this->parent->handle_post_events("modify",array("dn" => $this->dn,"zoneName" => $for));
         $this->dialog = false;
       }
     }
index 4bd34bcccddd33cd09a8d3b3e3866453a29b104a..f317e1fb62ad191fa28ef9f5916ff72b8b896ea6 100644 (file)
@@ -346,9 +346,6 @@ class servDNSeditZoneEntries extends plugin
     foreach($tmp['del'] as $dn => $del){
       $ldap->cd($dn);
       $ldap->rmdir_recursive($dn);
-      if(is_object($this->parent->parent)){
-        $this->parent->parent->handle_post_events("remove",array("dn" => $dn));
-      }
     }
 
     /* Add || Update new DNS entries
@@ -359,15 +356,9 @@ class servDNSeditZoneEntries extends plugin
       if(count($ldap->fetch())){
         $ldap->cd($dn);
         $ldap->modify ($attrs);
-        if(is_object($this->parent->parent)){
-          $this->parent->parent->handle_post_events("modify",array("dn" => $dn));
-        }
       }else{
         $ldap->cd($dn);
         $ldap->add($attrs);
-        if(is_object($this->parent->parent)){
-          $this->parent->parent->handle_post_events("create",array("dn" => $dn));
-        }
       }
     }
   }