2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-13 17:26:34 +00:00

01_FHEMWEB.pm: change the room separator to -> from -- (Forum #82151)

git-svn-id: https://svn.fhem.de/fhem/trunk@15795 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2018-01-05 20:46:21 +00:00
parent ec65198aaf
commit 39b337a703
8 changed files with 30 additions and 28 deletions

View File

@ -1,7 +1,8 @@
# 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.pm: -> as room separator (Forum #82151)
- bugfix: 10_FRM: accept Firmata firmware without AnalogInputFirmata - bugfix: 10_FRM: accept Firmata firmware without AnalogInputFirmata
- bugfix: 10_MYSENSORS_DEVICE: corrected S_LIGHT_LEVEL - bugfix: 10_MYSENSORS_DEVICE: corrected S_LIGHT_LEVEL
- bugfix: 93_DbRep: fix "month out of range" that causes fhem crash - bugfix: 93_DbRep: fix "month out of range" that causes fhem crash
- feature: 20_FRM_PWM: new attribute "restoreOnStartup" - feature: 20_FRM_PWM: new attribute "restoreOnStartup"
- feature: 20_FRM_OUT: new attributes "activeLow" and "valueMode" - feature: 20_FRM_OUT: new attributes "activeLow" and "valueMode"

View File

@ -646,10 +646,7 @@ FW_AsyncOutput($$)
$ret = $1; $ret = $1;
} else { } else {
$ret =~ s/&/&/g; $ret = FW_htmlEscape($ret);
$ret =~ s/'/'/g;
$ret =~ s/</&lt;/g;
$ret =~ s/>/&gt;/g;
$ret = "<pre>$ret</pre>" if($ret =~ m/\n/ ); $ret = "<pre>$ret</pre>" if($ret =~ m/\n/ );
$ret =~ s/\n/<br>/g; $ret =~ s/\n/<br>/g;
} }
@ -1522,10 +1519,7 @@ FW_roomOverview($)
next if($r eq "hidden" || $FW_hiddenroom{$r}); next if($r eq "hidden" || $FW_hiddenroom{$r});
$FW_room = AttrVal($FW_wname, "defaultRoom", $r) $FW_room = AttrVal($FW_wname, "defaultRoom", $r)
if(!$FW_room && $FW_ss); if(!$FW_room && $FW_ss);
my $lr = $r; push @list1, FW_htmlEscape($r);
$lr =~ s/</&lt;/g;
$lr =~ s/>/&gt;/g;
push @list1, $lr;
push @list2, "$FW_ME?room=".urlEncode($r); push @list2, "$FW_ME?room=".urlEncode($r);
} }
my $sfx = AttrVal("global", "language", "EN"); my $sfx = AttrVal("global", "language", "EN");
@ -1576,6 +1570,7 @@ FW_roomOverview($)
} else { } else {
my $tblnr = 1; my $tblnr = 1;
my $roomEscaped = FW_htmlEscape($FW_room);
foreach(my $idx = 0; $idx < @list1; $idx++) { foreach(my $idx = 0; $idx < @list1; $idx++) {
my ($l1, $l2) = ($list1[$idx], $list2[$idx]); my ($l1, $l2) = ($list1[$idx], $list2[$idx]);
if(!$l1) { if(!$l1) {
@ -1586,7 +1581,7 @@ FW_roomOverview($)
} }
} else { } else {
FW_pF "<tr%s>", $l1 eq $FW_room ? " class=\"sel\"" : ""; FW_pF "<tr%s>", $l1 eq $roomEscaped ? " class=\"sel\"" : "";
my $class = "menu_$l1"; my $class = "menu_$l1";
$class =~ s/[^A-Z0-9]/_/gi; $class =~ s/[^A-Z0-9]/_/gi;
@ -3152,6 +3147,7 @@ FW_htmlEscape($)
$txt =~ s/&/&amp;/g; $txt =~ s/&/&amp;/g;
$txt =~ s/</&lt;/g; $txt =~ s/</&lt;/g;
$txt =~ s/>/&gt;/g; $txt =~ s/>/&gt;/g;
$txt =~ s/'/&apos;/g;
# $txt =~ s/\n/<br>/g; # $txt =~ s/\n/<br>/g;
return $txt; return $txt;
} }

View File

@ -332,7 +332,7 @@ at_fhemwebFn($$$$)
my $isPerl = ($ts =~ m/^{(.*)}/); my $isPerl = ($ts =~ m/^{(.*)}/);
$ts = $1 if($isPerl); $ts = $1 if($isPerl);
my $h1 = "<br>Change Wizard:". my $h1 .= "<div class='makeTable wide'><span>Change wizard</span>".
"<table class='block wide' id='atWizard' nm='$hash->{NAME}' ts='$ts' ". "<table class='block wide' id='atWizard' nm='$hash->{NAME}' ts='$ts' ".
"rl='$hash->{RELATIVE}' ". "rl='$hash->{RELATIVE}' ".
"pr='$hash->{PERIODIC}' ip='$isPerl' class='block wide'>".<<'EOF'; "pr='$hash->{PERIODIC}' ip='$isPerl' class='block wide'>".<<'EOF';
@ -385,7 +385,7 @@ EOF
my @d = split(" ",$hash->{DEF},2); my @d = split(" ",$hash->{DEF},2);
LoadModule("notify"); LoadModule("notify");
my ($h2, $j2) = notfy_addFWCmd($d, $d[0], 2); my ($h2, $j2) = notfy_addFWCmd($d, $d[0], 2);
return "$h1$h2</table><br>$j1$j2"; return "$h1$h2</table></div><br>$j1$j2";
} }
1; 1;

