[rt-users] Having stripmime put a clickable link
Frank Thommen
thommen at inf.ethz.ch
Tue Mar 20 09:25:44 EST 2001
hi lorens,
i did the following:
i added a subroutine 'print_url_list' to 'support.pm' and called this routine
at the end of 'print_transaction' in 'support.pm'. it prints a list of all
http-urls occurring in the transaction (not only stripmime links) as clickable
urls at the end of each transaction.
the regexp used to detect http-urls is not very good :-}. you'll sometimes
have to correct the url in your browser, but that should not be a big problem
and - at least for me - is better than nothing.
the rest of the transaction is printed as preformatted text (<PRE>), therefore
you cannot have any clickable links in it. for 'optical conformance' the url
list is printed in teletype style (<TT>).
any feedbacks for enhancements are welcome.
#
# this is tne new subroutine
#
sub print_url_list {
my ($value) = shift;
$url_regexp = 'http://([\w-])+(\.\1)*(/?[^ ])*[^\.]';
if ($value =~ /$url_regexp/) {
print "<tt><b>URL-List for this Transaction:</b><p>\n";
while ($value =~ /$url_regexp/g) {
$url = $&;
print "* <a href=\"$url\" target=\"_new\">$url</a><br>\n";
}
print "</tt>\n";
}
}
#
# this is the modified print_transaction
#
sub print_transaction {
...codecodecode...
print "<pre>";
&print_html($body);
print "</pre>";
&print_url_list($body); #add here print_url_list
}
frank
--------------------
> (Hesitated between rt-user and rt-devel, decided that RT1
> belongs on rt-users... that right?)
>
> I just installed stripmime, and I'm a bit disappointed that I
> don't get a clickable link in the web ui.
>
> First off, I modified the script to only put the first
> attachment in-line (if it's text), since I expect large text
> attachments that I don't want in the interface. That was a
> breeze.
>
> Than I modified the stripmime script to output a HTML HREF
> instead of just the plaintext URL (should have realized it
> wasn't that simple) and saw that the output is HTML-sanitized,
> which was to be expected, after all.
>
> I'm quite concerned about not having problems with malicious or
> bizarre mails wreaking havoc in my interface, so I'm certainly
> not going to remove what protection I have against that, but I
> do want clickable links too.
>
> Any way? Maybe after the sanitation is done I could sed
> the output looking for the distinctive (text) link to
> https://myhost/stripmime/, or even with a custom unusual token
> that I'd make stripmime output? Anybody done that (where is the
> sanitation done?), or have another idea?
>
> Apologies if this has been discussed before.
>
> --
> #include <std_disclaim.h> Lorens Kockum
>
> _______________________________________________
> rt-users mailing list
> rt-users at lists.fsck.com
> http://lists.fsck.com/mailman/listinfo/rt-users
----------
Frank Thommen, Informatik Support Gruppe, D-INFK, ETH Zuerich
E-Mail: thommen at inf.ethz.ch; Tel: +41-1-63 27208 (Mo-Do)
----------
More information about the rt-users
mailing list