[Rt-commit] r3955 - in rtir/branches/1.9-EXPERIMENTAL: . etc html/RTIR html/RTIR/Incident

ruz at bestpractical.com ruz at bestpractical.com
Wed Oct 12 20:32:46 EDT 2005


Author: ruz
Date: Wed Oct 12 20:32:45 2005
New Revision: 3955

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
Log:
 r180 at cubic-pc:  cubic | 2005-10-13 04:33:24 +0400
  r178 at cubic-pc:  cubic | 2005-10-13 01:36:53 +0400
  D.9.1.11. When Editing a ticket, RTIR SHOULD redisplay
            the ticket after 'Submit changes' rather than
            bringing back the Edit screen.
  r179 at cubic-pc:  cubic | 2005-10-13 04:32:00 +0400
  Changes:
  * new config option $DisplayAfterEdit
  * internal redirects($m->comp+abort) to display after
    ticket editing if the option is true
  
 


Modified: rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm	Wed Oct 12 20:32:45 2005
@@ -232,4 +232,9 @@
 },
     );
 
+
+# Enable this option if you want jump to display screen after saving changes
+# on the edit screen.
+Set($DisplayAfterEdit, 1);
+
 1;

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	Wed Oct 12 20:32:45 2005
@@ -30,7 +30,7 @@
     current_subtab => 'RTIR/Display.html?id='.$Ticket->id,
     Title => $Title &>
 
-<& /Elements/ListActions, actions => \@Actions &>
+<& /Elements/ListActions, actions => \@results &>
 
 % if ($id != 'new' && $Ticket->QueueObj->Name ne $QueueObj->Name) {
 <%loc("This ticket isn't a [_1].", $Type)%>
@@ -172,7 +172,7 @@
 &> 
 
 <%INIT>
-my (@Actions, $Type, $name);
+my ($Type, $name);
 my $Ticket = new RT::Ticket($session{'CurrentUser'});
 my $QueueObj = new RT::Queue($session{'CurrentUser'});
 if ($id ne 'new') {
@@ -197,7 +197,7 @@
     unless ($QueueObj->CurrentUserHasRight('CreateTicket')) {
 	Abort('You have no permission to create tickets in that queue.');
     }
-    ($Ticket, @Actions) =
+    ($Ticket, @results) =
        CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
     delete $session{'Attachments'};
     unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
@@ -231,7 +231,7 @@
     if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
       my $action = $1;
       my ($res, $msg)=$Ticket->$action();
-      push(@Actions, $msg);
+      push(@results, $msg);
     }
   }
 
@@ -242,10 +242,10 @@
   my @LinkActions = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
   my @DateActions = ProcessTicketDates( TicketObj => $Ticket, ARGSRef => \%ARGS);
 
-  push (@Actions, @UpdateActions, @BasicActions, @LinkActions, @DateActions);
+  push (@results, @UpdateActions, @BasicActions, @LinkActions, @DateActions);
   $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
   if ($newstate ne $oldstate) {
-    push (@Actions, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
+    push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
   }
 }
 
@@ -275,4 +275,5 @@
 <%ARGS>
 $id => undef
 $Queue=>undef
+ at results => undef
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html	Wed Oct 12 20:32:45 2005
@@ -179,7 +179,7 @@
 
 <BR>
 
-<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
+<& /Elements/Submit, Name => 'SaveChanges', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
 </form>
 
 <%INIT>
@@ -244,6 +244,11 @@
 push @results, @lresults;
 push @results, @okresults;
 
+if( $ARGS{'SaveChanges'} && $RT::DisplayAfterEdit ) {
+    $m->comp("/RTIR/Display.html", results => [@results], %ARGS);
+    $m->abort;
+}
+
 # If they've gone and moved the ticket to somewhere they can't see, etc...
 # TODO: display the results, even if we can't display the ticket.
 

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	Wed Oct 12 20:32:45 2005
@@ -29,7 +29,7 @@
     current_subtab => 'RTIR/Display.html?id='.$Ticket->id,
     Title => loc("Incident #[_1]: [_2]", $Ticket->Id, $Ticket->Subject) &>
 
