Code

Closes #229 ZoneEditor changes will be saved when server object is saved
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Oct 2007 08:53:36 +0000 (08:53 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 Oct 2007 08:53:36 +0000 (08:53 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7681 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 5ca4a91fcb41db15e69890ce6233327f8c4745d0..77f74690f64b135f7cc897a726108849d5a17b0b 100644 (file)
@@ -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);
index 69590cea6d691a3775a0118f6d23c5b323ed0e18..c06b42ce8f767393fd8770f4430ca1350d727afd 100644 (file)
@@ -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);
   }
 
index f5e7136110d85fc63c624ada305def1bdb24b47c..e1d836c0c85b4bb9c3653caa8462767a4bdcb482 100644 (file)
@@ -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']);
           }
         }
 
index 0396575621171ae6869ac771ab7587e0e822e92c..9c0428c29d58795aa28029bf97225bd7f7ad7290 100644 (file)
@@ -1,7 +1,4 @@
 <h2>{t}This dialog allows you to configure all components of this DNS zone on a single list.{/t}</h2>
-{t}Be careful editing record types with this dialog. All changes will be saved immediately when using the save button.{/t}
-<br>
-<br>
 <p class="seperator">&nbsp;</p>
 {if $disableDialog}
        <br><b>