mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-03 23:06:37 +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:
parent
0da8f6f5fe
commit
b76ea96387
@ -2249,10 +2249,10 @@ FW_dev2image($)
|
|||||||
if($devStateIcon =~ m/^{.*}$/) {
|
if($devStateIcon =~ m/^{.*}$/) {
|
||||||
my ($html, $link) = eval $devStateIcon;
|
my ($html, $link) = eval $devStateIcon;
|
||||||
Log 1, "devStateIcon $name: $@" if($@);
|
Log 1, "devStateIcon $name: $@" if($@);
|
||||||
return ($link, undef, 1) if(!$html); # only one value returned by the {}
|
return ($link, undef, 1) if(defined($html) && $html == "");
|
||||||
return ($html, $link, 1);
|
return ($html, $link, 1) if(defined($html));
|
||||||
}
|
|
||||||
|
|
||||||
|
} else {
|
||||||
my @list = split(" ", $devStateIcon);
|
my @list = split(" ", $devStateIcon);
|
||||||
foreach my $l (@list) {
|
foreach my $l (@list) {
|
||||||
my ($re, $iconName, $link) = split(":", $l, 3);
|
my ($re, $iconName, $link) = split(":", $l, 3);
|
||||||
@ -2268,6 +2268,8 @@ FW_dev2image($)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx"
|
$state =~ s/ .*//; # Want to be able to have icons for "on-for-timer xxx"
|
||||||
@ -3011,7 +3013,9 @@ FW_dropdownFn()
|
|||||||
</ul>
|
</ul>
|
||||||
Second form:<br>
|
Second form:<br>
|
||||||
<ul>
|
<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>
|
||||||
{'<div style="width:32px;height:32px;background-color:green"></div>'}
|
{'<div style="width:32px;height:32px;background-color:green"></div>'}
|
||||||
</ul>
|
</ul>
|
||||||
Note: if the image is referencing an SVG icon, then you can use the @colorname
|
Note: if the image is referencing an SVG icon, then you can use the @colorname
|
||||||
|
Loading…
x
Reference in New Issue
Block a user