From: Moritz Bunkus Date: Thu, 30 Dec 2010 15:21:34 +0000 (+0100) Subject: Controller-Base: Methode für HTTP-Redirect implementiert X-Git-Tag: release-2.6.2beta1~17^2~3^2~10 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=11093bd5e435f766d1d401e60336a625226fd891;p=kivitendo-erp.git Controller-Base: Methode für HTTP-Redirect implementiert --- diff --git a/SL/Controller/Base.pm b/SL/Controller/Base.pm index c655e72e2..a2a380b93 100644 --- a/SL/Controller/Base.pm +++ b/SL/Controller/Base.pm @@ -4,6 +4,10 @@ use parent qw(Rose::Object); use List::Util qw(first); +# +# public/helper functions +# + sub parse_html_template { my $self = shift; my $name = shift; @@ -26,6 +30,17 @@ sub url_for { return "controller.pl?${query}"; } +sub redirect_to { + my $self = shift; + my $url = $self->url_for(@_); + + print $::cgi->redirect($url); +} + +# +# private functions -- for use in Base only +# + sub _run_action { my $self = shift; my $action = "action_" . shift; @@ -169,6 +184,12 @@ Usage from a template might look like this: create new message +=item redirect_to %url_params + +Redirects the browser to a new URL by outputting a HTTP redirect +header. The URL is generated by calling L with +C<%url_params>. + =back =head2 PRIVATE FUNCTIONS