[Rt-commit] rt branch, 4.2/delay-transaction-loading, created. rt-4.0.4-234-g5275b8d

Thomas Sibley trs at bestpractical.com
Tue Nov 29 17:09:53 EST 2011


The branch, 4.2/delay-transaction-loading has been created
        at  5275b8dc87558bf95c0ef499c78e54e58225205e (commit)

- Log -----------------------------------------------------------------
commit ffea49d4f5d17a1c7dc03521479bb4ba5ea83fa6
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Wed Aug 24 16:55:02 2011 -0400

    Option to load transactions after the rest of the page has loaded
    
    Similar to DeferTranasctionLoading, but without the need for an extra
    click.

diff --git a/etc/RT_Config.pm.in b/etc/RT_Config.pm.in
index fb8fbc1..4e68025 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1481,6 +1481,20 @@ option can be overridden by users in their preferences.
 
 Set($OldestTransactionsFirst, 1);
 
+=item C<$DelayTransactionLoading>
+
+When set, delays loading ticket history until after the rest of the
+ticket display loads.  This should end up serving pages to users
+quicker, since generating all the HTML for transaction history can be
+slow for long tickets.
+
+Unlike C<$DeferTransactionLoading> below, it doesn't require any extra
+click to view the ticket history.
+
+=cut
+
+# Set($DelayTransactionLoading, 1);
+
 =item C<$DeferTransactionLoading>
 
 When set, defers loading ticket history until the user clicks a link.
diff --git a/lib/RT/Config.pm b/lib/RT/Config.pm
index 9e4de5e..973d6ec 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -366,6 +366,15 @@ our %META = (
             Description => 'Hide ticket history by default',    #loc
         },
     },
