[Rt-commit] r8333 - in rtir/branches/2.3-EXPERIMENTAL: . html/RTIR
thayes at bestpractical.com
thayes at bestpractical.com
Tue Jul 31 16:42:41 EDT 2007
Author: thayes
Date: Tue Jul 31 16:42:40 2007
New Revision: 8333
Modified:
rtir/branches/2.3-EXPERIMENTAL/ (props changed)
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Edit.html
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Edit.html
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Split.html
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Split.html
Log:
r8497 at toth: toth | 2007-07-31 16:42:26 -0400
* Fixed locking for Incidents (uses different set of files, so they were missed at first)
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Edit.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Edit.html Tue Jul 31 16:42:40 2007
@@ -224,7 +224,7 @@
<%INIT>
my $Ticket = LoadTicket($id);
-$Ticket->Lock() unless $Ticket->Locked();
+$Ticket->Lock();
$id = $ARGS{'id'} = $Ticket->Id;
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Create.html Tue Jul 31 16:42:40 2007
@@ -29,6 +29,10 @@
Title => $Title,
Ticket => $TicketObj &>
+% if($Split) {
+ <& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0 &>
+% }
+
<& /Elements/ListActions, actions => \@results &>
<%PERL>
@@ -271,6 +275,7 @@
}
}
if( $inc_obj ) {
+ $TicketObj->Unlock() if $TicketObj->Locked();
return $m->comp('Display.html', id => $inc_obj->id, results => \@results );
}
}
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html Tue Jul 31 16:42:40 2007
@@ -29,7 +29,8 @@
current_subtab => 'RTIR/Display.html?id='.$id,
Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &>
-<& /Elements/ShowLock, Ticket => $TicketObj &>
+% $Duration ||= $ARGS{'Duration'};
+<& /Elements/ShowLock, Ticket => $TicketObj, Duration => $Duration &>
<& /Elements/ListActions, actions => \@results &>
<table border="0" cellpadding="0" cellspacing="2" width="100%"><tr><td valign="top" width="50%">
@@ -258,6 +259,7 @@
return $msg || ();
};
+my $Duration;
my $deleted_links = 0;
my $DoLinks = sub {
my ($child, $parent) = @_;
@@ -328,19 +330,19 @@
if ( $ARGS{'Lock'} ) {
if ( $ARGS{'Lock'} eq 'add' ) {
- if ( $TicketObj->RT::IR::Ticket::Lock() ) {
+ if ( $TicketObj->Lock() ) {
push @results, loc('You now have a lock on this ticket');
} else {
push @results, loc('Your attempt to lock this ticket failed');
}
} elsif ( $ARGS{'Lock'} eq 'remove' ) {
- my $lock = $TicketObj->RT::IR::Ticket::Locked();
- if ( !$lock ) {
+ my $lock = $TicketObj->Locked();
+ unless($lock) {
push @results, loc('This ticket was not locked');
-
- } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
- $TicketObj->RT::IR::Ticket::Unlock();
+ } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
+ $Duration = time() - $lock->Content->{'Timestamp'};
+ $TicketObj->Unlock();
push @results, loc('You have unlocked this ticket');
} else {
push @results,
@@ -349,7 +351,7 @@
}
} elsif ( $ARGS{'Lock'} eq 'break' ) {
- $TicketObj->RT::IR::Ticket::BreakLock();
+ $TicketObj->BreakLock();
push @results, loc('You have broken the lock on this ticket');
}
}
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Edit.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Edit.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Edit.html Tue Jul 31 16:42:40 2007
@@ -30,6 +30,7 @@
Title => loc("Edit Incident #[_1]: [_2]",
$Ticket->Id, $Ticket->Subject) &>
+<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
<& /Elements/ListActions, actions => \@results &>
% unless ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
@@ -153,6 +154,7 @@
<%INIT>
my $Ticket = LoadTicket($id);
+$Ticket->Lock();
$id = $ARGS{'id'} = $Ticket->Id;
my $CanRespond = 0;
@@ -194,7 +196,7 @@
push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
}
if ( !$checks_failure && RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ) {
- return $m->comp("/RTIR/Incident/Display.html", results => [@results], id => $id );
+ return $m->comp("/RTIR/Incident/Display.html", results => [@results], id => $id, Lock => 'remove' );
}
}
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Reply.html Tue Jul 31 16:42:40 2007
@@ -35,6 +35,7 @@
current_subtab => "RTIR/Search/Refine.html",
&>
+<& /Elements/ShowLock, Ticket => $IncidentObj, Unlock => 0 &>
<& /Elements/ListActions, actions => \@results &>
<form action="Reply.html" method="get">
@@ -98,6 +99,7 @@
my (@results);
my $IncidentObj = LoadTicket( $id );
+$IncidentObj->Lock();
$id = $ARGS{'id'} = $IncidentObj->id;
# XXX: we should get rid of DefaultStatus argument at all. use Status
@@ -206,7 +208,7 @@
push @results, loc("State of the Incident left unchanged; not all children were updated");
}
- return $m->comp("Display.html", results => \@results, id => $id);
+ return $m->comp("Display.html", results => \@results, id => $id, Lock => 'remove');
}
# XXX, BLOODY-DIRTY-EVIL HACK: when we load the page first time we should
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Split.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Split.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Split.html Tue Jul 31 16:42:40 2007
@@ -47,6 +47,7 @@
<%INIT>
my $TicketObj = LoadTicket($Ticket);
+$TicketObj->Lock();
</%INIT>
<%ARGS>
Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Split.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Split.html (original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Split.html Tue Jul 31 16:42:40 2007
@@ -45,7 +45,7 @@
<%INIT>
my $TicketObj = LoadTicket( $Ticket );
-$TicketObj->Lock() unless $TicketObj->Locked();
+$TicketObj->Lock();
my $Type = RT::IR::TicketType( Ticket => $TicketObj );
if ( $m->comp_exists("/RTIR/$Type/Split.html") ) {
More information about the Rt-commit
mailing list