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

01_FHEMWEB.pm: add cmdIcon

git-svn-id: https://svn.fhem.de/fhem/trunk@8735 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-06-12 18:37:56 +00:00
parent 2510bd6f94
commit 2fb65ec32c
2 changed files with 30 additions and 2 deletions

View File

@ -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: 01_FHEMWEB: add cmdIcon
- bugfix: 10_pilight_ctrl: set reset - lost connection to submodules - bugfix: 10_pilight_ctrl: set reset - lost connection to submodules
- bugfix: 70_Pushalot: corrected parameter order for image - bugfix: 70_Pushalot: corrected parameter order for image
- change: 70_Pushalot: changed http call to non-blocking - change: 70_Pushalot: changed http call to non-blocking

View File

@ -176,7 +176,7 @@ FHEMWEB_Initialize($)
############### ###############
# Initialize internal structures # Initialize internal structures
map { addToAttrList($_) } ( "webCmd", "icon", "devStateIcon", map { addToAttrList($_) } ( "webCmd", "icon", "cmdIcon", "devStateIcon",
"widgetOverride", "sortby", "devStateStyle"); "widgetOverride", "sortby", "devStateStyle");
InternalTimer(time()+60, "FW_closeInactiveClients", 0, 0); InternalTimer(time()+60, "FW_closeInactiveClients", 0, 0);
@ -1435,6 +1435,10 @@ FW_showRoom()
# Commands, slider, dropdown # Commands, slider, dropdown
my $smallscreenCommands = AttrVal($FW_wname, "smallscreenCommands", ""); my $smallscreenCommands = AttrVal($FW_wname, "smallscreenCommands", "");
if((!$FW_ss || $smallscreenCommands) && $cmdlist) { if((!$FW_ss || $smallscreenCommands) && $cmdlist) {
my @a = split("[: ]", AttrVal($d, "cmdIcon", ""));
Log 1, "ERROR: bad cmdIcon definition for $d" if(@a % 2);
my %cmdIcon = @a;
foreach my $cmd (split(":", $cmdlist)) { foreach my $cmd (split(":", $cmdlist)) {
my $htmlTxt; my $htmlTxt;
my @c = split(' ', $cmd); # @c==0 if $cmd==" "; my @c = split(' ', $cmd); # @c==0 if $cmd==" ";
@ -1452,7 +1456,9 @@ FW_showRoom()
FW_pO $htmlTxt; FW_pO $htmlTxt;
} else { } else {
FW_pH "cmd.$d=set $d $cmd$rf", $cmd, 1, "col3"; my $nCmd = $cmdIcon{$cmd} ?
FW_makeImage($cmdIcon{$cmd},$cmd,"webCmd") : $cmd;
FW_pH "cmd.$d=set $d $cmd$rf", $nCmd, 1, "col3";
} }
} }
} }
@ -3136,6 +3142,16 @@ FW_widgetOverride($$)
</li> </li>
<br> <br>
<a name="cmdIcon"></a>
<li>cmdIcon<br>
Space separated list of cmd:iconName pairs. If set, the webCmd text is
replaced with the icon. An easy method to set this value is to use
"Extend devStateIcon" in the detail-view, and copy its value.<br>
Example:<ul>
attr lamp cmdIcon on:control_centr_arrow_up off:control_centr_arrow_down
</ul>
</li><br>
<a name="devStateIcon"></a> <a name="devStateIcon"></a>
<li>devStateIcon<br> <li>devStateIcon<br>
First form:<br> First form:<br>
@ -3799,6 +3815,17 @@ FW_widgetOverride($$)
da ist, der Ger&auml;tename selbst. da ist, der Ger&auml;tename selbst.
</li><br> </li><br>
<a name="cmdIcon"></a>
<li>cmdIcon<br>
Leerzeichen getrennte Auflistung von cmd:iconName Paaren.
Falls gesetzt, wird das webCmd text durch den icon gesetzt.
Em einfachsten setzt man cmdIcon indem man "Extend devStateIcon" im
Detail-Ansicht verwendet, und den Wert nach cmdIcon kopiert.<br>
Beispiel:<ul>
attr lamp cmdIcon on:control_centr_arrow_up off:control_centr_arrow_down
</ul>
</li><br>
<a name="devStateIcon"></a> <a name="devStateIcon"></a>
<li>devStateIcon<br> <li>devStateIcon<br>
Erste Variante:<br> Erste Variante:<br>