[Bps-public-commit] RT-Extension-PreviewInSearch branch update-for-rt5 created. 0.04-5-g41f48a7

BPS Git Server git at git.bestpractical.com
Thu Mar 9 17:50:05 UTC 2023


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "RT-Extension-PreviewInSearch".

The branch, update-for-rt5 has been created
        at  41f48a7b60a42a4b2d4f7ddd1268be2a5b77fd7f (commit)

- Log -----------------------------------------------------------------
commit 41f48a7b60a42a4b2d4f7ddd1268be2a5b77fd7f
Author: Brad Embree <brad at bestpractical.com>
Date:   Thu Mar 9 09:46:50 2023 -0800

    Add RT 5 code

diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
index 7ae3d40..22171fa 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
@@ -1,4 +1,53 @@
-% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0 ) {
+% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') >= 0 ) {
+% # RT 5 version
+<style>
+tr.in-preview td { background: #ffb }
+div.ticket-list-with-previewinsearch table.ticket-list { table-layout:fixed; }
+</style>
+<script type="text/javascript">
+var ticket_list = jQuery('table.ticket-list');
+
+% if ( RT->Config->Get('SideBySidePreview') ) {
+ticket_list.wrap( "<div class='row m-0'><div class='ticket-list-with-previewinsearch col-6'></div></div>" );
+jQuery('div.ticket-list-with-previewinsearch').after( "<div id='ticket-preview-container' class='col-6'><p>foobar</p></div>" );
+% } else {
+ticket_list.after( "<div class='row m-0'><div id='ticket-preview-container' class='col-12'><p>foobar</p></div></div>" );
+% }
+
+var get_ticket_row = function (from) {
+    var row = jQuery(from).closest('tr');
+    var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
+    row = row.add(
+        row.prevUntil( '.' + even_or_odd, '[class*="line"]' )
+    ).add(
+        row.nextUntil( '.' + even_or_odd, '[class*="line"]' )
+    );
+    return row;
+};
+
+var do_preview = function (row) {
+    var tid = row.find('> td a[href*="Display.html?id="]').first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
+    var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
+    row.closest('table').children('tbody').children('tr').removeClass('in-preview');
+    row.addClass('in-preview');
+    jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
+};
+
+jQuery(document).ready(function() {
+    do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
+});
+
+jQuery(function(){
+    jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
+        if (e.target.tagName != 'TD')
+            return;
+
+        var row = get_ticket_row(e.target);
+        do_preview(row);
+    });
+});
+</script>
+% } elsif ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0 ) {
 % # RT 4 version
 <style>
 tr.in-preview td { background: #ffb }

commit 91bdfc16b6fb4389f8de1f5eb919ffd3b70553a3
Author: Brad Embree <brad at bestpractical.com>
Date:   Thu Mar 9 09:43:23 2023 -0800

    Move RT 4 code to AfterResults callback
    
    The RT 5 code needs to be in the AfterResults callback in order to
    manipulate the html. Moving the RT 4 code into the same callback
    eliminates the need to use two different callbacks.

diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
index e69de29..7ae3d40 100644
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
+++ b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/AfterResults
@@ -0,0 +1,97 @@
+% if ( RT::Handle::cmp_version($RT::VERSION, '5.0.0') < 0 ) {
+% # RT 4 version
+<style>
+tr.in-preview td { background: #ffb }
+% if ( RT->Config->Get('SideBySidePreview') ) {
+table.ticket-list, .ticket-list-with-previewinsearch {
+    position: fixed;
+    width: 42%;
+    top: 10em;
+    bottom: 6em;
+    overflow-y: auto;
+    overflow-x: hidden;
+    z-index: 11;
+}
+.refresh-with-previewinsearch {
+    position: fixed;
+    bottom: 0;
+}
+.paging-with-previewinsearch {
+    position: fixed;
+    bottom: 2.5em;
+}
+#ticket-preview-container {
+    position: fixed;
+    top: 10em;
+% if ( $web_style =~ /web2|ballard/ ) {
+    left: 54%;
+% }
+% else {
+    left: 47%;
+% }
+    right: 0;
+    bottom: 0;
+    overflow-y: auto;
+    background: inherit;
+    z-index: 10;
+    display: none;
+}
+% }
+</style>
+<div id="ticket-preview-container" ></div>
+<script type="text/javascript">
+var get_ticket_row = function (from) {
+    var row = jQuery(from).closest('tr');
+    var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
+    row = row.add(row.prevUntil('.'+even_or_odd, '[class*="line"]'))
+        .add(row.nextUntil('.'+even_or_odd, '[class*="line"]'));
+    return row;
+};
+var do_preview = function(row) {
+    var tid = row.find('> td a[href*="Display.html?id="]')
+        .first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
+    var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
+    row.closest('table').children('tbody').children('tr').removeClass('in-preview');
+    row.addClass('in-preview');
+    jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
+% if ( RT->Config->Get('SideBySidePreview') ) {
+    var ticket_list = jQuery('table.ticket-list');
+    ticket_list.wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
+    ticket_list.removeClass('ticket-list');
+    jQuery('#ticket-preview-container').show();
+    jQuery('div.refresh').addClass('refresh-with-previewinsearch');
+    jQuery('div.ticket-list-with-previewinsearch').animate({
+        scrollTop: '+='+(jQuery("tr.in-preview").offset().top-jQuery('div.ticket-list-with-previewinsearch').offset().top)
+    }, 1);
+    jQuery('div.paging').addClass('paging-with-previewinsearch');
+% } else {
+    jQuery('html, body').animate({
+        scrollTop: '+='+(jQuery("#ticket-preview-container").offset().top-jQuery(window).scrollTop())
+    }, 1000);
+% }
+};
+
+% if ( RT->Config->Get('SideBySidePreview') ) {
+jQuery(document).ready(function() {
+    do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
+});
+% }
+
+jQuery(function(){
+    jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
+        if (e.target.tagName != 'TD')
+            return;
+
+        var row = get_ticket_row(e.target);
+        do_preview(row);
+    });
+});
+</script>
+% }
+<%ARGS>
+</%ARGS>
+<%INIT>
+my $web_style = $session{'CurrentUser'}
+    ? $session{'CurrentUser'}->Stylesheet
+    : RT->Config->Get('WebDefaultStylesheet');
+</%INIT>
diff --git a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults b/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
deleted file mode 100644
index eeb1162..0000000
--- a/html/Callbacks/RT-Extension-PreviewInSearch/Search/Results.html/BeforeResults
+++ /dev/null
@@ -1,94 +0,0 @@
-<style>
-tr.in-preview td { background: #ffb }
-% if ( RT->Config->Get('SideBySidePreview') ) {
-table.ticket-list, .ticket-list-with-previewinsearch {
-    position: fixed;
-    width: 42%;
-    top: 10em;
-    bottom: 6em;
-    overflow-y: auto;
-    overflow-x: hidden;
-    z-index: 11;
-}
-.refresh-with-previewinsearch {
-    position: fixed;
-    bottom: 0;
-}
-.paging-with-previewinsearch {
-    position: fixed;
-    bottom: 2.5em;
-}
-#ticket-preview-container {
-    position: fixed;
-    top: 10em;
-% if ( $web_style =~ /web2|ballard/ ) {
-    left: 54%;
-% }
-% else {
-    left: 47%;
-% }
-    right: 0;
-    bottom: 0;
-    overflow-y: auto;
-    background: inherit;
-    z-index: 10;
-    display: none;
-}
-% }
-</style>
-<div id="ticket-preview-container" ></div>
-<script type="text/javascript">
-var get_ticket_row = function (from) {
-    var row = jQuery(from).closest('tr');
-    var even_or_odd = row.hasClass('oddline')? 'evenline': 'oddline';
-    row = row.add(row.prevUntil('.'+even_or_odd, '[class*="line"]'))
-        .add(row.nextUntil('.'+even_or_odd, '[class*="line"]'));
-    return row;
-};
-var do_preview = function(row) {
-    var tid = row.find('> td a[href*="Display.html?id="]')
-        .first().attr('href').match(/Display\.html\?id=(\d+)/)[1];
-    var url = <% RT->Config->Get('WebPath') |n,j %> +'/Helpers/TicketPreview?id='+tid;
-    row.closest('table').children('tbody').children('tr').removeClass('in-preview');
-    row.addClass('in-preview');
-    jQuery('#ticket-preview-container').text(<% loc('Loading...') |n,j %>).load( url );
-% if ( RT->Config->Get('SideBySidePreview') ) {
-    var ticket_list = jQuery('table.ticket-list');
-    ticket_list.wrap( "<div class='ticket-list-with-previewinsearch'></div>" );
-    ticket_list.removeClass('ticket-list');
-    jQuery('#ticket-preview-container').show();
-    jQuery('div.refresh').addClass('refresh-with-previewinsearch');
-    jQuery('div.ticket-list-with-previewinsearch').animate({
-        scrollTop: '+='+(jQuery("tr.in-preview").offset().top-jQuery('div.ticket-list-with-previewinsearch').offset().top)
-    }, 1);
-    jQuery('div.paging').addClass('paging-with-previewinsearch');
-% } else {
-    jQuery('html, body').animate({
-        scrollTop: '+='+(jQuery("#ticket-preview-container").offset().top-jQuery(window).scrollTop())
-    }, 1000);
-% }
-};
-
-% if ( RT->Config->Get('SideBySidePreview') ) {
-jQuery(document).ready(function() {
-    do_preview( get_ticket_row( jQuery('table.ticket-list tbody tr td').first() ) );
-});
-% }
-
-jQuery(function(){
-    jQuery('table.collection-as-table > tbody > tr > td').on('click', function (e) {
-        if (e.target.tagName != 'TD')
-            return;
-
-        var row = get_ticket_row(e.target);
-        do_preview(row);
-    });
-});
-</script>
-<%ARGS>
-</%ARGS>
-<%INIT>
-my $web_style = $session{'CurrentUser'}
-    ? $session{'CurrentUser'}->Stylesheet
-    : RT->Config->Get('WebDefaultStylesheet');
-</%INIT>

