mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
fifteen-theme: made services.cgi tables themeable
This commit is contained in:
@@ -116,25 +116,33 @@ if ( $querry[0] =~ "processescpu"){
|
|||||||
&Header::openbox('100%', 'left', $Lang::tr{'services'});
|
&Header::openbox('100%', 'left', $Lang::tr{'services'});
|
||||||
print <<END
|
print <<END
|
||||||
<div align='center'>
|
<div align='center'>
|
||||||
<table width='80%' cellspacing='1' border='0'>
|
<table width='80%' cellspacing='1' class='tbl'>
|
||||||
<tr bgcolor='$color{'color20'}'><td align='left'><b>$Lang::tr{'services'}</b></td><td align='center' ><b>$Lang::tr{'status'}</b></td><td align='center'><b>PID</b></td><td align='center'><b>$Lang::tr{'memory'}</b></td></tr>
|
<tr bgcolor='$color{'color20'}'>
|
||||||
|
<th align='left'><b>$Lang::tr{'services'}</b></th>
|
||||||
|
<th align='center' ><b>$Lang::tr{'status'}</b></th>
|
||||||
|
<th align='center'><b>PID</b></th>
|
||||||
|
<th align='center'><b>$Lang::tr{'memory'}</b></th>
|
||||||
|
</tr>
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
my $key = '';
|
my $key = '';
|
||||||
|
my $col="";
|
||||||
foreach $key (sort keys %servicenames){
|
foreach $key (sort keys %servicenames){
|
||||||
$lines++;
|
$lines++;
|
||||||
if ($lines % 2){
|
if ($lines % 2){
|
||||||
print "<tr bgcolor='$color{'color22'}'>\n<td align='left'>";
|
$col="bgcolor='$color{'color22'}'";
|
||||||
|
print "<tr><td align='left' $col>";
|
||||||
print $link{$key};
|
print $link{$key};
|
||||||
print "</td>\n";
|
print "</td>";
|
||||||
}else{
|
}else{
|
||||||
print "<tr bgcolor='$color{'color20'}'>\n<td align='left'>";
|
$col="bgcolor='$color{'color20'}'";
|
||||||
|
print "<tr><td align='left' $col>";
|
||||||
print $link{$key};
|
print $link{$key};
|
||||||
print "</td>\n";
|
print "</td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
my $shortname = $servicenames{$key};
|
my $shortname = $servicenames{$key};
|
||||||
my $status = &isrunning($shortname);
|
my $status = &isrunning($shortname,$col);
|
||||||
|
|
||||||
print "$status\n";
|
print "$status\n";
|
||||||
print "</tr>\n";
|
print "</tr>\n";
|
||||||
@@ -152,14 +160,14 @@ END
|
|||||||
|
|
||||||
print <<END
|
print <<END
|
||||||
<div align='center'>
|
<div align='center'>
|
||||||
<table width='80%' cellspacing='1' border='0'>
|
<table width='80%' cellspacing='1' class='tbl'>
|
||||||
<tr bgcolor='$color{'color20'}'>
|
<tr bgcolor='$color{'color20'}'>
|
||||||
<td align='center'><b>Addon</b></td>
|
<th align='center'><b>Addon</b></th>
|
||||||
<td align='center'><b>Boot</b></td>
|
<th align='center'><b>Boot</b></th>
|
||||||
<td align='center' colspan=2><b>$Lang::tr{'action'}</b></td>
|
<th align='center' colspan=2><b>$Lang::tr{'action'}</b></th>
|
||||||
<td align='center'><b>$Lang::tr{'status'}</b></td>
|
<th align='center'><b>$Lang::tr{'status'}</b></th>
|
||||||
<td align='center'><b>PID</b></td>
|
<th align='center'><b>PID</b></th>
|
||||||
<td align='center'><b>$Lang::tr{'memory'}</b></td>
|
<th align='center'><b>$Lang::tr{'memory'}</b></th>
|
||||||
</tr>
|
</tr>
|
||||||
END
|
END
|
||||||
;
|
;
|
||||||
@@ -183,16 +191,18 @@ END
|
|||||||
if ( ($_ ne "alsa") && ($_ ne "mdadm") ) {
|
if ( ($_ ne "alsa") && ($_ ne "mdadm") ) {
|
||||||
$lines++;
|
$lines++;
|
||||||
if ($lines % 2){
|
if ($lines % 2){
|
||||||
print "<tr bgcolor='$color{'color22'}'>";
|
print "<tr>";
|
||||||
|
$col="bgcolor='$color{'color22'}'";
|
||||||
}else{
|
}else{
|
||||||
print "<tr bgcolor='$color{'color20'}'>";
|
print "<tr>";
|
||||||
|
$col="bgcolor='$color{'color20'}'";
|
||||||
}
|
}
|
||||||
print "<td align='left'>$_</td> ";
|
print "<td align='left' $col>$_</td> ";
|
||||||
my $status = isautorun($_);
|
my $status = isautorun($_,$col);
|
||||||
print "$status ";
|
print "$status ";
|
||||||
print "<td align='center'><A HREF=services.cgi?$_!start><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></A></td>";
|
print "<td align='center' $col><A HREF=services.cgi?$_!start><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></A></td>";
|
||||||
print "<td align='center'><A HREF=services.cgi?$_!stop><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></A></td> ";
|
print "<td align='center' $col><A HREF=services.cgi?$_!stop><img alt='$Lang::tr{'stop'}' title='$Lang::tr{'stop'}' src='/images/go-down.png' border='0' /></A></td> ";
|
||||||
my $status = &isrunningaddon($_);
|
my $status = &isrunningaddon($_,$col);
|
||||||
$status =~ s/\\[[0-1]\;[0-9]+m//g;
|
$status =~ s/\\[[0-1]\;[0-9]+m//g;
|
||||||
|
|
||||||
chomp($status);
|
chomp($status);
|
||||||
@@ -219,16 +229,17 @@ END
|
|||||||
|
|
||||||
sub isautorun{
|
sub isautorun{
|
||||||
my $cmd = $_[0];
|
my $cmd = $_[0];
|
||||||
my $status = "<td align='center'></td>";
|
my $col = $_[1];
|
||||||
|
my $status = "<td align='center' $col></td>";
|
||||||
my $init = `find /etc/rc.d/rc3.d/S??${cmd} 2>/dev/null`;
|
my $init = `find /etc/rc.d/rc3.d/S??${cmd} 2>/dev/null`;
|
||||||
chomp ($init);
|
chomp ($init);
|
||||||
if ($init ne ''){
|
if ($init ne ''){
|
||||||
$status = "<td align='center'><A HREF=services.cgi?$_!disable><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></A></td>";
|
$status = "<td align='center' $col><A HREF=services.cgi?$_!disable><img alt='$Lang::tr{'deactivate'}' title='$Lang::tr{'deactivate'}' src='/images/on.gif' border='0' width='16' height='16' /></A></td>";
|
||||||
}
|
}
|
||||||
$init = `find /etc/rc.d/rc3.d/off/S??${cmd} 2>/dev/null`;
|
$init = `find /etc/rc.d/rc3.d/off/S??${cmd} 2>/dev/null`;
|
||||||
chomp ($init);
|
chomp ($init);
|
||||||
if ($init ne ''){
|
if ($init ne ''){
|
||||||
$status = "<td align='center'><A HREF=services.cgi?$_!enable><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></A></td>";
|
$status = "<td align='center' $col><A HREF=services.cgi?$_!enable><img alt='$Lang::tr{'activate'}' title='$Lang::tr{'activate'}' src='/images/off.gif' border='0' width='16' height='16' /></A></td>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return $status;
|
return $status;
|
||||||
@@ -236,7 +247,8 @@ sub isautorun{
|
|||||||
|
|
||||||
sub isrunning{
|
sub isrunning{
|
||||||
my $cmd = $_[0];
|
my $cmd = $_[0];
|
||||||
my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></td>";
|
my $col = $_[1];
|
||||||
|
my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>";
|
||||||
my $pid = '';
|
my $pid = '';
|
||||||
my $testcmd = '';
|
my $testcmd = '';
|
||||||
my $exename;
|
my $exename;
|
||||||
@@ -267,7 +279,7 @@ sub isrunning{
|
|||||||
close(FILE);
|
close(FILE);
|
||||||
}
|
}
|
||||||
if ($testcmd =~ /$exename/){
|
if ($testcmd =~ /$exename/){
|
||||||
$status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td><td align='center'>$pid</td><td align='center'>$memory</td>";
|
$status = "<td align='center' bgcolor='${Header::colourgreen}'><font color='white'><b>$Lang::tr{'running'}</b></font></td><td align='center' $col>$pid</td><td align='center' $col>$memory</td>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $status;
|
return $status;
|
||||||
@@ -275,7 +287,8 @@ sub isrunning{
|
|||||||
|
|
||||||
sub isrunningaddon{
|
sub isrunningaddon{
|
||||||
my $cmd = $_[0];
|
my $cmd = $_[0];
|
||||||
my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></td>";
|
my $col = $_[1];
|
||||||
|
my $status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2' $col></td>";
|
||||||
my $pid = '';
|
my $pid = '';
|
||||||
my $testcmd = '';
|
my $testcmd = '';
|
||||||
my $exename;
|
my $exename;
|
||||||
@@ -293,7 +306,7 @@ sub isrunningaddon{
|
|||||||
$testcmd =~ s///gi;
|
$testcmd =~ s///gi;
|
||||||
|
|
||||||
my @pid = split(/\s/,$testcmd);
|
my @pid = split(/\s/,$testcmd);
|
||||||
$status .="<td align='center'>$pid[0]</td>";
|
$status .="<td align='center' $col>$pid[0]</td>";
|
||||||
|
|
||||||
my $memory = 0;
|
my $memory = 0;
|
||||||
|
|
||||||
@@ -305,9 +318,9 @@ sub isrunningaddon{
|
|||||||
}
|
}
|
||||||
$memory+=$memory[0];
|
$memory+=$memory[0];
|
||||||
}
|
}
|
||||||
$status .="<td align='center'>$memory KB</td>";
|
$status .="<td align='center' $col>$memory KB</td>";
|
||||||
}else{
|
}else{
|
||||||
$status = "<td align='center' bgcolor='${Header::colourred}'><font color='white'><b>$Lang::tr{'stopped'}</b></font></td><td colspan='2'></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;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user