[Rt-commit] rt branch, 4.6/configurable-linked-queue-portlets, repushed
? sunnavy
sunnavy at bestpractical.com
Wed Jan 2 09:59:24 EST 2019
The branch 4.6/configurable-linked-queue-portlets was deleted and repushed:
was 9c6a4cac981f915a06d44884e5591757f96c0fc3
now c69e3625140d1350e3e0ee7f9ca2d7a665a8d347
1: 5f0c212bd4 ! 1: 6d4c846ac6 Add a configurable queue portlet to ticket display page
@@ -4,126 +4,7 @@
RTIR Incident page displays links portlets by queue. Isolating
these portlets allows a user to view linked tickets based on the
- queue and their relation (supports: Depends on, Depended on by,
- Parents, Children, Refers to, Referred to by, All) on any ticket
- display page.
-
-diff --git a/share/html/Elements/ShowLinksCollectionList b/share/html/Elements/ShowLinksCollectionList
-new file mode 100644
---- /dev/null
-+++ b/share/html/Elements/ShowLinksCollectionList
-@@
-+%# 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 }}}
-+<& /Elements/CollectionList,
-+ %ARGS,
-+ Collection => $linked_tickets,
-+ DisplayFormat => ($Delete? "__CheckBox__, $Format": $Format),
-+ Format => $Format,
-+ Rows => $Rows,
-+ ShowHeader => $ShowHeader,
-+ OrderBy => $OrderBy,
-+ ShowNavigation => 0,
-+ AllowSorting => $AllowSorting,
-+ PassArguments => $PassArguments,
-+&>
-+% unless( $linked_tickets->Count ) {
-+% if ( $NoTicketsCaption ) {
-+ <i>(<% $NoTicketsCaption %>)</i>
-+% }
-+% }
-+<br />
-+
-+% if( $FullList && $Rows > 0 && $linked_tickets->CountAll > $Rows ) {
-+<a href="<% $FullList %>"><i><% loc("More... ([_1] total)", $linked_tickets->CountAll) %></i></a><br />
-+% }
-+
-+<%INIT>
-+my $linked_tickets = RT::Tickets->new( $session{'CurrentUser'} );
-+my $ticket_id = $TicketObj->id;
-+
-+my $query = "Queue = '" . $QueueName . "' AND ". $ExtraQuery;
-+
-+if ( grep { lc $_ eq 'all' } @LinkTypes ) {
-+ $linked_tickets->FromSQL( "$query AND ( LinkedTo = $ticket_id OR LinkedFrom = $ticket_id )" );
-+} else {
-+ my @link_relations = map { $_ . " = $ticket_id" } @LinkTypes;
-+ my $link_query = join ( ' OR ', @link_relations );
-+ if ( $link_query ) {
-+ $query = $query . ' AND ( ' . $link_query . ' )';
-+ } else {
-+ $query = 'id=0';
-+ }
-+ $linked_tickets->FromSQL( $query );
-+}
-+
-+$Format = RT->Config->Get( 'LinkedQueuesPortletFormat' );
-+$FullList = RT->Config->Get( 'WebPath' ) . "/Ticket/ModifyLinks.html?id=" . $TicketObj->id . "&Queue=" . $QueueName;
-+
-+$m->callback( CallbackName => 'MassagePortlets', ARGSRef => \%ARGS, Format => \$Format, FullList => \$FullList );
-+</%INIT>
-+
-+<%ARGS>
-+$Format => undef
-+$OrderBy => 'Due'
-+$Rows => 0
-+$Delete => 0
-+$FullList => undef
-+$NoTicketsCaption => undef,
-+$ShowHeader => 0
-+$AllowSorting => undef
-+$PassArguments => undef
-+$ExtraQuery
-+ at LinkTypes
-+$QueueName
-+$TicketObj
-+$QueueId
-+</%ARGS>
+ 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
@@ -178,34 +59,48 @@
+%#
+%# END BPS TAGGED BLOCK }}}
+<%PERL>
-+my ( $title_href, $titleright_raw, $title_class, $class ) = ('')x4;
+
+foreach my $queues ( @{ $portlet_config{ $queue } } ) {
+ foreach my $queue_name ( keys %{ $queues } ) {
+ my $queue_obj = RT::Queue->new( $session{ CurrentUser } );
-+ my ( $ret, $msg ) = $queue_obj->Load( $queue_name );
++ my ( $ret ) = $queue_obj->Load( $queue_name );
+ unless ( $ret ) {
-+ RT::Logger->error( $msg );
++ RT::Logger->error( "Couldn't load queue $queue_name" );
+ next;
+ }
-+ my $link_types = $queues->{ $queue_name };
-+ $title_class = 'inverse';
-+ $class = "ticket-info-links";
++ 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,
-+ queue_name => $queue_name,
++ title => \$queue_name,
+ title_href => \$title_href,
+ titleright_raw => \$titleright_raw,
+ title_class => \$title_class,
+ class => \$class,
+);
+
-+$m->callback( CallbackName => '',
-+ ARGSRef => \%ARGS,
-+ OrderBy => \$OrderBy,
-+ Rows => \$Rows,
-+);
+</%PERL>
+
+<&| /Widgets/TitleBox,
@@ -216,24 +111,50 @@
+ class => $class,
+&>
+
-+<& /Elements/ShowLinksCollectionList, %ARGS,
-+ TicketObj => $TicketObj,
-+ LinkTypes => $link_types,
-+ QueueName => $queue_name,
-+ Rows => $Rows,
-+ ExtraQuery => "Status = '__Active__'",
-+ NoTicketsCaption => loc('No active [_1] tickets', loc( $queue_name )),
-+ QueueId => $queue_obj->id,
++<%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,
+&>
-+<& /Elements/ShowLinksCollectionList,
-+ TicketObj => $TicketObj,
-+ LinkTypes => $link_types,
-+ QueueName => $queue_name,
-+ Rows => $Rows,
-+ ExtraQuery => "Status = '__Inactive__'",
-+ NoTicketsCaption => loc('No inactive [_1] tickets', loc( $queue_name )),
-+ QueueId => $queue_obj->id,
-+&>
++
++% } else {
++ <div class="empty-message"><% $empty_message %></div>
++% }
++% }
++
+</&>
+% }
+%}
@@ -249,6 +170,7 @@
+$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
2: 9c6a4cac98 ! 2: c69e362514 Add docs for the new Linked Queue Portlets configs
@@ -34,15 +34,15 @@
+
+Set( %LinkedQueuePortlets, () );
+
-+=item C<$LinkedQueuesPortletFormat>
++=item C<$LinkedQueuePortletFormat>
+
-+$LinkedQueuesPortletFormat is the default format for displaying the
++$LinkedQueuePortletFormat is the default format for displaying the
+list of tickets in each linked queue portlet ( %LinkedQueuePortlets
+must be enabled ).
+
+=cut
+
-+Set( $LinkedQueuesPortletFormat,
++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}
More information about the rt-commit
mailing list