mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
ovpnclients.dat: Add table header.
The header will be dynamically generated, according the items which will be displayed. Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org> Signed-off-by: Arne Fitzenreiter <arne_f@ipfire.org>
This commit is contained in:
committed by
Arne Fitzenreiter
parent
896e882cf3
commit
d5b6023c32
@@ -243,7 +243,21 @@ my $lines = 0;
|
|||||||
|
|
||||||
print "<table width='100%' class='tbl'>";
|
print "<table width='100%' class='tbl'>";
|
||||||
|
|
||||||
my $col="";
|
my $col = "bgcolor='$color{'color20'}'";
|
||||||
|
|
||||||
|
print "<tr>\n";
|
||||||
|
print "<td width='40%' $col><b>$Lang::tr{'ovpn connection name'}</b></td>\n";
|
||||||
|
|
||||||
|
if ($cgiparams{'CONNECTION_NAME'}) {
|
||||||
|
print "<td width='20%' $col><b>$Lang::tr{'connected'}</b></td>\n";
|
||||||
|
print "<td width='20%' $col><b>$Lang::tr{'disconnected'}</b></td>\n";
|
||||||
|
print "<td width='10%' $col><b>$Lang::tr{'recieved'}</b></td>\n";
|
||||||
|
print "<td width='10%' $col><b>$Lang::tr{'sent'}</b></td>\n";
|
||||||
|
} else {
|
||||||
|
print "<td $col><b>$Lang::tr{'total connection time'}</b>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
while(my @row = $statement_handle->fetchrow_array()) {
|
while(my @row = $statement_handle->fetchrow_array()) {
|
||||||
# Assign some nice to read variable names for the DB fields.
|
# Assign some nice to read variable names for the DB fields.
|
||||||
@@ -253,23 +267,29 @@ while(my @row = $statement_handle->fetchrow_array()) {
|
|||||||
my $connection_bytes_recieved = &General::formatBytes($row[3]);
|
my $connection_bytes_recieved = &General::formatBytes($row[3]);
|
||||||
my $connection_bytes_sent = &General::formatBytes($row[4]);
|
my $connection_bytes_sent = &General::formatBytes($row[4]);
|
||||||
|
|
||||||
# Colorize columns.
|
# Colorize columns.
|
||||||
if ($lines % 2) {
|
if ($lines % 2) {
|
||||||
$col="bgcolor='$color{'color22'}'";
|
|
||||||
} else {
|
|
||||||
$col="bgcolor='$color{'color20'}'";
|
$col="bgcolor='$color{'color20'}'";
|
||||||
|
} else {
|
||||||
|
$col="bgcolor='$color{'color22'}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
print <<END
|
print "<tr>\n";
|
||||||
<tr>
|
print "<td width='40%' $col>$connection_name</td>\n";
|
||||||
<td width="40%" align="left" $col>$connection_name</td>
|
|
||||||
<td width="20%" align="center" $col>$connection_open_time</td>
|
if ($cgiparams{'CONNECTION_NAME'}) {
|
||||||
<td width="20%" align="center" $col>$connection_close_time</td>
|
print "<td width='20%' $col>$connection_open_time</td>\n";
|
||||||
<td width="10%" align="center" $col>$connection_bytes_recieved</td>
|
print "<td width='20%' $col>$connection_close_time</td>\n";
|
||||||
<td width="10%" align="center" $col>$connection_bytes_sent</td>
|
print "<td width='10%' $col>$connection_bytes_recieved</td>\n";
|
||||||
</tr>
|
print "<td width='10%' $col>$connection_bytes_sent</td>\n";
|
||||||
END
|
} else {
|
||||||
;
|
# Convert total connection time into human-readable format.
|
||||||
|
my $total_time = &General::format_time($row[1]);
|
||||||
|
|
||||||
|
print "<td $col>$total_time</td>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
print "</tr>\n";
|
||||||
|
|
||||||
# Increase lines count.
|
# Increase lines count.
|
||||||
$lines++;
|
$lines++;
|
||||||
|
|||||||
Reference in New Issue
Block a user