[Rt-commit] rt branch, 5.0/configurable-linked-queue-portlets, created. rt-5.0.0alpha1-32-g5cc23cfd80
Blaine Motsinger
blaine at bestpractical.com
Wed Mar 18 18:47:42 EDT 2020
The branch, 5.0/configurable-linked-queue-portlets has been created
at 5cc23cfd80ce36884ff59fae5c5ac311b5bb7041 (commit)
- Log -----------------------------------------------------------------
commit 94173dc2b23e0df7653b617e72e540db0f1d06f5
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date: Tue Aug 14 23:02:03 2018 -0400
Add a configurable queue portlet to ticket display page
RTIR Incident page displays links portlets by queue. Isolating
these portlets allows a user to view linked tickets based on the
queue and their relations on ticket display page.
diff --git a/share/html/Ticket/Elements/ShowLinkedQueues b/share/html/Ticket/Elements/ShowLinkedQueues
new file mode 100644
index 0000000000..79610be6fb
--- /dev/null
+++ b/share/html/Ticket/Elements/ShowLinkedQueues
@@ -0,0 +1,161 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2018 Best Practical Solutions, LLC
+%# <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%PERL>
+
+foreach my $queues ( @{ $portlet_config{ $queue } } ) {
+ foreach my $queue_name ( keys %{ $queues } ) {
+ my $queue_obj = RT::Queue->new( $session{ CurrentUser } );
+ my ( $ret ) = $queue_obj->Load( $queue_name );
+ unless ( $ret ) {
+ RT::Logger->error( "Couldn't load queue $queue_name" );
+ next;
+ }
+ my $link_types = $queues->{$queue_name};
+ my $query = "Queue = '$queue_name'";
+
+ my $ticket_id = $TicketObj->id;
+ if ( grep { lc $_ eq 'all' } @$link_types ) {
+ $query .= " AND ( LinkedTo = $ticket_id OR LinkedFrom = $ticket_id )";
+ }
+ else {
+ my @link_relations = map { $_ . " = $ticket_id" } @$link_types;
+ my $link_query = join( ' OR ', @link_relations );
+ if ($link_query) {
+ $query .= ' AND ( ' . $link_query . ' )';
+ }
+ else {
+ $query = 'id=0';
+ }
+ }
+
+ my $query_string = $m->comp( '/Elements/QueryString', Query => $query );
+ my $title_href = RT->Config->Get( 'WebPath' ) . "/Search/Results.html?$query_string";
+ my $title_class = 'inverse';
+ my $class = "ticket-info-links";
+ my $titleright_raw = '';
+
+$m->callback( CallbackName => 'MassageTitleBox',
+ ARGSRef => \%ARGS,
+ title => \$queue_name,
+ title_href => \$title_href,
+ titleright_raw => \$titleright_raw,
+ title_class => \$title_class,
+ class => \$class,
+);
+
+</%PERL>
+
+<&| /Widgets/TitleBox,
+ title => $queue_name,
+ title_href => $title_href,
+ titleright_raw => $titleright_raw,
+ title_class => $title_class,
+ class => $class,
+&>
+
+<%PERL>
+my @queries = map { "$query AND $_" } q{Status = '__Active__'}, q{Status = '__Inactive__'};
+my @empty_messages
+ = ( loc( '(No active tickets)', $queue_name ), loc( '(No inactive tickets)', $queue_name ) );
+
+$m->callback( CallbackName => 'MassageQueries',
+ ARGSRef => \%ARGS,
+ Queue => $queue_name,
+ Queries => \@queries,
+ EmptyMessages => \@empty_messages,
+);
+
+for my $query ( @queries ) {
+ my $empty_message = shift @empty_messages;
+ my $format = $Format;
+ my $order_by = $OrderBy;
+ my $rows = $Rows;
+
+$m->callback( CallbackName => 'MassageSearchArgs',
+ ARGSRef => \%ARGS,
+ Queue => $queue_name,
+ Query => $query,
+ Format => \$format,
+ OrderBy => \$order_by,
+ Rows => \$rows,
+);
+ my $tickets = RT::Tickets->new($session{CurrentUser});
+ $tickets->FromSQL($query);
+ if ( $tickets->Count ) {
+</%PERL>
+<& /Elements/CollectionList, %ARGS,
+ Class => 'RT::Tickets',
+ Query => $query,
+ Format => $format,
+ OrderBy => $order_by,
+ Rows => $rows,
+ ShowHeader => 0,
+&>
+
+% } else {
+ <div class="empty-message"><% $empty_message %></div>
+% }
+% }
+
+</&>
+% }
+%}
+<%INIT>
+my %portlet_config = RT->Config->Get( 'LinkedQueuePortlets' );
+return unless %portlet_config;
+my $queue = $TicketObj->QueueObj->Name;
+return unless $portlet_config{ $queue };
+</%INIT>
+
+
+<%ARGS>
+$TicketObj
+$OrderBy => 'Due'
+$Rows => 8
+$Format => RT->Config->Get( 'LinkedQueuePortletFormat' )
+</%ARGS>
diff --git a/share/html/Ticket/Elements/ShowSummary b/share/html/Ticket/Elements/ShowSummary
index 0c5ffdab9b..05d7e2d86a 100644
--- a/share/html/Ticket/Elements/ShowSummary
+++ b/share/html/Ticket/Elements/ShowSummary
@@ -171,6 +171,13 @@ my $dates_behavior = $InlineEdit ? ($inline_edit_behavior{Dates} || $inline_edit
% }
</&>
% $m->callback( %ARGS, CallbackName => 'AfterDates' );
+% my (@extra);
+% push @extra, titleright_raw => '<a href="'. RT->Config->Get('WebPath'). '/Ticket/Graphs/index.html?id='.$Ticket->id.'">'.loc('Graph').'</a>' unless RT->Config->Get('DisableGraphViz');
+
+<& /Ticket/Elements/ShowLinkedQueues,
+ TicketObj => $Ticket,
+&>
+
<& /Ticket/Elements/ShowAssets, Ticket => $Ticket &>
<%PERL>
my $links_url = RT->Config->Get('WebPath')."/Ticket/ModifyLinks.html?id=".$Ticket->Id;
commit 5cc23cfd80ce36884ff59fae5c5ac311b5bb7041
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date: Fri Aug 24 14:06:59 2018 -0400
Add docs for the new Linked Queue Portlets configs
diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index 9bed2dbd13..41d461fb58 100644
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -2642,6 +2642,45 @@ to the Article with that name.
Set($WikiImplicitLinks, 0);
+=item C<%LinkedQueuePortlets>
+
+If %LinkedQueuePortlets is set, new portlets will display on the ticket
+display page of each specified queue. Each portlet lists all the linked
+tickets grouped by queue name, and based on the indicated link type.
+Acceptable link types include, 'DependsOn', 'DependedOnBy', 'HasMember'
+(children), 'MemberOf' (parents), 'RefersTo', and 'ReferredToBy'.
+Additionally, the type, 'All', which lists all linked tickets by queue,
+is accepted. In the example below, portlets will be added to all tickets
+in both the General queue and the Support queue:
+
+Set( %LinkedQueuePortlets, (
+ General => [
+ { General => [ 'All' ] },
+ { Testing => [ 'HasMember', 'MemberOf', 'RefersTo' ] },
+ ],
+ Support => [
+ { General => [ 'All' ] },
+ ],
+));
+
+=cut
+
+Set( %LinkedQueuePortlets, () );
+
+=item C<$LinkedQueuePortletFormat>
+
+$LinkedQueuePortletFormat is the default format for displaying the
+list of tickets in each linked queue portlet ( %LinkedQueuePortlets
+must be enabled ).
+
+=cut
+
+Set( $LinkedQueuePortletFormat,
+ q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',}.
+ q{'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',}.
+ q{Status}
+);
+
=item C<$PreviewScripMessages>
Set C<$PreviewScripMessages> to 1 if the scrips preview on the ticket
-----------------------------------------------------------------------
More information about the rt-commit
mailing list