[Rt-commit] r8450 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: .

thayes at bestpractical.com thayes at bestpractical.com
Wed Aug 8 16:10:40 EDT 2007


Author: thayes
Date: Wed Aug  8 16:10:38 2007
New Revision: 8450

Modified:
   rt/branches/3.7-EXPERIMENTAL-TUNIS/   (props changed)
   rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock

Log:
 r8627 at toth:  toth | 2007-08-08 16:10:02 -0400
 * Reverted to facilitate display of others' locks. The Duration parameter indicates that you have just unlocked one of your locks before rendering the ShowLock element (and thus the timestamp on the lock will not be available). So the Duration parameter should be used only in that case, or ShowLock will always claim that you have a lock on a ticket, even when it's someone else's lock.
 


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	Wed Aug  8 16:10:38 2007
@@ -56,19 +56,23 @@
     $Ticket = LoadTicket($Id);
 }
 
-return unless defined $Ticket;
+my $Lock = $Ticket->Locked() if $Ticket;
 
-my $Lock = $Ticket->Locked();
+return unless (defined $Ticket && defined $Lock) || defined $Duration;
 
-$Duration = time - $Lock->Content->{'Timestamp'}
-    if $Lock && !defined $Duration;
-return unless defined $Duration;
+my $ago;
+my $date = RT::Date->new($session{'CurrentUser'});
+
+if(defined $Duration) {
+    $ago = $date->DurationAsString($Duration);
+}
+elsif($Lock) {
+    $ago = $date->DurationAsString(time() - $Lock->Content->{'Timestamp'});
+}
 
 my $u = RT::User->new($session{'CurrentUser'});
 $u->Load($Lock->Content->{'User'}) if $Lock;
 
-my $date = RT::Date->new($session{'CurrentUser'});
-my $ago = $date->DurationAsString($Duration);
 </%INIT>
 <%ARGS>
 $Ticket => undef


More information about the Rt-commit mailing list