From ec2baac1a2a00044adeabf5d472024b993aeb129 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 5 Sep 2007 10:05:51 +0000 Subject: [PATCH] Updated Post handling git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7226 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_servDNS.inc | 22 ++++++++++++++++--- .../admin/systems/class_servDNSeditZone.inc | 5 +++++ .../systems/class_servDNSeditZoneEntries.inc | 9 -------- 3 files changed, 24 insertions(+), 12 deletions(-) diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index 489ebfd11..703f3d303 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -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'])); + } } } } diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index a8abbf8c9..02a887407 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -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; } } diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index 4bd34bccc..f317e1fb6 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -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)); - } } } } -- 2.30.2