2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

devStateIcon {} using default icon for undef return

git-svn-id: https://svn.fhem.de/fhem/trunk@3283 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-06-14 10:39:58 +00:00
parent 0da8f6f5fe
commit b76ea96387

View File

@ -2249,24 +2249,26 @@ FW_dev2image($)
if($devStateIcon =~ m/^{.*}$/) {
my ($html, $link) = eval $devStateIcon;
Log 1, "devStateIcon $name: $@" if($@);
return ($link, undef, 1) if(!$html); # only one value returned by the {}
return ($html, $link, 1);
}
return ($link, undef, 1) if(defined($html) && $html == "");
return ($html, $link, 1) if(defined($html));
my @list = split(" ", $devStateIcon);
foreach my $l (@list) {
my ($re, $iconName, $link) = split(":", $l, 3);
if(defined($re) && $state =~ m/^$re$/) {
if($iconName eq "") {
$rlink = $link;
last;
}
if(defined(FW_iconName($iconName))) {
return ($iconName, $link, 0);
} else {
return ($state, $link, 1);
} else {
my @list = split(" ", $devStateIcon);
foreach my $l (@list) {
my ($re, $iconName, $link) = split(":", $l, 3);
if(defined($re) && $state =~ m/^$re$/) {
if($iconName eq "") {
$rlink = $link;
last;
}
if(defined(FW_iconName($iconName))) {
return ($iconName, $link, 0);
} else {
return ($state, $link, 1);
}
}
}
}
}
@ -3011,7 +3013,9 @@ FW_dropdownFn()
</ul>
Second form:<br>
<ul>
Perl regexp enclosed in {}. Example:<br>
Perl regexp enclosed in {}. If the code returns undef, then the default
icon is used, if it retunes "" then the name of the state is displayed.
Example:<br>
{'&lt;div style="width:32px;height:32px;background-color:green"&gt;&lt;/div&gt;'}
</ul>
Note: if the image is referencing an SVG icon, then you can use the @colorname