From 39b337a703bc7eee6632222ed8c61badd562ba7f Mon Sep 17 00:00:00 2001
From: rudolfkoenig <>
Date: Fri, 5 Jan 2018 20:46:21 +0000
Subject: [PATCH] 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
---
fhem/CHANGED | 3 ++-
fhem/FHEM/01_FHEMWEB.pm | 14 +++++---------
fhem/FHEM/90_at.pm | 4 ++--
fhem/FHEM/91_notify.pm | 5 +++--
fhem/FHEM/98_SVG.pm | 4 ++--
fhem/docs/commandref_frame.html | 11 ++++++-----
fhem/docs/commandref_frame_DE.html | 1 +
fhem/www/pgm2/fhemweb.js | 16 +++++++++-------
8 files changed, 30 insertions(+), 28 deletions(-)
diff --git a/fhem/CHANGED b/fhem/CHANGED
index 10a16c42d..8fb7c4501 100644
--- a/fhem/CHANGED
+++ b/fhem/CHANGED
@@ -1,7 +1,8 @@
# 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.
+ - feature: 01_FHEMWEB.pm: -> as room separator (Forum #82151)
- 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
- feature: 20_FRM_PWM: new attribute "restoreOnStartup"
- feature: 20_FRM_OUT: new attributes "activeLow" and "valueMode"
diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm
index 86ba31199..1df729495 100644
--- a/fhem/FHEM/01_FHEMWEB.pm
+++ b/fhem/FHEM/01_FHEMWEB.pm
@@ -646,10 +646,7 @@ FW_AsyncOutput($$)
$ret = $1;
} else {
- $ret =~ s/&/&/g;
- $ret =~ s/'/'/g;
- $ret =~ s/</g;
- $ret =~ s/>/>/g;
+ $ret = FW_htmlEscape($ret);
$ret = "
$ret
" if($ret =~ m/\n/ );
$ret =~ s/\n/
/g;
}
@@ -1522,10 +1519,7 @@ FW_roomOverview($)
next if($r eq "hidden" || $FW_hiddenroom{$r});
$FW_room = AttrVal($FW_wname, "defaultRoom", $r)
if(!$FW_room && $FW_ss);
- my $lr = $r;
- $lr =~ s/</g;
- $lr =~ s/>/>/g;
- push @list1, $lr;
+ push @list1, FW_htmlEscape($r);
push @list2, "$FW_ME?room=".urlEncode($r);
}
my $sfx = AttrVal("global", "language", "EN");
@@ -1576,6 +1570,7 @@ FW_roomOverview($)
} else {
my $tblnr = 1;
+ my $roomEscaped = FW_htmlEscape($FW_room);
foreach(my $idx = 0; $idx < @list1; $idx++) {
my ($l1, $l2) = ($list1[$idx], $list2[$idx]);
if(!$l1) {
@@ -1586,7 +1581,7 @@ FW_roomOverview($)
}
} else {
- FW_pF "", $l1 eq $FW_room ? " class=\"sel\"" : "";
+ FW_pF "
", $l1 eq $roomEscaped ? " class=\"sel\"" : "";
my $class = "menu_$l1";
$class =~ s/[^A-Z0-9]/_/gi;
@@ -3152,6 +3147,7 @@ FW_htmlEscape($)
$txt =~ s/&/&/g;
$txt =~ s/</g;
$txt =~ s/>/>/g;
+ $txt =~ s/'/'/g;
# $txt =~ s/\n/
/g;
return $txt;
}
diff --git a/fhem/FHEM/90_at.pm b/fhem/FHEM/90_at.pm
index 90c2ac3d1..ebf6b4513 100644
--- a/fhem/FHEM/90_at.pm
+++ b/fhem/FHEM/90_at.pm
@@ -332,7 +332,7 @@ at_fhemwebFn($$$$)
my $isPerl = ($ts =~ m/^{(.*)}/);
$ts = $1 if($isPerl);
- my $h1 = "
Change Wizard:".
+ my $h1 .= "Change wizard".
"
{RELATIVE}' ".
"pr='$hash->{PERIODIC}' ip='$isPerl' class='block wide'>".<<'EOF';
@@ -385,7 +385,7 @@ EOF
my @d = split(" ",$hash->{DEF},2);
LoadModule("notify");
my ($h2, $j2) = notfy_addFWCmd($d, $d[0], 2);
- return "$h1$h2
$j1$j2";
+ return "$h1$h2
$j1$j2";
}
1;
diff --git a/fhem/FHEM/91_notify.pm b/fhem/FHEM/91_notify.pm
index 6fb92e9c4..80fe96697 100644
--- a/fhem/FHEM/91_notify.pm
+++ b/fhem/FHEM/91_notify.pm
@@ -228,7 +228,8 @@ notify_fhemwebFn($$$$)
my ($FW_wname, $d, $room, $pageHash) = @_; # pageHash is set for summaryFn.
my $hash = $defs{$d};
- my $ret .= "Change wizard
";
+ my $ret .= "Change wizard".
+ "
";
my $row = 0;
my @ra = split(/\|/, $hash->{REGEXP});
$ret .= "Plot Editor";
$ret .= "";
$ret .= "";
$ret .= "Plot title | ";
@@ -549,7 +549,7 @@ SVG_PEdit($$$$)
FW_submit("showFileLogData", "Show preprocessed input").
"
";
- $ret .= "
";
+ $ret .= "
";
my $sl = "$FW_ME/SVG_WriteGplot?detail=$d&showFileLogData=1";
if(defined($FW_pos{zoom}) && defined($FW_pos{off})) {
diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html
index 359f7dc38..adbc65daf 100644
--- a/fhem/docs/commandref_frame.html
+++ b/fhem/docs/commandref_frame.html
@@ -406,12 +406,13 @@ Device specific attributes are documented in the corresponding device section.
room
- Filter/group devices. Recognized by web-pgm2 and web-pgm3. A device
- can appear in more than one room, in this case the rooms have to be
- specified comma-separated.
+ Filter/group devices in frontends. A device can appear in more than one
+ room, in this case the rooms have to be specified comma-separated.
Devices in the room hidden will not appear in the web output, or set
- the FHEMWEB attribute to selectively disable
- rooms for certain FHEMWEB instances.
+ the FHEMWEB attribute hiddenroom to
+ selectively disable rooms for certain FHEMWEB instances.
+ The -> string is considered as a structure separator for rooms, e.g.
+ "1st. floor->Master bedroom".
diff --git a/fhem/docs/commandref_frame_DE.html b/fhem/docs/commandref_frame_DE.html
index 471e70661..ac9dc4306 100644
--- a/fhem/docs/commandref_frame_DE.html
+++ b/fhem/docs/commandref_frame_DE.html
@@ -416,6 +416,7 @@ Gerät dokumentiert.
angegeben werden.
Geräte, die dem Raum mit der Bezeichnung "hidden" zugeordnet
werden, erscheinen nicht auf der Webseite.
+ Mit -> werden Räume strukturiert, z.Bsp. OG->Schlafzimmer
diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js
index c4ea92fc7..ddb0367ca 100644
--- a/fhem/www/pgm2/fhemweb.js
+++ b/fhem/www/pgm2/fhemweb.js
@@ -829,14 +829,14 @@ FW_treeMenu()
$("div#menu table.room").each(function(){ // one loop per Block
var t = this, ma = {};
$(t).find("td > div > a > span").each(function(e){
- var span = this, spanTxt = $(span).html();
- var ta = spanTxt.split("--");
+ var span = this, spanTxt = $(span).text();
+ var ta = spanTxt.split("->");
if(ta.length <= 1)
return;
fnd = true;
var nxt="", lst="", tr=$(span).closest("tr");
for(var i1=0; i1"+ta[i1];
if(!ma[nxt]) {
$(tr).before("