Bugzilla – Attachment 101775 Details for
Bug 14715
Results per page setting for catalog search in staff client and OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14715: Results per page dropdown for catalogue search
Bug-14715-Results-per-page-dropdown-for-catalogue-.patch (text/plain), 19.79 KB, created by
Katrin Fischer
on 2020-03-25 21:40:44 UTC
(
hide
)
Description:
Bug 14715: Results per page dropdown for catalogue search
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2020-03-25 21:40:44 UTC
Size:
19.79 KB
patch
obsolete
>From 27b704e1d2f00f49959bc4973de9c49aba1ca29e Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 5 Nov 2019 02:53:26 +0000 >Subject: [PATCH] Bug 14715: Results per page dropdown for catalogue search > >This patch utilises an unused search facet to handle results shown per >page. > >Sponsored-by: Region Halland >Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > ..._14715-add_resultsperpagedropdown_sysprefs.perl | 11 ++++++++++ > installer/data/mysql/sysprefs.sql | 2 ++ > .../prog/en/includes/page-numbers.inc | 10 ++++----- > .../en/modules/admin/preferences/searching.pref | 18 ++++++++++++++++ > .../prog/en/modules/catalogue/results.tt | 23 ++++++++++++++++++++ > .../bootstrap/en/includes/page-numbers.inc | 10 ++++----- > .../opac-tmpl/bootstrap/en/modules/opac-results.tt | 25 ++++++++++++++++++++++ > 7 files changed, 89 insertions(+), 10 deletions(-) > create mode 100644 installer/data/mysql/atomicupdate/bug_14715-add_resultsperpagedropdown_sysprefs.perl > >diff --git a/installer/data/mysql/atomicupdate/bug_14715-add_resultsperpagedropdown_sysprefs.perl b/installer/data/mysql/atomicupdate/bug_14715-add_resultsperpagedropdown_sysprefs.perl >new file mode 100644 >index 0000000000..c107cb60c4 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14715-add_resultsperpagedropdown_sysprefs.perl >@@ -0,0 +1,11 @@ >+$DBversion = 'XXX'; >+if( CheckVersion( $DBversion ) ) { >+ $dbh->do(q{ >+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`,`type`) VALUES >+ ('OPACnumSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in OPAC search results','YesNo'), >+ ('numSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in staff client search results','YesNo') >+ }); >+ >+ SetVersion( $DBversion ); >+ print "Upgrade to $DBversion done (Bug 14715 - Add sysprefs numSearchResultsDropdown and OPACnumSearchResultsDropdown)\n"; >+} >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 6eeff845d1..e090baf5de 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -345,6 +345,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('numReturnedItemsToShow','20',NULL,'Number of returned items to show on the check-in page','Integer'), > ('NumSavedReports', '20', NULL, 'By default, show this number of saved reports.', 'Integer'), > ('numSearchResults','20',NULL,'Specify the maximum number of results to display on a page of results','Integer'), >+('numSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in staff client search results','YesNo'), > ('numSearchRSSResults','50',NULL,'Specify the maximum number of results to display on a RSS page of results','Integer'), > ('OAI-PMH','0',NULL,'if ON, OAI-PMH server is enabled','YesNo'), > ('OAI-PMH:archiveID','KOHA-OAI-TEST',NULL,'OAI-PMH archive identification','Free'), >@@ -415,6 +416,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACNoResultsFound','','70|10','Display this HTML when no results are found for a search in the OPAC','Textarea'), > ('OPACNumbersPreferPhrase','0',NULL,'Control the use of phr operator in callnumber and standard number OPAC searches','YesNo'), > ('OPACnumSearchResults','20',NULL,'Specify the maximum number of results to display on a page of results','Integer'), >+('OPACnumSearchResultsDropdown', 0, NULL, 'Enable option list of number of results per page to show in OPAC search results','YesNo'), > ('OpacPasswordChange','1',NULL,'If ON, enables patron-initiated password change in OPAC (disable it when using LDAP auth)','YesNo'), > ('OPACPatronDetails','1','','If OFF the patron details tab in the OPAC is disabled.','YesNo'), > ('OPACpatronimages','0',NULL,'Enable patron images in the OPAC','YesNo'), >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 4fb9a6bba4..03cf92d907 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/page-numbers.inc >@@ -1,19 +1,19 @@ > [% IF ( PAGE_NUMBERS ) %]<nav><ul class="pagination"> > [% IF hits_to_paginate < total %]<h6>[% hits_to_paginate | html %] of [% total | html %] results loaded, refine your search to view other records</h6>[% END %] > [% IF ( previous_page_offset.defined ) %] >- <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li> >+ <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li> > <!-- Row of numbers corresponding to search result pages --> >- <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% previous_page_offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]"><i class="fa fa-fw fa-angle-left"></i> Previous</a></li> >+ <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% previous_page_offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]"><i class="fa fa-fw fa-angle-left"></i> Previous</a></li> > [% END %] > [% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %] > [% IF ( PAGE_NUMBER.highlight ) %] > <li class="active"><span>[% PAGE_NUMBER.pg | html %]</span></li> > [% ELSE %] >- <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% PAGE_NUMBER.offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]">[% PAGE_NUMBER.pg | html %]</a></li> >+ <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% PAGE_NUMBER.offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]">[% PAGE_NUMBER.pg | html %]</a></li> > [% END %] > [% END %] > [% IF ( next_page_offset ) %] >- <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% next_page_offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]">Next <i class="fa fa-fw fa-angle-right"></i></a></li> >- <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% last_page_offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %]">Last <i class="fa fa-fw fa-angle-double-right"></i></a></li> >+ <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% next_page_offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]">Next <i class="fa fa-fw fa-angle-right"></i></a></li> >+ <li><a class="nav" href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% last_page_offset | html %][% IF ( sort_by ) %]&sort_by=[% sort_by |url %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]">Last <i class="fa fa-fw fa-angle-double-right"></i></a></li> > [% END %] > </ul></nav>[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 9f2711ab27..adcb142a1e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -133,6 +133,24 @@ Searching: > - 'the operator "phr" in the callnumber and standard number staff client searches' > Results Display: > - >+ - pref: numSearchResultsDropdown >+ type: boolean >+ default: no >+ choices: >+ yes: Show >+ no: "Don't show" >+ - results per page dropdown on staff client search results. >+ - "Note: This does not work if ElasticSearch is activated." >+ - >+ - pref: OPACnumSearchResultsDropdown >+ type: boolean >+ default: no >+ choices: >+ yes: Show >+ no: "Don't show" >+ - results per page dropdown on OPAC search results. >+ - "Note: This does not work if ElasticSearch is activated." >+ - > - By default, sort search results in the staff client by > - pref: defaultSortField > default: relevance >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >index 4b66e8e516..b694d8e646 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt >@@ -268,6 +268,29 @@ > [% END %] > </ul> > </div> <!-- /.btn-group --> >+ >+ [% IF Koha.Preference('numSearchResultsDropdown') && Koha.Preference('SearchEngine') == "Zebra" %] >+ <div class="btn-group"> >+ <button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> >+ Results per page: [% results_per_page %] <span class="caret"></span> >+ </button> >+ <ul class="dropdown-menu"> >+ [% IF Koha.Preference('numSearchResults') %] >+ <li><a href="#" id="resultsperpage-default"> >+ [% IF results_per_page == Koha.Preference('numSearchResults') %] >+ <i class="fa fa-check"></i> >+ [% END %] Library default: [% Koha.Preference('numSearchResults') %] >+ </a></li> >+ [% END %] >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?count=20[% PROCESS sort_search_query %]">[% IF results_per_page == '20' %]<i class="fa fa-check"></i>[% END %] 20</a></li> >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?count=40[% PROCESS sort_search_query %]" id="resultsperpage-40">[% IF results_per_page == '40' %]<i class="fa fa-check"></i>[% END %] 40</a></li> >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?count=60[% PROCESS sort_search_query %]" id="resultsperpage-60">[% IF results_per_page == '60' %]<i class="fa fa-check"></i>[% END %] 60</a></li> >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?count=80[% PROCESS sort_search_query %]" id="resultsperpage-80">[% IF results_per_page == '80' %]<i class="fa fa-check"></i>[% END %] 80</a></li> >+ <li><a href="/cgi-bin/koha/catalogue/search.pl?count=100[% PROCESS sort_search_query %]" id="resultsperpage-100">[% IF results_per_page == '100' %]<i class="fa fa-check"></i>[% END %] 100</a></li> >+ </ul> >+ </div> <!-- /.btn-group --> >+ [% END %] >+ > </div> <!-- /#selection_ops --> > </div> <!-- /#searchheader --> > >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 3633b0c7c0..af105565de 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >@@ -3,19 +3,19 @@ > [% IF hits_to_paginate < total %]<h6>[% hits_to_paginate | html %] of [% total | html %] results loaded, refine your search to view other records</h6>[% END %] > <ul> > [% IF ( previous_page_offset.defined ) %] >- <li class="page-first"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %]"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li> >- <li class="page-prev"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% previous_page_offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %]"> <i class="fa fa-fw fa-angle-left"></i> Previous</a></li> >+ <li class="page-first"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li> >+ <li class="page-prev"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% previous_page_offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]"> <i class="fa fa-fw fa-angle-left"></i> Previous</a></li> > [% END %] > [% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %] > [% IF ( PAGE_NUMBER.highlight ) %] > <li class="active"><a clas="page-num current" href="#">[% PAGE_NUMBER.pg | html %]</a></li> > [% ELSE %] >- <li class="page-num"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% PAGE_NUMBER.offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %]">[% PAGE_NUMBER.pg | html %]</a></li> >+ <li class="page-num"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% PAGE_NUMBER.offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]">[% PAGE_NUMBER.pg | html %]</a></li> > [% END %] > [% END %] > [% IF ( next_page_offset ) %] >- <li class="page-next"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% next_page_offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %]">Next <i class="fa fa-fw fa-angle-double-right"></i></a></li> >- <li class="page-last"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% last_page_offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %]">Last <i class="fa fa-fw fa-angle-double-right"></i></a></li> >+ <li class="page-next"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% next_page_offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]">Next <i class="fa fa-fw fa-angle-double-right"></i></a></li> >+ <li class="page-last"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %]&offset=[% last_page_offset | uri %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %][% IF results_per_page %]&count=[% results_per_page %][% END %]">Last <i class="fa fa-fw fa-angle-double-right"></i></a></li> > [% END %] > </ul> > </div> >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >index 86baa9f802..acd21db152 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt >@@ -163,9 +163,29 @@ > [% UNLESS tag %] > <div class="sort_by pull-right"> > <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select> >+ >+ [% IF Koha.Preference('OPACnumSearchResultsDropdown') && Koha.Preference('SearchEngine') == "Zebra" %] >+ <label for="results_per_page">Results per page: </label> >+ <select id="results_per_page" name="count"> >+ [% IF Koha.Preference('OPACnumSearchResults') %] >+ [% IF results_per_page == Koha.Preference('OPACnumSearchResults') %] >+ <option value="[% Koha.Preference('OPACnumSearchResults') %]" selected="selected">Library default: [% Koha.Preference('OPACnumSearchResults') %]</option> >+ [% ELSE %] >+ <option value="[% Koha.Preference('OPACnumSearchResults') %]">Library default: [% Koha.Preference('OPACnumSearchResults') %]</option> >+ [% END %] >+ [% END %] >+ [% IF results_per_page == '20' %]<option value="20" selected="selected">20</option>[% ELSE %]<option value="20">20</option>[% END %] >+ [% IF results_per_page == '40' %]<option value="40" selected="selected">40</option>[% ELSE %]<option value="40">40</option>[% END %] >+ [% IF results_per_page == '60' %]<option value="60" selected="selected">60</option>[% ELSE %]<option value="60">60</option>[% END %] >+ [% IF results_per_page == '80' %]<option value="80" selected="selected">80</option>[% ELSE %]<option value="80">80</option>[% END %] >+ [% IF results_per_page == '100' %]<option value="100" selected="selected">100</option>[% ELSE %]<option value="100">100</option>[% END %] >+ </select> >+ [% END %] >+ > <input type="submit" class="btn btn-sm clearfix" id="sortsubmit" value="Go" /> > </div> > [% END %] >+ </div> > </div> <!-- / #toolbar --> > > <div id="selections-toolbar" class="toolbar noprint"> >@@ -758,6 +778,11 @@ $(document).ready(function(){ > $('.resort').change(function() { > $('#bookbag_form').submit(); > }); >+ >+ $('#results_per_page').change(function() { >+ $('#bookbag_form').submit(); >+ }); >+ > $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>"); > $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>"); > >-- >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 14715
:
41949
|
42003
|
42742
|
42743
|
56002
|
56003
|
56004
|
56005
|
56575
|
56576
|
56577
|
56610
|
56611
|
56612
|
57870
|
61721
|
64250
|
67912
|
67913
|
68000
|
68001
|
68305
|
68327
|
75938
|
75939
|
75940
|
75941
|
78230
|
78298
|
78299
|
78300
|
78301
|
78302
|
79796
|
79797
|
79988
|
81203
|
88097
|
88102
|
88103
|
88104
|
88105
|
88106
|
88107
|
88108
|
88109
|
88126
|
88195
|
88831
|
88832
|
88833
|
88834
|
88835
|
88836
|
88837
|
88838
|
88839
|
95038
|
97004
|
98365
|
99607
|
99677
|
99684
|
99685
| 101775 |
101776
|
101777
|
101778