[Rt-commit] [rtir] 01/02: Clone $ShowHistory config support into the two RTIR Displays

Kevin Falcone falcone at bestpractical.com
Wed Aug 13 16:40:30 EDT 2014


This is an automated email from the git hooks/post-receive script.

falcone pushed a commit to branch 3.2/defer-history-loading
in repository rtir.

commit e8550478f1abb5fd3898e7f6c2813f3ea732a442
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Wed Aug 13 16:22:26 2014 -0400

    Clone $ShowHistory config support into the two RTIR Displays
    
    This allows RTIR to use the RT default of "load the page, then make a
    request to load the history" which makes page loads seem much faster.
    
    RTIR needs to set a number of custom paths on history entries, so use
    the callback from 4.2/tickethistory-callback to do so.
    
    Resolves issues #29730
---
 .../TicketHistory/ExtraShowHistoryArguments        | 19 +++++++++++
 html/RTIR/Display.html                             | 37 +++++++++++++++-------
 html/RTIR/Incident/Display.html                    | 35 ++++++++++++++------
 3 files changed, 70 insertions(+), 21 deletions(-)

diff --git a/html/Callbacks/RTIR/Helpers/TicketHistory/ExtraShowHistoryArguments b/html/Callbacks/RTIR/Helpers/TicketHistory/ExtraShowHistoryArguments
new file mode 100644
index 0000000..22c5c45
--- /dev/null
+++ b/html/Callbacks/RTIR/Helpers/TicketHistory/ExtraShowHistoryArguments
@@ -0,0 +1,19 @@
+<%INIT>
+my $type = RT::IR::TicketType( Ticket => $Ticket );
+return unless $type;
+
+my $id = $Ticket->Id;
+%$ExtraArgs = (
+        DisplayPath    => RT->Config->Get('WebPath') ."/RTIR/Display.html?id=$id",
+        UpdatePath     => RT->Config->Get('WebPath') ."/RTIR/Update.html",
+        ForwardPath    => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
+        EncryptionPath => RT->Config->Get('WebPath') ."/RTIR/Crypt.html",
+        (($type eq "Incident") ? () : (WarnUnsigned   => 1)),
+        PathPrefix     => RT->Config->Get('WebPath') ."/Ticket/",
+);
+
+</%INIT>
+<%ARGS>
+$Ticket
+$ExtraArgs
+</%ARGS>
diff --git a/html/RTIR/Display.html b/html/RTIR/Display.html
index 9db7ec4..79da525 100644
--- a/html/RTIR/Display.html
+++ b/html/RTIR/Display.html
@@ -124,17 +124,31 @@
 
 </&></div>
 
-<& /Elements/ShowHistory,
-    Object         => $Ticket,
-    Collapsed      => $ARGS{'Collapsed'}, 
-    ShowHeaders    => $ARGS{'ShowHeaders'},
-    DisplayPath    => RT->Config->Get('WebPath') ."/RTIR/Display.html?id=$id",
-    UpdatePath     => RT->Config->Get('WebPath') ."/RTIR/Update.html",
-    ForwardPath    => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
-    EncryptionPath => RT->Config->Get('WebPath') ."/RTIR/Crypt.html",
-    WarnUnsigned   => 1,
-    PathPrefix     => RT->Config->Get('WebPath') ."/Ticket/",
-&>
+% my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
+% if ($ShowHistory eq "delay") {
+    <& /Ticket/Elements/DelayShowHistory,
+        Ticket => $Ticket,
+        ShowHeaders => $ARGS{'ShowHeaders'},
+    &>
+% } elsif (not $ForceShowHistory and $ShowHistory eq "click") {
+    <& /Ticket/Elements/ClickToShowHistory,
+        Ticket => $Ticket,
+        ShowHeaders => $ARGS{'ShowHeaders'},
+    &>
+% } else {
+    <& /Elements/ShowHistory,
+        Object         => $Ticket,
+        Collapsed      => $ARGS{'Collapsed'},
+        ShowHeaders    => $ARGS{'ShowHeaders'},
+        DisplayPath    => RT->Config->Get('WebPath') ."/RTIR/Display.html?id=$id",
+        UpdatePath     => RT->Config->Get('WebPath') ."/RTIR/Update.html",
+        ForwardPath    => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
+        EncryptionPath => RT->Config->Get('WebPath') ."/RTIR/Crypt.html",
+        WarnUnsigned   => 1,
+        PathPrefix     => RT->Config->Get('WebPath') ."/Ticket/",
+    &>
+% }
+
 <%INIT>
 my ($name);
 my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
@@ -259,4 +273,5 @@ my $attachments = $Ticket->Attachments;
 $id => 0
 $Queue => undef
 @SelectedTickets => ()
+$ForceShowHistory => 0
 </%ARGS>
diff --git a/html/RTIR/Incident/Display.html b/html/RTIR/Incident/Display.html
index df9fbf3..bd7ff56 100644
--- a/html/RTIR/Incident/Display.html
+++ b/html/RTIR/Incident/Display.html
@@ -119,16 +119,30 @@
 
 </&></div>
 
-<& /Elements/ShowHistory,
-    Object         => $TicketObj,
-    Collapsed      => $ARGS{'Collapsed'},
-    ShowHeaders    => $ARGS{'ShowHeaders'},
-    DisplayPath    => RT->Config->Get('WebPath') ."/RTIR/Display.html?id=$id",
-    UpdatePath     => RT->Config->Get('WebPath') ."/RTIR/Update.html",
-    ForwardPath    => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
-    EncryptionPath => RT->Config->Get('WebPath') ."/RTIR/Crypt.html",
-    PathPrefix     => RT->Config->Get('WebPath') ."/Ticket/",
-&>
+% my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
+% if ($ShowHistory eq "delay") {
+    <& /Ticket/Elements/DelayShowHistory,
+        Ticket => $TicketObj,
+        ShowHeaders => $ARGS{'ShowHeaders'},
+    &>
+% } elsif (not $ForceShowHistory and $ShowHistory eq "click") {
+    <& /Ticket/Elements/ClickToShowHistory,
+        Ticket => $TicketObj,
+        ShowHeaders => $ARGS{'ShowHeaders'},
+    &>
+% } else {
+    <& /Elements/ShowHistory,
+        Object         => $TicketObj,
+        Collapsed      => $ARGS{'Collapsed'},
+        ShowHeaders    => $ARGS{'ShowHeaders'},
+        DisplayPath    => RT->Config->Get('WebPath') ."/RTIR/Display.html?id=$id",
+        UpdatePath     => RT->Config->Get('WebPath') ."/RTIR/Update.html",
+        ForwardPath    => RT->Config->Get('WebPath') ."/RTIR/Forward.html",
+        EncryptionPath => RT->Config->Get('WebPath') ."/RTIR/Crypt.html",
+        PathPrefix     => RT->Config->Get('WebPath') ."/Ticket/",
+    &>
+% }
+
 <%INIT>
 
 if ($SelectedTicket) {
@@ -304,4 +318,5 @@ $Queue => 'Incidents'
 $Child => undef
 $SelectedTicket => undef
 @SelectedTickets => ()
+$ForceShowHistory => 0
 </%ARGS>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the rt-commit mailing list