[Rt-commit] r4849 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR/Elements

ruz at bestpractical.com ruz at bestpractical.com
Tue Mar 28 18:33:37 EST 2006


Author: ruz
Date: Tue Mar 28 18:33:36 2006
New Revision: 4849

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents

Log:
 r1045 at cubic-pc:  cubic | 2006-03-29 03:29:01 +0400
 * allow to unlink children of the incidents
 * we should change state of the ticket when take/steal it, revert change


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowIncidents	Tue Mar 28 18:33:36 2006
@@ -24,9 +24,12 @@
 %# END LICENSE BLOCK
 %  while (my $incident = $incidents->Next) {
 %   $count++;
-<a href="<%RT->Config->Get('WebPath')%>/RTIR/Display.html?id=<%$incident->Id%>"><%$incident->Id%>: <%$incident->Subject%></a> <i>(<& /RTIR/Elements/ShowRTIRField, Ticket => $incident, Name => 'State' &>)</i>
+% unless ( $action ) {
+<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?id=<% $Ticket->Id %>&DeleteLink--MemberOf-<% $incident->Id %>=1">[<% loc('Unlink') %>]</a>
+% }
+<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?id=<% $incident->Id %>"><% $incident->Id %>: <% $incident->Subject %></a> <i>(<& /RTIR/Elements/ShowRTIRField, Ticket => $incident, Name => 'State' &>)</i>
 % if ($depth < 8) {
-<& /RTIR/Elements/ShowIncidents, Ticket => $incident, depth => ($depth+1) &> 
+<& /RTIR/Elements/ShowIncidents, Ticket => $incident, depth => ($depth+1) &>
 %   }
 % }
 % if ($depth == 1 and $count == 0) {
@@ -34,19 +37,11 @@
 % }
 
 % if ($depth == 1) {
-%   if ( $Ticket->Owner == $session{'CurrentUser'}->id ) {
+%   unless ( $action ) {
 <b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Incident/LinkToIncident.html?id=<% $Ticket->Id %>">[Link]</a></b>
 <b><a href="<%RT->Config->Get('WebPath')%>/RTIR/Create.html?Child=<% $Ticket->Id %>&Queue=Incidents">[New]</a></b>
-%   } else { #XXX: looks too complex, refactor it
-%       if ( $Ticket->Owner == $RT::Nobody->Id ) {
-%           if ( $Ticket->QueueObj->IsActiveStatus( $Ticket->Status ) ) {
-<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=Take&id=<% $Ticket->Id %>&Status=open">[<% loc('Take') %>]</a>
-%           } else {
-<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=Take&id=<% $Ticket->Id %>">[<% loc('Take') %>]</a>
-%           }
-%       } else {
-<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=Steal&id=<% $Ticket->Id %>">[<% loc('Steal') %>]</a>
-%       }
+%   } else {
+<a href="<% RT->Config->Get('WebPath') %>/RTIR/Display.html?Action=<% $action %>&id=<% $Ticket->Id %>">[<% loc( $action ) %>]</a>
 %   }
 % }
 
@@ -58,6 +53,15 @@
 my $incidents = new RT::Tickets($session{'CurrentUser'});
 $incidents->FromSQL($query);
 
+my $action = '';
+if ( $Ticket->Owner != $session{'CurrentUser'}->Id ) {
+    if ( $Ticket->Owner == $RT::Nobody->Id ) {
+        $action = 'Take';
+    } else {
+        $action = 'Steal';
+    }
+}
+
 </%INIT>
 
 <%ARGS>


More information about the Rt-commit mailing list