From 1c010b89a52b33ad9eb9ecbe47f9777e0732a2d9 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 27 Feb 2006 10:50:00 +0000 Subject: [PATCH] disable dns if servdns, is not available git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2746 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_termDNS.inc | 35 +++++++++++++++++++++++++ plugins/admin/systems/network.tpl | 2 ++ 2 files changed, 37 insertions(+) diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index 59facba57..f0c8d3295 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -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"); diff --git a/plugins/admin/systems/network.tpl b/plugins/admin/systems/network.tpl index d21860cf8..eb472e1f1 100644 --- a/plugins/admin/systems/network.tpl +++ b/plugins/admin/systems/network.tpl @@ -14,6 +14,7 @@ + {if $DNS_is_account==true} + {/if} -- 2.30.2