[Rt-commit] [rtir] 23/24: Start to switch 'children' to use lifecycles

Jesse Vincent jesse at bestpractical.com
Mon Feb 9 00:25:27 EST 2015


This is an automated email from the git hooks/post-receive script.

jesse pushed a commit to branch 3.4/remove_old_constituencies
in repository rtir.

commit 61a29aa7341573f7fe56c891dad4d39dc960e004
Author: Jesse Vincent <jesse at bestpractical.com>
Date:   Sun Feb 8 21:10:55 2015 -0800

    Start to switch 'children' to use lifecycles
---
 html/RTIR/Elements/ShowChildren          |  8 +++----
 html/RTIR/Incident/Children/index.html   | 18 +++++++-------
 html/RTIR/Incident/Elements/ShowChildren | 41 +++++++++++++++++---------------
 3 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/html/RTIR/Elements/ShowChildren b/html/RTIR/Elements/ShowChildren
index d64ab58..49c58e7 100644
--- a/html/RTIR/Elements/ShowChildren
+++ b/html/RTIR/Elements/ShowChildren
@@ -46,7 +46,7 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 % if( $ShowStatusesSelector ) {
-%   foreach my $s ( $QueueObj->LifecycleObj->Valid ) {
+%   foreach my $s ( $LifecycleObj->Valid ) {
 %       my $checked = (grep { $_ eq $s } @Statuses)? 'checked': '';
 <input type="checkbox" name="Statuses" value="<% $s %>" <% $checked %> /> <% $s %>
 %   }
@@ -68,8 +68,8 @@
 % unless( $children->Count ) {
 %   if ( $NoTicketsCaption ) {
         <i>(<% $NoTicketsCaption %>)</i>
-%   } elsif ( $Queue ) {
-        <i>(<% loc("no [_1]", $Queue) %>)</i>
+%   } elsif ( $Lifecycle ) {
+        <i>(<% loc("no [_1]", RT::IR::FriendlyLifecycle($Lifecycle)) %>)</i>
 %   } else {
         <i>(<% loc("no children") %>)</i>
 %   }
@@ -101,7 +101,7 @@ $children->FromSQL( RT::IR->Query(
 
 <%ARGS>
 $Format => undef
-$Queue => undef
+$Lifecycle => undef
 $Ticket => undef
 $OrderBy => 'Due'
 $Rows => 0
diff --git a/html/RTIR/Incident/Children/index.html b/html/RTIR/Incident/Children/index.html
index a3edf60..6bbacea 100644
--- a/html/RTIR/Incident/Children/index.html
+++ b/html/RTIR/Incident/Children/index.html
@@ -58,13 +58,13 @@
 
 <form action="index.html" method="post">
 <input type="hidden" name="id" value="<% $id %>" />
-<input type="hidden" name="Queue" value="<% $Queue %>" />
+<input type="hidden" name="Lifecycle" value="<% $Lifecycle %>" />
 
 <& /RTIR/Elements/ShowChildren,
     Ticket               => $Incident,
-    Queue                => $Queue,
+    Lifecycle            => $Lifecycle,
     Statuses             => [@Statuses],
-    FullList             => RT->Config->Get('WebPath')."/RTIR/Incident/Children/?Queue=$Queue&id=$id",
+    FullList             => RT->Config->Get('WebPath')."/RTIR/Incident/Children/?Lifecycle=$Lifecycle&id=$id",
     Delete               => $delete,
     ShowHeader           => 1,
     ShowStatusesSelector => 1,
@@ -89,36 +89,36 @@ if( $ARGS{'Unlink'} ) {
 
 MaybeRedirectForResults(
     Actions   => \@results,
-    Arguments => { id => $id, Queue => $Queue },
+    Arguments => { id => $id, Lifecycle => $Lifecycle },
 );
 
 unless ( $Incident->CurrentUserHasRight('ShowTicket') ) {
     Abort("No permission to view ticket");
 }
 
-my $Title = loc("$Queue for Incident #[_1]: [_2]", $id, $Incident->Subject);
+my $Title = loc("[_1] for Incident #[_2]: [_3]", RT::IR->TicketType(Lifecycle => $Lifecycle),$id, $Incident->Subject);
 
 my $delete = $Incident->CurrentUserHasRight('ModifyTicket') ? 1: 0;
 
- at Statuses = RT::IR->Statuses( Queue => $Queue )
+ at Statuses = RT::IR->Statuses( Lifecycle => $Lifecycle ) 
     unless @Statuses;
 
 my $children = RT::Tickets->new( $session{'CurrentUser'} );
 $children->FromSQL( RT::IR->Query(
-    Queue    => $Queue,
+    Lifecycle =>  $Lifecycle,
     MemberOf => $Incident,
     Status   => [@Statuses],
 ) );
 
 my $all_children = RT::Tickets->new( $session{'CurrentUser'} );
 $all_children->FromSQL( RT::IR->Query(
-    Queue    => $Queue,
+    Lifecycle => $Lifecycle,
     MemberOf => $Incident,
 ) );
 </%INIT>
 <%ARGS>
 $id              => undef
-$Queue           => 'Incident Reports'
+$Lifecycle       => 'incident_reports'
 
 @SelectedTickets => ()
 @Statuses        => ()
diff --git a/html/RTIR/Incident/Elements/ShowChildren b/html/RTIR/Incident/Elements/ShowChildren
index 014834d..9d65f70 100644
--- a/html/RTIR/Incident/Elements/ShowChildren
+++ b/html/RTIR/Incident/Elements/ShowChildren
@@ -46,70 +46,73 @@
 %#
 %# END BPS TAGGED BLOCK }}}
 <&| /Widgets/TitleBox, 
-    title       => loc( $Queue ),
-    title_href  => RT->Config->Get('WebPath') ."/RTIR/Incident/Children/?Queue=". $EscapedQueue ."&id=".$id,
+    title       => loc( $FriendlyLifecycle ), 
+    title_href  => RT->Config->Get('WebPath') ."/RTIR/Incident/Children/?Lifecycle=". $Lifecycle ."&id=".$id,
     titleright_raw => $box_actions,
     title_class    => 'inverse',
-    class => 'tickets-list-'. lc(RT::IR::TicketType( Queue => $Queue )),
+    class => 'tickets-list-'. lc(RT::IR::TicketType( Lifecycle => $Lifecycle )),
 &>
 
 <& /RTIR/Elements/ShowChildren,
     Ticket           => $IncidentObj, 
-    Queue            => $Queue,
+    Lifecycle        => $Lifecycle,
     Rows             => $Rows,
     Statuses         => \@active_statuses,
-    NoTicketsCaption => loc('No active [_1]', loc( $Queue )),
+    NoTicketsCaption => loc('No active [_1]', loc( $FriendlyLifecycle )),
 &>
 % if ( $active->CountAll < $Rows ) {
 <& /RTIR/Elements/ShowChildren,
     Ticket           => $IncidentObj,
-    Queue            => $Queue,
+    Lifecycle        => $Lifecycle,
     Rows             => $Rows - $active->CountAll,
     Statuses         => \@inactive_statuses,
-    NoTicketsCaption => loc('No inactive [_1]', loc( $Queue )),
+    NoTicketsCaption => loc('No inactive [_1]', loc( $FriendlyLifecycle )),
 &>
 % }
 </&>
 
 <%ARGS>
 $IncidentObj
-$Queue
+$Lifecycle
 
 $OrderBy => 'Due'
 
 $Rows  => 8
 </%ARGS>
 <%INIT>
-return if $Queue eq 'Blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
+
+
+return if $Lifecycle eq 'blocks' && RT->Config->Get('RTIR_DisableBlocksQueue');
+
+
+my $FriendlyLifecycle = RT::IR::FriendlyLifecycle($Lifecycle);
 
 my $id = $IncidentObj->id;
-my $EscapedQueue = $m->interp->apply_escapes( $Queue, 'u' );
 
-my @active_statuses = RT::IR->Statuses( Queue => $Queue );
-my @inactive_statuses = RT::IR->Statuses( Queue => $Queue, Initial => 0, Active => 0, Inactive => 1 );
+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(
-    Queue    => $Queue,
+    Lifecycle => $Lifecycle,
     MemberOf => $IncidentObj,
     Status   => \@active_statuses,
 ));
 
 my $inactive = RT::Tickets->new( $session{'CurrentUser'} );
 $inactive->FromSQL( RT::IR->Query(
-    Queue    => $Queue,
+    Lifecycle => $Lifecycle,
     MemberOf => $IncidentObj,
     Status   => \@inactive_statuses,
 ));
 
 my $total_count = $active->CountAll + $inactive->CountAll;
 
-my $QueueObj = RT::Queue->new($session{CurrentUser});
-$QueueObj->Load($Queue);
 
 my @box_actions;
 if ( $IncidentObj->CurrentUserHasRight('ModifyTicket') ) {
-    if ( $QueueObj->Id and $QueueObj->CurrentUserHasRight('CreateTicket') ) {
+    if (1) { # XXX TODO RESTORE THIS ACL CHECK
+    # $QueueObj->Id and $QueueObj->CurrentUserHasRight('CreateTicket') ) {
         push @box_actions, {
             title => $Lifecycle ne 'investigations'? loc('Create') : loc('Launch'),
             path => "/RTIR/Create.html?Incident=$id&Lifecycle=".$Lifecycle,
@@ -117,14 +120,14 @@ if ( $IncidentObj->CurrentUserHasRight('ModifyTicket') ) {
     }
     push @box_actions, {
         title => loc('Link'),
-        path  => "/RTIR/Link/FromIncident/?id=$id&Queue=$EscapedQueue",
+        path  => "/RTIR/Link/FromIncident/?id=$id&Lifecycle=".$Lifecycle,
     };
 }
 
 if ( $total_count > $Rows ) {
     push @box_actions, {
         title => loc("More... ([_1] total)", $total_count),
-        path => '/RTIR/Incident/Children/?Queue='. $EscapedQueue .'&id='. $id
+        path => '/RTIR/Incident/Children/?Lifecycle='. $Lifecycle .'&id='. $id
     };
 }
 my $box_actions = join ' 'x3,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list