summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-10-28 09:24:56 -0200
committerRenato Botelho <garga@FreeBSD.org>2014-10-28 09:24:56 -0200
commit30cb409d6368287dbdc985a1ea32523746ed0613 (patch)
treed1e1545d7b079824bd21b6dd268d402dab1b745d /usr
parentbf50b0a42ff10ac5e489f3fa838ed1ef51f9556c (diff)
downloadpfsense-30cb409d6368287dbdc985a1ea32523746ed0613.zip
pfsense-30cb409d6368287dbdc985a1ea32523746ed0613.tar.gz
Simplify logic
Diffstat (limited to 'usr')
-rw-r--r--usr/local/www/widgets/widgets/interfaces.widget.php41
1 files changed, 20 insertions, 21 deletions
diff --git a/usr/local/www/widgets/widgets/interfaces.widget.php b/usr/local/www/widgets/widgets/interfaces.widget.php
index dd65b0e..fae51a4 100644
--- a/usr/local/www/widgets/widgets/interfaces.widget.php
+++ b/usr/local/www/widgets/widgets/interfaces.widget.php
@@ -55,6 +55,21 @@ foreach ($ifdescrs as $ifdescr => $ifname):
$icon = 'wlan_d';
} else
$icon = 'cablenic';
+
+ if ($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") {
+ $status = '-up';
+ $status_text = 'up';
+ $status_icon = 'icon_interface_up.gif';
+ } elseif ($ifinfo['status'] == "no carrier") {
+ $status = '-down';
+ $status_text = 'down';
+ $status_icon = 'icon_interface_down.gif';
+ } elseif ($ifinfo['status'] == "down") {
+ $status = '-block';
+ $status_text = 'disabled';
+ $status_icon = 'icon_block.gif';
+ } else
+ $status = '';
?>
<tr>
<td class="vncellt" rowspan="2">
@@ -71,32 +86,16 @@ foreach ($ifdescrs as $ifdescr => $ifname):
?>
</td>
<?php
- if($ifinfo['status'] == "up" || $ifinfo['status'] == "associated"):
-?>
- <td rowspan="2" class="listr" align="center">
- <div id="<?php echo $ifname;?>-up" style="display:inline" >
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_up.gif" title="<?=$ifname;?> is up" alt="up" />
- </div>
- </td>
-<?php
- elseif ($ifinfo['status'] == "no carrier"):
-?>
- <td rowspan="2" class="listr" align="center">
- <div id="<?php echo $ifname;?>-down" style="display:inline" >
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_down.gif" title="<?=$ifname;?> is down" alt="down" />
- </div>
- </td>
-<?php
- elseif ($ifinfo['status'] == "down"):
+ if ($status === ''):
+ echo htmlspecialchars($ifinfo['status']);
+ else:
?>
<td rowspan="2" class="listr" align="center">
- <div id="<?php echo $ifname;?>-block" style="display:inline" >
- <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" title="<?=$ifname;?> is disabled" alt="disabled" />
+ <div id="<?php echo $ifname . $status;?>" style="display:inline" >
+ <img src="./themes/<?= $g['theme']; ?>/images/icons/<?=$status_icon;?>" title="<?=$ifname;?> is <?=$status_text;?>" alt="<?=$status;?>" />
</div>
</td>
<?php
- else:
- echo htmlspecialchars($ifinfo['status']);
endif;
?>
<td class="listr">
OpenPOWER on IntegriCloud