diff options
Diffstat (limited to 'src/usr/local/www/status_gateway_groups.php')
-rwxr-xr-x | src/usr/local/www/status_gateway_groups.php | 217 |
1 files changed, 113 insertions, 104 deletions
diff --git a/src/usr/local/www/status_gateway_groups.php b/src/usr/local/www/status_gateway_groups.php index e9011c8..fa57d66 100755 --- a/src/usr/local/www/status_gateway_groups.php +++ b/src/usr/local/www/status_gateway_groups.php @@ -40,6 +40,14 @@ ##|*MATCH=status_gateway_groups.php* ##|-PRIV +define('COLOR', true); +define('LIGHTGREEN', '#90EE90'); +define('LIGHTCORAL', '#F08080'); +define('KHAKI', '#F0E68C'); +define('LIGHTGRAY', '#D3D3D3'); +define('LIGHTBLUE', '#ADD8E6'); +define('WHITE', '#FFFFFF'); + require("guiconfig.inc"); if (!is_array($config['gateways']['gateway_group'])) { @@ -55,119 +63,120 @@ $pgtitle = array(gettext("Status"), gettext("Gateway Groups")); $shortcut_section = "gateway-groups"; include("head.inc"); +$tab_array = array(); +$tab_array[0] = array(gettext("Gateways"), false, "status_gateways.php"); +$tab_array[1] = array(gettext("Gateway Groups"), true, "status_gateway_groups.php"); +display_top_tabs($tab_array); ?> -<body link="#0000CC" vlink="#0000CC" alink="#0000CC"> -<?php include("fbegin.inc"); ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td> +<div class="table-responsive"> + <table class="table table-hover table-condensed table-striped"> + <thead> + <tr> + <th><?=gettext("Group Name"); ?></th> + <th><?=gettext("Gateways"); ?></th> + <th><?=gettext("Description"); ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($a_gateway_groups as $gateway_group): ?> + <tr> + <td> + <?=htmlspecialchars($gateway_group['name'])?> + </td> + <td> + <table class="table table-bordered table-condensed"> <?php - $tab_array = array(); - $tab_array[0] = array(gettext("Gateways"), false, "status_gateways.php"); - $tab_array[1] = array(gettext("Gateway Groups"), true, "status_gateway_groups.php"); - display_top_tabs($tab_array); + /* process which priorities we have */ + $priorities = array(); + foreach($gateway_group['item'] as $item) { + $itemsplit = explode("|", $item); + $priorities[$itemsplit[1]] = true; + } + $priority_count = count($priorities); + ksort($priorities); ?> - </td> - </tr> - <tr> - <td> - <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="20%" class="listhdrr"><?=gettext("Group Name"); ?></td> - <td width="50%" class="listhdrr"><?=gettext("Gateways"); ?></td> - <td width="30%" class="listhdr"><?=gettext("Description"); ?></td> - </tr> + <thead> + <tr> <?php - $i = 0; - foreach ($a_gateway_groups as $gateway_group): + // Make a column for each tier + foreach($priorities as $number => $tier) { + echo "<th>" . sprintf(gettext("Tier %s"), $number) . "</th>"; + } ?> - <tr> - <td class="listlr"> + </tr> + </thead> + <tbody> <?php - echo $gateway_group['name']; + /* inverse gateway group to gateway priority */ + $priority_arr = array(); + foreach($gateway_group['item'] as $item) { + $itemsplit = explode("|", $item); + $priority_arr[$itemsplit[1]][] = $itemsplit[0]; + } + ksort($priority_arr); + $p = 1; + foreach($priority_arr as $number => $tier) { + /* for each priority process the gateways */ + foreach($tier as $member) { + /* we always have $priority_count fields */ ?> - </td> - <td class="listr"> - <table border='0'> + <tr> <?php - /* process which priorities we have */ - $priorities = array(); - foreach ($gateway_group['item'] as $item) { - $itemsplit = explode("|", $item); - $priorities[$itemsplit[1]] = true; - } - $priority_count = count($priorities); - ksort($priorities); - - echo "<tr>"; - foreach ($priorities as $number => $tier) { - echo "<td width='120'>" . sprintf(gettext("Tier %s"), $number) . "</td>"; - } - echo "</tr>\n"; - - /* inverse gateway group to gateway priority */ - $priority_arr = array(); - foreach ($gateway_group['item'] as $item) { - $itemsplit = explode("|", $item); - $priority_arr[$itemsplit[1]][] = $itemsplit[0]; - } - ksort($priority_arr); - $p = 1; - foreach ($priority_arr as $number => $tier) { - /* for each priority process the gateways */ - foreach ($tier as $member) { - /* we always have $priority_count fields */ - echo "<tr>"; - $c = 1; - while ($c <= $priority_count) { - $monitor = lookup_gateway_monitor_ip_by_name($member); - if ($p == $c) { - $status = $gateways_status[$monitor]['status']; - if (stristr($status, "down")) { - $online = gettext("Offline"); - $bgcolor = "#F08080"; // lightcoral - } elseif (stristr($status, "loss")) { - $online = gettext("Warning, Packetloss"); - $bgcolor = "#F0E68C"; // khaki - } elseif (stristr($status, "delay")) { - $online = gettext("Warning, Latency"); - $bgcolor = "#F0E68C"; // khaki - } elseif ($status == "none") { - $online = gettext("Online"); - $bgcolor = "#90EE90"; // lightgreen - } else { - $online = gettext("Gathering data"); - $bgcolor = "#ADD8E6"; // lightblue - } - echo "<td bgcolor='$bgcolor'> ". htmlspecialchars($member) .", $online </td>"; - } else { - echo "<td> </td>"; - } - $c++; - } - echo "</tr>\n"; - } - $p++; - } + $c = 1; + while($c <= $priority_count) { + $monitor = lookup_gateway_monitor_ip_by_name($member); + if($p == $c) { + $status = $gateways_status[$monitor]['status']; + if (stristr($status, "down")) { + $online = gettext("Offline"); + $bgcolor = LIGHTCORAL; + } elseif (stristr($status, "loss")) { + $online = gettext("Warning, Packetloss"); + $bgcolor = KHAKI; + } elseif (stristr($status, "delay")) { + $online = gettext("Warning, Latency"); + $bgcolor = KHAKI; + } elseif ($status == "none") { + $online = gettext("Online"); + $bgcolor = LIGHTGREEN; + } else { + $online = gettext("Gathering data"); + $bgcolor = LIGHTBLUE; + } + + if(!COLOR) + $bgcolor = WHITE; +?> + <td bgcolor="<?=$bgcolor?>"> + <?=htmlspecialchars($member);?>,<br /><?=$online?> + </td> + +<?php + } else { ?> - </table> - </td> - <td class="listbg"> - <?=htmlspecialchars($gateway_group['descr']);?> - </td> - </tr> + <td> + </td> +<?php } + $c++; + } +?> + </tr> <?php - $i++; - endforeach; + } + $p++; + } ?> - - </table> - </div> - </td> - </tr> -</table> -<?php include("fend.inc"); ?> -</body> -</html> + </tbody> + </table> + </td> + <td> + <?=htmlspecialchars($gateway_group['descr'])?> + </td> + </tr> + <?php endforeach; ?> + </tbody> + </table> +</div> + +<?php include("foot.inc"); |