From 023920e7b0ef59795071167f6d504d18c3aa48ee Mon Sep 17 00:00:00 2001 From: Ermal Date: Fri, 7 May 2010 17:12:05 +0000 Subject: Move the settings of down/latency/loss to per gateway. This allows more fine grained control on gateways. --- usr/local/www/system_gateways_edit.php | 129 ++++++++++++++++++++++++++++++--- 1 file changed, 117 insertions(+), 12 deletions(-) (limited to 'usr/local/www/system_gateways_edit.php') diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 1209704..5c14f17 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -69,6 +69,11 @@ if (isset($id) && $a_gateways[$id]) { $pconfig['friendlyiface'] = $a_gateways[$id]['friendlyiface']; $pconfig['gateway'] = $a_gateways[$id]['gateway']; $pconfig['defaultgw'] = isset($a_gateways[$id]['defaultgw']); + $pconfig['latencylow'] = $a_gateway_item[$id]['latencylow']; + $pconfig['latencyhigh'] = $a_gateway_item[$id]['latencyhigh']; + $pconfig['losslow'] = $a_gateway_item[$id]['losslow']; + $pconfig['losshigh'] = $a_gateway_item[$id]['losshigh']; + $pconfig['down'] = $a_gateway_item[$id]['down']; if (isset($a_gateways[$id]['dynamic'])) $pconfig['dynamic'] = true; if($a_gateways[$id]['monitor'] <> "") { @@ -146,6 +151,46 @@ if ($_POST) { } } + /* input validation */ + if($_POST['latencylow']) { + if (! is_numeric($_POST['latencylow'])) { + $input_errors[] = gettext("The low latency watermark needs to be a numeric value."); + } + } + + if($_POST['latencyhigh']) { + if (! is_numeric($_POST['latencyhigh'])) { + $input_errors[] = gettext("The high latency watermark needs to be a numeric value."); + } + } + if($_POST['losslow']) { + if (! is_numeric($_POST['losslow'])) { + $input_errors[] = gettext("The low loss watermark needs to be a numeric value."); + } + } + if($_POST['losshigh']) { + if (! is_numeric($_POST['losshigh'])) { + $input_errors[] = gettext("The high loss watermark needs to be a numeric value."); + } + } + + if(($_POST['latencylow']) && ($_POST['latencyhigh'])){ + if(($_POST['latencylow'] > $_POST['latencyhigh'])) { + $input_errors[] = gettext("The High latency watermark needs to be higher then the low latency watermark"); + } + } + + if(($_POST['losslow']) && ($_POST['losshigh'])){ + if($_POST['losslow'] > $_POST['losshigh']) { + $input_errors[] = gettext("The High packet loss watermark needs to be higher then the low packet loss watermark"); + } + } + if($_POST['down']) { + if (! is_numeric($_POST['down']) || $_POST['down'] < 1) { + $input_errors[] = gettext("The low latency watermark needs to be a numeric value."); + } + } + if (!$input_errors) { $reloadif = false; /* if we are processing a system gateway only save the monitorip */ @@ -194,6 +239,17 @@ if ($_POST) { unset($gateway['defaultgw']); } + if ($_POST['latencylow']) + $gateway['latencylow'] = $_POST['latencylow']; + if ($_POST['latencyhigh']) + $gateway['latencyhigh'] = $_POST['latencyhigh']; + if ($_POST['losslow']) + $gateway['losslow'] = $_POST['losslow']; + if ($_POST['losshigh']) + $gateway['losshigh'] = $_POST['losshigh']; + if ($_POST['down']) + $gateway['down'] = $_POST['down']; + /* when saving the manual gateway we use the attribute which has the corresponding id */ if (isset($id) && $a_gateway_item[$id]) { $a_gateway_item[$id] = $gateway; @@ -239,6 +295,11 @@ function enable_change(obj) { } } +function show_advanced_gateway() { + document.getElementById("showadvgatewaybox").innerHTML=''; + aodiv = document.getElementById('showgatewayadv'); + aodiv.style.display = "block"; +}
@@ -315,19 +376,63 @@ function enable_change(obj) { - + - -
+
1)) echo "style='display:none'"; ?>> + - Show advanced option +
+
> + + + + + + + + + + + + + + + + + + + + +
+ +

+
+ + + + +
+ + + + +
+ +
+
-- cgit v1.1