2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

SVG: startDate added

git-svn-id: https://svn.fhem.de/fhem/trunk@3761 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-08-21 17:20:04 +00:00
parent 00c391559a
commit 7b298cb173
2 changed files with 40 additions and 33 deletions

View File

@ -63,8 +63,8 @@ use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink
use vars qw(%FW_pos); # scroll position use vars qw(%FW_pos); # scroll position
use vars qw($FW_cname); # Current connection name use vars qw($FW_cname); # Current connection name
use vars qw(%FW_hiddenroom); # hash of hidden rooms, used by weblink use vars qw(%FW_hiddenroom); # hash of hidden rooms, used by weblink
use vars qw($FW_plotmode);# Global plot mode (WEB attribute), used by weblink use vars qw($FW_plotmode);# Global plot mode (WEB attribute), used by SVG
use vars qw($FW_plotsize);# Global plot size (WEB attribute), used by weblink use vars qw($FW_plotsize);# Global plot size (WEB attribute), used by SVG
use vars qw(%FW_webArgs); # all arguments specified in the GET use vars qw(%FW_webArgs); # all arguments specified in the GET
use vars qw(@FW_fhemwebjs);# List of fhemweb*js scripts to load use vars qw(@FW_fhemwebjs);# List of fhemweb*js scripts to load
use vars qw($FW_detail); # currently selected device for detail view use vars qw($FW_detail); # currently selected device for detail view
@ -2350,7 +2350,7 @@ FW_ActivateInform()
<li>plotsize<br> <li>plotsize<br>
the default size of the plot, in pixels, separated by comma: the default size of the plot, in pixels, separated by comma:
width,height. You can set individual sizes by setting the plotsize of width,height. You can set individual sizes by setting the plotsize of
the weblink. Default is 800,160 for desktop, and 480,160 for the SVG. Default is 800,160 for desktop, and 480,160 for
smallscreen. smallscreen.
</li><br> </li><br>
@ -2362,19 +2362,6 @@ FW_ActivateInform()
See also the clearSvgCache command for clearing the cache. See also the clearSvgCache command for clearing the cache.
</li><br> </li><br>
<a name="fixedrange"></a>
<li>fixedrange<br>
Can be applied to weblink devices (FHEMWEB).<br>
Contains two time specs in the form YYYY-MM-DD separated by a space.
In plotmode gnuplot-scroll or SVG the given time-range will be used,
and no scrolling for this weblinks will be possible. Needed e.g. for
looking at last-years data without scrolling.<br><br>
If the value is one of day, week, month, year than set the zoom level
for this weblink independently of the user specified zoom-level.
This is useful for pages with multiple plots: one of the plots is best
viewed in with the default (day) zoom, the other one with a week zoom.
</li><br>
<a name="endPlotToday"></a> <a name="endPlotToday"></a>
<li>endPlotToday<br> <li>endPlotToday<br>
If this FHEMWEB attribute ist set to 1, then week and month plots will If this FHEMWEB attribute ist set to 1, then week and month plots will
@ -2409,12 +2396,7 @@ FW_ActivateInform()
accepted. accepted.
Example:<br> Example:<br>
<code> <code>
attr WEB basicAuth { "$user:$password" eq "admin:secret" }<br> attr WEB basicAuth { "$user:$password" eq "admin:secret" }<br>
attr WEB basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$password") }<br>
</code>
or if you defined multiple users on the Fritzbox:<br>
<code>
attr WEB basicAuth {use FritzBoxUtils;;FB_checkPw("localhost","$user", "$password") }<br>
</code> </code>
</li><br> </li><br>

View File

