From d4dd10266c2740af57bf992ef3849d1bd0600c30 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 29 Oct 2007 08:53:36 +0000 Subject: [PATCH] Closes #229 ZoneEditor changes will be saved when server object is saved git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7681 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_servDNS.inc | 8 +++++ .../admin/systems/class_servDNSeditZone.inc | 30 ++++++++++++------- .../systems/class_servDNSeditZoneEntries.inc | 2 +- .../admin/systems/servDNSeditZoneEntries.tpl | 3 -- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index 5ca4a91fc..77f74690f 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -400,6 +400,14 @@ class servdns extends plugin if($old_dn == "new"){ $old_dn = $this->dn; } + + /* Save zone editor changes now */ + foreach($this->Zones as $name => $zone){ + if(isset($zone['zoneEditor'] ) && $zone['zoneEditor'] != NULL && is_object($zone['zoneEditor'])){ + $zone['zoneEditor']->save(); + unset($this->Zones[$name]['zoneEditor']);; + } + } /* Update dns to current object dn */ $tmp = getDNSZoneEntriesDiff($this->config,$this->Zones,$old_dn); diff --git a/plugins/admin/systems/class_servDNSeditZone.inc b/plugins/admin/systems/class_servDNSeditZone.inc index 69590cea6..c06b42ce8 100644 --- a/plugins/admin/systems/class_servDNSeditZone.inc +++ b/plugins/admin/systems/class_servDNSeditZone.inc @@ -34,6 +34,8 @@ class servdnseditZone extends plugin var $dialog = false; + var $zoneEditor = NULL; + var $isNew = true; var $cn; var $ZoneObject = array(); @@ -56,7 +58,9 @@ class servdnseditZone extends plugin }else{ $this->ZoneObject = $attrs; - + if(isset($attrs['zoneEditor'])){ + $this->zoneEditor = $attrs['zoneEditor']; + } $this->OldZoneName = $attrs['zoneName']; $this->OldReverseZone = $attrs['ReverseZone']; @@ -209,8 +213,11 @@ class servdnseditZone extends plugin }else{ $smarty->assign("AllowZoneEdit" , true); if(isset($_POST['EditZoneEntries'])){ - $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject); - $this->dialog->parent = $this; + if($this->zoneEditor == NULL){ + $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject); + $this->zoneEditor->parent = $this; + } + $this->dialog = $this->zoneEditor; } } @@ -224,13 +231,14 @@ class servdnseditZone extends plugin print_red($msg); } }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; + $this->zoneEditor = clone $this->dialog; + $this->dialog = FALSE; +# $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; } } @@ -531,6 +539,8 @@ class servdnseditZone extends plugin } $ret['RECORDS'][] = array("type" => "nSRecord","value" => $ret['sOAprimary']) ; + + $ret['zoneEditor'] = $this->zoneEditor; return($ret); } diff --git a/plugins/admin/systems/class_servDNSeditZoneEntries.inc b/plugins/admin/systems/class_servDNSeditZoneEntries.inc index f5e713611..e1d836c0c 100644 --- a/plugins/admin/systems/class_servDNSeditZoneEntries.inc +++ b/plugins/admin/systems/class_servDNSeditZoneEntries.inc @@ -298,7 +298,7 @@ class servDNSeditZoneEntries extends plugin if(!isset($tmp[$Rec['type']])){ $tmp[$Rec['type']] = ""; }else{ - $message[] = sprintf(_("The record type '%s' is a unique type and can't be defined twice."),$type); + $message[] = sprintf(_("The record type '%s' is a unique type and can't be defined twice."),$Rec['type']); } } diff --git a/plugins/admin/systems/servDNSeditZoneEntries.tpl b/plugins/admin/systems/servDNSeditZoneEntries.tpl index 039657562..9c0428c29 100644 --- a/plugins/admin/systems/servDNSeditZoneEntries.tpl +++ b/plugins/admin/systems/servDNSeditZoneEntries.tpl @@ -1,7 +1,4 @@

{t}This dialog allows you to configure all components of this DNS zone on a single list.{/t}

-{t}Be careful editing record types with this dialog. All changes will be saved immediately when using the save button.{/t} -
-

 

{if $disableDialog}
-- 2.30.2