2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-25 22:09:21 +00:00

devStateIcon with perl-expression

git-svn-id: https://svn.fhem.de/fhem/trunk@2804 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-02-25 11:44:23 +00:00
parent 2436989292
commit ffb155971f

View File

@ -2266,6 +2266,7 @@ FW_dev2image($)
my $icon;
my $devStateIcon = AttrVal($name, "devStateIcon", undef);
if(defined($devStateIcon)) {
return $devStateIcon if($devStateIcon =~ m/^{.*}$/);
my @list = split(" ", $devStateIcon);
foreach my $l (@list) {
my ($re,$iconName) = split(":", $l);
@ -2483,7 +2484,13 @@ FW_devState($$)
} else {
my $icon;
$icon = FW_dev2image($d);
$txt = FW_makeImage($icon, $txt) if($icon);
if($icon) {
if($icon =~ m/^{.*}$/) {
$txt = AnalyzePerlCommand(undef, $icon);
} else {
$txt = FW_makeImage($icon, $txt);
}
}
}
$txt = "<div id=\"$d\" align=\"center\" class=\"col2\">$txt</div>";
@ -2897,6 +2904,8 @@ FW_htmlEscape($)
<a name="devStateIcon"></a>
<li>devStateIcon<br>
First form:<br>
<ul>
Space separated list of regexp/icon-name pairs. If the state of the
device matches regexp, then the corresponding icon-name will be
displayed. If icon-name does not exist in the fhem/www/images
@ -2908,6 +2917,12 @@ FW_htmlEscape($)
attr lamp devStateIcon .*:noIcon<br>
</ul>
</li>
</ul>
Second form:<br>
<ul>
Perl regexp enclosed in {}. Example:<br>
{'&lt;div style="width:32px;height:32px;background-color:green"&gt;&lt;/div&gt;'}
</ul>
<br>
<a name="webCmd"></a>