Code

Fixed save object problems.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Nov 2006 05:01:39 +0000 (05:01 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Nov 2006 05:01:39 +0000 (05:01 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5223 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_termDNS.inc
plugins/admin/systems/network.tpl

index 974e133910723406f7d8743bde2207da36c887a3..953a29f55c55c136d2ed357ab968f155f8ec9945 100644 (file)
@@ -26,7 +26,7 @@ class termDNS extends plugin
   /* DNS attributes  
    */
   var $DNSattributes            = array("dNSClass","zoneName","dNSTTL");
-  var $DNS_is_Account           = false;
+  var $DNS_is_account           = false;
   var $initially_was_account = false;
   var $dnsEntry                 = array();
   var $DNSenabled               = false;
@@ -95,7 +95,6 @@ class termDNS extends plugin
       }else{
         $this->DNS_is_account = false;
       }
-   
     }
  
     /* Store initally account settings 
@@ -153,7 +152,7 @@ class termDNS extends plugin
     if($this->DNSenabled == false){
        
       /* Is IP address must ? */ 
-      $smarty->assign("DNS_is_account",false);  
+      $smarty->assign("DNS_enabled",false);  
       $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
     
       /* Assign smarty all non DNs attributes */
@@ -170,13 +169,13 @@ class termDNS extends plugin
       $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
       return($display);
     }else{
-      $smarty->assign("DNS_is_account",true); 
+      $smarty->assign("DNS_enabled",true); 
     }
 
     $accountACL = false; 
-    if($this->DNSenabled && $this->acl_is_removeable()){
+    if($this->DNS_is_account && $this->acl_is_removeable()){
       $accountACL = true;
-    }elseif(!$this->DNSenabled && $this->acl_is_createable()){
+    }elseif(!$this->DNS_is_account && $this->acl_is_createable()){
       $accountACL = true;
     }
     $smarty->assign("accountACL",$accountACL);
@@ -218,7 +217,7 @@ class termDNS extends plugin
     }
     
     /* Assign all needed vars */
-    $smarty->assign("DNSAccount",$this->DNS_is_account);
+    $smarty->assign("DNS_is_account",$this->DNS_is_account);
     $smarty->assign("Zones",$this->Zones);
     $smarty->assign("ZoneKeys",($this->Zones));
     $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
@@ -242,11 +241,11 @@ class termDNS extends plugin
     $ldap->cd($this->orig_dn);
     $ldap->search("(&(objectClass=dNSZone)(zoneName=*)(!(relativeDomainName=@)))",array("relativeDomainName","zoneName"));
     while($attr = $ldap->fetch()){  
-      $ldap->cd($attr['dn']);
-      $ldap->rmDir($attr['dn']);
-      show_ldap_error($ldap->get_error(), sprintf(_("Removing of terminal/dns acoount with dn '%s' failed."),$this->dn));
+    $ldap->cd($attr['dn']);
+    $ldap->rmDir($attr['dn']);
+    show_ldap_error($ldap->get_error(), sprintf(_("Removing of terminal/dns acoount with dn '%s' failed."),$this->dn));
     }
-    */
+     */
   }
 
   /* Save data to object */
