From b1bbf36825dcd415cf2bc511a07d7c3e399ac956 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Sun, 19 Nov 2006 05:17:15 +0000 Subject: [PATCH] Fix exporting of a redirect. The view method in the Redirect sets a HTTP header and returns "1", which doesn't create a redirect. I fixed this by: - Writing a exportHtml_view method just for Redirect. - using the Fail Safe style template to output an empty page with a redirect tag in the header. --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Redirect.pm | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 2f03899f3..c8532c7dd 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -3,6 +3,7 @@ - fix: Workflow form control edit button won't work. removed. - fix: Bug in HttpProxy.pm - fix: Storage::Image copy does not create thumbnails + - fix: Static export - redirect problems 7.2.1 - Made a change to version tag commits to deal with unusually long commit diff --git a/lib/WebGUI/Asset/Redirect.pm b/lib/WebGUI/Asset/Redirect.pm index 0464e788f..9f5083269 100644 --- a/lib/WebGUI/Asset/Redirect.pm +++ b/lib/WebGUI/Asset/Redirect.pm @@ -91,6 +91,24 @@ sub www_edit { #------------------------------------------------------------------- +=head2 exportHtml_view + +A web executable method that redirects the user to the specified page, or displays the edit interface when admin mode is enabled. + +=cut + +sub exportHtml_view { + my $self = shift; + return $self->session->privilege->noAccess() unless $self->canView; + my $url = $self->get("redirectUrl"); + WebGUI::Macro::process($self->session, \$url); + return '' if ($url eq $self->get("url")); + $self->session->http->setRedirect($url); + return $self->session->style->process('', 'PBtmpl0000000000000060'); +} + +#------------------------------------------------------------------- + =head2 www_view A web executable method that redirects the user to the specified page, or displays the edit interface when admin mode is enabled.