(FHEM) Stolperfallen
Hab mal wieder einen Volltreffer gelandet. Weil die Raeume im FHEMWEB zu viele wurden, aber auch nicht mit "hiddenroom" unterdrueckt werden sollten. Wollte ich mal 'Room in Room' aussprobieren. Leider scheint das nicht zu funktionieren (Stand fhem 6.0). Aus der Commandref geht eine Alternative hervor. Und zwar wenn man im Raumnamen eine '->' verwendet fuehrt das dazu, dass im FHEM-Roommenue aufklappbare Unterraeume (die nach dem ->) angezeigt werden. Man kann also keinen kompletten bestehenden Raum einem anderen Raum zuordnen, sondern man ist gezwungen alle Devices den neuen Raumnamen zuzuordnen. Ein unschoener Effekt ist es, dass der der uebergeordnete Raumname kein Icon mehr hat.
Dies bestatigt diese Forums-Nachfrage.
Ein Blick in den Quellcode von 01_FHEMWEB.pm zeigt:
1 ##########################
2 # Rooms and other links
3 foreach my $r (@FW_roomsArr) {
4 next if($r eq "hidden" || $FW_hiddenroom{$r});
5 $FW_room = AttrVal($FW_wname, "defaultRoom", $r)
6 if(!$FW_room && $FW_ss);
7 if(my $devspec = $FW_extraRooms{$r}) {
8 my $r = $r;
9 $r =~ s/ / /g;
10 push @list1, FW_htmlEscape($r);
11 push @list2, "$FW_ME?room=".urlEncode($devspec);
12 } else {
13 push @list1, FW_htmlEscape($r);
14 push @list2, "$FW_ME?room=".urlEncode($r);
15 }
16
17 }
18 my $sfx = AttrVal("global", "language", "EN");
19 $sfx = ($sfx eq "EN" ? "" : "_$sfx");
20 my @list = (
21 "Everything", "$FW_ME?room=all",
22 "", "",
23 "Commandref", "$FW_ME/docs/commandref${sfx}.html",
24 "Remote doc", "http://fhem.de/fhem.html#Documentation",
25 "Edit files", "$FW_ME?cmd=style%20list",
26 "Select style", "$FW_ME?cmd=style%20select",
27 "Event monitor", "$FW_ME?cmd=style%20eventMonitor",
28 "", "");
29 my $lastname = ","; # Avoid double "".
30
31 my $lfn = "Logfile";
32 if($defs{$lfn}) { # Add the current Logfile to the list if defined
33 my @l = FW_fileList($defs{$lfn}{logfile},1);
34 my $fn = pop @l;
35 splice @list, 4,0, ("Logfile",
36 "$FW_ME/FileLog_logWrapper?dev=$lfn&type=text&file=$fn");
37 }
38
39 my @me = split(",", AttrVal($FW_wname, "menuEntries", ""));
40 push @list, @me, "", "" if(@me);
41
42 for(my $idx = 0; $idx < @list; $idx+= 2) {
43 next if($FW_hiddenroom{$list[$idx]} || $list[$idx] eq $lastname);
44 push @list1, $list[$idx];
45 push @list2, $list[$idx+1];
46 $lastname = $list[$idx];
47 }
48
49 FW_pO "<div id=\"menu\">";
50 FW_pO "<table>";
51 if($FW_ss) { # Make a selection sensitive dropdown list
52 FW_pO "<tr><td><select OnChange=\"location.href=" .
53 "this.options[this.selectedIndex].value\">";
54 foreach(my $idx = 0; $idx < @list1; $idx++) {
55 next if(!$list1[$idx]);
56 my $sel = ($list1[$idx] eq $FW_room ? " selected=\"selected\"" : "");
57 FW_pO "<option value='$list2[$idx]'$sel>$list1[$idx]</option>";
58 }
59 FW_pO "</select></td>";
60 FW_pO "</tr>";
61
62 } else {
63
64 my $tblnr = 1;
65 my $roomEscaped = FW_htmlEscape($FW_room);
66 my $current;
67 $current = "$FW_ME?room=".urlEncode($FW_room) if($FW_room);
68 $current = "$FW_ME?cmd=".urlEncode($cmd) if($cmd);
69 foreach(my $idx = 0; $idx < @list1; $idx++) {
70 my ($l1, $l2) = ($list1[$idx], $list2[$idx]);
71 if(!$l1) {
72 FW_pO "</table></td></tr>" if($idx);
73 if($idx<int(@list1)-1) {
74 FW_pO "<tr><td><table class=\"room roomBlock$tblnr\">";
75 $tblnr++;
76 }
77
78 } else {
79 FW_pF "<tr%s>", ($current && $current eq $l2) ? " class=\"sel\"" : "";
80
81 my $class = "menu_$l1";
82 $class =~ s/[^A-Z0-9]/_/gi;
83
84 # image tag if we have an icon, else empty
85 my $icoName = "ico$l1";
86 map { my ($n,$v) = split(":",$_); $icoName=$v if($l1 =~ m/^$n$/); }
87 split(" ", AttrVal($FW_wname, "roomIcons", ""));
88 my $icon = FW_iconName($icoName) ?
89 FW_makeImage($icoName,$icoName,"icon")." " : "";
90
91 if($l1 eq "Save config") {
92 $l1 .= '</span></a> '.
93 '<a id="saveCheck" class="changed" style="visibility:'.
94 (int(@structChangeHist) ? 'visible' : 'hidden').'"><span>?';
95 }
96
97 # Force external browser if FHEMWEB is installed as an offline app.
98 my $target = ''; # Forum 33066, 39854
99 $target = 'target="_blank"' if($l2 =~ s/^$FW_ME\/\+/$FW_ME\//);
100 $target = 'target="_blank"' if($l2 =~ m/commandref|fhem.de.fhem.html/);
101 if($l2 =~ m/.html$/ || $l2 =~ m/^(http|javascript)/ || length($target)){
102 FW_pO "<td><div><a href='$l2' $target>$icon<span>$l1</span></a>".
103 "</div></td>";
104 } else {
105 FW_pH $l2, "$icon<span>$l1</span>", 1, $class;
106 }
107
108 FW_pO "</tr>";
109 }
110 }
111
112 }
113 FW_pO "</table>";
114 FW_pO "</div>";
115 FW_pO "</div>" if($hasMenuScroll);
Die automatische Aktualisierung der Kommentare aktivieren.