Commit c876b694 authored by Ad Schellevis's avatar Ad Schellevis

(dashboard) restyle gateways.widget.php

parent 4e6d9e24
<?php <?php
/* /*
Copyright (C) 2014 Deciso B.V. Copyright (C) 2014-2016 Deciso B.V.
Copyright (C) 2008 Seth Mos Copyright (C) 2008 Seth Mos
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without
...@@ -26,107 +26,76 @@ ...@@ -26,107 +26,76 @@
POSSIBILITY OF SUCH DAMAGE. POSSIBILITY OF SUCH DAMAGE.
*/ */
$nocsrf = true;
require_once("guiconfig.inc"); require_once("guiconfig.inc");
require_once("pfsense-utils.inc"); require_once("pfsense-utils.inc");
require_once("widgets/include/gateways.inc"); require_once("widgets/include/gateways.inc");
$a_gateways = return_gateways_array();
$gateways_status = array();
$gateways_status = return_gateways_status(true); $gateways_status = return_gateways_status(true);
$counter = 1;
?> ?>
<table class="table table-striped" width="100%" border="0" cellspacing="0" cellpadding="0" summary="gateway status"> <table class="table table-striped table-condensed">
<tr> <thead>
<td id="gatewayname" align="center"><b><?php echo gettext('Name')?></b></td> <tr>
<td align="center"><b><?php echo gettext('RTT')?></b></td> <th><?=gettext('Name')?></th>
<td align="center"><b><?php echo gettext('Loss')?></b></td> <th><?=gettext('RTT')?></th>
<td align="center"><b><?php echo gettext('Status')?></b></td> <th><?=gettext('Loss')?></th>
</tr> <th><?=gettext('Status')?></th>
<?php foreach ($a_gateways as $gname => $gateway) { </tr>
?> </thead>
<tr> <tbody>
<td class="h6" id="gateway<?php echo $counter; ?>" rowspan="2" align="center"> <?php
<strong> foreach (return_gateways_array() as $gname => $gateway):?>
<?php echo htmlspecialchars($gateway['name']); ?> <tr>
</strong> <td>
<?php $counter++; ?> <strong><?=htmlspecialchars($gateway['name']); ?></strong><br/>
</td> <?php
<td colspan="3" align="left"> $if_gw = '~';
<div class="h6" id="gateway<?php echo $counter; ?>" style="display:inline"> if (is_ipaddr($gateway['gateway'])) {
<?php $if_gw = htmlspecialchars($gateway['gateway']);
$if_gw = ''; } elseif ($gateway['ipprotocol'] == "inet") {
if (is_ipaddr($gateway['gateway'])) { $if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface']));
$if_gw = htmlspecialchars($gateway['gateway']); } elseif ($gateway['ipprotocol'] == "inet6") {
} else { $if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface']));
if ($gateway['ipprotocol'] == "inet") { }?>
$if_gw = htmlspecialchars(get_interface_gateway($gateway['friendlyiface'])); <small><?=$if_gw;?></small>
} </td>
if ($gateway['ipprotocol'] == "inet6") { <td>
$if_gw = htmlspecialchars(get_interface_gateway_v6($gateway['friendlyiface'])); <?=!empty($gateways_status[$gname]) ? htmlspecialchars($gateways_status[$gname]['delay']) : gettext("Pending");?>
} </td>
} <td>
echo ($if_gw == '' ? '~' : $if_gw); <?=!empty($gateways_status[$gname]) ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending");?>
unset ($if_gw); </td>
$counter++; <?php
?> $online = gettext("Unknown");
</div> $class="info";
</td> if (!empty($gateways_status[$gname])) {
</tr> if (stristr($gateways_status[$gname]['status'], "force_down")) {
<tr> $online = "Offline (forced)";
<td align="center" id="gateway<?php echo $counter; ?>"> $class="danger";
<?php } elseif (stristr($gateways_status[$gname]['status'], "down")) {
if ($gateways_status[$gname]) { $online = "Offline";
echo htmlspecialchars($gateways_status[$gname]['delay']); $class="danger";
} else { } elseif (stristr($gateways_status[$gname]['status'], "loss")) {
echo gettext("Pending"); $online = "Packetloss";
} $class="warning";
?> } elseif (stristr($gateways_status[$gname]['status'], "delay")) {
<?php $counter++; ?> $online = "Latency";
</td> $class="warning";
<td align="center" id="gateway<?php echo $counter; ?>"> } elseif ($gateways_status[$gname]['status'] == "none") {
<?php $online = "Online";
if ($gateways_status[$gname]) { $class="success";
echo htmlspecialchars($gateways_status[$gname]['loss']); } elseif ($gateways_status[$gname]['status'] == "") {
} else { $online = "Pending";
echo gettext("Pending");
}
?>
<?php $counter++; ?>
</td>
<?php
if ($gateways_status[$gname]) {
if (stristr($gateways_status[$gname]['status'], "force_down")) {
$online = "Offline (forced)";
$class="danger";
} elseif (stristr($gateways_status[$gname]['status'], "down")) {
$online = "Offline";
$class="danger";
} elseif (stristr($gateways_status[$gname]['status'], "loss")) {
$online = "Packetloss";
$class="warning";
} elseif (stristr($gateways_status[$gname]['status'], "delay")) {
$online = "Latency";
$class="warning";
} elseif ($gateways_status[$gname]['status'] == "none") {
$online = "Online";
$class="success";
} elseif ($gateways_status[$gname]['status'] == "") {
$online = "Pending";
$class="info";
}
} else {
$online = gettext("Unknown");
$class="info"; $class="info";
} }
echo "<td class=\"$class\" align=\"center\">$online</td>\n"; }?>
$counter++; <td style="width:160px;">
?> <div class="bg-<?=$class;?>" style="width:150px;">
</tr> <?=$online;?>
<?php </div>
} // foreach ?> </td>
</tr>
<?php
endforeach; ?>
</tbody>
</table> </table>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment