* Add restart action to services. * Only display available actions for a service: Start when service is stopped or Stop and Restart when a service is running.
Signed-off-by: Robin Roevens robin.roevens@disroot.org --- html/cgi-bin/services.cgi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi index d480088a8..498d7fd8e 100644 --- a/html/cgi-bin/services.cgi +++ b/html/cgi-bin/services.cgi @@ -189,8 +189,6 @@ END
my $status = isautorun($pak,$service,$col); print "$status "; - print "<td align='center' $col width='8%'><a href='services.cgi?$pak!start!$service'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; - print "<td align='center' $col width='8%'><a href='services.cgi?$pak!stop!$service'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; my $status = isrunningaddon($pak,$service,$col); $status =~ s/\[[0-1];[0-9]+m//g;
@@ -300,7 +298,9 @@ sub isrunningaddon (@) { my $testcmd = @testcmd[0];
if ( $testcmd =~ /is\ running/ && $testcmd !~ /is\ not\ running/){ - $status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>"; + $status = "<td align='center' $col width='8%'><a href='services.cgi?$pak!stop!$service'><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></a></td> "; + $status .= "<td align='center' $col width='8%'><a href='services.cgi?$pak!restart!$service'><img alt='$Lang::tr{'restart'}' title='$Lang::tr{'restart'}' src='/images/reload.gif' border='0' /></a></td> "; + $status .= "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td>"; $testcmd =~ s/.* //gi; $testcmd =~ s/[a-z_]//gi; $testcmd =~ s/[[0-1];[0-9]+//gi; @@ -323,7 +323,8 @@ sub isrunningaddon (@) { } $status .="<td align='center' $col>$memory KB</td>"; }else{ - $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; + $status = "<td align='center' $col width='16%' colspan=2><a href='services.cgi?$pak!start!$service'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>"; + $status .= "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>"; } return $status; }