2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-16 10:46:03 +00:00

contrib/Infopanel: code cleanup

git-svn-id: https://svn.fhem.de/fhem/trunk@7879 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2015-02-05 09:26:42 +00:00
parent 30c39fd2f8
commit 2e8f418ee9

View File

@ -378,18 +378,18 @@ sub btIP_itemPlot {
($newWidth,$newHeight) = _btIP_imgRescale($width,$height,$scale); ($newWidth,$newHeight) = _btIP_imgRescale($width,$height,$scale);
if($inline == 1) { if($inline == 1) {
# embed base64 data
$FW_RET = undef; $FW_RET = undef;
$FW_webArgs{dev} = $plotName[0]; $FW_webArgs{dev} = $plotName[0];
$FW_webArgs{logdev} = InternalVal($plotName[0], "LOGDEVICE", ""); $FW_webArgs{logdev} = InternalVal($plotName[0], "LOGDEVICE", "");
$FW_webArgs{gplotfile} = InternalVal($plotName[0], "GPLOTFILE", ""); $FW_webArgs{gplotfile} = InternalVal($plotName[0], "GPLOTFILE", "");
$FW_webArgs{logfile} = InternalVal($plotName[0], "LOGFILE", "CURRENT"); $FW_webArgs{logfile} = InternalVal($plotName[0], "LOGFILE", "CURRENT");
# $FW_pos{zoom} = ($plotName[1]) ? $plotName[1] : 'day'; $FW_pos{zoom} = $plotName[1] if(length($plotName[1]));
# $FW_pos{off} = ($plotName[2]) ? $plotName[2] : undef; $FW_pos{off} = $plotName[2] if(length($plotName[2]));
$FW_plotsize = "$newWidth,$newHeight"; $FW_plotsize = "$newWidth,$newHeight";
($mimetype, $svgdata) = SVG_showLog("unused"); ($mimetype, $svgdata) = SVG_showLog("unused");
$svgdata =~ s/<\/svg>/<polyline opacity="0" points="0,0 $newWidth,$newHeight"\/><\/svg>/; $svgdata =~ s/<\/svg>/<polyline opacity="0" points="0,0 $newWidth,$newHeight"\/><\/svg>/;
(undef,undef,undef,$svgdata) = _btIP_imgData($svgdata,1); (undef,undef,undef,$svgdata) = _btIP_imgData($svgdata,1);
@ -397,17 +397,20 @@ sub btIP_itemPlot {
$output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"${newWidth}px\" height=\"${newHeight}px\" \n"; $output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"${newWidth}px\" height=\"${newHeight}px\" \n";
$output .= "xlink:href=\"$svgdata\" />\n"; $output .= "xlink:href=\"$svgdata\" />\n";
} else { } else {
# embed link to plot # embed link to plot
#
my $url; my $url;
$url = "$FW_ME/SVG_showLog?dev=". $plotName[0]. $url = "$FW_ME/SVG_showLog?dev=". $plotName[0].
"&amp;logdev=". InternalVal($plotName[0], "LOGDEVICE", ""). "&amp;logdev=". InternalVal($plotName[0], "LOGDEVICE", "").
"&amp;gplotfile=". InternalVal($plotName[0], "GPLOTFILE", ""). "&amp;gplotfile=". InternalVal($plotName[0], "GPLOTFILE", "").
"&amp;logfile=". InternalVal($plotName[0], "LOGFILE", "CURRENT"). "&amp;logfile=". InternalVal($plotName[0], "LOGFILE", "CURRENT").
"&amp;plotsize=". "$newWidth,$newHeight"; "&amp;plotsize=". "$newWidth,$newHeight";
# $url .= "&amp;pos=". ($plotName[1]) ? $plotName[1] : 'day'; $url .= "&amp;pos=";
# $url .= "&amp;zoom=". ($plotName[2]) ? $plotName[2] : undef; $url .= "zoom=". "$plotName[1];" if(length($plotName[1]));
$output = "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"${newWidth}px\" height=\"${newHeight}px\" \nxlink:href=\"$url\" />\n"; $url .= "off=". $plotName[2] if(length($plotName[2]));
$output = "<!-- $url -->\n";
$output .= "<image id=\"$id\" x=\"$x\" y=\"$y\" width=\"${newWidth}px\" height=\"${newHeight}px\" \nxlink:href=\"$url\" />\n";
} }
return $output; return $output;
@ -567,6 +570,7 @@ sub btIP_changeColor {
$readBytes = read(GRAFIK, $data, $length); $readBytes = read(GRAFIK, $data, $length);
close(GRAFIK); close(GRAFIK);
if($newcolor =~ /[[:xdigit:]]{6}/) { if($newcolor =~ /[[:xdigit:]]{6}/) {
Log3(undef,4,"Infopanel: changing color from $oldcolor to $newcolor");
$data =~ s/fill="#$oldcolor"/fill="#$newcolor"/g; $data =~ s/fill="#$oldcolor"/fill="#$newcolor"/g;
$data =~ s/fill:#$oldcolor/fill:#$newcolor/g; $data =~ s/fill:#$oldcolor/fill:#$newcolor/g;
} else { } else {