These changes add the current system time to the footer of the webinterface. Because of differing themes one has to differentiate between legacy themes (ipfire-legacy, darkdos, maniac) and the current standard (ipfire, ipfire-rounded).
--- html/html/themes/darkdos/include/functions.pl | 4 ++ .../themes/ipfire-legacy/include/functions.pl | 36 ++++++++------- html/html/themes/ipfire/include/functions.pl | 33 +++++++------ html/html/themes/maniac/include/functions.pl | 46 ++++++++++--------- 4 files changed, 67 insertions(+), 52 deletions(-)
diff --git a/html/html/themes/darkdos/include/functions.pl b/html/html/themes/darkdos/include/functions.pl index ed3f546b0..9f3547237 100644 --- a/html/html/themes/darkdos/include/functions.pl +++ b/html/html/themes/darkdos/include/functions.pl @@ -19,6 +19,8 @@ # # ###############################################################################
+use POSIX; + sub showmenu() { print <<EOF <div id="menu"> @@ -322,6 +324,7 @@ END
sub closepage () { my $status = &connectionstatus(); + my $localtime_now = strftime "%H:%M:%S", localtime; my $uptime = `/usr/bin/uptime|cut -d " " -f 4-`; $uptime =~ s/year(s|)/$Lang::tr{'year'}/; $uptime =~ s/month(s|)/$Lang::tr{'month'}/; @@ -354,6 +357,7 @@ print <<END <br /> <b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + <b>time:</b> $localtime_now
END ; diff --git a/html/html/themes/ipfire-legacy/include/functions.pl b/html/html/themes/ipfire-legacy/include/functions.pl index 26a8763c1..3ce62ea41 100644 --- a/html/html/themes/ipfire-legacy/include/functions.pl +++ b/html/html/themes/ipfire-legacy/include/functions.pl @@ -19,6 +19,8 @@ # # ###############################################################################
+use POSIX; + sub showmenu() { print <<EOF <div id="menu"> @@ -321,14 +323,15 @@ END }
sub closepage () { - my $status = &connectionstatus(); - my $uptime = `/usr/bin/uptime|cut -d " " -f 4-`; - $uptime =~ s/year(s|)/$Lang::tr{'year'}/; - $uptime =~ s/month(s|)/$Lang::tr{'month'}/; - $uptime =~ s/day(s|)/$Lang::tr{'day'}/; - $uptime =~ s/user(s|)/$Lang::tr{'user'}/; - $uptime =~ s/load average/$Lang::tr{'uptime load average'}/; - + my $status = &connectionstatus(); + my $localtime_now = strftime "%H:%M:%S", localtime; + my $uptime = `/usr/bin/uptime|cut -d " " -f 4-`; + $uptime =~ s/year(s|)/$Lang::tr{'year'}/; + $uptime =~ s/month(s|)/$Lang::tr{'month'}/; + $uptime =~ s/day(s|)/$Lang::tr{'day'}/; + $uptime =~ s/user(s|)/$Lang::tr{'user'}/; + $uptime =~ s/load average/$Lang::tr{'uptime load average'}/; + print <<END </div> </div> @@ -341,19 +344,20 @@ END &showsubsection($menu); &showsubsubsection($menu);
- print <<END - </div> - </div> - <br class="clear" /> - <div id="footer" class="fixed"> - <b>Status:</b> $status <b>Uptime:</b> $uptime + print <<END + </div> + </div> + <br class="clear" /> + <div id="footer" class="fixed"> + <b>Status:</b> $status <b>Uptime:</b> $uptime END ; if ($settings{'SPEED'} ne 'off') { -print <<END +print <<END <br /> <b>$Lang::tr{'bandwidth usage'}:</b> - $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + <b>time:</b> $localtime_now
END ; diff --git a/html/html/themes/ipfire/include/functions.pl b/html/html/themes/ipfire/include/functions.pl index 9aec77497..9e3063476 100644 --- a/html/html/themes/ipfire/include/functions.pl +++ b/html/html/themes/ipfire/include/functions.pl @@ -32,6 +32,7 @@ ###############################################################################
require "${General::swroot}/lang.pl"; +use POSIX;
############################################################################### # @@ -194,29 +195,31 @@ sub openpagewithoutmenu { # print page closing html layout
sub closepage () { - open(FILE, "</etc/system-release"); - my $system_release = <FILE>; - $system_release =~ s/core/Core Update /; - close(FILE); + open(FILE, "</etc/system-release"); + my $system_release = <FILE>; + $system_release =~ s/core/Core Update /; + close(FILE); + $localtime_now = strftime "%H:%M:%S", localtime;
print <<END; - </div> - </div> - - <div id="footer" class='bigbox fixed'> - <span class="pull-right"> - <a href="https://www.ipfire.org/" target="_blank"><strong>IPFire.org</strong></a> • - <a href="https://www.ipfire.org/donate" target="_blank">$Lang::tr{'support donation'}</a> - </span> - - <strong>$system_release</strong> - </div> + </div> + </div> + + <div id="footer" class='bigbox fixed'> + <span class="pull-right"> + <a href="https://www.ipfire.org/" target="_blank"><strong>IPFire.org</strong></a> • + <a href="https://www.ipfire.org/donate" target="_blank">$Lang::tr{'support donation'}</a> + </span> + <strong>$system_release</strong> + <strong> - $localtime_now<strong> + </div> </body> </html> END ; }
+ ############################################################################### # # print big box opening html layout diff --git a/html/html/themes/maniac/include/functions.pl b/html/html/themes/maniac/include/functions.pl index 1c0aea1c4..c50357070 100644 --- a/html/html/themes/maniac/include/functions.pl +++ b/html/html/themes/maniac/include/functions.pl @@ -19,6 +19,8 @@ # # ###############################################################################
+use POSIX; + sub showmenu() { print <<EOF <div id="menu"> @@ -321,39 +323,41 @@ END }
sub closepage () { - my $status = &connectionstatus(); - my $uptime = `/usr/bin/uptime|cut -d " " -f 4-`; - $uptime =~ s/year(s|)/$Lang::tr{'year'}/; - $uptime =~ s/month(s|)/$Lang::tr{'month'}/; - $uptime =~ s/day(s|)/$Lang::tr{'day'}/; - $uptime =~ s/user(s|)/$Lang::tr{'user'}/; - $uptime =~ s/load average/$Lang::tr{'uptime load average'}/; - + my $status = &connectionstatus(); + my $localtime_now = strftime "%H:%M:%S", localtime; + my $uptime = `/usr/bin/uptime|cut -d " " -f 4-`; + $uptime =~ s/year(s|)/$Lang::tr{'year'}/; + $uptime =~ s/month(s|)/$Lang::tr{'month'}/; + $uptime =~ s/day(s|)/$Lang::tr{'day'}/; + $uptime =~ s/user(s|)/$Lang::tr{'user'}/; + $uptime =~ s/load average/$Lang::tr{'uptime load average'}/; + print <<END - </div> - </div> + </div> + </div>
- <div id="secondaryContent_2columns"> - - <div id="columnC_2columns"> + <div id="secondaryContent_2columns"> + + <div id="columnC_2columns"> END ; &showsubsection($menu); &showsubsubsection($menu);
- print <<END - </div> - </div> - <br class="clear" /> - <div id="footer" class="fixed"> - <b>Status:</b> $status <b>Uptime:</b> $uptime + print <<END + </div> + </div> + <br class="clear" /> + <div id="footer" class="fixed"> + <b>Status:</b> $status <b>Uptime:</b> $uptime END ; if ($settings{'SPEED'} ne 'off') { -print <<END +print <<END <br /> <b>$Lang::tr{'bandwidth usage'}:</b> - $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + <b>time:</b> $localtime_now
END ;
According to the described coding style the following changes were made.
--- html/html/themes/darkdos/include/functions.pl | 35 +++++++++---------- .../themes/ipfire-legacy/include/functions.pl | 22 ++++++------ html/html/themes/ipfire/include/functions.pl | 2 +- html/html/themes/maniac/include/functions.pl | 32 ++++++++--------- 4 files changed, 44 insertions(+), 47 deletions(-)
diff --git a/html/html/themes/darkdos/include/functions.pl b/html/html/themes/darkdos/include/functions.pl index 9f3547237..6285ef8ba 100644 --- a/html/html/themes/darkdos/include/functions.pl +++ b/html/html/themes/darkdos/include/functions.pl @@ -48,7 +48,7 @@ EOF </ul> </div> EOF -; +; }
sub getselected($) { @@ -141,7 +141,7 @@ sub openpage {
$title = "-= IPFire - $title =-"; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; + $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; }
print <<END @@ -154,7 +154,7 @@ sub openpage { <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="/themes/darkdos/include/style.css" /> <script language="javascript" type="text/javascript"> - + function swapVisibility(id) { el = document.getElementById(id); if(el.style.display != 'block') { @@ -184,21 +184,21 @@ print <<END t_current = new Date(); var t_diff = t_current - t_last; t_last = t_current; - + rxb_current = $("rxb",xml).text(); var rxb_diff = rxb_current - rxb_last; rxb_last = rxb_current; - + var rx_kbs = rxb_diff/t_diff; rx_kbs = Math.round(rx_kbs*10)/10; - + txb_current = $("txb",xml).text(); var txb_diff = txb_current - txb_last; txb_last = txb_current; - + var tx_kbs = txb_diff/t_diff; tx_kbs = Math.round(tx_kbs*10)/10; - + $("#rx_kbs").text(rx_kbs + ' kb/s'); $("#tx_kbs").text(tx_kbs + ' kb/s'); } @@ -227,7 +227,7 @@ print <<END END ; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; + print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; } else { print "<h1><span><a href='https://www.ipfire.org' style='text-decoration: none;'>-= IPFire =-</a></span></h1><br />"; } @@ -239,7 +239,7 @@ END ; &showmenu();
-print <<END +print <<END </div> </div>
@@ -264,7 +264,7 @@ sub openpagewithoutmenu {
$title = "-= IPFire - $title =-"; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; + $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; }
print <<END @@ -287,7 +287,7 @@ END <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="/include/style.css" /> <script language="javascript" type="text/javascript"> - + function swapVisibility(id) { el = document.getElementById(id); if(el.style.display != 'block') { @@ -310,7 +310,7 @@ END <div id="logo"> <h1><span>-= IPFire =-</span></h1> <h2>+ $h2 +</h2> - </div> + </div> </div> </div>
@@ -330,14 +330,11 @@ sub closepage () { $uptime =~ s/month(s|)/$Lang::tr{'month'}/; $uptime =~ s/day(s|)/$Lang::tr{'day'}/; $uptime =~ s/user(s|)/$Lang::tr{'user'}/; - $uptime =~ s/load average/$Lang::tr{'uptime load average'}/; - + $uptime =~ s/load average/$Lang::tr{'uptime load average'}/; print <<END </div> </div> - <div id="secondaryContent_2columns"> - <div id="columnC_2columns"> END ; @@ -347,13 +344,13 @@ END print <<END </div> </div> - <br class="clear" /> + <br class="clear" /> <div id="footer" class="fixed"> <b>Status:</b> $status <b>Uptime:</b> $uptime END ; if ($settings{'SPEED'} ne 'off') { -print <<END +print <<END <br /> <b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> diff --git a/html/html/themes/ipfire-legacy/include/functions.pl b/html/html/themes/ipfire-legacy/include/functions.pl index 3ce62ea41..cc8dfa318 100644 --- a/html/html/themes/ipfire-legacy/include/functions.pl +++ b/html/html/themes/ipfire-legacy/include/functions.pl @@ -48,7 +48,7 @@ EOF </ul> </div> EOF -; +; }
sub getselected($) { @@ -141,7 +141,7 @@ sub openpage {
$title = "IPFire - $title"; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; + $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; }
print <<END @@ -154,7 +154,7 @@ sub openpage { <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="/themes/ipfire-legacy/include/style.css" /> <script language="javascript" type="text/javascript"> - + function swapVisibility(id) { el = document.getElementById(id); if(el.style.display != 'block') { @@ -227,7 +227,7 @@ print <<END END ; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; + print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; } else { print "<h1><span><a href='https://www.ipfire.org' style='text-decoration: none;'>IPFire</a></span></h1><br />"; } @@ -239,7 +239,7 @@ END ; &showmenu();
-print <<END +print <<END </div> </div>
@@ -264,7 +264,7 @@ sub openpagewithoutmenu {
$title = "IPFire - $title"; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; + $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; }
print <<END @@ -287,7 +287,7 @@ END <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="/include/style.css" /> <script language="javascript" type="text/javascript"> - + function swapVisibility(id) { el = document.getElementById(id); if(el.style.display != 'block') { @@ -310,7 +310,7 @@ END <div id="logo"> <h1><span>IPFire</span></h1> <h2>$h2</h2> - </div> + </div> </div> </div>
@@ -337,7 +337,7 @@ sub closepage () { </div>
<div id="secondaryContent_2columns"> - + <div id="columnC_2columns"> END ; @@ -347,7 +347,7 @@ END print <<END </div> </div> - <br class="clear" /> + <br class="clear" /> <div id="footer" class="fixed"> <b>Status:</b> $status <b>Uptime:</b> $uptime END @@ -356,7 +356,7 @@ if ($settings{'SPEED'} ne 'off') { print <<END <br /> <b>$Lang::tr{'bandwidth usage'}:</b> - $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> <b>time:</b> $localtime_now
END diff --git a/html/html/themes/ipfire/include/functions.pl b/html/html/themes/ipfire/include/functions.pl index 9e3063476..108ce5f1a 100644 --- a/html/html/themes/ipfire/include/functions.pl +++ b/html/html/themes/ipfire/include/functions.pl @@ -40,7 +40,7 @@ use POSIX; # @param submenu entries sub showsubmenu() { my $submenus = shift; - + print "<ul>"; foreach my $item (sort keys %$submenus) { $link = getlink($submenus->{$item}); diff --git a/html/html/themes/maniac/include/functions.pl b/html/html/themes/maniac/include/functions.pl index c50357070..2fbc3f53a 100644 --- a/html/html/themes/maniac/include/functions.pl +++ b/html/html/themes/maniac/include/functions.pl @@ -48,7 +48,7 @@ EOF </ul> </div> EOF -; +; }
sub getselected($) { @@ -141,7 +141,7 @@ sub openpage {
$title = "-= IPFire - $title =-"; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; + $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; }
print <<END @@ -154,7 +154,7 @@ sub openpage { <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="/themes/maniac/include/style.css" /> <script type="text/javascript"> - + function swapVisibility(id) { el = document.getElementById(id); if(el.style.display != 'block') { @@ -184,21 +184,21 @@ print <<END t_current = new Date(); var t_diff = t_current - t_last; t_last = t_current; - + rxb_current = $("rxb",xml).text(); var rxb_diff = rxb_current - rxb_last; rxb_last = rxb_current; - + var rx_kbs = rxb_diff/t_diff; rx_kbs = Math.round(rx_kbs*10)/10; - + txb_current = $("txb",xml).text(); var txb_diff = txb_current - txb_last; txb_last = txb_current; - + var tx_kbs = txb_diff/t_diff; tx_kbs = Math.round(tx_kbs*10)/10; - + $("#rx_kbs").text(rx_kbs + ' kb/s'); $("#tx_kbs").text(tx_kbs + ' kb/s'); } @@ -227,7 +227,7 @@ print <<END END ; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; + print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; } else { print "<h1><span><a href='https://www.ipfire.org' style='text-decoration: none;'>-= IPFire =-</a></span></h1><br />"; } @@ -239,7 +239,7 @@ END ; &showmenu();
-print <<END +print <<END </div> </div>
@@ -264,7 +264,7 @@ sub openpagewithoutmenu {
$title = "-= IPFire - $title =-"; if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { - $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; + $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; }
print <<END @@ -287,7 +287,7 @@ END <link rel="shortcut icon" href="/favicon.ico" /> <link rel="stylesheet" type="text/css" href="/include/style.css" /> <script type="text/javascript"> - + function swapVisibility(id) { el = document.getElementById(id); if(el.style.display != 'block') { @@ -310,7 +310,7 @@ END <div id="logo"> <h1><span>-= IPFire =-</span></h1> <h2>+ $h2 +</h2> - </div> + </div> </div> </div>
@@ -337,7 +337,7 @@ sub closepage () { </div>
<div id="secondaryContent_2columns"> - + <div id="columnC_2columns"> END ; @@ -347,7 +347,7 @@ END print <<END </div> </div> - <br class="clear" /> + <br class="clear" /> <div id="footer" class="fixed"> <b>Status:</b> $status <b>Uptime:</b> $uptime END @@ -356,7 +356,7 @@ if ($settings{'SPEED'} ne 'off') { print <<END <br /> <b>$Lang::tr{'bandwidth usage'}:</b> - $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> + $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span> <b>time:</b> $localtime_now
END