2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 01:14:19 +00:00

fhemweb.js: fixing inline attribtue changes (Forum #52379)

git-svn-id: https://svn.fhem.de/fhem/trunk@11328 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-04-27 12:07:21 +00:00
parent 431413e11f
commit f2ffa13962
2 changed files with 10 additions and 8 deletions

View File

@ -2512,7 +2512,7 @@ FW_Notify($$)
if($dev->{CHANGED}) {
$dn = $1 if($dev->{CHANGED}->[0] =~ m/^MODIFIED (.*)$/);
if($dev->{CHANGED}->[0] =~ m/^ATTR ([^ ]+) ([^ ]+) (.*)$/) {
if($dev->{CHANGED}->[0] =~ m/^ATTR ([^ ]+) ([^ ]+) (.*)$/s) {
$dn = $1;
my @a = ("$2: $3");
$events = \@a;

View File

@ -500,10 +500,10 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify
var newDef = typeof cm !== 'undefined' ?
cm.getValue() : $(this).closest("form").find("textarea").val();
var cmd = $(this).attr("name")+"="+$(this).attr("value")+" "+newDef;
var noDef;
var isDef = true;
if( newDef == undefined ) {
noDef = true;
isDef = false;
var div = $(this).closest("div.makeSelect");
var devName = $(div).attr("dev"),
cmd = $(div).attr("cmd");
@ -527,9 +527,9 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify
newDef = newDef.replace(/&/g, '&') // Same as in 01_FHEMWEB
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;');
if(newDef.indexOf("\n") >= 0)
newDef = '<pre>'+newDef+'</pre>';
if(!noDef) {
if(isDef) {
if(newDef.indexOf("\n") >= 0)
newDef = '<pre>'+newDef+'</pre>';
$("div#disp").html(newDef).css("display", "");
$("div#edit").css("display", "none");
}
@ -580,9 +580,11 @@ FW_doUpdate()
} else {
$("[informId='"+d[0]+"']").each(function(){
if(this.setValueFn) { // change the select/etc value
this.setValueFn(d[1]);
this.setValueFn(d[1].replace(/\n/g, '\u2424'));
} else {
if(d[2].match(/\n/))
d[2] = '<pre>'+d[2]+'</pre>';
$(this).html(d[2]); // Readings-Value
if(d[0].match(/-ts$/)) // timestamps
$(this).addClass('changed');
@ -823,7 +825,7 @@ FW_createTextField(elName, devName, vArr, currVal, set, params, cmd)
$("#td_longText").val(txt);
var cm;
if( typeof AddCodeMirror == 'function' && !$("#td_longText").get(0).editor) {
if(typeof AddCodeMirror == 'function' && !$("#td_longText").get(0).editor) {
$("#td_longText").get(0).editor = true;
AddCodeMirror($("#td_longText").get(0), function(pcm) {cm = pcm;});
}