From d95bfc011219ceecd9b8344cf445747d4a86717e Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 23 Mar 2019 16:59:40 +0000 Subject: [PATCH] fhem.pl: add -q to deletereading, fhemweb.js: retain fw_id (Forum #97989) git-svn-id: https://svn.fhem.de/fhem/trunk@19006 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/fhem.pl | 9 ++++++++- fhem/www/pgm2/fhemweb.js | 8 ++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/fhem/fhem.pl b/fhem/fhem.pl index 0de880220..89a1179fb 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -2337,8 +2337,14 @@ CommandDeleteReading($$) { my ($cl, $def) = @_; + my $quiet = undef; + if($def =~ m/^\s*-q\s(.*)$/) { + $quiet = 1; + $def = $1; + } + my @a = split(" ", $def, 2); - return "Usage: deletereading \n$namedef" if(@a != 2); + return "Usage: deletereading [-q] \n$namedef" if(@a != 2); eval { "" =~ m/$a[1]/ }; return "Bad regexp $a[1]: $@" if($@); @@ -2362,6 +2368,7 @@ CommandDeleteReading($$) } } + return undef if($quiet); return join("\n", @rets); } diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index 7163b193b..76caf3fb6 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -770,8 +770,12 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify cmd = $(this).attr("name")+"="+cmd+" "+devName+" "+arg+" "+newDef; } FW_cmd(FW_root+"?"+encodeURIComponent(cmd)+"&XHR=1", function(resp){ - if(!resp && reloadIfOk) - location.reload(); + if(!resp && reloadIfOk) { + var hr = location.href+""; + location.href = hr+ // retain fw_id + (hr.match(/fw_id=\d+/) ? "" : '&fw_id='+$("body").attr('fw_id')); + + } if(resp) { if(!resp.match(/^[\s\S]*<\/html>/ ) ) { resp = FW_htmlQuote(resp);