[Rt-commit] r8559 - in rtir/branches/2.3-EXPERIMENTAL: . html/RTIR html/RTIR/Elements

thayes at bestpractical.com thayes at bestpractical.com
Wed Aug 15 18:50:01 EDT 2007


Author: thayes
Date: Wed Aug 15 18:49:58 2007
New Revision: 8559

Modified:
   rtir/branches/2.3-EXPERIMENTAL/   (props changed)
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Edit.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/QueueTabs
   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/LinkToIncident.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/Merge.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Split.html
   rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html

Log:
 r8741 at toth:  toth | 2007-08-15 18:48:02 -0400
 * Modified to use callbacks for locking, in keeping with the new RT-Extension-TicketLocking
 


Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Create.html	Wed Aug 15 18:49:58 2007
@@ -47,7 +47,7 @@
 &>
 % }
 
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0, Id => $Id &>
+% $m->callback(CallbackName => 'ShowLock', %ARGS, Ticket => $TicketObj);
 <& /Elements/ListActions, actions => \@results &>
 
 % if ( $Split && !$TicketObj->CurrentUserHasRight('ModifyTicket') ) {
@@ -329,10 +329,10 @@
 </form>
 
 <%INIT>
+
 my $QueueObj = new RT::Queue( $session{'CurrentUser'} );
 $QueueObj->Load( $Queue ) || Abort( loc("Queue could not be loaded.") );
 
-my $Id;
 
 my $Type = RT::IR::TicketType( Queue => $Queue );
 if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
@@ -424,12 +424,8 @@
 
     unless ( $checks_failure ) {
         $ARGS{'new-MemberOf'} = $parentvalue if $parentvalue;
-        my $Duration;
-        if($TicketObj) {
-            ($Duration) = $TicketObj->Unlock();
-            $Id = $TicketObj->id;
-        }
-        return $m->comp( 'Display.html', %ARGS, SkipNotification => \@SkipNotification, results => \@results, Duration => $Duration, Id => $Id );
+        $m->callback(CallbackName => 'BeforeDisplay', Ticket => $TicketObj, ARGSref => \%ARGS);
+        return $m->comp( 'Display.html', %ARGS, SkipNotification => \@SkipNotification, results => \@results );
     }
     unshift @results, loc("Creation failed:");
 }

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Display.html	Wed Aug 15 18:49:58 2007
@@ -30,8 +30,7 @@
     current_subtab => 'RTIR/Display.html?id='.$Ticket->id,
     Title => $Title &>
 
-% $Duration ||= $ARGS{'Duration'};
-<& /Elements/ShowLock, Ticket => $Ticket, Duration => $Duration, Id => $ARGS{'Id'}, Unlock => $Unlock &>
+% $m->callback(CallbackName => 'ShowLock', %ARGS, Ticket => $Ticket);
 <& /Elements/ListActions, actions => \@results &>
 <table border="0" cellpadding="0" cellspacing="2" width="100%">
 <tr>
@@ -209,8 +208,6 @@
 <%INIT>
 my ($name);
 my $Ticket = new RT::Ticket( $session{'CurrentUser'} );
-my $Duration;
-my $Unlock = 1;
 
 my $QueueObj;
 unless ( $id eq 'new' ) {
@@ -248,11 +245,7 @@
         push @results, $msg;
         # If they succeeded in taking the ticket, they should also get a lock
         if ($status && $action =~  /^(?:Take|Steal)$/) {
-            if($Type eq 'Report' && !RT::IR::Ticket::IsLinkedToActiveIncidents($Ticket)) {
-                $Ticket->Lock('Take');
-                $Unlock = 0;
-                push @results, 'You have a lock on this report until you link it to an incident';
-            }
+            $m->callback(CallbackName => 'TicketTakeOrSteal', %ARGS, Ticket => $Ticket, Type => $Type, Results => \@results);
         }
     }
 
