[Rt-commit] rtir branch, 4.2/rtir-configurable-linked-queue-portlets, created. 4.0.1rc1-88-g9acc36ff

Maureen Mirville maureen at bestpractical.com
Tue Nov 27 23:28:14 EST 2018


The branch, 4.2/rtir-configurable-linked-queue-portlets has been created
        at  9acc36ff5681edc60d96039c45837a63f014a9d3 (commit)

- Log -----------------------------------------------------------------
commit 9b2b37b24aa08ea756724b369ac86d4f71c94eb3
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Fri Nov 9 13:22:22 2018 -0500

    Update RTIR Incidents to use a callback for displaying queue portlets
    
    RT was updated so users can now add portlets by queue on any ticket,
    like the RTIR Incident page that displays linked Incident Reports,
    Investigations, and Countermeasures. With this change to RT, RTIR code
    was updated accordingly.

diff --git a/etc/RTIR_Config.pm b/etc/RTIR_Config.pm
index b0534476..1420a4ae 100644
--- a/etc/RTIR_Config.pm
+++ b/etc/RTIR_Config.pm
@@ -230,6 +230,25 @@ Set(
     },
 );
 
+=item C<%LinkedQueuePortlets%>
+
+This config adds portlets, containing a list of linked
+tickets by queue (Incident Reports, Investigations,
+Countermeasures) to each Incident display page. By
+default, all link types are shown. Additional accepted
+link types include, 'DependsOn', 'DependedOnBy',
+'HasMember' (children), 'MemberOf' (parents), 'RefersTo',
+and 'ReferredToBy'.
+
+=cut
+
+Set( %LinkedQueuePortlets, (
+    Incidents   => [
+        { 'Incident Reports'  => [ 'All' ] },
+        { Investigations      => [ 'All' ] },
+        { Countermeasures     => [ 'All' ] },
+    ],
+));
 
 =item C<%RTIR_IncidentChildren>
 
diff --git a/html/Callbacks/RTIR/Elements/ShowLinksCollectionList/MassagePortlets b/html/Callbacks/RTIR/Elements/ShowLinksCollectionList/MassagePortlets
new file mode 100644
index 00000000..6154b25c
--- /dev/null
+++ b/html/Callbacks/RTIR/Elements/ShowLinksCollectionList/MassagePortlets
@@ -0,0 +1,26 @@
+<%INIT>
+my $id = $ARGSRef->{ TicketObj }->id;
+
+my %lifecycles = (
+    'Incident Reports'  => 'incident_reports',
+    'Investigations'    => 'investigations',
+    'Countermeasures'   => 'countermeasures',
+);
+
+foreach my $lifecycle_name ( keys %lifecycles ) {
+    if( $ARGSRef->{ QueueName } eq $lifecycle_name ) {
+        my $lifecycle = $lifecycles{ $lifecycle_name };
+        my $fulllist = RT::IR->HREFTo("Incident/Children/?Lifecycle=$lifecycle&id=$id");
+        $$FullList = $fulllist;
+        my $Type = RT::IR::TicketType( Lifecycle => $lifecycle );
+        $$Format ||= RT->Config->Get('RTIRSearchResultFormats')->{'Child' . $Type};
+    }
+}
+
+</%INIT>
+
+<%ARGS>
+$ARGSRef
+$FullList
+$Format
+</%ARGS>
diff --git a/html/Callbacks/RTIR/Ticket/Elements/ShowLinkedQueues/MassageTitleBox b/html/Callbacks/RTIR/Ticket/Elements/ShowLinkedQueues/MassageTitleBox
new file mode 100644
index 00000000..964b5417
--- /dev/null
+++ b/html/Callbacks/RTIR/Ticket/Elements/ShowLinkedQueues/MassageTitleBox
@@ -0,0 +1,48 @@
+<%INIT>
+my @queues = ( 'Incident Reports','Investigations', 'Countermeasures' );
+
+my %lifecycles = (
+    'Incident Reports'  => 'incident_reports',
+    'Investigations'    => 'investigations',
+    'Countermeasures'   => 'countermeasures',
+);
+
+my $id = $ARGSRef->{ TicketObj }->id;
+
+foreach my $title ( @queues ) {
+    if( $queue_name eq $title ) {
+        my $lifecycle = $lifecycles{ $title };
+        $$class = 'tickets-list-'. lc(RT::IR::TicketType( Lifecycle => $lifecycle ));
+        $$title_href = RT::IR->HREFTo("Incident/Children/?Lifecycle=$lifecycle&id=$id");
+
+    my @titleright_raw;
+    if( $ARGSRef->{ TicketObj }->CurrentUserHasRight('ModifyTicket') ) {
+        if (1) { # XXX TODO RESTORE THIS ACL CHECK
+        # $QueueObj->Id and $QueueObj->CurrentUserHasRight('CreateTicket') ) {
+            push @titleright_raw, {
+                title => $lifecycle ne RT::IR->lifecycle_investigation? loc('Create') : loc('Launch'),
+                class => 'create_child' . ($lifecycle ? '_'.$lifecycle : ''),
+                path => RT::IR->HREFTo("CreateInQueue.html?Incident=$id&Lifecycle=".$lifecycle),
+            };
+        }
+        push @titleright_raw, {
+            title => loc('Link'),
+            path  => RT::IR->HREFTo("Link/FromIncident/?id=$id&Lifecycle=".$lifecycle),
+        };
+    }
+
+    $$titleright_raw = join ' 'x3,
+        map q{<a href="} . $_->{'path'} . ( $_->{'class'} ? q{" class="} . $_->{'class'} : '' ) . q{">}
+            . $m->interp->apply_escapes( $_->{title}, 'h' ) . q{</a>},
+        @titleright_raw;
+    }
+}
+</%INIT>
+
+<%ARGS>
+$ARGSRef
+$queue_name
+$class => undef
+$title_href => undef
+$titleright_raw => undef
+</%ARGS>
diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index 1623f4bc..4bfc5c70 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -135,12 +135,9 @@
 </td><td class="boxcontainer" valign="top">
 % $m->callback( %ARGS, Ticket => $TicketObj, CallbackName => 'RightColumnStart' );
 
