[Rt-commit] r6245 - in rtir/branches/2.1-EXPERIMENTAL: .

ruz at bestpractical.com ruz at bestpractical.com
Fri Oct 20 22:20:03 EDT 2006


Author: ruz
Date: Fri Oct 20 22:20:00 2006
New Revision: 6245

Modified:
   rtir/branches/2.1-EXPERIMENTAL/   (props changed)
   rtir/branches/2.1-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default

Log:
 r1739 at cubic-pc:  cubic | 2006-10-21 06:31:15 +0400
 * match <email> too so we would break text with links


Modified: rtir/branches/2.1-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default
==============================================================================
--- rtir/branches/2.1-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default	(original)
+++ rtir/branches/2.1-EXPERIMENTAL/html/Callbacks/RTIR/Elements/MakeClicky/Default	Fri Oct 20 22:20:00 2006
@@ -50,19 +50,23 @@
     },
     email => sub {
         my %args = @_;
-        my ($pre, $post) = split /@/, $args{value}, 2;
-        my $result = qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=email&q=$args{value}">}
+        my $email = $args{'value'}; $email =~ s/^<|>$//g;
+        RT::Interface::Web::EscapeUTF8( \$args{'value'} ); 
+        my $domain = (split /@/, $email, 2)[1];
+
+        my $result = qq{[<a href="$web_path/RTIR/Tools/Lookup.html?$args{'lookup_params'}type=email&q=$email">}
                       .loc('lookup email') .q{</a>]};
-        if ( $args{incident} ) {
+        if ( $args{'incident'} ) {
             if ( $r->uri =~ /Lookup.html$/ ) {
-                $result .= qq{<input type="checkbox" name="Requestorbox-$args{value}" unchecked />};
+                $result .= qq{<input type="checkbox" name="Requestorbox-$email" unchecked />};
             }
-            $result .= qq{[<a href="$web_path/RTIR/Create.html?Incident=$args{incident}&Queue=Investigations&Requestors=$args{value}">}
-                       .loc('Investigate to') .qq{</a>]};
+            $result .= qq{[<a href="$web_path/RTIR/Create.html}
+                . qq{?Incident=$args{'incident'}&Queue=Investigations&Requestors=$email">}
+                . loc('Investigate to') .qq{</a>]};
         }
-        $result .= qq{ [<a href="$web_path/RTIR/Tools/Lookup.html?$args{lookup_params}type=host&q=$post">}
-               .loc('lookup "[_1]"', $post) .qq{</a>]};
-        return $args{value} . qq{ <span class="clickylink">$result</span>};
+        $result .= qq{ [<a href="$web_path/RTIR/Tools/Lookup.html?$args{'lookup_params'}type=host&q=$domain">}
+               .loc('lookup "[_1]"', $domain) .qq{</a>]};
+        return $args{'value'} . qq{ <span class="clickylink">$result</span>};
     },
     noc => sub {
         my %args = @_;
@@ -91,7 +95,7 @@
     },
     {
         name   => "email",
-        regex  => q[(?:mailto:)?[\w\.\+-]+\@[\w\.-]+\.\w{2,3}],
+        regex  => qr{(?:mailto:)?<?[\w\.\+-]+\@[\w\.-]+\.\w{2,3}>?},
         action => "email",
     },
     {


More information about the Rt-commit mailing list