[rt-users] FOLLOW-UP: "refersto" link customizations?

Kurt Yoder kylist at shcorp.com
Thu Jul 10 11:40:59 EDT 2003


Kurt Yoder said:
> Hello all
>
> I've looked in every place I can think of (mailing list, rt hacker's
> guide, google), but can't seem to locate any information on
> customizing rt's "refersto" links. I only know that it looks like it
> should be extremely easy, to the point that there's an option in the
> main configuration file to set it up.
>
> Can anyone offer me any pointers? Using rt 2.0.14. Thanks.

OK, I figured this out, so I'll post it to the list for posterity
(if knowledgeable people here want to point out anything I did
wrong, feel free to correct me). Following is an example of the type
of scenario I was trying to get working.

Suppose you have an external web-browser-accessible database where
each element of the database has a unique http url. Maybe your url
for accessing an element of the database looks like this:
"http://dbase.site.com/dbase/page.html?id=1234". Instead of typing
this monstrosity in every time you want to link to an id, you want a
custom external rt link that looks like "db://1234".

The above example is quite easy to set up using link/uri
customization within rt2 (NOTE: I have not used rt3 yet, so I can't
say if it works the same in rt3). Here is how to do it:

-Find your etc directory within rt2

-Edit config.pm

-Find "%URI2HTTP" in this file; this is what you will be editing

-The 6 included configs should give you an idea for how to proceed.
In our example, our uri identifier will be "db".

-Add a line
'db' => sub {return @_;},
right above the 'http' line

-The "return @_;" needs to be changed to return our http link
instead of "db://<number>". The bit between the {} is a regular perl
function, so we'll modify it to return the http link. Add this line
in front of "return @_;":
$_[0] =~ s[db://][http://dbase.site.com/dbase/page.html?id=];

-Finally, stop and start your web server. Note, do *not* simply
"restart" or "kill -HUP", etc. You *must* completely stop and start
the web server. Rumor has it this is due to some kind of caching in
mason, which RT uses.

Done!

-- 
Kurt Yoder
Sport & Health network administrator




More information about the rt-users mailing list