2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

telnet/FHEMWEB: multiline Attribute patch (Forum #42431)

git-svn-id: https://svn.fhem.de/fhem/trunk@9511 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-10-18 10:13:01 +00:00
parent 4994c826e0
commit a1cf8bd51f
4 changed files with 16 additions and 6 deletions

View File

@ -901,6 +901,11 @@ FW_digestCgi($)
$cmd.=" $arg{$c}" if(defined($arg{$c}) &&
($arg{$c} ne "state" || $cmd !~ m/^set/));
$cmd.=" $val{$c}" if(defined($val{$c}));
#replace unicode newline symbol \u2424 with real newline
my $nl = chr(226) . chr(144) . chr(164);
$cmd =~ s/$nl/\n/g;
return ($cmd, $c);
}

View File

@ -258,6 +258,7 @@ telnet_Read($)
$gotCmd = 1;
if($cmd) {
if($cmd =~ m/\\ *$/) { # Multi-line
$cmd =~ s/\\ *$//;
$hash->{prevlines} .= $cmd . "\n";
} else {
if($hash->{prevlines}) {

View File

@ -223,7 +223,7 @@ use vars qw(@structChangeHist); # Contains the last 10 structural changes
use vars qw($cmdFromAnalyze); # used by the warnings-sub
use vars qw($featurelevel);
my $AttrList = "verbose:0,1,2,3,4,5 room group comment alias ".
my $AttrList = "verbose:0,1,2,3,4,5 room group comment:textField-long alias ".
"eventMap userReadings";
my $currcfgfile=""; # current config/include file
my $currlogfile; # logfile, without wildcards

View File

@ -631,7 +631,8 @@ FW_queryValue(cmd, el)
qConn.onreadystatechange = function() {
if(qConn.readyState != 4)
return;
var qResp = qConn.responseText.replace(/[\r\n]/g, "");
var qResp = qConn.responseText.replace(/\n$/, '');
qResp = qResp.replace(/\n/g, '\u2424');
if(el.setValueFn)
el.setValueFn(qResp);
qConn.abort();
@ -681,7 +682,9 @@ FW_createTextField(elName, devName, vArr, currVal, set, params, cmd)
'<textarea id="td_longText" rows="25" cols="60" style="width:99%"/>'+
'</div>');
$("#td_longText").val($(inp).val());
var txt = $(inp).val();
txt = txt.replace(/\u2424/g, '\n');
$("#td_longText").val(txt);
var cm;
if( typeof AddCodeMirror == 'function' )
@ -700,6 +703,7 @@ FW_createTextField(elName, devName, vArr, currVal, set, params, cmd)
if(cm)
$("#td_longText").val(cm.getValue());
var res=$("#td_longText").val();
res = res.replace(/\n/g, '\u2424' );
$(this).dialog('close');
$(inp).val(res);
addBlur();