From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Schantl To: development@lists.ipfire.org Subject: [PATCH 07/19] ovpnclients.dat: Add table header. Date: Mon, 13 Apr 2020 09:45:38 +0200 Message-ID: <20200413074550.2735-7-stefan.schantl@ipfire.org> In-Reply-To: <20200413074550.2735-1-stefan.schantl@ipfire.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="===============2310401358449321521==" List-Id: --===============2310401358449321521== Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The header will be dynamically generated, according the items which will be displayed. Signed-off-by: Stefan Schantl --- html/cgi-bin/logs.cgi/ovpnclients.dat | 46 +++++++++++++++++++-------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ov= pnclients.dat index b601fd292..33d6d8717 100755 --- a/html/cgi-bin/logs.cgi/ovpnclients.dat +++ b/html/cgi-bin/logs.cgi/ovpnclients.dat @@ -243,7 +243,21 @@ my $lines =3D 0; =20 print ""; =20 -my $col=3D""; +my $col =3D "bgcolor=3D'$color{'color20'}'"; + + print "\n"; + print "\n"; + print "\n"; + print "\n"; + print "\n"; + } else { + print "\n"; =20 while(my @row =3D $statement_handle->fetchrow_array()) { # Assign some nice to read variable names for the DB fields. @@ -253,23 +267,29 @@ while(my @row =3D $statement_handle->fetchrow_array()) { my $connection_bytes_recieved =3D &General::formatBytes($row[3]); my $connection_bytes_sent =3D &General::formatBytes($row[4]); =20 - # Colorize columns.=20 + # Colorize columns. if ($lines % 2) { + $col=3D"bgcolor=3D'$color{'color20'}'"; + } else { $col=3D"bgcolor=3D'$color{'color22'}'"; + } + + print "\n"; + print "\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "\n"; + print "\n"; + print "\n"; + print "\n"; } else { - $col=3D"bgcolor=3D'$color{'color20'}'"; + # Convert total connection time into human-readable format. + my $total_time =3D &General::format_time($row[1]); + + print "\n"; } =20 -print < - - - - - - -END -; + print "\n"; =20 # Increase lines count. $lines++; --=20 2.26.0 --===============2310401358449321521==--
$Lang::tr{'ovpn connection name'}\n"; + + if ($cgiparams{'CONNECTION_NAME'}) { + print "$Lang::tr{'connected'}$Lang::tr{'disconnected'}$Lang::tr{'recieved'}$Lang::tr{'sent'}$Lang::tr{'total connection time'}\n"; + } + + print "
$connection_name$connection_open_time$connection_close_time$connection_bytes_recieved$connection_bytes_sent$total_time$connection_name$connection_open_time$connection_close_time$connection_bytes_recieved$connection_bytes_sent