[Rt-commit] rt branch, 5.0/linked-queue-pagination, created. rt-5.0.0-187-g8e7f639da9

? sunnavy sunnavy at bestpractical.com
Mon Jan 4 17:04:15 EST 2021


The branch, 5.0/linked-queue-pagination has been created
        at  8e7f639da99c6fa609f2f143b1994b7b73538006 (commit)

- Log -----------------------------------------------------------------
commit 8e7f639da99c6fa609f2f143b1994b7b73538006
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Tue Jan 5 05:15:06 2021 +0800

    Make pagination in linked queue portlet really work
    
    Note that we can't use the default "Page" parameter as each portlet has
    two search results by default and there could be multiple linked queue
    portlets. Here we suffix the parameter with queue name and also the
    order number in the same portlet to avoid name collision.

diff --git a/share/html/Elements/CollectionList b/share/html/Elements/CollectionList
index 604de25a10..a53f772219 100644
--- a/share/html/Elements/CollectionList
+++ b/share/html/Elements/CollectionList
@@ -204,6 +204,7 @@ if ( $Rows && $ShowNavigation && $TotalFound > $Rows ) {
         TotalFound  => $TotalFound,
         CurrentPage => $Page,
         Pages       => $pages,
+        PageParam   => $PageParam,
         URLParams   => \%query_args
     );
 
@@ -221,6 +222,7 @@ $DisplayFormat => undef
 $GenericQueryArgs => undef
 $Rows          => undef
 $Page          => 1
+$PageParam     => 'Page'
 $Title         => loc('Ticket Search')
 $BaseURL       => RT->Config->Get('WebPath') . $m->request_comp->path .'?'
 @PassArguments => qw( Query Format Rows Page Order OrderBy Class ObjectType )
diff --git a/share/html/Elements/CollectionListPaging b/share/html/Elements/CollectionListPaging
index cc9d0c6c43..96b6c44528 100644
--- a/share/html/Elements/CollectionListPaging
+++ b/share/html/Elements/CollectionListPaging
@@ -52,6 +52,7 @@ $TotalFound => undef
 $CurrentPage => undef
 $Pages => undef
 $URLParams => undef
+$PageParam => 'Page'
 </%ARGS>
 
 <%INIT>
@@ -81,7 +82,7 @@ else{
               my $qs = $m->interp->apply_escapes(
                 $m->comp('/Elements/QueryString',
                   %$URLParams,
-                  Page => $number
+                  $PageParam => $number
                 ),
                 'h',
               );
@@ -92,7 +93,7 @@ else{
       my $qs = $m->interp->apply_escapes(
         $m->comp('/Elements/QueryString',
           %$URLParams,
-          Page => $chunk->first,
+          $PageParam => $chunk->first,
         ),
         'h',
       );
diff --git a/share/html/Ticket/Elements/ShowLinkedQueues b/share/html/Ticket/Elements/ShowLinkedQueues
index 72c32c42fb..f5aa8505de 100644
--- a/share/html/Ticket/Elements/ShowLinkedQueues
+++ b/share/html/Ticket/Elements/ShowLinkedQueues
@@ -119,7 +119,9 @@ my $format = ( exists RT->Config->Get('LinkedQueuePortletFormats')->{$queue_name
     ? RT->Config->Get('LinkedQueuePortletFormats')->{$queue_name}
     : RT->Config->Get('LinkedQueuePortletFormats')->{'Default'} );
 
+my $i = 0;
 for my $query ( @queries ) {
+    $i++;
     my $empty_message = shift @empty_messages;
     my $order_by = $OrderBy;
     my $rows = $Rows;
@@ -137,12 +139,16 @@ $m->callback( CallbackName => 'MassageSearchArgs',
     if ( $tickets->Count ) {
 </%PERL>
 <& /Elements/CollectionList, %ARGS,
+    %$DECODED_ARGS,
     Class            => 'RT::Tickets',
     Query            => $query,
     Format           => $format,
     OrderBy          => $order_by,
     Rows             => $rows,
     ShowHeader       => 0,
+    Page             => $DECODED_ARGS->{"Page-$queue_name-$i"} || 1,
+    PageParam        => "Page-$queue_name-$i",
+    PassArguments    => [ keys %$DECODED_ARGS ],
 &>
 
 % } else {

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


More information about the rt-commit mailing list