Code

disable dns if servdns, is not available
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Feb 2006 10:50:00 +0000 (10:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 27 Feb 2006 10:50:00 +0000 (10:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2746 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 59facba570f96070772da4a3bf31086d9ea801d8..f0c8d3295382edcfa6973a1bfc66832835450e06 100644 (file)
@@ -33,6 +33,8 @@ class termDNS extends plugin
   var $IPisMust = false;
   var $MACisMust= false;
 
+  var $found = false;
+
   function termDNS ($config, $dn,$objectClasses,$IPisMust = false)
   {
     /* We need to know which objectClasses are used, to store the ip/mac*/
@@ -42,6 +44,21 @@ class termDNS extends plugin
     $this->orig_dn= $dn;
  
     $this->IPisMust = $IPisMust;
+
+    /* Hide all dns specific code, if dns is not available 
+     */
+    $found = false;
+    foreach($this->config->data['TABS']['SERVTABS'] as $tab){
+      if(preg_match("/^servdns$/",$tab['CLASS'])){
+        $found = true;
+      }
+    }
+    $this->found = $found;
+    if(!$this->found){
+      $this->DNS_is_account = false;
+      return;
+    }
+
  
     /* All types with required attrs */
     $this->RecordTypes['aRecord']       = "aRecord";           // ok
@@ -135,7 +152,25 @@ class termDNS extends plugin
          /* Call parent execute */
     $smarty= get_smarty();
     $display= "";
+  
+    /* There is no dns available 
+     */
+    if($this->found == false){
+        
+      $smarty->assign("DNS_is_account",false);  
+      $smarty->assign("IPisMust",(($this->IPisMust)||($this->DNS_is_account)));
+    
+      /* Assign smarty all non DNs attributes */
+      foreach($this->attributes as $attr){
+        $smarty->assign($attr,$this->$attr);
+      }
 
+      $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
+      return($display);
+    }else{
+      $smarty->assign("DNS_is_account",true); 
+    }
     /* Add new empty array with status new, to our record list */
     if(isset($_POST['AddNewRecord'])){
       $this->types[]  =array("type"=>"aRecord","value"=>"","status"=>"new");
index d21860cf8e48836d2f99a32d3950ca673a8227f4..eb472e1f16205a46ab2b2ee71bd1866d7507d6a3 100644 (file)
@@ -14,6 +14,7 @@
                                </tr>
       </table> 
     </td>
+    {if $DNS_is_account==true}
                <td     style="width:50%">
       <input type="checkbox" name="enableDNS" value="1" 
         {if $DNSAccount==true}checked{/if}
@@ -47,6 +48,7 @@
                                </tr>
                        </table>
                </td>
+    {/if}
        </tr>
 </table>
 <input type="hidden" name="network_tpl_posted" value="1">