From: hickert Date: Mon, 29 Jun 2009 09:59:28 +0000 (+0000) Subject: Updated dhcp flag handling X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=76191f641e7553882a4803bb7a2d5525ff103a8a;p=gosa.git Updated dhcp flag handling git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13815 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc index 6f7964832..b57cd44f1 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSharedNetwork.inc @@ -52,22 +52,20 @@ class dhcpSharedNetwork extends dhcpPlugin } else { $smarty->assign("authoritative", ""); } - if (!$this->statements->exists("deny unknown-clients")){ - $smarty->assign("allow_unknown_state", "checked"); - } else { - $smarty->assign("allow_unknown_state", ""); - } - if (!$this->statements->exists("deny bootp")){ - $smarty->assign("allow_bootp_state", "checked"); - } else { - $smarty->assign("allow_bootp_state", ""); - } - if (!$this->statements->exists("deny booting")){ - $smarty->assign("allow_booting_state", "checked"); - } else { - $smarty->assign("allow_booting_state", ""); - } + $allow = $this->statements->get("allow"); + if(!is_array($allow)) $allow=array($allow); + foreach(array( + "unknown-clients" => "allow_unknown_state", + "bootp" => "allow_bootp_state", + "booting" => "allow_booting_state") as $state => $target){ + if(in_array($state,$allow)){ + $smarty->assign($target,"checked"); + }else{ + $smarty->assign($target,""); + } + } + /* Show main page */ $display= $smarty->fetch(get_template_path('dhcp_sharedNetwork.tpl', TRUE,dirname(__FILE__))).$this->network->execute(); @@ -127,13 +125,13 @@ class dhcpSharedNetwork extends dhcpPlugin $this->statements->removeAll("authoritative"); } + $this->statements->removeAll("deny"); + $this->statements->removeAll("allow"); foreach(array("unknown-clients", "bootp", "booting") as $name){ if (isset($_POST[$name])){ - $this->statements->removeAll("deny $name"); - $this->statements->set("allow $name",""); + $this->statements->add("allow",$name); } else { - $this->statements->removeAll("allow $name"); - $this->statements->set("deny $name",""); + $this->statements->add("deny",$name); } } }