@@ -260,30 +253,17 @@
     if ( $ARGS{'TakeOrStealFirst'} and $Ticket->Owner != $Ticket->CurrentUser->Id) {
         my ($status, $msg) = $Ticket->SetOwner($Ticket->CurrentUser->Id, 'Force');
         push @results, $msg if $msg;
-
+        
         # If they succeeded in taking the ticket, they should also get a lock
-        if ($status) { $ARGS{'Lock'} = 'add'; }
-    }
-
-    if ( $ARGS{'Lock'} ) {
-
-        if ( $ARGS{'Lock'} eq 'add' ) {
-            if ( $Ticket->Lock('Hard') ) {
-                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 $msg;
-            ($Duration, $msg) = $Ticket->Unlock('Hard');
-            push @results, loc($msg);
-
-        } elsif ( $ARGS{'Lock'} eq 'break' ) {
-            $Ticket->BreakLock();
-            push @results, loc('You have broken the lock on this ticket');
+        ## Should they? This should only happen when a ticket is rejected, do we want to lock it?
+        if ($status) { 
+            $m->callback(CallbackName => 'TicketTakeOrSteal', %ARGS, Ticket => $Ticket, Type => $Type, Results => \@results); 
         }
     }
+    $m->callback(CallbackName => 'ProcessLockArgument', 
+                Ticket => $Ticket,
+                ARGSref => \%ARGS,  
+                Actions => \@results);
 
 
     $ARGS{UpdateAttachments} = delete $session{'Attachments'};

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	Wed Aug 15 18:49:58 2007
@@ -29,7 +29,7 @@
     current_subtab => "RTIR/Edit.html?id=".$Ticket->Id, 
     Title => $Title &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>          
+% $m->callback(CallbackName => 'ShowLock', Ticket => $Ticket);          
 <& /Elements/ListActions, actions => \@results &>
 
 % if (!$Ticket->CurrentUserHasRight('ModifyTicket')) {
@@ -224,9 +224,10 @@
 
 <%INIT>
 my $Ticket = LoadTicket($id);
-$Ticket->Lock();
+
 $id = $ARGS{'id'} = $Ticket->Id;
 
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $Ticket);
 
 my $Type = RT::IR::TicketType( Ticket => $Ticket );
 
@@ -285,13 +286,9 @@
         push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
     }
     if ( !$checks_failure && RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ) {
-    	my $Duration;
-    	if(my $lock = $Ticket->Locked()) {
-    		$Duration = time() - $lock->Content->{'Timestamp'};
-    		$Ticket->Unlock();
-    	}
-    		
-        return $m->comp("/RTIR/Display.html", results => [@results], id => $id, Duration => $Duration);
+        $m->callback(CallbackName => 'BeforeDisplay', ARGSref => \%ARGS, Ticket => $Ticket);
+            
+        return $m->comp("/RTIR/Display.html", %ARGS, results => [@results], id => $id);
     }
 }
  

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/QueueTabs
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/QueueTabs	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Elements/QueueTabs	Wed Aug 15 18:49:58 2007
@@ -22,7 +22,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-% $m->callback( %ARGS, CallbackPage => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs);;
+% $m->callback( %ARGS, CallbackPage => '/Ticket/Elements/Tabs', Ticket => $Ticket, actions=> $actions, tabs => $tabs);
 <& /RTIR/Elements/Tabs,
     %ARGS,
     tabs => $tabs, 
@@ -342,30 +342,6 @@
     }
 }
 
-if ($Ticket) {
-if (my $Lock = $Ticket->Locked()) {
-    if ($Lock->Content->{'User'} == $session{'CurrentUser'}->id) {
-    $actions->{'Lock'} = { 
-                    path  => "Ticket/Display.html?Lock=remove&id=$id",
-                    title => loc('Unlock') 
-                    };
-    } else {
-    $actions->{'Lock'} = { 
-                    path  => "Ticket/Display.html?Lock=break&id=$id",
-                    title => loc('Break lock') 
-                    };
-
-    }
-} else {
-    $actions->{'Lock'} = { 
-                    path  => "Ticket/Display.html?Lock=add&id=$id",
-                    title => loc('Lock') 
-                    };
-
-
-}
-}
-
 </%INIT>
 <%ARGS>
 $Title          => ''

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	Wed Aug 15 18:49:58 2007
@@ -30,7 +30,7 @@
     Ticket => $TicketObj &>
 
 
