[rt-users] Bypassing Local mason components

Todd Chapman todd at chaka.net
Wed May 18 16:53:31 EDT 2005


On Wed, May 18, 2005 at 04:04:43PM -0400, Stephen Turner wrote:
> At Wednesday 5/18/2005 12:00 PM, Todd Chapman wrote:
> >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.
> >
> >What's the easiest way to do this? I want to call the actual original
> >component and not duplicate it's functionality.
> >
> >Can I just call the original component with an absolute path
> >and my args? I guess I need some way to re-call the component
> >but bypass the local system.
> >
> >Ideas?
> 
> 
> I wonder if you could do something funky with a sym link? Create 
> local/html/MyCompLink that points to share/html/MyComp and have your local 
> MyComp call local MyCompLink when it needs to call the original component.
> 
> I suspect this won't work . If you find a solution I'd be interested to 
> hear about it.
> 
> Thanks,
> Steve

Figured it out!

0. read: http://www.masonhq.com/?FAQ:Components#h-when_using_multiple_component_roots__is_there_a_way_to_explicitly_call_a_component_in_a_specific_root_

1. perl -MCPAN -e 'install MasonX::Request::ExtendedCompRoot'

2. In RT_SiteConfig.pm:
@MasonParameters = (request_class  => 'MasonX::Request::ExtendedCompRoot', resolver_class => 'MasonX::Resolver::ExtendedCompRoot') unless (@MasonParameters);

3. mkdir /opt/rt3/local/html/Ticket

4. vi /opt/rt3/local/html/Ticket/Create.html with content:
% if ($ARGS{Queue} == 1) {
<& standard=>/Ticket/Create.html, %ARGS &>
% $m->abort;
% }
bite me!

5. mkdir /opt/rt3/local/html/Elements

6. 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 for more fun.

-Todd



More information about the rt-users mailing list