[rt-users] MakeClicky call back example doesn't seem to work(RT3.8.4)

Justin Hayes justin.hayes at orbisuk.com
Tue Jul 14 14:07:02 EDT 2009


Also tried the following:

   $actions->{'bold_text'} = sub {
       my %args = @_;
       my $id = $args{'all_matches'}[1];
       return qq{<b>$id<b>};
   };

   push @$types, {
       # name, that should be used in config to activate action
       name   => 'bold_text',
       # regular expression that matches text 'ticket #xxx'
       regex  => qr{\[b\](.*)\[\/b\]}i,
       # name of the action that should be applied
       action => 'bold_text',
   };

In this case

       return qq{<b>$id<b>};

gives nothing

       return qq{<b>$args{value}<b>};

returns the whole pattern matched (which obviously I don't want as I  
want to strip the [b][/b] tags off).

So it really looks like $args{'all_matches'}[1]; etc doesn't get  
populated with the sub-matches in a regex like qr{\[b\](.*)\[\/b\]}i,

I would expect [1] to contain the stuff in the (.*) sub-match (unless  
the example I'm basing mine on is wrong and I'm doing something stupid)

Justin
-------------------------------------------------
Justin Hayes
Orbis Support Manager
justin.hayes at orbisuk.com




On 14 Jul 2009, at 18:12, Justin Hayes wrote:

> Hi,
>
> Has anyone tried the example MakeClicky Callback in the docs  
> (extending_clickable_links.pod)?
>
> I've added the following as a callback as it says :
>
>  <%ARGS>
>   $types   => []
>   $actions => {}
>   </%ARGS>
>   <%INIT>
>   my $web_path = RT->Config->Get('WebPath');
>
>   # action that takes ticket ID as argument and returns link to the  
> ticket
>   $actions->{'link_ticket'} = sub {
>       my %args = @_;
>       my $id = $args{'all_matches'}[1];
>       return qq{<a href="$web_path/Ticket/Display.html?id=$id"> 
> $args{value}</a>};
>   };
>
>   # add action to the list
>   push @$types, {
>       # name, that should be used in config to activate action
>       name   => 'short_ticket_link',
>       # regular expression that matches text 'ticket #xxx'
>       regex  => qr{ticket\s+#(\d+)}i,
>       # name of the action that should be applied
>       action => 'link_ticket',
>   };
>   </%INIT>
>
> It definitely does something, as my Ticket #1 text becomes  
> clickable, however it links to a Display.html url with no ticket id
>
> Ticket/Display.html?id=
>
> I guess the       my $id = $args{'all_matches'}[1];   bit just  
> doesn't have a value, but this is the example in the official docs  
> so I'm surprised it doesn't work....
>
> Cheers,
>
> Justin
> -------------------------------------------------
> Justin Hayes
> Orbis Support Manager
> justin.hayes at orbisuk.com
>
>
>
>
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
>
> Community help: http://wiki.bestpractical.com
> Commercial support: sales at bestpractical.com
>
>
> Discover RT's hidden secrets with RT Essentials from O'Reilly Media.
> Buy a copy at http://rtbook.bestpractical.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090714/171dbb0e/attachment.htm>


More information about the rt-users mailing list