Revision 36d1c798
Added by Jim Pingle about 13 years ago
etc/inc/service-utils.inc | ||
---|---|---|
397 | 397 |
return $running; |
398 | 398 |
} |
399 | 399 |
|
400 |
function get_service_status_icon($service, $withtext = true) { |
|
400 |
function get_service_status_icon($service, $withtext = true, $smallicon = false) {
|
|
401 | 401 |
global $g; |
402 | 402 |
$output = ""; |
403 | 403 |
if(get_service_status($service)) { |
404 | 404 |
$statustext = gettext("Running"); |
405 | 405 |
$output .= '<td class="listr"><center>' . "\n"; |
406 |
$output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/icon_service_running.gif\">"; |
|
406 |
$output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/"; |
|
407 |
$output .= ($smallicon) ? "icon_pass.gif" : "icon_service_running.gif"; |
|
408 |
$output .= "\">"; |
|
407 | 409 |
if ($withtext) |
408 |
$output .= " " . $statustext;
|
|
410 |
$output .= " " . $statustext;
|
|
409 | 411 |
$output .= "</td>\n"; |
410 | 412 |
} else { |
411 | 413 |
$statustext = gettext("Stopped"); |
412 | 414 |
$output .= '<td class="listbg"><center>' . "\n"; |
413 |
$output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/icon_service_stopped.gif\">"; |
|
415 |
$output .= "<img style=\"vertical-align:middle\" title=\"" . sprintf(gettext("%s Service is"),$service["name"]) . " {$statustext}\" src=\"/themes/" . $g["theme"] . "/images/icons/"; |
|
416 |
$output .= ($smallicon) ? "icon_block.gif" : "icon_service_stopped.gif"; |
|
417 |
$output .= "\">"; |
|
414 | 418 |
if ($withtext) |
415 |
$output .= "<font color=\"white\">{$statustext}</font>"; |
|
419 |
$output .= " " . "<font color=\"white\">{$statustext}</font>";
|
|
416 | 420 |
$output .= "</td>\n"; |
417 | 421 |
} |
418 | 422 |
return $output; |
usr/local/www/status_services.php | ||
---|---|---|
257 | 257 |
$service['description'] = get_pkg_descr($service['name']); |
258 | 258 |
echo '<tr><td class="listlr">' . $service['name'] . '</td>' . "\n"; |
259 | 259 |
echo '<td class="listr">' . $service['description'] . '</td>' . "\n"; |
260 |
echo get_service_status_icon($service); |
|
260 |
echo get_service_status_icon($service, true, true);
|
|
261 | 261 |
echo '<td valign="middle" class="list" nowrap>'; |
262 | 262 |
echo get_service_control_links($service); |
263 | 263 |
echo "</td></tr>\n"; |
usr/local/www/widgets/widgets/services_status.widget.php | ||
---|---|---|
74 | 74 |
$service['description'] = get_pkg_descr($service['name']); |
75 | 75 |
echo '<tr><td class="listlr">' . $service['name'] . '</td>' . "\n"; |
76 | 76 |
echo '<td class="listr">' . $service['description'] . '</td>' . "\n"; |
77 |
echo get_service_status_icon($service); |
|
77 |
echo get_service_status_icon($service, false, true);
|
|
78 | 78 |
echo '<td valign="middle" class="list" nowrap>'; |
79 | 79 |
echo get_service_control_links($service); |
80 | 80 |
echo "</td></tr>\n"; |
Also available in: Unified diff
Refine the formatting of the service status icon a bit depending on its context.