2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

redirectCmds

git-svn-id: https://svn.fhem.de/fhem/trunk@1249 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-02-11 13:35:11 +00:00
parent 2ec6bf5c51
commit bdbb63382e
3 changed files with 28 additions and 2 deletions

View File

@ -11,6 +11,7 @@
- feature: NetIO230B module by Andy
- feature: Retaining configfile comments (not within a define statement)
- feature: EnOcean PM101 by Ignaz
- feature: FHEMWEB redirectCmds attribute added
- 2011-12-31 (5.2)
- bugfix: applying smallscreen attributes to firefox/opera

View File

@ -7348,6 +7348,16 @@ href="http://www.elv.de/output/controller.aspx?cid=74&detail=10&detail2=29870">U
</li>
<br>
<a name="redirectCmds"></a>
<li>redirectCmds<br>
Clear the browser URL window after issuing the command by redirecting
the browser, as a reload for the same site might have unintended
side-effects. Default is 1 (enabled). Disable it by setting this
attribute to 0 if you want to study the command syntax, in order to
communicate with FHEMWEB.
</li>
<br>
<a name="webCmd"></a>
<li>webCmd<br>
Colon separated list of commands to be shown in the room overview for a

View File

@ -91,7 +91,7 @@ FHEMWEB_Initialize($)
$hash->{AttrList}= "loglevel:0,1,2,3,4,5,6 webname fwmodpath fwcompress " .
"plotmode:gnuplot,gnuplot-scroll,SVG plotsize refresh " .
"touchpad smallscreen plotfork basicAuth basicAuthMsg ".
"stylesheetPrefix hiddenroom HTTPS longpoll";
"stylesheetPrefix hiddenroom HTTPS longpoll redirectCmds";
###############
# Initialize internal structures
@ -436,6 +436,19 @@ FW_AnswerCall($)
return 0;
}
# Redirect after a command, to clean the browser URL window
if($docmd && !$FW_cmdret && AttrVal($FW_wname, "redirectCmds", 1)) {
my $tgt = $FW_ME;
if($FW_detail) { $tgt .= "?detail=$FW_detail" }
elsif($FW_room) { $tgt .= "?room=$FW_room" }
my $c = $defs{$FW_cname}{CD};
print $c "HTTP/1.1 302 Found\r\n",
"Content-Length: 0\r\n",
"Location: $tgt\r\n",
"\r\n";
return -1;
}
FW_updateHashes();
if($cmd =~ m/^showlog /) {
FW_showLog($cmd);
@ -501,7 +514,8 @@ FW_AnswerCall($)
FW_pO $FW_cmdret;
}
FW_pO "</div>";
}
}
FW_roomOverview($cmd);
FW_style($cmd,undef) if($cmd =~ m/^style /);
@ -1528,6 +1542,7 @@ FW_style($$)
my $ret = FW_fC("rereadcfg") if($fName eq $attr{global}{configfile});
$ret = ($ret ? "<h3>ERROR:</h3><b>$ret</b>" : "Saved the file $fName");
FW_style("style list", $ret);
$ret = "";
}
}