mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-04 22:19:38 +00:00
01_FHEMWEB.pm: nameDisplay for name translation added (Forum #37379)
git-svn-id: https://svn.fhem.de/fhem/trunk@8617 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
f2aeff8757
commit
7a3c9a40aa
@ -152,6 +152,7 @@ FHEMWEB_Initialize($)
|
|||||||
longpoll:0,1
|
longpoll:0,1
|
||||||
longpollSVG:1,0
|
longpollSVG:1,0
|
||||||
menuEntries
|
menuEntries
|
||||||
|
nameDisplay
|
||||||
ploteditor:always,onClick,never
|
ploteditor:always,onClick,never
|
||||||
plotfork:1,0
|
plotfork:1,0
|
||||||
plotmode:gnuplot,gnuplot-scroll,SVG
|
plotmode:gnuplot,gnuplot-scroll,SVG
|
||||||
@ -1370,6 +1371,7 @@ FW_showRoom()
|
|||||||
# row counter
|
# row counter
|
||||||
my $row=1;
|
my $row=1;
|
||||||
my %extPage = ();
|
my %extPage = ();
|
||||||
|
my $nameDisplay = AttrVal($FW_wname,"nameDisplay",undef);
|
||||||
|
|
||||||
my ($columns, $maxc) = FW_parseColumns();
|
my ($columns, $maxc) = FW_parseColumns();
|
||||||
FW_pO "<tr class=\"column\">" if($maxc != -1);
|
FW_pO "<tr class=\"column\">" if($maxc != -1);
|
||||||
@ -1397,6 +1399,7 @@ FW_showRoom()
|
|||||||
|
|
||||||
FW_pF "\n<tr class=\"%s\">", ($row&1)?"odd":"even";
|
FW_pF "\n<tr class=\"%s\">", ($row&1)?"odd":"even";
|
||||||
my $devName = AttrVal($d, "alias", $d);
|
my $devName = AttrVal($d, "alias", $d);
|
||||||
|
$devName = eval $nameDisplay if(defined($nameDisplay));
|
||||||
my $icon = AttrVal($d, "icon", "");
|
my $icon = AttrVal($d, "icon", "");
|
||||||
$icon = FW_makeImage($icon,$icon,"icon") . " " if($icon);
|
$icon = FW_makeImage($icon,$icon,"icon") . " " if($icon);
|
||||||
|
|
||||||
@ -3000,6 +3003,20 @@ FW_widgetOverride($$)
|
|||||||
</li>
|
</li>
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
<a name="nameDisplay"></a>
|
||||||
|
<li>nameDisplay<br>
|
||||||
|
The argument is perl code, which is executed for each single device in
|
||||||
|
the room to determine the name displayed. $d is the name of the current
|
||||||
|
device, and $devName is the value of the alias attribute or the name of
|
||||||
|
the device, if no alias is set. E.g. you can add a a global userattr
|
||||||
|
named alias_hu for the Hungarian translation, and specify nameDisplay
|
||||||
|
for the hungarian FHEMWEB instance as
|
||||||
|
<ul>
|
||||||
|
AttrVal($d, "alias_hu", $devName)
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
<a name="longpoll"></a>
|
<a name="longpoll"></a>
|
||||||
<li>longpoll<br>
|
<li>longpoll<br>
|
||||||
Affects devices states in the room overview only.<br>
|
Affects devices states in the room overview only.<br>
|
||||||
@ -3665,6 +3682,22 @@ FW_widgetOverride($$)
|
|||||||
attr WEB menuEntries AlarmOn,http://fhemhost:8083/fhem?cmd=set%20alarm%20on<br>
|
attr WEB menuEntries AlarmOn,http://fhemhost:8083/fhem?cmd=set%20alarm%20on<br>
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
|
<a name="nameDisplay"></a>
|
||||||
|
<li>nameDisplay<br>
|
||||||
|
Das Argument ist Perl-Code, was für jedes Gerät in der
|
||||||
|
Raum-Übersicht ausgeführt wird, um den angezeigten Namen zu
|
||||||
|
berechnen. Dabei kann man die Variable $d für den aktuellen
|
||||||
|
Gerätenamen, und $devName für den aktuellen alias bzw. Name,
|
||||||
|
falls alias nicht gesetzt ist, verwenden. Z.Bsp. für eine FHEMWEB
|
||||||
|
Instanz mit ungarischer Anzeige fügt man ein global userattr
|
||||||
|
alias_hu hinzu, und man setzt nameDisplay für diese FHEMWEB
|
||||||
|
Instanz auf dem Wert:
|
||||||
|
<ul>
|
||||||
|
AttrVal($d, "alias_hu", $devName)
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
<a name="longpoll"></a>
|
<a name="longpoll"></a>
|
||||||
<li>longpoll<br>
|
<li>longpoll<br>
|
||||||
Dies betrifft die Aktualisierung der Gerätestati in der
|
Dies betrifft die Aktualisierung der Gerätestati in der
|
||||||
@ -3842,7 +3875,7 @@ FW_widgetOverride($$)
|
|||||||
<li>widgetOverride<br>
|
<li>widgetOverride<br>
|
||||||
Leerzeichen separierte Liste von Name/Modifier Paaren, mit dem man den
|
Leerzeichen separierte Liste von Name/Modifier Paaren, mit dem man den
|
||||||
vom Modulautor fuer einen bestimmten Parameter (Set/Get/Attribut)
|
vom Modulautor fuer einen bestimmten Parameter (Set/Get/Attribut)
|
||||||
vorgesehene Widgets aendern kann.
|
vorgesehene Widgets ändern kann.
|
||||||
<ul>
|
<ul>
|
||||||
<li>Ist der Modifier ":noArg", wird kein weiteres Eingabefeld
|
<li>Ist der Modifier ":noArg", wird kein weiteres Eingabefeld
|
||||||
angezeigt.</li>
|
angezeigt.</li>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user