-<& /Elements/ListActions, actions => \@Actions &>
+<& /Elements/ListActions, actions => \@results &>
 
 % if ($id != 'new' && $Ticket->QueueObj->Name ne "Incidents") {
 <&|/l&>This ticket isn't an Incident.</&>
@@ -203,7 +203,7 @@
 
   
 <%INIT>
-my ($Ticket, $ChildObj, @Actions);  
+my ($Ticket, $ChildObj);  
 $Ticket = new RT::Ticket($session{'CurrentUser'});
 if ($ARGS{'child'}) {
   $ChildObj = LoadTicket($ARGS{'child'});
@@ -255,7 +255,7 @@
 
   @linkresults = map { loc("Ticket [_1]: [_2]",$Ticket->Id,$_) } @linkresults;
 
-  push (@Actions, @linkresults);
+  push (@results, @linkresults);
 
 };
 
@@ -270,7 +270,7 @@
   unless ($Queue->CurrentUserHasRight('CreateTicket')) {
     Abort('You have no permission to create tickets in that queue.');
   }
-  ($Ticket, @Actions) =
+  ($Ticket, @results) =
      CreateTicket(Attachments => $session{'Attachments'}, %ARGS);
   delete $session{'Attachments'};
   unless ($Ticket->CurrentUserHasRight('ShowTicket')) {
@@ -299,7 +299,7 @@
     if ($ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/) {
       my $action = $1;
       my ($res, $msg)=$Ticket->$action();
-      push(@Actions, $msg);
+      push(@results, $msg);
     }
   } elsif ($ARGS{'BulkLink'}) {
     #Iterate through each ticket we've been handed
@@ -322,7 +322,7 @@
       ) {
     $ARGS{UpdateAttachments} = $session{'Attachments'};
     ProcessUpdateMessage(ARGSRef=>\%ARGS, 
-	  	         Actions=>\@Actions, 
+	  	         Actions=>\@results, 
 		         TicketObj=>$Ticket);
     delete $session{'Attachments'};
   }
@@ -330,11 +330,11 @@
   #Process basics updates
   my @BasicActions = ProcessTicketBasics(ARGSRef => \%ARGS, TicketObj=>$Ticket);
 
-  push (@Actions, @BasicActions);
+  push (@results, @BasicActions);
 
   $newstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
   if ($newstate ne $oldstate) {
-    push (@Actions, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
+    push (@results, loc("State changed from [_1] to [_2]", $oldstate, $newstate));
   }
 }
 
@@ -357,7 +357,7 @@
     $children->LimitQueue(VALUE => 'Blocks');
     $children->LimitMemberOf($t);
     if ($children->Count == 0) {
-      push (@Actions, 
+      push (@results, 
             loc("WARNING: Incident [_1] has no children.", $t));
     }
   }
@@ -371,7 +371,7 @@
 $children->LimitQueue(VALUE => 'Blocks');
 $children->LimitMemberOf($Ticket->Id);
 if ($children->Count == 0) {
-  push (@Actions, 
+  push (@results, 
         loc("WARNING: Incident [_1] has no children.", $Ticket->Id));
 }
 
@@ -383,4 +383,5 @@
 $id => undef
 $SelectedTicket => undef
 $child => undef
+ at results => ()
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Edit.html	Wed Oct 12 20:32:45 2005
@@ -130,7 +130,7 @@
 </table>
 <BR>
 
-<& /Elements/Submit, Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
+<& /Elements/Submit, Name => 'SaveChanges', Label => loc('Save Changes'), Caption => loc("If you've updated anything above, be sure to"), color => "#333399" &>
 </form>
 
 <%INIT>
@@ -182,6 +182,11 @@
 push @results, @lresults;
 push @results, @okresults;
 
+if( $ARGS{'SaveChanges'} && $RT::DisplayAfterEdit ) {
+    $m->comp("/RTIR/Incident/Display.html", results => [@results], %ARGS);
+    $m->abort;
+}
+
 # If they've gone and moved the ticket to somewhere they can't see, etc...
 # TODO: display the results, even if we can't display the ticket.
 


More information about the Rt-commit mailing list