[Rt-commit] r8386 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: . lib/RT

thayes at bestpractical.com thayes at bestpractical.com
Thu Aug 2 18:54:33 EDT 2007


Author: thayes
Date: Thu Aug  2 18:54:33 2007
New Revision: 8386

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock
   rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm

Log:
 r8575 at toth:  toth | 2007-08-02 18:54:17 -0400
 * ShowLock now allows you to specify a ticket ID whose locks to look at. This is for features such as Split, in which the display page loaded after the completion of the task is not the display page of the ticket that was locked for the purpose. While this doesn't change any actual locking, it keeps the user appraised of the state of the locks of the ticket they are Splitting/Merging/Linking to Incident/etc.
 
 * RT::Ticket::Unlock now returns the lock Attribute object of the ticket just unlocked (this way we can still access values of the just-removed lock, such as Timestamp)
 


Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock	Thu Aug  2 18:54:33 2007
@@ -1,16 +1,43 @@
+%# BEGIN LICENSE BLOCK
+%# 
+%# Copyright (c) 1996-2002 Jesse Vincent <jesse at bestpractical.com>
+%# 
+%# (Except where explictly superceded by other copyright notices)
+%# 
+%# 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.
+%# 
+%# 
+%# Unless otherwise specified, all modifications, corrections or
+%# extensions to this work which alter its source code become the
+%# property of Best Practical Solutions, LLC when submitted for
+%# inclusion in the work.
+%# 
+%# 
+%# END LICENSE BLOCK
+
+% my $TicketLabel = $Id ? "Ticket #$Id" : 'this ticket';
+
 % if ($Duration ||($u->id && $u->id == $session{'CurrentUser'}->id)) {
 <div class="locked-by-you">
 % if(defined $Duration && !$Lock) {
-	<&|/l, $ago &>You had this ticket locked for [_1]. It is now unlocked</&>.
+	<&|/l, $TicketLabel, $ago &>You had [_1] locked for [_2]. It is now unlocked</&>.
 % #Do not display time if it is very little time, since such a short time probably 
 % #means the lock was just created.
 % } elsif($ago < 5) {	
-		<&|/l &>You have locked this ticket</&>.
+		<&|/l, $TicketLabel &>You have locked [_1]</&>.
 %	if($Unlock) {
 		[<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->id%>&Lock=remove"><&|/l&>Unlock</&></a>]
 %	}
 % }	else {
-	<&|/l, $ago &>You have had this ticket locked for [_1]</&>.
+	<&|/l, $TicketLabel, $ago &>You have had [_1] locked for [_2]</&>.
 % 	if($Unlock) {
 		[<a href="<%$RT::WebPath%>/Ticket/Display.html?id=<%$Ticket->id%>&Lock=remove"><&|/l&>Unlock</&></a>]
 %	}
@@ -18,11 +45,13 @@
 
 </div>
 % } else {
+% 	$TicketLabel = 'This ticket' if $TicketLabel eq 'this ticket';	
 <div class="locked">
-<&|/l, $u->Name, $ago &>This ticket has been locked by [_1] for [_2]</&>.
+<&|/l, $TicketLabel, $u->Name, $ago &>[_1] has been locked by [_2] for [_3]</&>.
 </div>
 %}
 <%INIT>
+$Ticket = LoadTicket($Id) if $Id;
 my $Lock = $Ticket->Locked();
 return unless defined $Duration || $Lock;
 
@@ -43,4 +72,9 @@
 $Ticket
 $Duration => undef
 $Unlock => 1;
+
+# To enable display of information about a ticket other than the one displayed
+# (e.g., Split shows the Display page for the new ticket, so this allows us to
+# display the Split-from ticket's lock information)
+$Id => 0;
 </%ARGS>

Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm	(original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Ticket.pm	Thu Aug  2 18:54:33 2007
@@ -248,7 +248,7 @@
 		}
 		return undef if $priority <= $LockPriority;
     } else {
-    	$ticket->Unlock();	#Remove any existing locks (because this one has greater priority)
+    	$ticket->Unlock($type);	#Remove any existing locks (because this one has greater priority)
         $ticket->SetAttribute(
             Name    => 'RT_Lock',
             Content => {
@@ -278,6 +278,7 @@
 	}
 	return undef if $priority < $LockPriority;
     $ticket->DeleteAttribute('RT_Lock');
+    return $lock;
 }
 
 


More information about the Rt-commit mailing list