[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-238-g8580349

Thomas Sibley trs at bestpractical.com
Tue Aug 10 00:41:00 EDT 2010


The branch, 3.9-trunk has been updated
       via  8580349af276a031b67707e6818762676dac7018 (commit)
      from  4d0b7de5ff74267b875c4c86b8cd1cc661c28151 (commit)

Summary of changes:
 share/html/Ticket/Display.html                     |   20 +++++++-------------
 share/html/Ticket/Elements/MaybeRedirectForResults |   19 +++++++++++++++++++
 2 files changed, 26 insertions(+), 13 deletions(-)
 create mode 100644 share/html/Ticket/Elements/MaybeRedirectForResults

- Log -----------------------------------------------------------------
commit 8580349af276a031b67707e6818762676dac7018
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Aug 10 00:42:27 2010 -0400

    Refactor results redirect in Display.html

diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 4a02e07..5fe019d 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -186,19 +186,13 @@ $m->callback(
 );
 
 # This code does automatic redirection if any updates happen. 
-
-if (@Actions) {
-
-    # We've done something, so we need to clear the decks to avoid
-    # resubmission on refresh.
-    # But we need to store Actions somewhere too, so we don't lose them.
-    my $key = Digest::MD5::md5_hex( rand(1024) );
-    push @{ $session{"Actions"}->{$key} ||= [] }, @Actions;
-    $session{'i'}++;
-    my $url = RT->Config->Get('WebURL') . "Ticket/Display.html?id=" . $TicketObj->id . "&results=" . $key;
-    $url .= '#' . $ARGS{Anchor} if $ARGS{Anchor};
-    RT::Interface::Web::Redirect($url);
-}
+$m->comp(
+    'Elements/MaybeRedirectForResults',
+    Actions     => \@Actions,
+    Path        => 'Ticket/Display.html',
+    TicketObj   => $TicketObj,
+    ARGSRef     => \%ARGS
+);
 
 my $attachments = $m->comp('Elements/FindAttachments', Ticket => $TicketObj, Tickets => $Tickets);
 my $attachment_content = $m->comp('Elements/LoadTextAttachments', Ticket => $TicketObj);
diff --git a/share/html/Ticket/Elements/MaybeRedirectForResults b/share/html/Ticket/Elements/MaybeRedirectForResults
new file mode 100644
index 0000000..ecebd1b
--- /dev/null
+++ b/share/html/Ticket/Elements/MaybeRedirectForResults
@@ -0,0 +1,19 @@
+<%args>
+$Actions => []
+$ARGSRef => {}
+$Path    => 'Ticket/Display.html'
+$TicketObj
+</%args>
+<%init>
+if ( @$Actions ) {
+    # We've done something, so we need to clear the decks to avoid
+    # resubmission on refresh.
+    # But we need to store Actions somewhere too, so we don't lose them.
+    my $key = Digest::MD5::md5_hex( rand(1024) );
+    push @{ $session{"Actions"}->{$key} ||= [] }, @$Actions;
+    $session{'i'}++;
+    my $url = RT->Config->Get('WebURL') . "$Path?id=" . $TicketObj->id . "&results=" . $key;
+    $url .= '#' . $ARGSRef->{Anchor} if $ARGSRef->{Anchor};
+    RT::Interface::Web::Redirect($url);
+}
+</%init>

-----------------------------------------------------------------------


More information about the Rt-commit mailing list