[Rt-commit] rt branch, 4.0/delay-transaction-loading, updated. rt-4.0.2-25-g38daa78

Thomas Sibley trs at bestpractical.com
Wed Aug 24 16:56:00 EDT 2011


The branch, 4.0/delay-transaction-loading has been updated
       via  38daa78ad7a92bdaf7f425503475952dd21a39b3 (commit)
      from  c6335e5c4b3148c0e945fe7a6ce20c78525a01be (commit)

Summary of changes:
 etc/RT_Config.pm.in                                |   14 ++++++++++++++
 lib/RT/Config.pm                                   |    9 +++++++++
 share/html/Ticket/Display.html                     |    6 +++++-
 .../{ClickToShowHistory => DelayShowHistory}       |   11 +++++++++--
 4 files changed, 37 insertions(+), 3 deletions(-)
 copy share/html/Ticket/Elements/{ClickToShowHistory => DelayShowHistory} (88%)

- Log -----------------------------------------------------------------
commit 38daa78ad7a92bdaf7f425503475952dd21a39b3
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 f98a4cc..ce25969 100755
--- a/etc/RT_Config.pm.in
+++ b/etc/RT_Config.pm.in
@@ -1484,6 +1484,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 50cb0c8..249933a 100644
--- a/lib/RT/Config.pm
+++ b/lib/RT/Config.pm
@@ -345,6 +345,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 318e494..8962905 100755
--- a/share/html/Ticket/Display.html
+++ b/share/html/Ticket/Display.html
@@ -65,7 +65,11 @@
 
 % $m->callback( Ticket => $TicketObj, %ARGS, CallbackName => 'BeforeShowHistory' );
 
-% if (RT->Config->Get( 'DeferTransactionLoading', $session{'CurrentUser'} )) {
+% if (RT->Config->Get( 'DelayTransactionLoading', $session{'CurrentUser'} )) {
+    <& /Ticket/Elements/DelayShowHistory,
+        Ticket => $TicketObj,
+    &>
+% } elsif (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>

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


More information about the Rt-commit mailing list