diff options
author | Colin Fleming <cj_fleming@sky.com> | 2013-11-14 13:44:59 +0000 |
---|---|---|
committer | Colin Fleming <cj_fleming@sky.com> | 2013-11-14 13:44:59 +0000 |
commit | 17b8c60a398c225db03cedbb936aa62b97cb4ee3 (patch) | |
tree | 4d9e4d1da58f4bcef218621252d8bcd6d5528312 | |
parent | eef01b14df77186f9c1205e9e5cb83f80407d7fd (diff) | |
download | pfsense-17b8c60a398c225db03cedbb936aa62b97cb4ee3.zip pfsense-17b8c60a398c225db03cedbb936aa62b97cb4ee3.tar.gz |
Tidy up the "Helper Icons"
The "Helper Icons" at the top right of some service pages at present
produces 30+ HTML errors/warnings, this is due to the table cell being
wrapped in a span statement then in a div statement, table cells can
only be part of a table row then within a table statement.
- remove the table cell definitions from /etc/inc/service-utils.inc
- add the table cell definition from /etc/inc/service-utils.inc to
/usr/local/www/status_services.php and add some logic to determine if
the service is running which will then determine which class statement
to use and pad the icon with a space
- apply the same table cell definition and logic as above to
/usr/local/www/widgets/widgets/services_status.widget.php
-rw-r--r-- | etc/inc/service-utils.inc | 12 | ||||
-rwxr-xr-x | usr/local/www/status_services.php | 17 | ||||
-rw-r--r-- | usr/local/www/widgets/widgets/services_status.widget.php | 18 |
3 files changed, 26 insertions, 21 deletions
diff --git a/etc/inc/service-utils.inc b/etc/inc/service-utils.inc index 4547a53..509a764 100644 --- a/etc/inc/service-utils.inc +++ b/etc/inc/service-utils.inc @@ -442,23 +442,19 @@ function get_service_status_icon($service, $withtext = true, $smallicon = false) $output = ""; if(get_service_status($service)) { $statustext = gettext("Running"); - $output .= '<td class="listr" align="center">' . "\n"; $output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/"; $output .= ($smallicon) ? "icon_pass.gif" : "icon_service_running.gif"; - $output .= "\" alt=\"status\" />"; + $output .= "\" alt=\"status\" /> "; if ($withtext) - $output .= " " . $statustext; - $output .= "</td>\n"; + $output .= " " . $statustext; } else { $service_enabled = is_service_enabled($service['name']); $statustext = ($service_enabled) ? gettext("Stopped") : gettext("Disabled"); - $output .= '<td class="listbg" align="center">' . "\n"; $output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/"; $output .= ($smallicon) ? "icon_block.gif" : "icon_service_stopped.gif"; - $output .= "\" alt=\"status\" />"; + $output .= "\" alt=\"status\" /> "; if ($withtext) - $output .= " " . "<font color=\"white\">{$statustext}</font>"; - $output .= "</td>\n"; + $output .= " <font color=\"white\">{$statustext}</font>"; } return $output; } diff --git a/usr/local/www/status_services.php b/usr/local/www/status_services.php index 1f1fee5..48f9db4 100755 --- a/usr/local/www/status_services.php +++ b/usr/local/www/status_services.php @@ -93,11 +93,16 @@ if (count($services) > 0) { continue; if (empty($service['description'])) $service['description'] = get_pkg_descr($service['name']); - echo '<tr><td class="listlr" width="20%">' . $service['name'] . '</td>' . "\n"; - echo '<td class="listr" width="55%">' . $service['description'] . '</td>' . "\n"; - echo get_service_status_icon($service, true, true); - echo '<td valign="middle" class="list nowrap">'; - echo get_service_control_links($service); + echo "<tr><td class=\"listlr\" width=\"20%\">" . $service['name'] . "</td>\n"; + echo "<td class=\"listr\" width=\"55%\">" . $service['description'] . "</td>\n"; + // if service is running then listr else listbg + $bgclass = null; + if (get_service_status($service)) + $bgclass = "listr"; + else + $bgclass = "listbg"; + echo "<td class=\"" . $bgclass . "\" align=\"center\">" . get_service_status_icon($service, true, true) . "</td>\n"; + echo "<td valign=\"middle\" class=\"list nowrap\">" . get_service_control_links($service); $scut = get_shortcut_by_service_name($service['name']); if (!empty($scut)) { echo get_shortcut_main_link($scut, true, $service); @@ -107,7 +112,7 @@ if (count($services) > 0) { echo "</td></tr>\n"; } } else { - echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . ".</td></tr>\n"; + echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . " . </td></tr>\n"; } ?> diff --git a/usr/local/www/widgets/widgets/services_status.widget.php b/usr/local/www/widgets/widgets/services_status.widget.php index 9ae8696..dfe172b 100644 --- a/usr/local/www/widgets/widgets/services_status.widget.php +++ b/usr/local/www/widgets/widgets/services_status.widget.php @@ -73,15 +73,19 @@ if (count($services) > 0) { if (empty($service['description'])) $service['description'] = get_pkg_descr($service['name']); $service_desc = explode(".",$service['description']); - echo '<tr><td class="listlr">' . $service['name'] . '</td>' . "\n"; - echo '<td class="listr">' . $service_desc[0] . '</td>' . "\n"; - echo get_service_status_icon($service, false, true); - echo '<td valign="middle" class="list nowrap">'; - echo get_service_control_links($service); - echo "</td></tr>\n"; + echo "<tr><td class=\"listlr\">" . $service['name'] . "</td>\n"; + echo "<td class=\"listr\">" . $service_desc[0] . "</td>\n"; + // if service is running then listr else listbg + $bgclass = null; + if (get_service_status($service)) + $bgclass = "listr"; + else + $bgclass = "listbg"; + echo "<td class=\"" . $bgclass . "\" align=\"center\">" . get_service_status_icon($service, true, true) . "</td>\n"; + echo "<td valign=\"middle\" class=\"list nowrap\">" . get_service_control_links($service) . "</td></tr>\n"; } } else { - echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . ".</td></tr>\n"; + echo "<tr><td colspan=\"3\" align=\"center\">" . gettext("No services found") . " . </td></tr>\n"; } ?> </table> |