-% foreach my $lifecycle ( RT::IR->lifecycle_report, RT::IR->lifecycle_investigation, RT::IR->lifecycle_countermeasure ) {
-<& /RTIR/Incident/Elements/ShowChildren,
-    IncidentObj => $TicketObj,
-    Lifecycle   => $lifecycle
+<& /Ticket/Elements/ShowLinkedQueues,
+    TicketObj => $TicketObj,
 &>
-% }
 
 <& /RTIR/Elements/ShowArticles, Ticket => $TicketObj &>
 % $m->callback( %ARGS, Ticket => $TicketObj, CallbackName => 'RightColumnEnd' );
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
deleted file mode 100644
index 31584955..00000000
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ /dev/null
@@ -1,139 +0,0 @@
-%# 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 }}}
-<&| /Widgets/TitleBox, 
-    title       => loc( $FriendlyLifecycle ), 
-    title_href  => RT::IR->HREFTo("Incident/Children/?Lifecycle=". $Lifecycle ."&id=".$id),
-    titleright_raw => $box_actions,
-    title_class    => 'inverse',
-    class => 'tickets-list-'. lc(RT::IR::TicketType( Lifecycle => $Lifecycle )),
-&>
-
-<& /RTIR/Elements/ShowChildren,
-    Ticket           => $IncidentObj, 
-    Lifecycle        => $Lifecycle,
-    Rows             => $Rows,
-    Statuses         => \@active_statuses,
-    NoTicketsCaption => loc('No active [_1]', loc( $FriendlyLifecycle )),
-&>
-% if ( $active->CountAll < $Rows ) {
-<& /RTIR/Elements/ShowChildren,
-    Ticket           => $IncidentObj,
-    Lifecycle        => $Lifecycle,
-    Rows             => $Rows - $active->CountAll,
-    Statuses         => \@inactive_statuses,
-    NoTicketsCaption => loc('No inactive [_1]', loc( $FriendlyLifecycle )),
-&>
-% }
-</&>
-
-<%ARGS>
-$IncidentObj
-$Lifecycle
-
-$OrderBy => 'Due'
-
-$Rows  => 8
-</%ARGS>
-<%INIT>
-
-
-return if $Lifecycle eq RT::IR->lifecycle_countermeasure && RT->Config->Get('RTIR_DisableCountermeasures');
-
-
-my $FriendlyLifecycle = RT::IR::FriendlyLifecycle($Lifecycle);
-
-my $id = $IncidentObj->id;
-
-my @active_statuses = RT::IR->Statuses( Lifecycle => $Lifecycle);
-my @inactive_statuses = RT::IR->Statuses( Lifecycle => $Lifecycle, Initial => 0, Active => 0, Inactive => 1 );
-
-my $active = RT::Tickets->new( $session{'CurrentUser'} );
-$active->FromSQL( RT::IR->Query(
-    Lifecycle => $Lifecycle,
-    MemberOf => $IncidentObj,
-    Status   => \@active_statuses,
-));
-
-my $inactive = RT::Tickets->new( $session{'CurrentUser'} );
-$inactive->FromSQL( RT::IR->Query(
-    Lifecycle => $Lifecycle,
-    MemberOf => $IncidentObj,
-    Status   => \@inactive_statuses,
-));
-
-my $total_count = $active->CountAll + $inactive->CountAll;
-
-
-my @box_actions;
-if ( $IncidentObj->CurrentUserHasRight('ModifyTicket') ) {
-    if (1) { # XXX TODO RESTORE THIS ACL CHECK
-    # $QueueObj->Id and $QueueObj->CurrentUserHasRight('CreateTicket') ) {
-        push @box_actions, {
-            title => $Lifecycle ne RT::IR->lifecycle_investigation? loc('Create') : loc('Launch'),
-            class => 'create_child' . ($Lifecycle ? '_'.$Lifecycle : ''),
-            path => RT::IR->HREFTo("CreateInQueue.html?Incident=$id&Lifecycle=".$Lifecycle),
-        };
-    }
-    push @box_actions, {
-        title => loc('Link'),
-        path  => RT::IR->HREFTo("Link/FromIncident/?id=$id&Lifecycle=".$Lifecycle),
-    };
-}
-
-if ( $total_count > $Rows ) {
-    push @box_actions, {
-        title => loc("More... ([_1] total)", $total_count),
-        path => RT::IR->HREFTo('Incident/Children/?Lifecycle='. $Lifecycle .'&id='. $id)
-    };
-}
-my $box_actions = join ' 'x3,
-    map q{<a href="} . $_->{'path'} . ( $_->{'class'} ? q{" class="} . $_->{'class'} : '' ) . q{">}
-        . $m->interp->apply_escapes( $_->{title}, 'h' ) . q{</a>},
-    @box_actions;
-
-</%INIT>

