diff --git a/config/cfgroot/graphs.pl b/config/cfgroot/graphs.pl index beddff032..cf4a30de3 100644 --- a/config/cfgroot/graphs.pl +++ b/config/cfgroot/graphs.pl @@ -24,6 +24,7 @@ package Graphs; use strict; use RRDs; +use experimental 'smartmatch'; require '/var/ipfire/general-functions.pl'; require "${General::swroot}/lang.pl"; @@ -99,26 +100,35 @@ foreach (@sensorsdir){ &General::readhash("${General::swroot}/sensors/settings", \%sensorsettings); # Generate a nice box for selection of time range in graphs -# this will generate a nice iframe for the cgi every klick for -# the graph will be handled inside the iframe +# this will generate a nice div box for the cgi every klick for +# the graph will be handled by javascript # 0 is the cgi refering to # 1 is the graph name -# 2 is the time range for the graph -# 3 if given is the height of the iframe default if nothing is given +# 2 is the time range for the graph (optional) sub makegraphbox { - print "
"; - print "".$Lang::tr{'hour'}.""; - print " - "; - print "".$Lang::tr{'day'}.""; - print " - "; - print "".$Lang::tr{'week'}.""; - print " - "; - print "".$Lang::tr{'month'}.""; - print " - "; - print "".$Lang::tr{'year'}.""; - print "
"; - print ""; + my ($origin, $name, $default_range) = @_; + + # Optional time range: Default to "day" unless otherwise specified + $default_range = "day" unless ($default_range ~~ @time_ranges); + + print < +