-<& /Elements/ShowLock, Ticket => $TicketObj, Unlock => 0, Id => $Id, Duration => $Duration &>
+% $m->callback(CallbackName => 'ShowLock', %ARGS, Ticket => $TicketObj);
 <& /Elements/ListActions, actions => \@results &>
 
 <%PERL>
@@ -200,27 +200,21 @@
 
 
 <%INIT>
+
 my @results;
-my $Duration;
 
 # if there isn't a subject, but there is a child, use that one
 my $ChildObj;
-my $Id;
+
 if ( $Child ) {
     $ChildObj = LoadTicket( $Child );
     $Child = $ARGS{'Child'} = $ChildObj->id;
     $ARGS{'Subject'} ||= $ChildObj->Subject;
-    # We don't want to bother even trying to lock if the form has been submitted
-    # (it will have been locked upon first rendering of the creation page)
-    unless($ARGS{'CreateIncident'} || $ARGS{'CreateWithInvestigation'}) {
-        $ChildObj->Lock();
-    }
-    $Id = $ARGS{'Child'};
+    $m->callback(CallbackName => 'LinkToNewIncident', ARGSref => \%ARGS, Child => $ChildObj);
 }
 
 if($Split && ($ARGS{'CreateIncident'} || $ARGS {'CreateWithInvestigation'})) {
-    $Id = $ARGS{'Ticket'};
-    ($Duration) = $TicketObj->Unlock();
+    $m->callback(CallbackName => 'SplitSubmitted', ARGSref => \%ARGS, Ticket => $TicketObj);
 }
 
 
