Re: Adding an Action link to Ticket/Display.html/BeforeActionList

David Schmidt <[email protected]>
Newsgroups gmane.comp.bug-tracking.request-tracker.user
Message-ID <[email protected]>
How can I access the referer in a callback?


I managed to add the link using this callback:

file: html/Callbacks/RT-Extension-OneClickClose/Elements/Tabs/Privileged
<%ARGS>
$Path => undef
</%ARGS>

<%INIT>
if ( $Path =~ m!^\/Ticket\/Display\.html! ) {
     if ( $DECODED_ARGS->{id} && $DECODED_ARGS->{id} =~ m/\d+/ ) {
         my $ticket_id = $DECODED_ARGS->{id};
         my $actions   = PageMenu()->child( 'actions' );
         $actions->child(
             'OneClickClose',
             title => 'OneClickClose',
             path => 
"/Ticket/Update.html?Status=resolved&SubmitTicket=1&id=$ticket_id&AfterSubmitReturn=1",
         );
     }
}
</%INIT>



On 06.10.2016 14:40, David Schmidt wrote:
> I'll answer myself:
> if an action is not a ref it is rendered in the result box. bit
> unexpected but im sure there is a reason. (code in
> share/html/Elements/ListActions)
> 
> https://github.com/bestpractical/rt/blob/stable/share/html/Elements/ListActions#L49
> 
> 
> On 06.10.2016 13:53, David Schmidt wrote:
>> When/Where are the actions added to @Actions?
>> 
>> 1) for some reason the \@Actions ArrayRef is empty when I access it in
>> the callback. Where do the Actions come from? I am talking about the
>> links "Reply", "Comment", "Forward", "Stall", ...
>> 
>> 2) If I push a simple string to \@Actions they end up in a yellow
>> "Results" Widget. see attached screenshot
>> 
>> 
>> #local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList
>> <%init>
>> use Data::Dumper;
>> $RT::Logger->debug("\n\n###\n".Dumper($Actions)."\n\n###\n");
>> push @$Actions, "foo";
>> </%init>
>> 
>> <%args>
>> $Actions     => undef
>> $TicketObj   => undef
>> </%args>
>> 
>> 
>> Output:
>> ###
>> $VAR1 = [];
>> 
>> 
>> ###
>> (/opt/rt4/local/plugins/RT-Extension-OneClickClose/html/Callbacks/RT-Extension-OneClickClose/Ticket/Display.html/BeforeActionList:3)
>> 
>> ---------
>> RT 4.4 and RTIR training sessions, and a new workshop day!
>> https://bestpractical.com/training
>> * Boston - October 24-26
>> * Los Angeles - Q1 2017
> ---------
> RT 4.4 and RTIR training sessions, and a new workshop day!
> https://bestpractical.com/training
> * Boston - October 24-26
> * Los Angeles - Q1 2017
---------
RT 4.4 and RTIR training sessions, and a new workshop day! https://bestpractical.com/training
* Boston - October 24-26
* Los Angeles - Q1 2017
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.