Skip to content

Commit

Permalink
Add EndOfWidget callbacks for ticket display widgets
Browse files Browse the repository at this point in the history
This allows extensions to insert content within the titlebox.
One of our existing extensions needed this to add content
to Times, at a location similar to the previous "EndOfList"
from ShowBasics.

Also pass the ticket object to other existing callbacks.
  • Loading branch information
cbrandtbuffalo committed Jan 8, 2025
1 parent 13f11d5 commit 4e2118a
Show file tree
Hide file tree
Showing 17 changed files with 39 additions and 29 deletions.
1 change: 1 addition & 0 deletions share/html/Elements/ShowCustomFieldCustomGroupings
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ for my $group ( @Groupings ) {
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', Object => $Object, Grouping => $group );
</&>
</div>
% }
Expand Down
2 changes: 2 additions & 0 deletions share/html/Ticket/Display.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@

<& /Elements/ShowWidgets, InRow => 0, Object => $TicketObj, Page => 'Display' &>

% $m->callback(CallbackName => 'EndOfPage', %ARGS, Ticket => $TicketObj);

<%ARGS>
$TicketObj => undef
$ShowHeaders => 0
Expand Down
2 changes: 1 addition & 1 deletion share/html/Ticket/Elements/ShowLinkedQueues
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ $m->callback( CallbackName => 'MassageSearchArgs',
<div class="empty-message"><% $empty_message %></div>
% }
% }

% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $TicketObj );
</&>
% }
%}
Expand Down
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/Articles
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );
<& /Elements/ShowArticle, Ticket => $Ticket &>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%ARGS>
$Ticket
Expand Down
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/Assets
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );
<div hx-trigger="ticketAssetsChanged from:body" hx-get="<% RT->Config->Get('WebPath') %>/Views/Ticket/ShowAssets?HTMXLoad=0&id=<% $Ticket->id %>">
<& /Ticket/Elements/ShowAssets, Ticket => $Ticket &>
</div>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%ARGS>
$Ticket
Expand Down
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/Attachments
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );
<& /Ticket/Elements/ShowAttachments, Ticket => $Ticket, Attachments => $ARGS{Attachments}, Count => RT->Config->Get('AttachmentListCount') &>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%ARGS>
$Ticket
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/Basics
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

<&| /Widgets/TitleBox, title => loc('The Basics'),
(($can_modify || $can_modify_cf) ? (title_href => RT->Config->Get('WebPath')."/Ticket/Modify.html?id=".$Ticket->Id) : ()),
Expand All @@ -72,8 +72,9 @@
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%INIT>
my %inline_edit_behavior;
Expand Down
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/CustomFieldCustomGroupings
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

<& /Elements/ShowCustomFieldCustomGroupings,
Object => $Ticket,
Expand All @@ -54,7 +54,7 @@
$ARGS{Argument} ? ( Groupings => [ map { $_ eq 'Default' ? '' : $_ } split /\s*,\s*/, $ARGS{Argument} ] ) : (),
&>

% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%INIT>
my $can_modify = $Ticket->CurrentUserHasRight('ModifyTicket');
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/Dates
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

<&| /Widgets/TitleBox, title => loc("Dates"),
($can_modify ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyDates.html?id=".$Ticket->Id) : ()),
Expand All @@ -71,8 +71,9 @@
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%INIT>
my %inline_edit_behavior;
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/Description
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

<&| /Widgets/TitleBox, title => loc('Description'),
(($can_modify || $can_modify_cf) && $modify_behavior =~ /^(link|click)$/ ? (titleright_raw => $m->scomp('/Elements/InlineEditLink')) : ()),
Expand All @@ -71,8 +71,9 @@
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%INIT>
my %inline_edit_behavior;
Expand Down
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/History
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, %$DECODED_ARGS, Ticket => $Ticket, CallbackName => 'BeforeShowHistory', CallbackPage => '/Ticket/Display.html' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

% my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
% if ($ShowHistory eq "scroll") {
Expand All @@ -71,7 +71,7 @@
&>
% }

% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%ARGS>
$Ticket
Expand Down
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/LinkedQueues
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );
<& /Ticket/Elements/ShowLinkedQueues,
TicketObj => $Ticket,
&>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%ARGS>
$Ticket
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/Links
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

% $m->callback( %ARGS, CallbackName => 'LinksExtra', extra => \@extra );
<&| /Widgets/TitleBox, title => loc('Links'),
Expand Down Expand Up @@ -77,9 +77,10 @@
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>

% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%INIT>
my %inline_edit_behavior;
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/People
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

<&| /Widgets/TitleBox, title => loc('People'),
(($can_modify || $can_modify_owner || $can_modify_people) ? (title_href => RT->Config->Get('WebPath')."/Ticket/ModifyPeople.html?id=".$Ticket->Id) : ()),
Expand All @@ -71,9 +71,10 @@
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>

% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%INIT>
my %inline_edit_behavior;
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/Reminders
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );
% if ( RT->Config->Get('EnableReminders') ) {
<&|/Widgets/TitleBox, title => loc("Reminders"),
title_href => RT->Config->Get('WebPath')."/Ticket/Reminders.html?id=".$Ticket->Id,
Expand All @@ -56,9 +56,10 @@
<& /Ticket/Elements/Reminders, Ticket => $Ticket, ShowCompleted => 0 &>
</div>
</form>
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>
% }
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );
<%ARGS>
$Ticket
</%ARGS>
4 changes: 2 additions & 2 deletions share/html/Ticket/Widgets/Display/Requestors
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );
<div hx-trigger="ticketRequestorChanged from:body" hx-get="<% RT->Config->Get('WebPath') %>/Views/Ticket/ShowRequestor?HTMXLoad=0&id=<% $Ticket->id %>">
<& /Ticket/Elements/ShowRequestor, Ticket => $Ticket &>
</div>
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%ARGS>
$Ticket
Expand Down
5 changes: 3 additions & 2 deletions share/html/Ticket/Widgets/Display/Times
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
% $m->callback( %ARGS, CallbackName => 'BeforeWidget' );
% $m->callback( %ARGS, CallbackName => 'BeforeWidget', TicketObj => $Ticket );

% if ($show_time_worked) {
<&| /Widgets/TitleBox, title => loc('Time'),
Expand Down Expand Up @@ -73,9 +73,10 @@
</div>
</form>
% }
% $m->callback( %ARGS, CallbackName => 'EndOfWidget', TicketObj => $Ticket );
</&>
% } # End if $show_time_worked
% $m->callback( %ARGS, CallbackName => 'AfterWidget' );
% $m->callback( %ARGS, CallbackName => 'AfterWidget', TicketObj => $Ticket );

<%init>
my %inline_edit_behavior;
Expand Down

0 comments on commit 4e2118a

Please sign in to comment.