Author: spadkins
Date: Wed Oct 21 13:06:37 2009
New Revision: 13406

Modified:
   p5ee/trunk/App-Context/lib/App/Request/CGI.pm

Log:
keep the app.Request.keep_url_params on the form tag url

Modified: p5ee/trunk/App-Context/lib/App/Request/CGI.pm
==============================================================================
--- p5ee/trunk/App-Context/lib/App/Request/CGI.pm       (original)
+++ p5ee/trunk/App-Context/lib/App/Request/CGI.pm       Wed Oct 21 13:06:37 2009
@@ -691,7 +691,22 @@
     my ($url);
     my $cgi = $self->{cgi};
     if ($cgi) {
-        $url = $cgi->url(-path_info=>1);
+        my $context = $self->{context};
+        my $options = $context->{options};
+        my (%keep_param);
+        if ($options->{"app.Request.keep_url_params"}) {
+            %keep_param = map { $_ => 1 } split(/[ ,]+/, 
$options->{"app.Request.keep_url_params"});
+        }
+        else {
+            %keep_param = ( u => 1, p => 1, eu => 1, eu_normal => 1 );
+        }
+        my $newcgi = CGI->new($cgi);
+        foreach my $param ($cgi->param()) {
+            if (!$keep_param{$param}) {
+                $newcgi->delete($param);
+            }
+        }
+        $url = $newcgi->url(-path_info=>1, -query_string=>1);
     }
     &App::sub_exit($url) if ($App::trace);
     return($url);

Reply via email to