From 30cb409d6368287dbdc985a1ea32523746ed0613 Mon Sep 17 00:00:00 2001 From: Renato Botelho Date: Tue, 28 Oct 2014 09:24:56 -0200 Subject: [PATCH] Simplify logic --- .../www/widgets/widgets/interfaces.widget.php | 49 +++++++++---------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/usr/local/www/widgets/widgets/interfaces.widget.php b/usr/local/www/widgets/widgets/interfaces.widget.php index dd65b0e252..fae51a40de 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 = ''; ?> @@ -71,32 +86,16 @@ foreach ($ifdescrs as $ifdescr => $ifname): ?> - -
- up -
- - - -
- down -
- - - -
- disabled -
- - + +
+ <?=$status;?> +
+ +