From: hickert Date: Wed, 5 Dec 2007 08:07:23 +0000 (+0000) Subject: Closes #235 Propose IP addresses for selected zone. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0ac9063e0c561f01b7d4744be07cc80ade298d31;p=gosa.git Closes #235 Propose IP addresses for selected zone. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8004 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index 5910182ba..025933291 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -231,7 +231,6 @@ class termDNS extends plugin } } } - /********** @@ -282,6 +281,10 @@ class termDNS extends plugin $smarty->assign("dhcpParentNodeCnt",count($this->dhcpParentNodes)); + /********** + * DNS Handling + **********/ + /* There is no dns available */ if($this->DNSenabled == false){ @@ -305,6 +308,16 @@ class termDNS extends plugin $this->dnsEntry['RECORDS'][] =array("type"=>"aRecord","value"=>""); } + /* propose_ip */ + if(isset($_POST['propose_ip'])){ + foreach($this->Zones as $key => $name){ + if($name == $this->dnsEntry['zoneName']){ + $net = FlipIp(str_replace(".in-addr.arpa","",getNameFromMix($key))); + $this->ipHostNumber = $this->generateRandomIp($net); + } + } + } + /* Handle all posts */ $only_once =true; foreach($_POST as $name => $value){ @@ -956,6 +969,20 @@ class termDNS extends plugin } + function generateRandomIP($net = "") + { + $str = $net; + $cnt = 4; + while(substr_count($str,".") < 3 && $cnt > 0){ + $str .= ".".rand(0,255); + $str = preg_replace("/\.\.*/",".",$str); + $str = trim($str,". "); + $cnt --; + } + return($str); + } + + function create_tree($arr,$base,$current = "") { $ret = array(); diff --git a/plugins/admin/systems/network.tpl b/plugins/admin/systems/network.tpl index 98c21d66b..7cb6b3ff9 100644 --- a/plugins/admin/systems/network.tpl +++ b/plugins/admin/systems/network.tpl @@ -10,6 +10,13 @@ {render acl=$ipHostNumberACL} +{/render} +{render acl=$ipHostNumberACL} +{if $DNSAccount == true} + + {else} + + {/if} {/render} @@ -77,6 +84,7 @@ onclick="toggle('test2'); changeState('zoneName'); changeState('dNSTTL'); + toggle('propose_ip'); changeState('AddNewRecord'); {$changeStateForRecords}"/> {else} @@ -84,6 +92,7 @@ onclick="toggle('test2'); changeState('zoneName'); changeState('dNSTTL'); + toggle('propose_ip'); changeState('AddNewRecord');"/> {/if}