Code

Updated post events
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Sep 2007 10:13:45 +0000 (10:13 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Sep 2007 10:13:45 +0000 (10:13 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7228 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 9625dab37db813baa64b25614b63b75d3cc5dbd6..4365eb7d458ae4373f749e0a07db0da2bd8665e6 100644 (file)
@@ -307,7 +307,7 @@ function getDNSZoneEntriesDiff($config,$newZones,$HostDn)
    */
   foreach($oldZones as $zone)  {
     $oldDn = "zoneName=".$zone['InitialzoneName'].",".$HostDn;
-    $del[$oldDn] = "";
+    $del[$oldDn] = $zone;
   }
 
   /* Check for entries which must be updated 
index 93343090ceb7de6024dd220f86d4d6c2bd26b55f..1fc5d0403601ae0daed72e172534147fa00a9dfe 100644 (file)
@@ -285,6 +285,7 @@ class servdns extends goService
   {
     if($this->initially_was_account){
       $bool = true;
+      $this->is_account = FALSE;
       foreach($this->Zones as $key => $zone){
         $bool= $bool & $this->RemoveZone($key);
       }
@@ -330,7 +331,6 @@ class servdns extends goService
       foreach($tmp['zoneUpdates'] as $dn => $attrs){
         $ldap->cd($dn);
         $ldap->modify($attrs);
-        $this->handle_post_events("modify",array("dn" => $dn));
         new log("modfiy","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
         show_ldap_error($ldap->get_error(), sprintf(_("Updating of system server/dns with dn '%s' failed."),$this->dn));
       }
@@ -339,11 +339,20 @@ class servdns extends goService
     /* 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);
-      $this->handle_post_events("remove",array("dn" => $dn));
       new log("remove","unknown/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
       show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/dns with dn '%s' failed."),$this->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
@@ -360,13 +369,21 @@ class servdns extends goService
       if($ldap->fetch()){
         $ldap->cd($dn);
         $ldap->modify ($attrs);
-        $this->handle_post_events("modify",array("dn" => $dn));
         show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->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);
-        $this->handle_post_events("create",array("dn" => $dn));
         show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/dns with dn '%s' failed."),$this->dn));
+
+        /* Handle Post events */
+        if(preg_match("/^zoneName=/",$dn)){
+          $this->handle_post_events("add",array("dn" => $dn,"zoneName" => $attrs['zoneName']));
+        }
       }
     }
   }
index c71fdf67b3bab1c0eabb4f96499a585d677e851e..1f1ee73a635b3734c4d03ea2afb711e25206232b 100644 (file)
@@ -232,6 +232,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 7eace297ac85e493bc416f8a1f77a09e80a08f13..30e26827326b18a174f5715dcd0499d774b076cd 100644 (file)
@@ -345,6 +345,9 @@ 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
@@ -355,9 +358,15 @@ 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));
+        }
       }
     }
   }