BypassLocalComponent

From Request Tracker Wiki
Jump to navigation Jump to search

I would like to create a mason Local component (/opt/rt3/local/html/MyComp) that will decide to either handle the request or pass it off to the original component (/opt/rt3/share/html/MyComp) to handle.

For example, you might want the component /Ticket/Create.html to be drastically different for just one queue, but appear as normal for all other queues. You don't want to include the code/html for both version in one component. If you did it that way you would have to update your component every time Create.html changes in the standard RT distribution.

Here's how to do this:

Read this entry of the Mason FAQ.

Install perl module: [=perl -MCPAN -e 'install MasonX::Request::ExtendedCompRoot']

In RT_SiteConfig.pm:

@MasonParameters = (request_class => 'MasonX::Request::ExtendedCompRoot',

                    resolver_class => 'MasonX::Resolver::ExtendedCompRoot') unless (@MasonParameters);

mkdir /opt/rt3/local/html/Ticket

vi /opt/rt3/local/html/Ticket/Create.html with content:

% if ($ARGS{Queue} == 1) {

<& standard=>/Ticket/Create.html, %ARGS &>
% $m->abort;
% }
This is not the component your are looking for. (Jedi mind tricks. he, he)

mkdir /opt/rt3/local/html/Elements

vi /opt/rt3/local/html/Elements/SelectOwner with content:

Pick me! Pick me!

Try to create a ticket in queue with id 1. Notice how SelectOwner is from local but Create.html is from share? Try to create a ticket in queue with id > 1. Not happening!

See the MasonX::Request::ExtendedCompRoot documentation for more fun.