From 22b44f3d874502df0572fa5de04497290cad7bb3 Mon Sep 17 00:00:00 2001 From: Aleisha Amohia 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 Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- ...5-add_resultsperpagedropdown_sysprefs.perl | 11 ++++++++ installer/data/mysql/sysprefs.sql | 2 ++ .../prog/en/includes/page-numbers.inc | 10 ++++---- .../modules/admin/preferences/searching.pref | 18 +++++++++++++ .../prog/en/modules/catalogue/results.tt | 23 +++++++++++++++++ .../bootstrap/en/includes/page-numbers.inc | 10 ++++---- .../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 3992c62808..01ec32d118 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -344,6 +344,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'), @@ -414,6 +415,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 ) %][% 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 @@ -132,6 +132,24 @@ Searching: no: "don't use" - '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 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 %] + + [% IF Koha.Preference('numSearchResultsDropdown') && Koha.Preference('SearchEngine') == "Zebra" %] + + [% END %] + 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 %]
[% hits_to_paginate | html %] of [% total | html %] results loaded, refine your search to view other records
[% END %] 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 %]
+ + [% IF Koha.Preference('OPACnumSearchResultsDropdown') && Koha.Preference('SearchEngine') == "Zebra" %] + + + [% END %] +
[% END %] +
@@ -758,6 +778,11 @@ $(document).ready(function(){ $('.resort').change(function() { $('#bookbag_form').submit(); }); + + $('#results_per_page').change(function() { + $('#bookbag_form').submit(); + }); + $("span.clearall").html(""+_("Clear all")+"<\/a>"); $("span.checkall").html(""+_("Select all")+"<\/a>"); -- 2.39.5