[Rt-devel] manual redirect

Joby Walker joby at u.washington.edu
Thu Jan 5 12:53:15 EST 2006


We have a /Elements/Redirect object that we use for all redirection
(e.g. /Tickets/Display.html whenever a value is changed), so a browser
reload "does the right thing"(TM).  The object includes two layers of
automatic redirection HTTP (very fast), and Javascript (pretty fast),
and if that fails there is a link.  It is simple to use:

/Elements/Redirect
$page: the page you want to send the client to
@actions: array of Result strings that you want diplayed on the target page.


For exmple from our /Tickets/Display.html:

if(@Actions){
    $m->comp('/Elements/Redirect',
             page => $RT::WebPath . '/Ticket/Display.html?id=' .
$TicketObj->Id,
             actions => \@Actions);
    return 1;
}

/Elements/Redirect
---------------------------------------------------------------------
<html>
<head>
<script language="JavaScript">
    window.location="<%$page%>";
</script>
</head>
<body>
Please go to this location: <a href="<%$page%>"><%$page%></a>
<table>
<tr><td>
<%init>
$session{'actions'} = \@actions;
$page = $RT::WebBaseURL . $page;
$r->headers_out->{'Location'} = $page;
</%init>
<%ARGS>
$page => '/index.html'
@actions => undef
</%ARGS>
---------------------------------------------------------------------

Joby Walker
ITI SSG, C&C, University of Washington


Jens Porup wrote:
> On Thu, Jan 05, 2006 at 12:01:17AM -0500, Todd Chapman wrote:
> 
>>On Thu, Jan 05, 2006 at 03:52:39PM +1100, Jens Porup wrote:
>>
>>>If so, how does this affect my ability to get the $m object,
>>>and call a redirect using it?
>>>
>>
>>It's always available from a Mason component.
> 
> 
> Thanks!
> 
> The only time I ever use Mason is when I'm hacking on RT, so
> I'm still finding my way around...
> 
> Cheers,
> 
> Jens
> 
> _______________________________________________
> Rt-devel mailing list
> Rt-devel at lists.bestpractical.com
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel


More information about the Rt-devel mailing list