View File

@ -228,7 +228,8 @@ notify_fhemwebFn($$$$)
my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn. my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn.
my $hash = $defs{$d}; my $hash = $defs{$d};
my $ret .= "Change wizard<br><table class='block wide'>"; my $ret .= "<div class='makeTable wide'><span>Change wizard</span>".
"<table class='block wide'>";
my $row = 0; my $row = 0;
my @ra = split(/\|/, $hash->{REGEXP}); my @ra = split(/\|/, $hash->{REGEXP});
$ret .= "<tr class='".(($row++&1)?"odd":"even"). $ret .= "<tr class='".(($row++&1)?"odd":"even").
@ -274,7 +275,7 @@ notify_fhemwebFn($$$$)
$ret .= "</td></tr>"; $ret .= "</td></tr>";
} }
my ($tr, $js) = notfy_addFWCmd($d, $hash->{REGEXP}, $row); my ($tr, $js) = notfy_addFWCmd($d, $hash->{REGEXP}, $row);
return "$ret$tr</table><br>$js"; return "$ret$tr</table></div><br>$js";
} }
sub sub

View File

@ -393,11 +393,11 @@ SVG_PEdit($$$$)
$ret .= "<form $pestyle id=\"pedit\" method=\"$FW_formmethod\" autocomplete=\"off\" ". $ret .= "<form $pestyle id=\"pedit\" method=\"$FW_formmethod\" autocomplete=\"off\" ".
"action=\"$FW_ME/SVG_WriteGplot\">"; "action=\"$FW_ME/SVG_WriteGplot\">";
$ret .= "Plot Editor";
$ret .= FW_hidden("detail", $d); # go to detail after save $ret .= FW_hidden("detail", $d); # go to detail after save
if(defined($FW_pos{zoom}) && defined($FW_pos{off})) { # for showData if(defined($FW_pos{zoom}) && defined($FW_pos{off})) { # for showData
$ret .= FW_hidden("pos", "zoom=$FW_pos{zoom};off=$FW_pos{off}"); $ret .= FW_hidden("pos", "zoom=$FW_pos{zoom};off=$FW_pos{off}");
} }
$ret .= "<div class='makeTable wide'><span>Plot Editor</span>";
$ret .= "<table class=\"block wide plotEditor\">"; $ret .= "<table class=\"block wide plotEditor\">";
$ret .= "<tr class=\"even\">"; $ret .= "<tr class=\"even\">";
$ret .= "<td>Plot title</td>"; $ret .= "<td>Plot title</td>";
@ -549,7 +549,7 @@ SVG_PEdit($$$$)
FW_submit("showFileLogData", "Show preprocessed input"). FW_submit("showFileLogData", "Show preprocessed input").
"</td></tr>"; "</td></tr>";
$ret .= "</table></form>"; $ret .= "</table></div></form>";
my $sl = "$FW_ME/SVG_WriteGplot?detail=$d&showFileLogData=1"; my $sl = "$FW_ME/SVG_WriteGplot?detail=$d&showFileLogData=1";
if(defined($FW_pos{zoom}) && defined($FW_pos{off})) { if(defined($FW_pos{zoom}) && defined($FW_pos{off})) {

View File

@ -406,12 +406,13 @@ Device specific attributes are documented in the corresponding device section.
<a name="room"></a> <a name="room"></a>
<li>room<br> <li>room<br>
Filter/group devices. Recognized by web-pgm2 and web-pgm3. A device Filter/group devices in frontends. A device can appear in more than one
can appear in more than one room, in this case the rooms have to be room, in this case the rooms have to be specified comma-separated.<br>
specified comma-separated.<br>
Devices in the room hidden will not appear in the web output, or set Devices in the room hidden will not appear in the web output, or set
the <a href="#hiddenroom"> FHEMWEB attribute to selectively disable the FHEMWEB attribute <a href="#hiddenroom">hiddenroom</a> to
rooms for certain FHEMWEB instances. selectively disable rooms for certain FHEMWEB instances.
The -&gt; string is considered as a structure separator for rooms, e.g.
"1st. floor-&gt;Master bedroom".
</li><br> </li><br>
<a name="suppressReading"></a> <a name="suppressReading"></a>

View File

@ -416,6 +416,7 @@ Ger&auml;t dokumentiert.
angegeben werden.<br> angegeben werden.<br>
Ger&auml;te, die dem Raum mit der Bezeichnung "hidden" zugeordnet Ger&auml;te, die dem Raum mit der Bezeichnung "hidden" zugeordnet
werden, erscheinen nicht auf der Webseite. werden, erscheinen nicht auf der Webseite.
Mit -&gt; werden R&auml;ume strukturiert, z.Bsp. OG-&gt;Schlafzimmer
</li><br> </li><br>
<a name="showtime"></a> <a name="showtime"></a>

View File

@ -829,14 +829,14 @@ FW_treeMenu()
$("div#menu table.room").each(function(){ // one loop per Block $("div#menu table.room").each(function(){ // one loop per Block
var t = this, ma = {}; var t = this, ma = {};
$(t).find("td > div > a > span").each(function(e){ $(t).find("td > div > a > span").each(function(e){
var span = this, spanTxt = $(span).html(); var span = this, spanTxt = $(span).text();
var ta = spanTxt.split("--"); var ta = spanTxt.split("->");
if(ta.length <= 1) if(ta.length <= 1)
return; return;
fnd = true; fnd = true;
var nxt="", lst="", tr=$(span).closest("tr"); var nxt="", lst="", tr=$(span).closest("tr");
for(var i1=0; i1<ta.length-1; i1++) { for(var i1=0; i1<ta.length-1; i1++) {
nxt += "--"+ta[i1]; nxt += "->"+ta[i1];
if(!ma[nxt]) { if(!ma[nxt]) {
$(tr).before("<tr class='menuTree closed level"+i1+"' "+ $(tr).before("<tr class='menuTree closed level"+i1+"' "+
"data-mTree='"+lst+"' data-nxt='"+nxt+"'>"+ "data-mTree='"+lst+"' data-nxt='"+nxt+"'>"+
@ -861,7 +861,7 @@ FW_treeMenu()
"tr.menuTree.open { font-weight: bold; }"+ "tr.menuTree.open { font-weight: bold; }"+
"tr.menuTree > td > div > div { "+ "tr.menuTree > td > div > div { "+
"display:inline-block; width:1em; height:1em; float:right;"+ "display:inline-block; width:1em; height:1em; float:right;"+
"background-size: contain;"+ "background-size: contain; background-repeat: no-repeat;"+
"}"+ "}"+
"</style>"); "</style>");
var t = $("div#menu table.room"); var t = $("div#menu table.room");
@ -871,9 +871,9 @@ FW_treeMenu()
.css("background-image", "url('"+arrowRight+"')"); .css("background-image", "url('"+arrowRight+"')");
var selRoom = $("div#content").attr("room"); var selRoom = $("div#content").attr("room");
if(selRoom) { if(selRoom) {
var ta = selRoom.split("--"), nxt=""; var ta = selRoom.split("->"), nxt="";
for(var i1=0; i1<ta.length-1; i1++) { for(var i1=0; i1<ta.length-1; i1++) {
nxt += "--"+FW_escapeSelector(ta[i1]); nxt += FW_escapeSelector("->"+ta[i1]);
treeClick($(t).find("tr.menuTree[data-nxt="+nxt+"]")); treeClick($(t).find("tr.menuTree[data-nxt="+nxt+"]"));
} }
} }
@ -900,7 +900,7 @@ FW_escapeSelector(s)
{ {
if(typeof s != 'string') if(typeof s != 'string')
return s; return s;
return s.replace(/[ .#\[\]]/g, function(r) { return '\\'+r }); return s.replace(/[ .#\[\]>]/g, function(r) { return '\\'+r });
} }
/*************** LONGPOLL START **************/ /*************** LONGPOLL START **************/
@ -1130,6 +1130,8 @@ FW_detailSelect(selEl, mayMissing)
var selVal = $(selEl).val(); var selVal = $(selEl).val();
var div = $(selEl).closest("div.makeSelect"); var div = $(selEl).closest("div.makeSelect");
if(!div.attr("list")) // hiddenRoom=input
return;
var arg, var arg,
listArr = $(div).attr("list").split(" "), listArr = $(div).attr("list").split(" "),
devName = $(div).attr("dev"), devName = $(div).attr("dev"),