@@ -296,11 +290,9 @@
         }
     }
     if( $inc_obj ) {
-        if($ChildObj) {
-            $Id = $ChildObj->id;
-            ($Duration) = $ChildObj->Unlock('Take');
-        }
-        return $m->comp('Display.html', id => $inc_obj->id, Duration => $Duration, Id => $Id, results => \@results );
+        $m->callback(CallbackName => 'BeforeDisplayIncident', ARGSref => \%ARGS, Child => $ChildObj);
+
+        return $m->comp('Display.html', %ARGS, 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	Wed Aug 15 18:49:58 2007
@@ -22,6 +22,7 @@
 %# 
 %# 
 %# END LICENSE BLOCK
+
 <& /RTIR/Elements/Header, Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &>
 <& /RTIR/Incident/Elements/Tabs, 
     Ticket => $TicketObj, 
@@ -29,9 +30,7 @@
     current_subtab => 'RTIR/Display.html?id='.$id,
     Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &>
     
-% $Duration ||= $ARGS{'Duration'};
-% my $Id = $ARGS{'Id'} || $ARGS{'Child'};
-<& /Elements/ShowLock, Ticket => $TicketObj, Duration => $Duration, Id => $Id &>
+% $m->callback(CallbackName => 'ShowLock', %ARGS, Ticket => $TicketObj);
 <& /Elements/ListActions, actions => \@results &>
 
 <table border="0" cellpadding="0" cellspacing="2" width="100%"><tr><td valign="top" width="50%">
@@ -245,7 +244,6 @@
     ForwardPath => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
 &>
 <%INIT>
-my $Duration;
 
 if ($SelectedTicket) {
     $id = $SelectedTicket;
@@ -256,7 +254,7 @@
 if( $Child ) {
     my $ChildObj = RT::Ticket->new( $session{'CurrentUser'} );
     $ChildObj->Load($Child);
-    ($Duration) = $ChildObj->Unlock('Take');
+    $m->callback(CallbackName => 'ThisLinkedToIR', ARGSref => \%ARGS, Child => $ChildObj);
 }
 
 
@@ -342,34 +340,10 @@
         if ($res && $action =~  /^(?:Take|Steal)$/) { $ARGS{'Lock'} = 'add'; }
 
     }
-    if ( $ARGS{'Lock'} ) {
-
-        if ( $ARGS{'Lock'} eq 'add' ) {
-            if ( $TicketObj->Lock('Hard') ) {
-                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->Locked();
-            unless($lock) {
-                push @results, loc('This ticket was not locked');
-            } elsif ( $lock->Content->{'User'} == $session{'CurrentUser'}->id ) {
-                $Duration = time() - $lock->Content->{'Timestamp'};
-                $TicketObj->Unlock('Hard');
-                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' ) {
-            $TicketObj->BreakLock();
-            push @results, loc('You have broken the lock on this ticket');
-        }
-    }
+    $m->callback(CallbackName => 'ProcessLockArgument', 
+                Ticket => $TicketObj,
+                ARGSref => \%ARGS,  
+                Actions => \@results);
 
 
     unless( $new_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	Wed Aug 15 18:49:58 2007
@@ -30,7 +30,7 @@
     Title => loc("Edit Incident #[_1]: [_2]", 
     $Ticket->Id, $Ticket->Subject) &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &> 
+% $m->callback(CallbackName => 'ShowLock', Ticket => $Ticket);
 <& /Elements/ListActions, actions => \@results &>
 
 % unless ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
@@ -53,8 +53,8 @@
     </td>
     <td class="value">
       <& /RTIR/Elements/ShowRTIRField, 
-	Name => 'State', 
-	Ticket => $Ticket &>
+    Name => 'State', 
+    Ticket => $Ticket &>
     </td>
   </tr>
   <tr>
@@ -74,8 +74,8 @@
     <td class="value">
       <& /RTIR/Elements/EditRTIRField, 
          TicketObj => $Ticket, 
-	 Name => 'Description',
-	 Cols => 60 &>
+     Name => 'Description',
+     Cols => 60 &>
     </td>
   </tr>
   <tr>
@@ -91,8 +91,8 @@
     <td class="value">
       <& /RTIR/Elements/EditRTIRField, 
          TicketObj => $Ticket, 
-	 Name => 'Constituency',
-	 Rows => 1 &>
+     Name => 'Constituency',
+     Rows => 1 &>
     </td>
   </tr>
   <tr>
@@ -100,8 +100,8 @@
     <td class="value">
       <& /RTIR/Elements/EditRTIRField, 
          TicketObj => $Ticket, 
-	 Name => 'Function',
-	 Rows => 1 &>
+     Name => 'Function',
+     Rows => 1 &>
     </td>
   </tr>
   <tr>
@@ -109,8 +109,8 @@
     <td class="value">
       <& /RTIR/Elements/EditRTIRField, 
          TicketObj => $Ticket, 
-	 Name => 'Classification',
-	 Rows => 1 &>
+     Name => 'Classification',
+     Rows => 1 &>
     </td>
   </tr>
   <tr>
@@ -118,7 +118,7 @@
     <td class="value">
       <& /RTIR/Elements/EditRTIRField,
          TicketObj => $Ticket,
-	     Name => 'IP',
+         Name => 'IP',
          Cols => 40 &>
     </td>
   </tr>
@@ -127,8 +127,8 @@
     <td class="value">
       <& /RTIR/Elements/EditRTIRField,
          TicketObj => $Ticket,
-	     Name => 'Resolution',
-	     Rows => 1 &>
+         Name => 'Resolution',
+         Rows => 1 &>
     </td>
   </tr>
 </table>
@@ -154,9 +154,12 @@
 
 <%INIT>
 my $Ticket = LoadTicket($id);
-$Ticket->Lock();
+
 $id = $ARGS{'id'} = $Ticket->Id;
 
+
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $Ticket);
+
 my $CanRespond = 0;
 my $CanComment = 0;
 
@@ -189,19 +192,16 @@
     RT->Config->Set( StrictLinkACL => $strict_acl );
 
     $ARGS{UpdateAttachments} = $session{'Attachments'};
-   	push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
+       push @results, ProcessUpdateMessage( TicketObj => $Ticket, ARGSRef=>\%ARGS );
 
     my $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
     if ($newstate ne $oldstate) {
         push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
     }
     if ( !$checks_failure && RT->Config->Get('DisplayAfterEdit', $session{'CurrentUser'}) ) {
-    	my $Duration;
-    	if(my $lock = $Ticket->Locked()) {
-    		$Duration = time() - $lock->Content->{'Timestamp'};
-    		$Ticket->Unlock();
-    	}
-        return $m->comp("/RTIR/Incident/Display.html", results => [@results], id => $id, Duration => $Duration );
+        $m->callback(CallbackName => 'BeforeDisplay', ARGSref => \%ARGS, Ticket => $Ticket);
+
+        return $m->comp("/RTIR/Incident/Display.html", %ARGS, results => [@results], id => $id );
     }
 }
 

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html	Wed Aug 15 18:49:58 2007
@@ -38,7 +38,7 @@
    current_subtab => "RTIR/Search/Refine.html",
 &>
 
-<& /Elements/ShowLock, Ticket => $ChildObj, Unlock => 0 &> 
+% $m->callback(CallbackName => 'ShowLock', Ticket => $ChildObj);
 
 <form action="<% RT->Config->Get('WebPath') %>/RTIR/Incident/Display.html" method="post">
 <input type="hidden" name="Child" value="<% $id %>" />
@@ -67,9 +67,12 @@
 
 <%INIT>
 my $ChildObj = LoadTicket($id);
-$ChildObj->Lock();
+
 $ARGS{'id'} = $id = $ChildObj->id;
 
+
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $ChildObj);
+
 my $Type = RT::IR::TicketType( Ticket => $ChildObj );
 my $title = loc( "Link [_1] #[_2] to selected Incident", $Type, $id );
 

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	Wed Aug 15 18:49:58 2007
@@ -35,7 +35,7 @@
     current_subtab => "RTIR/Search/Refine.html",
 &>
 
-<& /Elements/ShowLock, Ticket => $IncidentObj, Unlock => 0 &> 
+% $m->callback(CallbackName => 'ShowLock', Ticket => $IncidentObj);
 <& /Elements/ListActions, actions => \@results &>
 
 <form action="Reply.html" method="get">
@@ -99,9 +99,11 @@
 my (@results);
 
 my $IncidentObj = LoadTicket( $id );
-$IncidentObj->Lock();
+
 $id = $ARGS{'id'} = $IncidentObj->id;
 
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $IncidentObj);
+
 # XXX: we should get rid of DefaultStatus argument at all. use Status
 $Status ||= $DefaultStatus; $DefaultStatus ||= $Status;
 
@@ -208,13 +210,9 @@
         push @results, loc("State of the Incident left unchanged; not all children were updated");
     }
 