commit 9acc36ff5681edc60d96039c45837a63f014a9d3
Author: Maureen E. Mirville <maureen at bestpractical.com>
Date:   Tue Nov 27 18:16:14 2018 -0500

    Update Web Scrubber to correspond with RT changes
    
    RT's Web Scrubber was moved to its own class and renamed (see RT
    commit #01f90b627e). Updated RTIR to work with these changes.

diff --git a/lib/RT/IR/Web.pm b/lib/RT/IR/Web.pm
index 7a097c00..14fd57b0 100644
--- a/lib/RT/IR/Web.pm
+++ b/lib/RT/IR/Web.pm
@@ -57,7 +57,7 @@ package HTML::Mason::Commands;
 # If we set this in the ColumnMap callback, it's too late, as RT's scrubber
 # has already been initialized
 #
-$HTML::Mason::Commands::SCRUBBER_ALLOWED_ATTRIBUTES{'href'} = '^(?:'.$HTML::Mason::Commands::SCRUBBER_ALLOWED_ATTRIBUTES{'href'} . ')|(?:__RTIRTicketURI__)';
+$RT::Interface::Web::Scrubber::ALLOWED_ATTRIBUTES{'href'} = '^(?:'.$RT::Interface::Web::Scrubber::ALLOWED_ATTRIBUTES{'href'} . ')|(?:__RTIRTicketURI__)';
 
 package RT::IR::Web;
 RT::Base->_ImportOverlays();

-----------------------------------------------------------------------


More information about the rt-commit mailing list