Skip to content

Commit

Permalink
Item985: Switching off automatic redirects in FormPlugin by an option
Browse files Browse the repository at this point in the history
"nicer" foreachs

git-svn-id: http://svn.foswiki.org/trunk/FormPlugin@2344 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
EugenMayer authored and EugenMayer committed Feb 4, 2009
1 parent 4118bfb commit e65ca18
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lib/Foswiki/Plugins/FormPlugin.pm
Expand Up @@ -422,12 +422,13 @@ sub _startForm {
"FormPlugin - POST and Plugins::VERSION < 1.2 -- converting all key-values to a parameter string: actionUrl="
. $actionUrl )
if $debug;
Foswiki::Func::redirectCgiQuery( undef, $actionUrl );

Foswiki::Func::redirectCgiQuery( undef, $actionUrl ) if(_doRedirects());
return;
}

# else
Foswiki::Func::redirectCgiQuery( undef, $actionUrl, 1 );
Foswiki::Func::redirectCgiQuery( undef, $actionUrl, 1 ) if(_doRedirects());
return '';
}
}
Expand Down Expand Up @@ -1465,8 +1466,7 @@ sub _group {
if $options{-onMouseOut};

my @elements;
foreach (@$values) {
my $value = $_;
foreach my $value (@$values) {
my $label = $labels->{$value};

my %attributes = ();
Expand Down Expand Up @@ -1617,8 +1617,7 @@ sub _postDataToUrlParamString {
my $out = '';
my $query = Foswiki::Func::getCgiQuery();
my @names = $query->param;
foreach (@names) {
my $name = $_;
foreach my $name (@names) {
next if !$name;
$out .= ';' if $out;
my $value = $query->param($name);
Expand All @@ -1641,4 +1640,17 @@ sub _urlEncode {

return $text;
}

=pod
Evaluates if the FormPlugin should redirect if needed. True means, it is allowed to redirect, false denys any redirects
=cut
sub _doRedirects {
my $query = Foswiki::Func::getCgiQuery();
return 0 if($query->param("fp_noredirects"));

# default do redirects
return 1;
}
1;

0 comments on commit e65ca18

Please sign in to comment.