mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
enabled JavaScript in 02_RSS to support WebViewControl
git-svn-id: https://svn.fhem.de/fhem/trunk@6402 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c5110ca5d9
commit
fc376368cb
@ -1,5 +1,6 @@
|
|||||||
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
|
||||||
# Do not insert empty lines here, update check depends on it.
|
# Do not insert empty lines here, update check depends on it.
|
||||||
|
- feature: enabled JavaScript in 02_RSS to support WebViewControl
|
||||||
- added: new module 36_WMBUS.pm (kaihs) Wireless M-Bus
|
- added: new module 36_WMBUS.pm (kaihs) Wireless M-Bus
|
||||||
- feature: SYSMON: aded new plots (power infos for cubietruck)
|
- feature: SYSMON: aded new plots (power infos for cubietruck)
|
||||||
- feature: SYSMON: aded new readings for each network interface: ip and ip6
|
- feature: SYSMON: aded new readings for each network interface: ip and ip6
|
||||||
|
@ -222,6 +222,24 @@ RSS_returnRSS($) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
##################
|
##################
|
||||||
|
sub
|
||||||
|
RSS_getScript() {
|
||||||
|
|
||||||
|
my $scripts= "";
|
||||||
|
my $jsTemplate = '<script type="text/javascript" src="%s"></script>';
|
||||||
|
if(defined($data{FWEXT})) {
|
||||||
|
foreach my $k (sort keys %{$data{FWEXT}}) {
|
||||||
|
my $h = $data{FWEXT}{$k};
|
||||||
|
next if($h !~ m/HASH/ || !$h->{SCRIPT});
|
||||||
|
my $script = $h->{SCRIPT};
|
||||||
|
$script = ($script =~ m,^/,) ? "$FW_ME$script" : "$FW_ME/pgm2/$script";
|
||||||
|
$scripts .= sprintf($jsTemplate, $script) . "\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
sub
|
sub
|
||||||
RSS_returnHTML($) {
|
RSS_returnHTML($) {
|
||||||
my ($name) = @_;
|
my ($name) = @_;
|
||||||
@ -232,7 +250,10 @@ RSS_returnHTML($) {
|
|||||||
my $refresh= AttrVal($name, 'refresh', 60);
|
my $refresh= AttrVal($name, 'refresh', 60);
|
||||||
my $areas= AttrVal($name, 'areas', "");
|
my $areas= AttrVal($name, 'areas', "");
|
||||||
my $mime = ($type eq 'png')? 'image/png' : 'image/jpeg';
|
my $mime = ($type eq 'png')? 'image/png' : 'image/jpeg';
|
||||||
my $code= "<html>\n <head>\n <title>$name</title>\n <meta http-equiv=\"refresh\" content=\"$refresh\"/>\n </head>\n <body topmargin=\"0\" leftmargin=\"0\" margin=\"0\" padding=\"0\">\n <img src=\"$img\" usemap=\"#map\"/>\n <map name=\"map\" id=\"map\">\n $areas\n </map>\n </body>\n</html>";
|
my $doctype= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
|
||||||
|
my $xmlns= 'xmlns="http://www.w3.org/1999/xhtml"';
|
||||||
|
my $scripts= RSS_getScript();
|
||||||
|
my $code= "$doctype\n<html $xmlns>\n<head>\n<title>$name</title>\n<meta http-equiv=\"refresh\" content=\"$refresh\"/>\n$scripts</head>\n<body topmargin=\"0\" leftmargin=\"0\" margin=\"0\" padding=\"0\">\n<img src=\"$img\" usemap=\"#map\"/>\n<map name=\"map\" id=\"map\">\n$areas\n</map>\n</body>\n</html>";
|
||||||
return ("text/html; charset=utf-8", $code);
|
return ("text/html; charset=utf-8", $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,6 +638,7 @@ RSS_returnIMG($$) {
|
|||||||
# set the background
|
# set the background
|
||||||
#
|
#
|
||||||
# check if background directory is set
|
# check if background directory is set
|
||||||
|
my $reason= "?"; # remember reason for undefined image
|
||||||
my $bgdir= AttrVal($name,"bg","undef");
|
my $bgdir= AttrVal($name,"bg","undef");
|
||||||
if(defined($bgdir)){
|
if(defined($bgdir)){
|
||||||
my $bgnr; # item number
|
my $bgnr; # item number
|
||||||
@ -639,6 +661,10 @@ RSS_returnIMG($$) {
|
|||||||
# detect pictures
|
# detect pictures
|
||||||
if(opendir(BGDIR, $bgdir)){
|
if(opendir(BGDIR, $bgdir)){
|
||||||
my @bgfiles= grep {$_ !~ /^\./} readdir(BGDIR);
|
my @bgfiles= grep {$_ !~ /^\./} readdir(BGDIR);
|
||||||
|
|
||||||
|
#foreach my $f (@bgfiles) {
|
||||||
|
# Debug sprintf("File \"%s\"\n", $f);
|
||||||
|
#}
|
||||||
closedir(BGDIR);
|
closedir(BGDIR);
|
||||||
# get item number
|
# get item number
|
||||||
if($#bgfiles>=0) {
|
if($#bgfiles>=0) {
|
||||||
@ -672,6 +698,7 @@ RSS_returnIMG($$) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$S= undef;
|
$S= undef;
|
||||||
|
$reason= "Something was wrong with background image \"$bgfile\".";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -679,7 +706,12 @@ RSS_returnIMG($$) {
|
|||||||
#
|
#
|
||||||
# evaluate layout
|
# evaluate layout
|
||||||
#
|
#
|
||||||
RSS_evalLayout($S, $name, $defs{$name}{fhem}{layout});
|
if(defined($S)) {
|
||||||
|
RSS_evalLayout($S, $name, $defs{$name}{fhem}{layout});
|
||||||
|
} else {
|
||||||
|
Log3 undef, 2, "$name: Could not create image. $reason";
|
||||||
|
$S= GD::Image->newTrueColor($width,$height); # return empty image
|
||||||
|
}
|
||||||
$defs{$name}{STATE} = localtime();
|
$defs{$name}{STATE} = localtime();
|
||||||
}; warn $@ if $@;
|
}; warn $@ if $@;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user