commit 289684d0bc6e35f273140a2b7d392ee92b291d11
Author: Brad Embree <brad at bestpractical.com>
Date:   Thu Mar 9 09:34:26 2023 -0800

    Use ScrollShowHistory if configured

diff --git a/html/Helpers/TicketPreview b/html/Helpers/TicketPreview
index 67d6cba..645cba4 100644
--- a/html/Helpers/TicketPreview
+++ b/html/Helpers/TicketPreview
@@ -12,6 +12,12 @@ my $web_path = RT->Config->Get('WebPath');
 <h2><a href="<% $web_path %>/Ticket/Display.html?id=<% $ticket->id %>">#<% $ticket->id %>: <% $ticket->Subject %></a></h2>
 </div>
 % $m->callback(CallbackName => 'BeforeHistory', ARGSRef => \%ARGS, Ticket => $ticket);
+% my $ShowHistory = RT->Config->Get("ShowHistory", $session{'CurrentUser'});
+% if ($ShowHistory eq "scroll") {
+    <& /Ticket/Elements/ScrollShowHistory,
+        Ticket => $ticket,
+    &>
+% } else {
 <& /Elements/ShowHistory,
     Object => $ticket,
     ShowDisplayModes => 0,
@@ -24,6 +30,7 @@ my $web_path = RT->Config->Get('WebPath');
     EmailRecordPath => "$web_path/Ticket/ShowEmailRecord.html",
     EncryptionPath  => "$web_path/Ticket/Crypt.html",
 &>
+% }
 <script type="text/javascript">ReplaceUserReferences()</script>
 % $m->callback(CallbackName => 'AfterHistory', ARGSRef => \%ARGS, Ticket => $ticket);
 % $m->abort();
\ No newline at end of file

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


hooks/post-receive
-- 
RT-Extension-PreviewInSearch


More information about the Bps-public-commit mailing list