[Rt-commit] rt branch, 4.6/configurable-linked-queue-portlets, repushed
Maureen Mirville
maureen at bestpractical.com
Thu Sep 27 14:20:55 EDT 2018
The branch 4.6/configurable-linked-queue-portlets was deleted and repushed:
was 461d8bb05bf035451639ba18426df9d08510a46f
now 6355550a4fe5596be7052dd5f2250ad380261e7b
1: 449f092c2 ! 1: 77d8f0fc2 Add a configurable queue portlet to ticket display
@@ -91,37 +91,14 @@
+my $query = "Queue = '" . $QueueName . "' AND ". $Status;
+my @link_relations;
+my $link_query;
-+foreach my $type ( @$LinkTypes ) {
-+ if ( $type =~ m/All/ ) {
-+ $query = $query;
-+ }
-+ if ( $type =~ m/Depends on/ ) {
-+ push @link_relations, " DependsOn = " . $ticket_id;
-+ }
-+ if ( $type =~ m/Depended on by/ ) {
-+ push @link_relations, " DependedOnBy = " . $ticket_id;
-+ }
-+ if ( $type =~ m/Parents/ ) {
-+ push @link_relations, " HasMember = " . $ticket_id;
-+ }
-+ if ( $type =~ m/Children/ ) {
-+ push @link_relations, " MemberOf = " . $ticket_id;
-+ }
-+ if ( $type =~ m/Refers to/ ) {
-+ push @link_relations, " RefersTo = " . $ticket_id;
-+ }
-+ if ( $type =~ m/Referred to by/ ) {
-+ push @link_relations, " ReferredToBy = " . $ticket_id;
-+ }
-+}
++
++ at link_relations = map { $RT::Link::TYPEMAP{$_}{'Type'} . " = $ticket_id" } @$LinkTypes;
+$link_query = join ( ' OR ', @link_relations ) if scalar @link_relations;
++
+$query = $query . ' AND ( ' . $link_query . ' )' if $link_query;
-+
+$linked_tickets->FromSQL( $query );
+
-+$Format = 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};
++$Format = RT->Config->Get( 'LinkedQueuesPortletFormat' );
+
+</%INIT>
+
@@ -194,9 +171,13 @@
+%#
+%# END BPS TAGGED BLOCK }}}
+<%PERL>
-+foreach my $queue_name ( @$portlet_queues ) {
++foreach my $queue_name ( @portlet_queues ) {
+ my $queue = RT::Queue->new($session{CurrentUser});
+ $queue->Load( $queue_name );
++ if ( !$queue->id ) {
++ RT->Logger->error( "Unable to load queue: $queue_name" );
++ } else {
++ my $link_types = $portlet_config->{ $queue_name };
+</%PERL>
+
+<&| /Widgets/TitleBox,
@@ -209,6 +190,7 @@
+ Rows => $Rows,
+ Status => "Status = '__Active__'",
+ NoTicketsCaption => loc('No active [_1] tickets', loc( $queue_name )),
++ FullList => "/Ticket/ModifyLinks.html?id=" . $TicketObj->id . "&Queue=" . $queue->id,
+&>
+<& /Elements/ShowLinksCollectionList,
+ TicketObj => $TicketObj,
@@ -220,11 +202,11 @@
+&>
+</&>
+%}
++%}
+<%INIT>
-+my $portlet_config = RT->Config->Get( 'LinkedQueuePortlets' ) || undef;
++my $portlet_config = RT->Config->Get( 'LinkedQueuePortlets' ) || {};
+return unless $portlet_config;
-+my $portlet_queues = $portlet_config->{'Queues'};
-+my $link_types = $portlet_config->{'Type'};
++my @portlet_queues = keys %$portlet_config;
+</%INIT>
+
+
@@ -242,8 +224,8 @@
% 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');
+
-+% my $portlet_queues = RT->Config->Get( 'LinkedQueuePortlets' ) || [];
-+% if ( length $portlet_queues ) {
++% my $portlet_queues = RT->Config->Get( 'LinkedQueuePortlets' ) || {};
++% if ( scalar keys %$portlet_queues ) {
+<& /Ticket/Elements/ShowLinkedQueues,
+ TicketObj => $Ticket,
+&>
2: 461d8bb05 ! 2: 6355550a4 Add docs for the new %LinkedQueuePortlets config
@@ -13,16 +13,16 @@
+
+If %LinkedQueuePortlets is set, new portlets will display on tickets.
+Each portlet lists all the linked tickets grouped by queue, and based
-+on the indicated link type. Acceptable link types include, 'Depends on',
-+'Depended on by', 'Parents', 'Children', 'Refers to', and 'Referred to by'.
-+Additionally, the type, 'All', which lists all linked tickets by queue,
-+is accepted.
++on the indicated link type. Acceptable link types include, 'DependsOn',
++'DependedOnBy', 'HasMember' (parents), 'MemberOf' (children), 'RefersTo',
++and 'ReferredToTy'. Additionally, the type, 'All', which lists all
++linked tickets by queue, is accepted.
+
+=cut
+
-+Set(%LinkedQueuePortlets, (
-+ Queues => [ 'General', 'TestQueue' ],
-+ Type => [ 'Children', 'Depends on' ],
++Set( %LinkedQueuePortlets, (
++ General => [ 'HasMember', 'MemberOf', 'RefersTo'],
++ TestQueue => ['HasMember', 'MemberOf', 'RefersTo'],
+));
+
=item C<$PreviewScripMessages>
More information about the rt-commit
mailing list