Bugzilla – Attachment 68721 Details for
Bug 18128
'Go to page' option for search results in opac and staff
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18128: [FOLLOW-UP] Some display fixes
Bug-18128-FOLLOW-UP-Some-display-fixes.patch (text/plain), 10.61 KB, created by
Jonathan Druart
on 2017-10-27 14:17:42 UTC
(
hide
)
Description:
Bug 18128: [FOLLOW-UP] Some display fixes
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-10-27 14:17:42 UTC
Size:
10.61 KB
patch
obsolete
>From e22cf3ee23e421242eac7a43f4ca1bd675baf32c Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Fri, 20 Oct 2017 01:48:32 +0000 >Subject: [PATCH] Bug 18128: [FOLLOW-UP] Some display fixes > >This patch addresses some of the display issues brought up in Comment 6. > >The dropdown list should now include every page number. >The bar will only show up to 5 page numbers on each side of the current >active page. > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > catalogue/search.pl | 64 +++++++++------------- > .../prog/en/includes/page-numbers.inc | 4 +- > .../bootstrap/en/includes/page-numbers.inc | 4 +- > opac/opac-search.pl | 61 ++++++++------------- > 4 files changed, 54 insertions(+), 79 deletions(-) > >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 05d064bcdc..543169d12f 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -626,45 +626,31 @@ for (my $i=0;$i<@servers;$i++) { > $previous_page_offset = $offset - $results_per_page; > } > my $next_page_offset = $offset + $results_per_page; >- # If we're within the first 10 pages, keep it simple >- #warn "current page:".$current_page_number; >- if ($current_page_number < 10) { >- # just show the first 10 pages >- # Loop through the pages >- my $pages_to_show = 10; >- $pages_to_show = $pages if $pages<10; >- for (my $i=1; $i<=$pages_to_show;$i++) { >- # the offset for this page >- my $this_offset = (($i*$results_per_page)-$results_per_page); >- # the page number for this page >- my $this_page_number = $i; >- # put it in the array >- push @page_numbers, >- { offset => $this_offset, >- pg => $this_page_number, >- # it should only be highlighted if it's the current page >- highlight => $this_page_number == $current_page_number, >- sort_by => join ' ', @sort_by >- }; >- >- } >- >- } >- >- # now, show twenty pages, with the current one smack in the middle >- else { >- for (my $i=$current_page_number; $i<=($current_page_number + 20 );$i++) { >- my $this_offset = ((($i-9)*$results_per_page)-$results_per_page); >- my $this_page_number = $i-9; >- if ( $this_page_number <= $pages ) { >- push @page_numbers, >- { offset => $this_offset, >- pg => $this_page_number, >- highlight => $this_page_number == $current_page_number, >- sort_by => join ' ', @sort_by >- }; >- } >- } >+ # Loop through the pages >+ for (my $i=1; $i<=$pages;$i++) { >+ # the offset for this page >+ my $this_offset = (($i*$results_per_page)-$results_per_page); >+ # the page number for this page >+ my $this_page_number = $i; >+ # put it in the array >+ push @page_numbers, >+ { offset => $this_offset, >+ pg => $this_page_number, >+ # it should only be highlighted if it's the current page >+ highlight => $this_page_number == $current_page_number, >+ # it should only show if it is within 5 pages of the current page on either side >+ show => $current_page_number - $this_page_number == -5 || >+ $current_page_number - $this_page_number == -4 || >+ $current_page_number - $this_page_number == -3 || >+ $current_page_number - $this_page_number == -2 || >+ $current_page_number - $this_page_number == -1 || >+ $current_page_number - $this_page_number == 1 || >+ $current_page_number - $this_page_number == 2 || >+ $current_page_number - $this_page_number == 3 || >+ $current_page_number - $this_page_number == 4 || >+ $current_page_number - $this_page_number == 5, >+ sort_by => join ' ', @sort_by >+ }; > } > # FIXME: no previous_page_offset when pages < 2 > $template->param( PAGE_NUMBERS => \@page_numbers, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >index f19f26d2a1..f3198fad78 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >@@ -8,7 +8,9 @@ > [% IF ( PAGE_NUMBER.highlight ) %] > <li class="active"><span>[% PAGE_NUMBER.pg %]</span></li> > [% ELSE %] >- <li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ [% IF ( PAGE_NUMBER.show ) %] >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ [% END %] > [% END %] > [% END %] > [% IF ( next_page_offset ) %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >index d0f02cd51f..e7d91ff8d3 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >@@ -9,7 +9,9 @@ > [% IF ( PAGE_NUMBER.highlight ) %] > <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li> > [% ELSE %] >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ [% IF ( PAGE_NUMBER.show ) %] >+ <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ [% END %] > [% END %] > [% END %] > [% IF ( next_page_offset ) %] >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index ccde617022..991728a5a4 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -843,44 +843,29 @@ for (my $i=0;$i<@servers;$i++) { > $previous_page_offset = $offset - $results_per_page; > } > my $next_page_offset = $offset + $results_per_page; >- # If we're within the first 10 pages, keep it simple >- #warn "current page:".$current_page_number; >- if ($current_page_number < 10) { >- # just show the first 10 pages >- # Loop through the pages >- my $pages_to_show = 10; >- $pages_to_show = $pages if $pages<10; >- for ($i=1; $i<=$pages_to_show;$i++) { >- # the offset for this page >- my $this_offset = (($i*$results_per_page)-$results_per_page); >- # the page number for this page >- my $this_page_number = $i; >- # put it in the array >- push @page_numbers, >- { offset => $this_offset, >- pg => $this_page_number, >- highlight => $this_page_number == $current_page_number, >- sort_by => join ' ', @sort_by >- }; >- >- } >- >- } >- # now, show twenty pages, with the current one smack in the middle >- else { >- for ($i=$current_page_number; $i<=($current_page_number + 20 );$i++) { >- my $this_offset = ((($i-9)*$results_per_page)-$results_per_page); >- my $this_page_number = $i-9; >- if ( $this_page_number <= $pages ) { >- push @page_numbers, >- { offset => $this_offset, >- pg => $this_page_number, >- highlight => $this_page_number == $current_page_number, >- sort_by => join ' ', @sort_by >- }; >- } >- } >- >+ # Loop through the pages >+ for ($i=1; $i<=$pages;$i++) { >+ # the offset for this page >+ my $this_offset = (($i*$results_per_page)-$results_per_page); >+ # the page number for this page >+ my $this_page_number = $i; >+ # put it in the array >+ push @page_numbers, >+ { offset => $this_offset, >+ pg => $this_page_number, >+ highlight => $this_page_number == $current_page_number, >+ show => $current_page_number - $this_page_number == -5 || >+ $current_page_number - $this_page_number == -4 || >+ $current_page_number - $this_page_number == -3 || >+ $current_page_number - $this_page_number == -2 || >+ $current_page_number - $this_page_number == -1 || >+ $current_page_number - $this_page_number == 1 || >+ $current_page_number - $this_page_number == 2 || >+ $current_page_number - $this_page_number == 3 || >+ $current_page_number - $this_page_number == 4 || >+ $current_page_number - $this_page_number == 5, >+ sort_by => join ' ', @sort_by >+ }; > } > $template->param( PAGE_NUMBERS => \@page_numbers, > last_page_offset => $last_page_offset, >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 18128
:
60301
|
64940
|
64980
|
67778
|
68306
|
68325
|
68326
|
68720
| 68721