Code

Updated workstation - Startup
[gosa.git] / plugins / admin / systems / class_servDNSeditZone.inc
index 615ede4bcef337a0896fc2cc34e54da61238fb2b..d5df0871d9bbbb912ec1699716255342ccb2b451 100644 (file)
@@ -39,11 +39,13 @@ class servdnseditZone extends plugin
 
   var $dialog                   = false;
 
+  var $zoneEditor               = NULL;
+
   var $isNew                    = true;
 
   var $ZoneObject               = array();
 
-  function servdnseditZone ($config, $dn= NULL,$attrs = array())
+  function servdnseditZone (&$config, $dn= NULL,$attrs = array())
   {
     plugin::plugin ($config, $dn);
 
@@ -61,7 +63,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'];
 
@@ -116,11 +120,11 @@ class servdnseditZone extends plugin
     /* Detect Network class */
     if(!empty($this->ReverseZone)){
 
-      $dots = count(split(".",$this->ReverseZone));
-      if($dots == 0){
+      $dots = count(split("\.",$this->ReverseZone));
+      if($dots == 1){
         $this->NetworkClass = "A";  
         $this->ReverseZone .= ".0.0.0"; 
-      }elseif($dots == 1){
+      }elseif($dots == 2){
         $this->NetworkClass = "B";  
         $this->ReverseZone .= ".0.0"; 
       }else{
@@ -205,7 +209,8 @@ class servdnseditZone extends plugin
     /* Fill templating stuff */
     $smarty= get_smarty();
     $ui = get_userinfo();
-    $smarty->assign("ACLs",$ui->get_permissions($this->dn,"server/servdns"));
+
+    $smarty->assign("ACLs",$this->parent->getacl(""));
     $display= "";
 
     /* Open Zone Entry Edit Dialog
@@ -215,7 +220,11 @@ class servdnseditZone extends plugin
     }else{
       $smarty->assign("AllowZoneEdit" , true);
       if(isset($_POST['EditZoneEntries'])){
-        $this->dialog= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+        if($this->zoneEditor == NULL){
+          $this->zoneEditor= new servDNSeditZoneEntries($this->config,$this->dn,$this->ZoneObject);
+          $this->zoneEditor->parent = $this;
+        }
+        $this->dialog = $this->zoneEditor;
       }
     }
 
@@ -229,8 +238,14 @@ class servdnseditZone extends plugin
           print_red($msg);
         }
       }else{
-        $this->dialog->save();
-        $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;
       }
     }
 
@@ -242,7 +257,7 @@ class servdnseditZone extends plugin
 
     /* Display any type of open dialogs 
      */
-    if($this->dialog){
+    if(is_object($this->dialog)){
       $this->dialog->save_object();
       return($this->dialog->execute());
     }
@@ -312,7 +327,7 @@ class servdnseditZone extends plugin
     }
 
 
-    $div = new DivSelectBox("MxRecords");
+    $div = new divSelectBox("MxRecords");
     $div->setHeight(120);
     $recs = $this->mXRecords;
 
@@ -522,6 +537,8 @@ class servdnseditZone extends plugin
     }
 
     $ret['RECORDS'][] = array("type" => "nSRecord","value" => $ret['sOAprimary']) ;
+
+    $ret['zoneEditor'] = $this->zoneEditor;
     return($ret);
   }