@@ -254,43 +253,49 @@ class termDNS extends plugin
   {
     /* Save all posted vars */
     plugin::save_object();
-    
-    /* Ge all non dns attributes (IP/MAC)*/
-    foreach($this->attributes as $attr){
-      if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-        $this->$attr = $_POST[$attr];
-      }
-    }
-
-    /* Get dns attributes */
-    if(($this->DNSenabled) && (isset($_POST['network_tpl_posted']))){
 
-      /* Check for posted record changes */
-      if(is_array($this->dnsEntry['RECORDS']) && $this->acl_is_writeable("Records")){
-        foreach($this->dnsEntry['RECORDS'] as $key => $value){
+    if(isset($_POST['network_tpl_posted'])){
 
-          /* Check if type has changed */
-          if(isset($_POST['RecordTypeSelectedFor_'.$key])){
-            $this->dnsEntry['RECORDS'][$key]['type'] = $_POST['RecordTypeSelectedFor_'.$key];
-          }
-          /* Check if value has changed */
-          if(isset($_POST['RecordValue_'.$key])){
-            $this->dnsEntry['RECORDS'][$key]['value'] = $_POST['RecordValue_'.$key];
-          }
-        }
-      }
-      /* Get all basic DNS attributes (TTL, Clas ..)*/
-      foreach($this->DNSattributes as $attr){
+      /* Ge all non dns attributes (IP/MAC)*/
+      foreach($this->attributes as $attr){
         if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
-          $this->dnsEntry[$attr] = $_POST[$attr];
+          $this->$attr = $_POST[$attr];
         }
       }
 
-      if($this->DNSenabled && $this->acl_is_removeable() && !isset($_POST['enableDNS'])){
+      /* Check if DNS should be enabled / disabled */
+      if($this->DNS_is_account && $this->acl_is_removeable() && !isset($_POST['DNS_is_account'])){
         $this->DNS_is_account = false;
-      }elseif(!$this->DNSenabled && $this->acl_is_createable() && isset($_POST['enableDNS'])){
+      }elseif(!$this->DNS_is_account && $this->acl_is_createable() && isset($_POST['DNS_is_account'])){
         $this->DNS_is_account = true;
       }
+
+      /* Get dns attributes */
+      if(($this->DNSenabled) && (isset($_POST['network_tpl_posted']))){
+
+        /* Check for posted record changes */
+        if(is_array($this->dnsEntry['RECORDS']) && $this->acl_is_writeable("Records")){
+          foreach($this->dnsEntry['RECORDS'] as $key => $value){
+
+            /* Check if type has changed */
+            if(isset($_POST['RecordTypeSelectedFor_'.$key])){
+              $this->dnsEntry['RECORDS'][$key]['type'] = $_POST['RecordTypeSelectedFor_'.$key];
+            }
+            /* Check if value has changed */
+            if(isset($_POST['RecordValue_'.$key])){
+              $this->dnsEntry['RECORDS'][$key]['value'] = $_POST['RecordValue_'.$key];
+            }
+          }
+        }
+        /* Get all basic DNS attributes (TTL, Clas ..)*/
+        foreach($this->DNSattributes as $attr){
+          if(isset($_POST[$attr]) && $this->acl_is_writeable($attr)){
+            $this->dnsEntry[$attr] = $_POST[$attr];
+          }
+        }
+
+
+      }
     }
   }
 
index 06d73f4c7764f5f0652585e7d5bf89bbb13e37c1..436e363210014ee7ded6370a97c743f8fd2262b4 100644 (file)
         {/if}
       </table> 
     </td>
-    {if $DNS_is_account==true}
+    {if $DNS_enabled==true}
                <td     style="width:50%;vertical-align:top;border-left:1px solid #b0b0b0;" valign="top">
-      <input type="checkbox" name="enableDNS" value="1" 
+      <input type="checkbox" name="DNS_is_account" value="1" 
 
         {if !$accountACL}  
           disabled
         {/if}
 
-        {if $DNSAccount == true}checked="checked"
+        {if $DNS_is_account == true}checked="checked"
         onclick="toggle('test2');
           changeState('zoneName');
           changeState('dNSTTL');
@@ -57,7 +57,7 @@
         {/if}
       {t}Enable DNS for this device{/t}
       <input type="submit" name="reloadThisDNSStuff" value="{t}Refresh{/t}"/>
-      {if $DNSAccount == true}
+      {if $DNS_is_account == true}
       <div style="padding-left:20px;visibility:visible;" id="test2">
       {else}
       <div style="padding-left:20px;visibility:hidden;" id="test2">
@@ -67,7 +67,7 @@
                                        <td><LABEL      for="zoneName">{t}Zone{/t}</LABEL></td>
                                        <td>
 {render acl=$zoneNameACL}
-              <select name="zoneName" id="zoneName" {if $DNSAccount == false} disabled='disabled' {/if}>
+              <select name="zoneName" id="zoneName" {if $DNS_is_account == false} disabled='disabled' {/if}>
                 {html_options values=$ZoneKeys output=$Zones selected=$zoneName}
               </select>
 {/render}
           <td>{t}TTL{/t}</td>
           <td>
 {render acl=$dNSTTLACL}
-            <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNSAccount == false} disabled {/if}>
+            <input type="text" name="dNSTTL" value="{$dNSTTL}" id="dNSTTL" {if $DNS_is_account == false} disabled {/if}>
 {/render}
           </td> 
                                </tr>
                                <tr>
           <td valign="top">{t}Dns records{/t}</td>
           <td>
-            {if $DNSAccount == true}
+            {if $DNS_is_account == true}
 {render acl=$RecordsACL}
               {$records}
 {/render}