-	my $Duration;
-	if(my $lock = $IncidentObj->Locked()) {
-		$Duration = time() - $lock->Content->{'Timestamp'};
-		$IncidentObj->Unlock();
-	}
+    $m->callback(CallbackName => 'BeforeDisplay', ARGSref => \%ARGS, Ticket => $IncidentObj);
 
-    return $m->comp("Display.html", results => \@results, id => $id, Duration => $Duration);
+    return $m->comp("Display.html", %ARGS, results => \@results, id => $id);
 }
 
 # 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	Wed Aug 15 18:49:58 2007
@@ -47,7 +47,7 @@
 
 <%INIT>
 my $TicketObj = LoadTicket($Ticket);
-$TicketObj->Lock();
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $TicketObj);
 </%INIT>
 
 <%ARGS>

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Merge.html	Wed Aug 15 18:49:58 2007
@@ -35,7 +35,7 @@
     current_subtab => 'RTIR/Search/Refine.html',
 &>
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &> 
+% $m->callback(CallbackName => 'ShowLock', Ticket => $Ticket);
 
 <& /Elements/ListActions, actions => \@results &>
 
@@ -67,19 +67,16 @@
 
 <%INIT>
 my $Ticket = LoadTicket($id);
-$Ticket->Lock();
+
 $id = $ARGS{'id'} = $Ticket->id;
 
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $Ticket);
+
 my (@results);
 if ( $SelectedTicket ) {
-	my $MergeTicket = LoadTicket( $SelectedTicket );
+    my $MergeTicket = LoadTicket( $SelectedTicket );
 
-	if(my $lock = $Ticket->Locked()) {
-		my $lockType = $lock->Content->{'Type'};
-		$MergeTicket->Lock($lockType);
-		$Ticket->Unlock('Hard');	#We don't need any locks on the merged-from ticket, since it's now the merge-to ticket
-		$MergeTicket->Unlock();		#Remove if it's an auto lock
-	}
+    $m->callback(CallbackName => 'MergeTicketSelected', MergeFrom => $Ticket, MergeTo => $MergeTicket);
 
     my @queues = sort map {$_->Name} $Ticket->QueueObj, $MergeTicket->QueueObj;
     if ( $queues[0] eq $queues[1] or ($queues[0] eq "Incident Reports" and $queues[1] eq "Investigations")) {

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	Wed Aug 15 18:49:58 2007
@@ -45,7 +45,8 @@
 
 <%INIT>
 my $TicketObj = LoadTicket( $Ticket );
-$TicketObj->Lock();
+
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $TicketObj);
 
 my $Type = RT::IR::TicketType( Ticket => $TicketObj );
 if ( $m->comp_exists("/RTIR/$Type/Split.html") ) {

Modified: rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html
==============================================================================
--- rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html	(original)
+++ rtir/branches/2.3-EXPERIMENTAL/html/RTIR/Update.html	Wed Aug 15 18:49:58 2007
@@ -29,9 +29,9 @@
     Title => $title &>
 
 
-<& /Elements/ShowLock, Ticket => $Ticket, Unlock => 0 &>
+% $m->callback(CallbackName => 'ShowLock', Ticket => $Ticket);
 <form action="Update.html" name="TicketUpdate" 
-	method="post" enctype="multipart/form-data">
+    method="post" enctype="multipart/form-data">
 <input type="hidden" name="QuoteTransaction" value="<% $ARGS{'QuoteTransaction'} || '' %>" />
 % if ( $ARGS{'Status'} ) {
 <input type="hidden" name="DefaultStatus" value="<% $DefaultStatus %>" />
@@ -107,9 +107,12 @@
 
 my $title;
 my $Ticket = LoadTicket($id);
-$Ticket->Lock() unless $Ticket->Locked();
+
 $id = $ARGS{'id'} = $Ticket->Id;
 
+
+$m->callback(CallbackName => 'Initial', %ARGS, Ticket => $Ticket);
+
 my $Type = RT::IR::TicketType( Ticket => $Ticket );
 
 my $name;
@@ -168,10 +171,9 @@
 $m->comp( '/RTIR/Create.html:ProcessAttachments', %ARGS );
 
 if ( exists $ARGS{SubmitTicket} ) {
-	my $lock = $Ticket->Locked();
-	my $Duration = time() - $lock->Content->{'Timestamp'} if $lock;
-	$Ticket->Unlock();
-    return $m->comp('/RTIR/Display.html', Duration => $Duration, %ARGS);
+    $m->callback(CallbackName => 'BeforeDisplay', ARGSref => \%ARGS, Ticket => $Ticket);
+
+    return $m->comp('/RTIR/Display.html', %ARGS);
 }
 
 </%INIT>


More information about the Rt-commit mailing list