diff options
author | Phil Davis <phil.davis@inf.org> | 2015-12-09 18:20:28 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2015-12-09 18:20:28 +0545 |
commit | 501e25be3c4a9ed684c743bf23c3c0cb842172f7 (patch) | |
tree | 521c0ba24ec013b2d7ce9ed69eaeb1cfb71a254a | |
parent | 811fbcd82624689ae077633e076947ca06ba3456 (diff) | |
download | pfsense-501e25be3c4a9ed684c743bf23c3c0cb842172f7.zip pfsense-501e25be3c4a9ed684c743bf23c3c0cb842172f7.tar.gz |
Widgets format and white space
10 files changed, 121 insertions, 90 deletions
diff --git a/src/usr/local/www/widgets/widgets/carp_status.widget.php b/src/usr/local/www/widgets/widgets/carp_status.widget.php index 642b0f4..e5c2e0e 100644 --- a/src/usr/local/www/widgets/widgets/carp_status.widget.php +++ b/src/usr/local/www/widgets/widgets/carp_status.widget.php @@ -93,20 +93,30 @@ $carp_enabled = get_carp_status(); $status = "DISABLED"; echo '<i class="fa fa-ban"></i>'; } else { - if($status == "MASTER") { + if ($status == "MASTER") { echo '<i class="fa fa-arrow-right"></i>'; - } else if($status == "BACKUP") { + } else if ($status == "BACKUP") { echo '<i class="fa fa-arrow-right"></i>'; - } else if($status == "INIT") { + } else if ($status == "INIT") { echo '<i class="fa fa-list-alt"></i>'; } } - if ($ipaddress){ ?> + if ($ipaddress) { +?> + <?=htmlspecialchars($status);?> - <?=htmlspecialchars($ipaddress);}?> -</td></tr><?php } - } else { ?> + <?=htmlspecialchars($ipaddress);?> +<?php + } +?> +</td></tr> +<?php + } + } else { +?> <tr><td>No CARP Interfaces Defined. Click <a href="carp_status.php">here</a> to configure CARP.</td></tr> -<?php } ?> +<?php + } +?> </table> </div> diff --git a/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php b/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php index cb4612e..24b8c0e 100644 --- a/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php +++ b/src/usr/local/www/widgets/widgets/dyn_dns_status.widget.php @@ -1,6 +1,6 @@ <?php /* - Original status page code from: services_dyndns.php + dyn_dns_status.widget.php */ /* ==================================================================== * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. @@ -71,7 +71,7 @@ if (!is_array($config['dyndnses']['dyndns'])) { $a_dyndns = &$config['dyndnses']['dyndns']; -if($_REQUEST['getdyndnsstatus']) { +if ($_REQUEST['getdyndnsstatus']) { $first_entry = true; foreach ($a_dyndns as $dyndns) { if ($first_entry) { diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php index 59fa21d..0836716 100644 --- a/src/usr/local/www/widgets/widgets/gateways.widget.php +++ b/src/usr/local/www/widgets/widgets/gateways.widget.php @@ -75,7 +75,7 @@ if (isset($config["widgets"]["gateways_widget"]["display_type"])) { } // Compose the table contents and pass it back to the ajax caller -if($_REQUEST && $_REQUEST['ajax']) { +if ($_REQUEST && $_REQUEST['ajax']) { global $a_gateways, $gateways_status; print("<thead>\n"); @@ -167,7 +167,7 @@ if($_REQUEST && $_REQUEST['ajax']) { print( "<td>" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "</td>\n"); print('<td class="bg-' . $bgcolor . '">' . $online . "</td>\n"); print("</tr>\n"); - } + } print("</tbody>\n"); @@ -227,23 +227,23 @@ if ($_POST) { <form action="/widgets/widgets/gateways.widget.php" method="post" name="gateways_widget_iform" id="gateways_widget_iform"> Display: <?php - $display_type_gw_ip="checked"; - $display_type_monitor_ip=""; - $display_type_both_ip=""; + $display_type_gw_ip = "checked"; + $display_type_monitor_ip = ""; + $display_type_both_ip = ""; if (isset($config["widgets"]["gateways_widget"]["display_type"])) { $selected_radio = $config["widgets"]["gateways_widget"]["display_type"]; if ($selected_radio == "gw_ip") { $display_type_gw_ip = "checked"; - $display_type_monitor_ip=""; - $display_type_both_ip=""; + $display_type_monitor_ip = ""; + $display_type_both_ip = ""; } else if ($selected_radio == "monitor_ip") { $display_type_gw_ip = ""; - $display_type_monitor_ip="checked"; - $display_type_both_ip=""; + $display_type_monitor_ip = "checked"; + $display_type_both_ip = ""; } else if ($selected_radio == "both_ip") { $display_type_gw_ip = ""; - $display_type_monitor_ip=""; - $display_type_both_ip="checked"; + $display_type_monitor_ip = ""; + $display_type_both_ip = "checked"; } } ?> diff --git a/src/usr/local/www/widgets/widgets/installed_packages.widget.php b/src/usr/local/www/widgets/widgets/installed_packages.widget.php index 5b85b6b..255212a 100644 --- a/src/usr/local/www/widgets/widgets/installed_packages.widget.php +++ b/src/usr/local/www/widgets/widgets/installed_packages.widget.php @@ -66,7 +66,7 @@ require_once("functions.inc"); require_once("/usr/local/www/widgets/include/installed_packages.inc"); require_once("pkg-utils.inc"); -if($_REQUEST && $_REQUEST['ajax']) { +if ($_REQUEST && $_REQUEST['ajax']) { $package_list = get_pkg_info(); $installed_packages = array_filter($package_list, function($v) { return (isset($v['installed']) || isset($v['broken'])); @@ -153,13 +153,13 @@ if($_REQUEST && $_REQUEST['ajax']) { print( "<td>\n"); print( '<a title="' . gettext("Remove") . '" href="pkg_mgr_install.php?mode=delete&pkg=' . $pkg['name'] . '"><i class="fa fa-trash"></i></a>'."\n"); - if($upgradeavail) { + if ($upgradeavail) { print( '<a title="' . gettext("Update") . '" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=' . $pkg['name'] . $vergetstr . '"><i class="fa fa-refresh"></i></a>'."\n"); } else { print( '<a title="' . gettext("Reinstall") . '" href="pkg_mgr_install.php?mode=reinstallpkg&pkg=' . $pkg['name'] . '"><i class="fa fa-retweet"></i></a>'."\n"); } - if(!isset($g['disablepackageinfo']) && $pkg['www'] != 'UNKNOWN') { + if (!isset($g['disablepackageinfo']) && $pkg['www'] != 'UNKNOWN') { print( '<a target="_blank" title="' . gettext("View more information") . '" href="' . htmlspecialchars($pkg['www']) . '"><i class="fa fa-info"></i></a>'."\n"); } diff --git a/src/usr/local/www/widgets/widgets/ipsec.widget.php b/src/usr/local/www/widgets/widgets/ipsec.widget.php index bffa87f..5011e3a 100644 --- a/src/usr/local/www/widgets/widgets/ipsec.widget.php +++ b/src/usr/local/www/widgets/widgets/ipsec.widget.php @@ -182,8 +182,9 @@ if ($_REQUEST && $_REQUEST['ajax']) { case "mobile" : foreach ($mobile['pool'] as $pool) { - if (!is_array($pool['lease'])) + if (!is_array($pool['lease'])) { continue; + } foreach ($pool['lease'] as $muser) { print(" <tr>\n"); @@ -259,7 +260,7 @@ if (isset($config['ipsec']['phase2'])): ?> <?php endif; // This function was in index.php It seems that the ipsec widget is the only place it is used -// so now it lives here. It wouldn't hurt to update this functions and the tab display, but it +// so now it lives here. It wouldn't hurt to update this function and the tab display, but it // looks OK for now. The display_widget_tabs() function in guiconfig.inc would need to be updated to match ?> <script type="text/javascript"> @@ -316,7 +317,7 @@ function get_ipsec_stats() { ajaxRequest = $.ajax({ url: "/widgets/widgets/ipsec.widget.php", type: "post", - data: { + data: { ajax: "ajax", tab: curtab } diff --git a/src/usr/local/www/widgets/widgets/ntp_status.widget.php b/src/usr/local/www/widgets/widgets/ntp_status.widget.php index 037db1a..536e40e 100644 --- a/src/usr/local/www/widgets/widgets/ntp_status.widget.php +++ b/src/usr/local/www/widgets/widgets/ntp_status.widget.php @@ -65,8 +65,8 @@ function getServerDateItems($inDate) { return date('Y,n,j,G,',$inDate).intval(date('i',$inDate)).','.intval(date('s',$inDate)); // year (4-digit),month,day,hours (0-23),minutes,seconds // use intval to strip leading zero from minutes and seconds - // so JavaScript won't try to interpret them in octal - // (use intval instead of ltrim, which translates '00' to '') + // so JavaScript won't try to interpret them in octal + // (use intval instead of ltrim, which translates '00' to '') } function clockTimeString($inDate, $showSeconds) { @@ -110,7 +110,7 @@ if ($_REQUEST['updateme']) { $tmp = $tmp[1]; if (substr($tmp, 0, 6) == '$GPRMC') { $gps_vars = explode(",", $tmp); - $gps_ok = ($gps_vars[2] == "A"); + $gps_ok = ($gps_vars[2] == "A"); $gps_lat_deg = substr($gps_vars[3], 0, 2); $gps_lat_min = substr($gps_vars[3], 2) / 60.0; $gps_lon_deg = substr($gps_vars[5], 0, 3); @@ -123,7 +123,7 @@ if ($_REQUEST['updateme']) { $gps_lo = $gps_vars[6]; } elseif (substr($tmp, 0, 6) == '$GPGGA') { $gps_vars = explode(",", $tmp); - $gps_ok = $gps_vars[6]; + $gps_ok = $gps_vars[6]; $gps_lat_deg = substr($gps_vars[2], 0, 2); $gps_lat_min = substr($gps_vars[2], 2) / 60.0; $gps_lon_deg = substr($gps_vars[4], 0, 3); @@ -139,7 +139,7 @@ if ($_REQUEST['updateme']) { $gps_lo = $gps_vars[5]; } elseif (substr($tmp, 0, 6) == '$GPGLL') { $gps_vars = explode(",", $tmp); - $gps_ok = ($gps_vars[6] == "A"); + $gps_ok = ($gps_vars[6] == "A"); $gps_lat_deg = substr($gps_vars[1], 0, 2); $gps_lat_min = substr($gps_vars[1], 2) / 60.0; $gps_lon_deg = substr($gps_vars[3], 0, 3); diff --git a/src/usr/local/www/widgets/widgets/services_status.widget.php b/src/usr/local/www/widgets/widgets/services_status.widget.php index e6bb352..8cd5dad 100644 --- a/src/usr/local/www/widgets/widgets/services_status.widget.php +++ b/src/usr/local/www/widgets/widgets/services_status.widget.php @@ -65,7 +65,7 @@ require_once("/usr/local/www/widgets/include/services_status.inc"); $services = get_services(); -if($_POST) { +if ($_POST) { $validNames = array(); foreach ($services as $service) { diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php index e89e8e1..03c439b 100644 --- a/src/usr/local/www/widgets/widgets/system_information.widget.php +++ b/src/usr/local/www/widgets/widgets/system_information.widget.php @@ -120,12 +120,12 @@ $filesystems = get_mounted_filesystems(); (<?php echo php_uname("m"); ?>) <br /> built on <?php readfile("/etc/version.buildtime"); ?> - <?php if(!$g['hideuname']): ?> + <?php if (!$g['hideuname']): ?> <br /> <span title="<?php echo php_uname("a"); ?>"><?php echo php_uname("s") . " " . php_uname("r"); ?></span> <?php endif; ?> <br/><br/> - <?php if(!isset($config['system']['firmware']['disablecheck'])): ?> + <?php if (!isset($config['system']['firmware']['disablecheck'])): ?> <div id='updatestatus'><?php echo gettext("Obtaining update status "); ?><i class="fa fa-cog fa-spin"></i></div> <?php endif; ?> </td> @@ -163,12 +163,13 @@ $filesystems = get_mounted_filesystems(); <tr> <th><?=gettext("CPU Type");?></th> <td><?=htmlspecialchars(get_single_sysctl("hw.model"))?> - <div id="cpufreq"><?= get_cpufreq(); ?></div> + <div id="cpufreq"><?= get_cpufreq(); ?></div> <?php $cpucount = get_cpu_count(); if ($cpucount > 1): ?> - <div id="cpucount"> - <?= htmlspecialchars($cpucount) ?> CPUs: <?= htmlspecialchars(get_cpu_count(true)); ?></div> + <div id="cpucount"> + <?= htmlspecialchars($cpucount) ?> CPUs: <?= htmlspecialchars(get_cpu_count(true)); ?> + </div> <?php endif; ?> </td> </tr> @@ -208,7 +209,8 @@ $filesystems = get_mounted_filesystems(); <tr> <th><?=gettext("State table size");?></th> <td> - <?php $pfstatetext = get_pfstate(); + <?php + $pfstatetext = get_pfstate(); $pfstateusage = get_pfstate(true); ?> <div class="progress"> @@ -245,7 +247,7 @@ $filesystems = get_mounted_filesystems(); <tr> <th><?=gettext("Load average");?></th> <td> - <div id="load_average" title="Last 1, 5 and 15 minutes"><?= get_load_average(); ?></div> + <div id="load_average" title="Last 1, 5 and 15 minutes"><?= get_load_average(); ?></div> </td> </tr> <tr> @@ -263,11 +265,11 @@ $filesystems = get_mounted_filesystems(); <td> <?php $memUsage = mem_usage(); ?> - <div class="progress" > - <div id="memUsagePB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$memUsage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$memUsage?>%"> - </div> + <div class="progress" > + <div id="memUsagePB" class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$memUsage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$memUsage?>%"> </div> - <span id="memusagemeter"><?=$memUsage?></span><span>% of <?= sprintf("%.0f", get_single_sysctl('hw.physmem') / (1024*1024)) ?> MB</span> + </div> + <span id="memusagemeter"><?=$memUsage?></span><span>% of <?= sprintf("%.0f", get_single_sysctl('hw.physmem') / (1024*1024)) ?> MB</span> </td> </tr> <?php if ($showswap == true): ?> @@ -279,7 +281,7 @@ $filesystems = get_mounted_filesystems(); <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="<?=$swapusage?>" aria-valuemin="0" aria-valuemax="100" style="width: <?=$swapusage?>%"> </div> </div> - <span><?=$swapusage?>% of <?= sprintf("%.0f", `/usr/sbin/swapinfo -m | /usr/bin/grep -v Device | /usr/bin/awk '{ print $2;}'`) ?> MB</span> + <span><?=$swapusage?>% of <?= sprintf("%.0f", `/usr/sbin/swapinfo -m | /usr/bin/grep -v Device | /usr/bin/awk '{ print $2;}'`) ?> MB</span> </td> </tr> <?php endif; ?> @@ -287,16 +289,16 @@ $filesystems = get_mounted_filesystems(); <th><?=gettext("Disk usage");?></th> <td> <table class="table"> -<?PHP foreach ($filesystems as $fs): ?> - <tr> - <th><?=$fs['mountpoint']?></th> - <td><?=$fs['type'] . ("md" == substr(basename($fs['device']), 0, 2) ? " in RAM" : "")?></td> - <td><?=$fs['total_size']?></td> - <td> - <span><?=$fs['percent_used']?>%</span> - </td> - </tr> -<?PHP endforeach; ?> +<?php foreach ($filesystems as $fs): ?> + <tr> + <th><?=$fs['mountpoint']?></th> + <td><?=$fs['type'] . ("md" == substr(basename($fs['device']), 0, 2) ? " in RAM" : "")?></td> + <td><?=$fs['total_size']?></td> + <td> + <span><?=$fs['percent_used']?>%</span> + </td> + </tr> +<?php endforeach; ?> </table> </td> </tr> @@ -383,75 +385,88 @@ function stats(x) { } function updateMemory(x) { - if(jQuery('#memusagemeter')) + if (jQuery('#memusagemeter')) { jQuery("#memusagemeter").html(x); - if(jQuery('#memUsagePB')) { + } + if (jQuery('#memUsagePB')) { setProgress('memUsagePB', parseInt(x)); } } function updateMbuf(x) { - if(jQuery('#mbuf')) + if (jQuery('#mbuf')) { jQuery("#mbuf").html(x); + } } function updateMbufMeter(x) { - if(jQuery('#mbufusagemeter')) + if (jQuery('#mbufusagemeter')) { jQuery("#mbufusagemeter").html(x + '%'); - if(jQuery('#mbufPB')) + } + if (jQuery('#mbufPB')) { setProgress('mbufPB', parseInt(x)); + } } function updateCPU(x) { - if(jQuery('#cpumeter')) + if (jQuery('#cpumeter')) { jQuery("#cpumeter").html(x + '%'); - if(jQuery('#cpuPB')) + } + if (jQuery('#cpuPB')) { setProgress('cpuPB', parseInt(x)); + } /* Load CPU Graph widget if enabled */ - if(widgetActive('cpu_graphs')) { + if (widgetActive('cpu_graphs')) { GraphValue(graph[0], x); } } function updateTemp(x) { - if(jQuery("#tempmeter")) + if (jQuery("#tempmeter")) { jQuery("#tempmeter").html(x + '\u00B0' + 'C'); - if(jQuery('#tempPB')) + } + if (jQuery('#tempPB')) { jQuery("#tempPB").progressbar( { value: parseInt(x) } ); + } } function updateDateTime(x) { - if(jQuery('#datetime')) + if (jQuery('#datetime')) { jQuery("#datetime").html(x); + } } function updateUptime(x) { - if(jQuery('#uptime')) + if (jQuery('#uptime')) { jQuery("#uptime").html(x); + } } function updateState(x) { - if(jQuery('#pfstate')) + if (jQuery('#pfstate')) { jQuery("#pfstate").html('(' + x + ')'); + } } function updateStateMeter(x) { - if(jQuery('#pfstateusagemeter')) + if (jQuery('#pfstateusagemeter')) { jQuery("#pfstateusagemeter").html(x + '%'); - if(jQuery('#statePB')) + } + if (jQuery('#statePB')) { setProgress('statePB', parseInt(x)); + } } -function updateGatewayStats(x){ - if (widgetActive("gateways")){ +function updateGatewayStats(x) { + if (widgetActive("gateways")) { gateways_split = x.split(","); - for (var y=0; y<gateways_split.length; y++){ + for (var y=0; y<gateways_split.length; y++) { gateways_field_split = gateways_split[y].split("^"); - if(jQuery('#gateway' + (y + 1))) { + if (jQuery('#gateway' + (y + 1))) { jQuery('#gateway' + (y + 1)).html(gateways_field_split[0]); - if(gateways_field_split[1]) { + if (gateways_field_split[1]) { jQuery('#gateway' + (y + 1)).css('background-color',gateways_field_split[1]); } } @@ -460,21 +475,23 @@ function updateGatewayStats(x){ } function updateCpuFreq(x) { - if(jQuery('#cpufreq')) + if (jQuery('#cpufreq')) { jQuery("#cpufreq").html(x); + } } function updateLoadAverage(x) { - if(jQuery('#load_average')) + if (jQuery('#load_average')) { jQuery("#load_average").html(x); + } } -function updateInterfaceStats(x){ - if (widgetActive("interface_statistics")){ +function updateInterfaceStats(x) { + if (widgetActive("interface_statistics")) { statistics_split = x.split(","); var counter = 1; - for (var y=0; y<statistics_split.length-1; y++){ - if(jQuery('#stat' + counter)) { + for (var y=0; y<statistics_split.length-1; y++) { + if (jQuery('#stat' + counter)) { jQuery('#stat' + counter).html(statistics_split[y]); counter++; } @@ -482,15 +499,16 @@ function updateInterfaceStats(x){ } } -function updateInterfaces(x){ - if (widgetActive("interfaces")){ +function updateInterfaces(x) { + if (widgetActive("interfaces")) { interfaces_split = x.split("~"); interfaces_split.each(function(iface){ details = iface.split("^"); - if (details[2] == '') + if (details[2] == '') { ipv4_details = ''; - else + } else { ipv4_details = details[2] + '<br />'; + } switch(details[1]) { case "up": jQuery('#' + details[0] + '-up').css("display","inline"); @@ -520,10 +538,11 @@ function updateInterfaces(x){ function widgetActive(x) { var widget = jQuery('#' + x + '-container'); - if ((widget != null) && (widget.css('display') != null) && (widget.css('display') != "none")) + if ((widget != null) && (widget.css('display') != null) && (widget.css('display') != "none")) { return true; - else + } else { return false; + } } /* start updater */ diff --git a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php index b1131f8..11835c4 100644 --- a/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php +++ b/src/usr/local/www/widgets/widgets/traffic_graphs.widget.php @@ -81,8 +81,9 @@ if (!is_array($a_config["shown"]["item"])) { } $ifdescrs = get_configured_interface_with_descr(); -if (ipsec_enabled()) +if (ipsec_enabled()) { $ifdescrs['enc0'] = "IPsec"; +} if ($_POST) { if (isset($_POST["refreshinterval"]) && is_numeric($_POST["refreshinterval"])) { diff --git a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php index 27f983d..df12e43 100644 --- a/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php +++ b/src/usr/local/www/widgets/widgets/wake_on_lan.widget.php @@ -79,7 +79,7 @@ if (is_array($config['wol']['wolentry'])) { <tbody> <?php if (count($wolcomputers) > 0) { - foreach($wolcomputers as $wolent) { + foreach ($wolcomputers as $wolent) { echo '<tr><td>' . $wolent['descr'] . '<br />' . $wolent['mac'] . '</td>' . "\n"; echo '<td>' . convert_friendly_interface_to_friendly_descr($wolent['interface']) . '</td>' . "\n"; @@ -106,7 +106,7 @@ if (count($wolcomputers) > 0) { echo "<tr><td colspan=\"4\" align=\"center\">" . gettext("No saved WoL addresses") . ".</td></tr>\n"; } ?> -</tbody> + </tbody> </table> <center><a href="status_dhcp_leases.php" class="navlink">DHCP Leases Status</a></center> </div> |