@ -16,8 +16,8 @@ use vars qw($FW_cssdir); # css directory
use vars qw($FW_detail); # currently selected device for detail view use vars qw($FW_detail); # currently selected device for detail view
use vars qw($FW_dir); # base directory for web server use vars qw($FW_dir); # base directory for web server
use vars qw($FW_gplotdir);# gplot directory for web server: the first use vars qw($FW_gplotdir);# gplot directory for web server: the first
use vars qw($FW_plotmode);# Global plot mode (WEB attribute), used by weblink use vars qw($FW_plotmode);# Global plot mode (WEB attribute), used by SVG
use vars qw($FW_plotsize);# Global plot size (WEB attribute), used by weblink use vars qw($FW_plotsize);# Global plot size (WEB attribute), used by SVG
use vars qw($FW_room); # currently selected room use vars qw($FW_room); # currently selected room
use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink use vars qw($FW_subdir); # Sub-path in URL, used by FLOORPLAN/weblink
use vars qw($FW_wname); # Web instance use vars qw($FW_wname); # Web instance
@ -27,7 +27,7 @@ use vars qw(%FW_webArgs); # all arguments specified in the GET
use vars qw($FW_formmethod); use vars qw($FW_formmethod);
my $SVG_RET; # Returned data (SVG) my $SVG_RET; # Returned data (SVG)
sub SVG_calcWeblink($$); sub SVG_calcOffsets($$);
sub SVG_doround($$$); sub SVG_doround($$$);
sub SVG_fmtTime($$); sub SVG_fmtTime($$);
sub SVG_pO($); sub SVG_pO($);
@ -48,7 +48,7 @@ SVG_Initialize($)
my ($hash) = @_; my ($hash) = @_;
$hash->{DefFn} = "SVG_Define"; $hash->{DefFn} = "SVG_Define";
$hash->{AttrList} = "fixedrange plotsize label title plotfunction"; $hash->{AttrList} = "fixedrange startDate plotsize label title plotfunction";
$hash->{SetFn} = "SVG_Set"; $hash->{SetFn} = "SVG_Set";
$hash->{FW_summaryFn} = "SVG_FwFn"; $hash->{FW_summaryFn} = "SVG_FwFn";
$hash->{FW_detailFn} = "SVG_FwFn"; $hash->{FW_detailFn} = "SVG_FwFn";
@ -537,10 +537,10 @@ SVG_substcfg($$$$$$)
} }
################## ##################
# Calculate either the number of scrollable weblinks (for $d = undef) or # Calculate either the number of scrollable SVGs (for $d = undef) or
# for the device the valid from and to dates for the given zoom and offset # for the device the valid from and to dates for the given zoom and offset
sub sub
SVG_calcWeblink($$) SVG_calcOffsets($$)
{ {
my ($d,$wl) = @_; my ($d,$wl) = @_;
@ -569,7 +569,14 @@ SVG_calcWeblink($$)
$off = 0 if(!$off); $off = 0 if(!$off);
$off += $FW_pos{off} if($FW_pos{off}); $off += $FW_pos{off} if($FW_pos{off});
my $now = time(); my $now;
my $st = AttrVal($wl, "startDate", undef);
if($st) {
$now = mktime(0,0,12,$3,$2-1,$1-1900,0,0,-1)
if($st =~ m/(\d\d\d\d)-(\d\d)-(\d\d)/);
}
$now = time() if(!$now);
my $zoom = $FW_pos{zoom}; my $zoom = $FW_pos{zoom};
$zoom = "day" if(!$zoom); $zoom = "day" if(!$zoom);
$zoom = $frx if ($frx); #for fixedrange {day|week|...} klaus $zoom = $frx if ($frx); #for fixedrange {day|week|...} klaus
@ -677,7 +684,7 @@ SVG_showLog($)
} }
} }
SVG_calcWeblink($d,$wl); SVG_calcOffsets($d,$wl);
if($pm =~ m/gnuplot/) { if($pm =~ m/gnuplot/) {
@ -1494,9 +1501,27 @@ SVG_pO($)
<a name="SVGattr"></a> <a name="SVGattr"></a>
<b>Attributes</b> <b>Attributes</b>
<ul> <ul>
<li><a href="#fixedrange">fixedrange</a></li> <a name="fixedrange"></a>
<li><a href="#plotsize">plotsize</a></li> <li>fixedrange<br>
<li><a href="#plotmode">plotmode</a></li> Contains two time specs in the form YYYY-MM-DD separated by a space.
In plotmode gnuplot-scroll or SVG the given time-range will be used,
and no scrolling for this weblinks will be possible. Needed e.g. for
looking at last-years data without scrolling.<br><br>
If the value is one of day, week, month, year than set the zoom level
for this weblink independently of the user specified zoom-level.
This is useful for pages with multiple plots: one of the plots is best
viewed in with the default (day) zoom, the other one with a week zoom.
</li><br>
<a name="startDate"></a>
<li>startDate<br>
Set the start date for the plot. Used for demo installations.
</li><br>
<li><a href="#plotsize">plotsize</a></li><br>
<li><a href="#plotmode">plotmode</a></li><br>
<a name="label"></a> <a name="label"></a>
<li>label<br> <li>label<br>
Double-Colon separated list of values. The values will be used to replace Double-Colon separated list of values. The values will be used to replace