[Rt-commit] r8358 - in rt/branches/3.7-EXPERIMENTAL-TUNIS: . lib/RT
thayes at bestpractical.com
thayes at bestpractical.com
Wed Aug 1 14:02:30 EDT 2007
Author: thayes
Date: Wed Aug 1 14:02:29 2007
New Revision: 8358
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:
r8526 at toth: toth | 2007-08-01 14:02:14 -0400
* Changed locking system so that only one lock is ever in place on a given ticket and, RT::Ticket::Unlock only unlocks if the lock was an auto lock or Unlock was called with a true value (hard unlock)
* RT::Ticket::Lock now has a parameter to determine whether the lock is a hard (manual) lock or an auto 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 1 14:02:29 2007
@@ -1,6 +1,6 @@
% if ($Duration ||($u->id && $u->id == $session{'CurrentUser'}->id)) {
<div class="locked-by-you">
-% if(defined $Duration) {
+% if(defined $Duration && !$Lock) {
<&|/l, $ago &>You had this ticket locked for [_1]. It is now unlocked</&>.
% } else {
<&|/l, $ago &>You have had this ticket locked for [_1]</&>.
@@ -16,15 +16,15 @@
</div>
%}
<%INIT>
-my $Lock;
-return unless defined $Duration || ($Lock = $Ticket->Locked());
+my $Lock = $Ticket->Locked();
+return unless defined $Duration || $Lock;
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) {
+if(defined $Duration && !$Lock) {
$ago = $date->DurationAsString($Duration);
} elsif($Lock) {
$ago = $date->DurationAsString(time() - $Lock->Content->{'Timestamp'});
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 Wed Aug 1 14:02:29 2007
@@ -236,6 +236,7 @@
sub Lock {
my $ticket = shift;
+ my $hard = shift;
if ( $ticket->Locked() ) {
return undef;
@@ -244,8 +245,8 @@
Name => 'RT_Lock',
Content => {
User => $ticket->CurrentUser->id,
- Timestamp => time()
-
+ Timestamp => time(),
+ Hard => $hard
}
);
}
@@ -254,10 +255,12 @@
sub Unlock {
my $ticket = shift;
+ my $hard = shift;
my $lock = $ticket->RT::Ticket::Locked();
- return undef unless $lock;
- return undef unless $lock->Content->{User} == $ticket->CurrentUser->id;
+ return undef unless $lock;
+ return undef unless $lock->Content->{User} == $ticket->CurrentUser->id;
+ return undef if $lock->Content->{'Hard'} && !$hard;
$ticket->DeleteAttribute('RT_Lock');
}
More information about the Rt-commit
mailing list