[Rt-commit] r8395 - rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements
ruz at bestpractical.com
ruz at bestpractical.com
Fri Aug 3 19:52:50 EDT 2007
Author: ruz
Date: Fri Aug 3 19:52:50 2007
New Revision: 8395
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/html/Elements/ShowLock
Log:
/Elements/ShowLock
* as we have now Id argument make Ticket optional
** Id have higher priority
* get out if we have no ticket
* refactor things a little
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 Fri Aug 3 19:52:50 2007
@@ -52,25 +52,25 @@
</div>
%}
<%INIT>
-$Ticket = LoadTicket($Id) if $Id;
-my $Lock = $Ticket->Locked();
-return unless defined $Duration || $Lock;
+my $Lock;
+if ( $Id ) {
+ $Ticket = LoadTicket($Id);
+ $Lock = $Ticket->Locked;
+}
+return unless defined $Ticket;
+
+$Duration = time - $Lock->Content->{'Timestamp'}
+ if $Lock && !defined $Duration;
+return unless defined $Duration;
my $u = RT::User->new($session{'CurrentUser'});
$u->Load($Lock->Content->{'User'}) if $Lock;
my $date = RT::Date->new($session{'CurrentUser'});
-my $ago;
-if(defined $Duration && !$Lock) {
- $ago = $date->DurationAsString($Duration);
-} elsif($Lock) {
- $ago = $date->DurationAsString(time() - $Lock->Content->{'Timestamp'});
-} else {
- return;
-}
+my $ago = $date->DurationAsString($Duration);
</%INIT>
<%ARGS>
-$Ticket
+$Ticket => undef
$Duration => undef
$Unlock => 1;
More information about the Rt-commit
mailing list