2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

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
This commit is contained in:
rudolfkoenig 2019-03-23 16:59:40 +00:00
parent 0cb2fcb3c5
commit d95bfc0112
2 changed files with 14 additions and 3 deletions

View File

@ -2337,8 +2337,14 @@ CommandDeleteReading($$)
{ {
my ($cl, $def) = @_; my ($cl, $def) = @_;
my $quiet = undef;
if($def =~ m/^\s*-q\s(.*)$/) {
$quiet = 1;
$def = $1;
}
my @a = split(" ", $def, 2); my @a = split(" ", $def, 2);
return "Usage: deletereading <name> <reading>\n$namedef" if(@a != 2); return "Usage: deletereading [-q] <name> <reading>\n$namedef" if(@a != 2);
eval { "" =~ m/$a[1]/ }; eval { "" =~ m/$a[1]/ };
return "Bad regexp $a[1]: $@" if($@); return "Bad regexp $a[1]: $@" if($@);
@ -2362,6 +2368,7 @@ CommandDeleteReading($$)
} }
} }
return undef if($quiet);
return join("\n", @rets); return join("\n", @rets);
} }

View File

@ -770,8 +770,12 @@ FW_inlineModify() // Do not generate a new HTML page upon pressing modify
cmd = $(this).attr("name")+"="+cmd+" "+devName+" "+arg+" "+newDef; cmd = $(this).attr("name")+"="+cmd+" "+devName+" "+arg+" "+newDef;
} }
FW_cmd(FW_root+"?"+encodeURIComponent(cmd)+"&XHR=1", function(resp){ FW_cmd(FW_root+"?"+encodeURIComponent(cmd)+"&XHR=1", function(resp){
if(!resp && reloadIfOk) if(!resp && reloadIfOk) {
location.reload(); 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) {
if(!resp.match(/^<html>[\s\S]*<\/html>/ ) ) { if(!resp.match(/^<html>[\s\S]*<\/html>/ ) ) {
resp = FW_htmlQuote(resp); resp = FW_htmlQuote(resp);