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: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
parent
0d0ec2d414
commit
22b44f3d87
|
|
@ -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";
|
||||
}
|
||||
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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 %]
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 -->
|
||||
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
|
|
@ -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>");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue