MakeClicky call back example doesn't seem to work (RT3.8.4)

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{
$args{value}
};
};

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@orbisuk.com

Also tried the following:

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

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 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@orbisuk.comOn 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{
$args{value}
};
};

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@orbisuk.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

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 :

I just tried with your code and with the code copied from pod and it
worked for me without any tweaking (RT 3.8.4). I suggest you add the
following piece of debugging and see what you get. Otherwise you’re
going to need to instrument MakeClicky itself.

You don’t mention your RT version of your perl version, both of which
might be interesting.

-kevin

<%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 = @_;

use Data::Dumper; $RT::Logger->error(Dumper %args);

Thanks Kevin.

RT version is 3.8.4 as given in the subject of my mail. Perl is 5.10.0
I believe.

I’ll try adding that debug and see what I get.

Justin

Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.comOn 14 Jul 2009, at 21:14, Kevin Falcone wrote:

On Tue, Jul 14, 2009 at 06:12:16PM +0100, 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 :

I just tried with your code and with the code copied from pod and it
worked for me without any tweaking (RT 3.8.4). I suggest you add the
following piece of debugging and see what you get. Otherwise you’re
going to need to instrument MakeClicky itself.

You don’t mention your RT version of your perl version, both of which
might be interesting.

-kevin

<%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 = @_;
use Data::Dumper; $RT::Logger->error(Dumper %args);
my $id = $args{‘all_matches’}[1];
return qq{
$args{value}
};
};
# 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>


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Here’s the output from that debug you suggested adding:

Jul 14 21:50:42 cetus RT: $VAR1 = {
‘all_matches’ => [
‘Ticket #1’,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef
],
‘Message’ => [
{
‘text’ => ‘Ticket #1 this is bold’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ => ‘Ticket #1 this is bold
},
{
‘text’ =>
‘---------------------------------------------’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ =>
‘---------------------------------------------’

Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.comOn 14 Jul 2009, at 21:14, Kevin Falcone wrote:

On Tue, Jul 14, 2009 at 06:12:16PM +0100, 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 :

I just tried with your code and with the code copied from pod and it
worked for me without any tweaking (RT 3.8.4). I suggest you add the
following piece of debugging and see what you get. Otherwise you’re
going to need to instrument MakeClicky itself.

You don’t mention your RT version of your perl version, both of which
might be interesting.

-kevin

<%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 = @_;
use Data::Dumper; $RT::Logger->error(Dumper %args);
my $id = $args{‘all_matches’}[1];
return qq{
$args{value}
};
};
# 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>


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Try attached patch. Don’t forget to flush mason cache and send us feedback.On Wed, Jul 15, 2009 at 12:53 AM, Justin Hayesjustin.hayes@orbisuk.com wrote:

Here’s the output from that debug you suggested adding:

Jul 14 21:50:42 cetus RT: $VAR1 = {
‘all_matches’ => [
‘Ticket #1’,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef
],
‘Message’ => [
{
‘text’ => ‘Ticket #1 this is bold’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ => ‘Ticket #1 this is bold
},
{
‘text’ =>
‘---------------------------------------------’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ =>
‘---------------------------------------------’


Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.com

On 14 Jul 2009, at 21:14, Kevin Falcone wrote:

On Tue, Jul 14, 2009 at 06:12:16PM +0100, 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 :

I just tried with your code and with the code copied from pod and it
worked for me without any tweaking (RT 3.8.4). I suggest you add the
following piece of debugging and see what you get. Otherwise you’re
going to need to instrument MakeClicky itself.

You don’t mention your RT version of your perl version, both of which
might be interesting.

-kevin

<%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 = @_;
use Data::Dumper; $RT::Logger->error(Dumper %args);
my $id = $args{‘all_matches’}[1];
return qq{
$args{value}
};
};
# 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>


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Best regards, Ruslan.

RT-3.8.4-make_click_all_matches.patch (553 Bytes)

Here’s the output from that debug you suggested adding:

My colleage suspects you’re running into a bug where the other
two MakeClicky extensions are clobbering captures.
You didn’t mention having them enabled, so I was testing without them.

He may followup with a patch to try

-kevin

Ah that might be it - I have got the httpurl one turned on as well.

I’ve got the patch and will let you know how it goes.

Thanks again!

Justin

Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.comOn 14 Jul 2009, at 22:43, Kevin Falcone wrote:

On Tue, Jul 14, 2009 at 09:53:30PM +0100, Justin Hayes wrote:

Here’s the output from that debug you suggested adding:

My colleage suspects you’re running into a bug where the other
two MakeClicky extensions are clobbering captures.
You didn’t mention having them enabled, so I was testing without them.

He may followup with a patch to try

-kevin

Jul 14 21:50:42 cetus RT: $VAR1 = {
‘all_matches’ => [
‘Ticket #1’,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef
],
‘Message’ => [
{
‘text’ => ‘Ticket #1 [b]this is bold[/
b]’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ => ‘Ticket #1 this is bold
},
{
‘text’ =>
‘---------------------------------------------’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ =>
‘---------------------------------------------’


Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.com

On 14 Jul 2009, at 21:14, Kevin Falcone wrote:

On Tue, Jul 14, 2009 at 06:12:16PM +0100, 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 :

I just tried with your code and with the code copied from pod and it
worked for me without any tweaking (RT 3.8.4). I suggest you add
the
following piece of debugging and see what you get. Otherwise you’re
going to need to instrument MakeClicky itself.

You don’t mention your RT version of your perl version, both of
which
might be interesting.

-kevin

<%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 = @_;
use Data::Dumper; $RT::Logger->error(Dumper %args);
my $id = $args{‘all_matches’}[1];
return qq{$args{value}};
};

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>


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Works great. Thanks very much for fixing this so quickly!!

Justin

Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.comOn 14 Jul 2009, at 22:40, Ruslan Zakirov wrote:

Try attached patch. Don’t forget to flush mason cache and send us
feedback.

On Wed, Jul 15, 2009 at 12:53 AM, Justin Hayes<justin.hayes@orbisuk.com wrote:

Here’s the output from that debug you suggested adding:

Jul 14 21:50:42 cetus RT: $VAR1 = {
‘all_matches’ => [
‘Ticket #1’,
undef,
undef,
undef,
undef,
undef,
undef,
undef,
undef
],
‘Message’ => [
{
‘text’ => ‘Ticket #1 [b]this is bold[/
b]’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ => ‘Ticket #1 this is bold
},
{
‘text’ =>
‘---------------------------------------------’,
‘empty’ => ‘’,
‘quoter’ => ‘’,
‘raw’ =>
‘---------------------------------------------’


Justin Hayes
Orbis Support Manager
justin.hayes@orbisuk.com

On 14 Jul 2009, at 21:14, Kevin Falcone wrote:

On Tue, Jul 14, 2009 at 06:12:16PM +0100, 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 :

I just tried with your code and with the code copied from pod and it
worked for me without any tweaking (RT 3.8.4). I suggest you add
the
following piece of debugging and see what you get. Otherwise you’re
going to need to instrument MakeClicky itself.

You don’t mention your RT version of your perl version, both of
which
might be interesting.

-kevin

<%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 = @_;
use Data::Dumper; $RT::Logger->error(Dumper %args);
my $id = $args{‘all_matches’}[1];
return qq{
$args{value}
};
};
# 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>


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com


Best regards, Ruslan.
*** NDS UK IT scanned this email for malicious content ***
*** IMPORTANT: Do not open attachments from unrecognized senders ***
<RT-3.8.4-make_click_all_matches.patch>