+    DelayTransactionLoading => {
+        Section         => 'Ticket display',
+        Overridable     => 1,
+        SortOrder       => 3.1,
+        Widget          => '/Widgets/Form/Boolean',
+        WidgetArguments => {
+            Description => 'Delay load ticket history by default',    #loc
+        },
+    },
     ShowUnreadMessageNotifications => { 
         Section         => 'Ticket display',
         Overridable     => 1,
diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 086ccb4..03077d6 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -65,7 +65,13 @@
 
 % $m->callback( Ticket => $TicketObj, %ARGS, CallbackName => 'BeforeShowHistory' );
 
-% if (not $ForceShowHistory and RT->Config->Get( 'DeferTransactionLoading', $session{'CurrentUser'} )) {
+% if (not $ForceShowHistory
+%     and RT->Config->Get( 'DelayTransactionLoading', $session{'CurrentUser'} )) {
+    <& /Ticket/Elements/DelayShowHistory,
+        Ticket => $TicketObj,
+    &>
+% } elsif (not $ForceShowHistory
+%          and RT->Config->Get( 'DeferTransactionLoading', $session{'CurrentUser'} )) {
     <& /Ticket/Elements/ClickToShowHistory,
         Ticket => $TicketObj,
     &>
diff --git a/share/html/Ticket/Elements/DelayShowHistory b/share/html/Ticket/Elements/DelayShowHistory
new file mode 100644
index 0000000..00f70a1
--- /dev/null
+++ b/share/html/Ticket/Elements/DelayShowHistory
@@ -0,0 +1,66 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC
+%#                                          <sales at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<div id="delayed_ticket_history">
+    <& /Widgets/TitleBoxStart, title => 'History' &>
+        <&|/l&>Loading...</&>
+    <& /Widgets/TitleBoxEnd &>
+</div>
+<script type="text/javascript">
+jQuery(function(){
+    jQuery('#delayed_ticket_history').load('<% $url |n %>', null, function() {
+        jQuery(this).find('.titlebox-content').hide().slideDown();
+    });
+});
+</script>
+<%ARGS>
+$Ticket
+</%ARGS>
+<%INIT>
+my $id = $Ticket->id;
+my $url = RT->Config->Get('WebPath') ."/Helpers/TicketHistory?id=". $id;
+</%INIT>

commit f09ef3b11216411cad3c5e18d7dc0e9742d7ff0b
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Nov 29 11:42:56 2011 -0500

    Preserve page anchors when using delay loaded transactions
    
    This jumps to the desired anchor in the page after the ticket history is
    fully loaded and displayed.

diff --git a/share/html/Ticket/Elements/DelayShowHistory b/share/html/Ticket/Elements/DelayShowHistory
index 00f70a1..a4200f8 100644
--- a/share/html/Ticket/Elements/DelayShowHistory
+++ b/share/html/Ticket/Elements/DelayShowHistory
@@ -53,7 +53,14 @@
 <script type="text/javascript">
 jQuery(function(){
     jQuery('#delayed_ticket_history').load('<% $url |n %>', null, function() {
-        jQuery(this).find('.titlebox-content').hide().slideDown();
+        jQuery(this).find('.titlebox-content').hide().slideDown(400, function(){
+            // Jump to any anchor specified after we load the txns into the page
+            var hash = window.location.hash;
+            if (hash) {
+                window.location.hash = "";  // trick the browser into a "change"
+                window.location.hash = hash;
+            }
+        });
     });
 });
 </script>

commit 5275b8dc87558bf95c0ef499c78e54e58225205e
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Tue Nov 29 12:05:56 2011 -0500

    Respect the full/brief header view when deferring and delaying history

diff --git a/share/html/Ticket/Display.html b/share/html/Ticket/Display.html
index 03077d6..b81bb6f 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -69,11 +69,13 @@
 %     and RT->Config->Get( 'DelayTransactionLoading', $session{'CurrentUser'} )) {
     <& /Ticket/Elements/DelayShowHistory,
         Ticket => $TicketObj,
+        ShowHeaders => $ARGS{'ShowHeaders'},
     &>
 % } elsif (not $ForceShowHistory
 %          and RT->Config->Get( 'DeferTransactionLoading', $session{'CurrentUser'} )) {
     <& /Ticket/Elements/ClickToShowHistory,
         Ticket => $TicketObj,
+        ShowHeaders => $ARGS{'ShowHeaders'},
     &>
 % } else {
     <& /Ticket/Elements/ShowHistory ,
diff --git a/share/html/Ticket/Elements/ClickToShowHistory b/share/html/Ticket/Elements/ClickToShowHistory
index 0dcfd10..4554839 100644
--- a/share/html/Ticket/Elements/ClickToShowHistory
+++ b/share/html/Ticket/Elements/ClickToShowHistory
@@ -47,14 +47,23 @@
 %# END BPS TAGGED BLOCK }}}
 <div id="deferred_ticket_history">
     <& /Widgets/TitleBoxStart, title => 'History' &>
-        <a href="<% $display %>" onclick="jQuery('#deferred_ticket_history').text('<% loc('Loading...') %>').load('<% $url |n %>'); return false;" ><% loc('Show ticket history') %></a>
+        <a href="<% $display %>" onclick="jQuery('#deferred_ticket_history').text('<% loc('Loading...') %>').load(<% $url %>); return false;" ><% loc('Show ticket history') %></a>
     <& /Widgets/TitleBoxEnd &>
 </div>
 <%ARGS>
 $Ticket
 </%ARGS>
+<%ONCE>
+require JSON;
+</%ONCE>
 <%INIT>
-my $id = $Ticket->id;
-my $url = RT->Config->Get('WebPath') ."/Helpers/TicketHistory?id=". $id;
-my $display = RT->Config->Get('WebPath') ."/Ticket/Display.html?id=$id;ForceShowHistory=1";
+my %params = %ARGS;
+delete $params{Ticket};
+
+my $query   = $m->comp('/Elements/QueryString', %params, id => $Ticket->id );
+my $url     = JSON::to_json(
+    RT->Config->Get('WebPath')."/Helpers/TicketHistory?$query",
+    { allow_nonref => 1 }
+);
+my $display = RT->Config->Get('WebPath')."/Ticket/Display.html?ForceShowHistory=1;$query";
 </%INIT>
diff --git a/share/html/Ticket/Elements/DelayShowHistory b/share/html/Ticket/Elements/DelayShowHistory
index a4200f8..89f390b 100644
--- a/share/html/Ticket/Elements/DelayShowHistory
+++ b/share/html/Ticket/Elements/DelayShowHistory
@@ -52,7 +52,7 @@
 </div>
 <script type="text/javascript">
 jQuery(function(){
-    jQuery('#delayed_ticket_history').load('<% $url |n %>', null, function() {
+    jQuery('#delayed_ticket_history').load(<% $url |n %>, null, function() {
         jQuery(this).find('.titlebox-content').hide().slideDown(400, function(){
             // Jump to any anchor specified after we load the txns into the page
             var hash = window.location.hash;
@@ -67,7 +67,16 @@ jQuery(function(){
 <%ARGS>
 $Ticket
 </%ARGS>
+<%ONCE>
+require JSON;
+</%ONCE>
 <%INIT>
-my $id = $Ticket->id;
-my $url = RT->Config->Get('WebPath') ."/Helpers/TicketHistory?id=". $id;
+my %params = %ARGS;
+delete $params{Ticket};
+
+my $url = JSON::to_json(
+    RT->Config->Get('WebPath') . "/Helpers/TicketHistory?".
+        $m->comp('/Elements/QueryString', %params, id => $Ticket->id ),
+    { allow_nonref => 1 }
+);
 </%INIT>

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


More information about the Rt-commit mailing list