Code

Fixed gotoPrinter membership problem
[gosa.git] / plugins / admin / systems / class_servDNSeditZone.inc
index 5ddf04346082fd579dc8f67cf4af281b127a4e79..7fcef3aa0e0f1e601189aed6e9f507385ac5fdaa 100644 (file)
@@ -40,6 +40,8 @@ class servdnseditZone extends plugin
 
   var $isNew                    = true;
 
+  var $ZoneObject               = array();
+
   function servdnseditZone ($config, $dn= NULL,$attrs = array())
   {
     plugin::plugin ($config, $dn);
@@ -56,6 +58,8 @@ class servdnseditZone extends plugin
       $this->InitialzoneName    = "";//$attrs['InitialzoneName'];
       $this->InitialReverseZone = "";//$attrs['InitialReverseZone'];
     }else{
+      $this->ZoneObject         = $attrs;
+
       $this->OldZoneName        = $attrs['zoneName'];
       $this->OldReverseZone     = $attrs['ReverseZone'];
 
@@ -174,11 +178,15 @@ class servdnseditZone extends plugin
     $smarty= get_smarty();
     $display= "";
 
-
     /* Open Zone Entry Edit Dialog
      */
-    if(isset($_POST['EditZoneEntries'])){
-      $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->InitialzoneName,FlipIp($this->InitialReverseZone));
+    if(!count($this->ZoneObject)){
+      $smarty->assign("AllowZoneEdit" , false);
+    }else{
+      $smarty->assign("AllowZoneEdit" , true);
+      if(isset($_POST['EditZoneEntries'])){
+        $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+      }
     }
 
     /* Save Zone Entry Edit Dialog
@@ -333,7 +341,9 @@ class servdnseditZone extends plugin
   /* Check supplied data */
   function check()
   {
-    $message= array();
+    /* Call common method to give check the hook */
+    $message= plugin::check();
+        
     /* Check if zoneName is already in use */
     $usedZones = $this->getUsedZoneNames();
     if(($this->isNew == true)||($this->zoneName  != $this->InitialzoneName)||($this->ReverseZone != $this->InitialReverseZone)){
@@ -345,6 +355,14 @@ class servdnseditZone extends plugin
       }
     }
 
+    if(empty($this->zoneName)){
+      $message[] =sprintf(_("Please choose a valid zone name."));
+    }
+
+    if(empty($this->ReverseZone)){
+      $message[] =sprintf(_("Please choose a valid reverse zone name."));
+    }
+
     if(!preg_match("/\.$/",$this->sOAprimary)){
       $message[] = _("Primary dns server must end with '.' to be a valid entry.");
     }