[Rt-commit] r7535 - in rtir/branches/2.3-EXPERIMENTAL: .
jesse at bestpractical.com
jesse at bestpractical.com
Wed Apr 18 02:01:19 EDT 2007
Author: jesse
Date: Wed Apr 18 02:01:18 2007
New Revision: 7535
Modified:
rtir/branches/2.3-EXPERIMENTAL/ (props changed)
rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/Display.html
Log:
r55613 at pinglin: jesse | 2007-04-18 08:00:58 +0200
* quick attempt to add locking for incidents.
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 Wed Apr 18 02:01:18 2007
@@ -28,7 +28,8 @@
current_tab => 'RTIR/Display.html?id='.$id,
current_subtab => 'RTIR/Display.html?id='.$id,
Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &>
-
+
+<& /RTIR/Elements/ShowLock, Ticket => $TicketObj &>
<& /Elements/ListActions, actions => \@results &>
<table border="0" cellpadding="0" cellspacing="2" width="100%"><tr><td valign="top" width="50%">
@@ -314,11 +315,44 @@
my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $TicketObj, '_RTIR_State' );
if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ )
- {
- my ($res, $msg) = $TicketObj->$1();
+ {
+ my $action = $1;
+ my ($res, $msg) = $TicketObj->$action();
push @results, $msg;
+ # If they succeeded in taking the ticket, they should also get a lock
+ if ($res && $action =~ /^(?:Take|Steal)$/) { $ARGS{'Lock'} = 'add'; }
+
+ }
+ if ( $ARGS{'Lock'} ) {
+
+ if ( $ARGS{'Lock'} eq 'add' ) {
+ if ( $Ticket->RT::IR::Ticket::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 = $Ticket->RT::IR::Ticket::Locked();
+ if ( !$lock ) {
+ push @results, loc('This ticket was not locked');
+
+ } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
+ $Ticket->RT::IR::Ticket::Unlock();
+ push @results, loc('You have unlocked this ticket');
+ } else {
+ push @results,
+ loc("You can't unlock tickets that you did not lock");
+
+ }
+
+ } elsif ( $ARGS{'Lock'} eq 'break' ) {
+ $Ticket->RT::IR::Ticket::BreakLock();
+ push @results, loc('You have broken the lock on this ticket');
+ }
}
+
unless( $new_ticket ) {
push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj );
}
More information about the Rt-commit
mailing list