Bug 9043: Changes to the advanced search page

This patch adds 2 new sysprefs: OpacAdvSearchOptions and
OpacAdvSearchMoreOptions.

These sysprefs are multivalued and you can add or remove some elements on
the adv search page.

This patch allows to display/hide some entries in the advanced search
page at the OPAC.
On this way, it is possible to configure the search options to display.

Test plan:
1/
Fill OpacAdvSearchOptions with Item types and Languages.
Fill OpacAdvSearchMoreOptions with Item types, Languages and Location.
On the advanced search page, verify the Location is only displayed for
the "More options" view.
2/ Try different settings for these prefs
3/ Remove all entries for the OpacAdvSearchMoreOptions and verify that
the "More options" does not displayed additional options.
4/ Remove all entries for the OpacAdvSearchOptions and verify that the
"normal view" does not displayed any options.

Note that this patch only affects the bootstrap theme.

Signed-off-by: Koha Team Lyon 3 <koha@univ-lyon3.fr>
Signed-off-by: Jacek Ablewicz <abl@biblos.pk.edu.pl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
This commit is contained in:
Jonathan Druart 2013-02-19 14:49:20 +01:00 committed by Tomas Cohen Arazi
parent 28ebfafc9b
commit b1174b24a1
5 changed files with 64 additions and 7 deletions

View File

@ -223,6 +223,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'),
('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'),
('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'),
('OpacAdvSearchMoreOptions','pubdate|itemtype|language|subtype|sorting|location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple'),
('OpacAdvSearchOptions','pubdate|itemtype|language|sorting|location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'),
('OPACAllowHoldDateInFuture','0','','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','YesNo'),
('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'),
('OpacAllowSharingPrivateLists','0',NULL,'If set, allows opac users to share private lists with other patrons','YesNo'),

View File

@ -9425,6 +9425,19 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.17.00.XXX";
if ( CheckVersion($DBversion) ) {
$dbh->do(q{
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchOptions','pubdate|itemtype|language|sorting|location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple');
});
$dbh->do(q{
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchMoreOptions','pubdate|itemtype|language|subtype|sorting|location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple');
});
print "Upgrade to $DBversion done (Bug 9043: Add system preference OpacAdvSearchOptions and OpacAdvSearchMoreOptions)\n";
SetVersion ($DBversion);
}
=head1 FUNCTIONS
=head2 TableExists($table)

View File

@ -663,3 +663,24 @@ OPAC:
- pref: PatronSelfRegistrationAdditionalInstructions
type: textarea
class: html
Advanced Search Options:
-
- Show search options
- pref: OpacAdvSearchOptions
multiple:
pubdate: Publication date
itemtype: Item types
language: Language
subtype: Subtypes
sorting: Sorting
location: Location and availability
-
- Show search options for the expanded view
- pref: OpacAdvSearchMoreOptions
multiple:
pubdate: Publication date
itemtype: Item types
language: Language
subtype: Subtypes
sorting: Sorting
location: Location and availability

View File

@ -111,6 +111,7 @@
</div>
<div class="row-fluid">
[% IF ( ( OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
<div class="span12">
<div id="advsearches" class="toptabs">
<ul>
@ -141,8 +142,10 @@
[% END # / FOREACH advancedsearchesloop %]
</div> <!-- / #advsearches -->
</div> <!-- / .span12 -->
[% END %]
<div class="row-fluid">
[% IF ( ( OpacAdvSearchOptions.grep('pubdate').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('pubdate').size > 0 and expanded_options ) ) %]
<div class="span3">
<div id="pubrange">
<!-- PUB RANGE OPTION -->
@ -155,7 +158,9 @@
<!-- /PUB RANGE OPTION -->
</div>
</div>
[% END %]
[% IF ( ( OpacAdvSearchOptions.grep('language').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('language').size > 0 and expanded_options ) ) %]
<div class="span3">
<div id="langfilter">
<fieldset>
@ -178,7 +183,9 @@
</fieldset>
</div> <!-- / #langfilter -->
</div> <!-- / .span3 -->
[% END %]
[% IF ( ( OpacAdvSearchOptions.grep('location').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('location').size > 0 and expanded_options ) ) %]
[% UNLESS ( singleBranchMode ) %]
<div class="span3">
<!-- AVAILABILITY LIMITS -->
@ -214,7 +221,9 @@
<!-- /AVAILABILITY LIMITS -->
</div> <!-- / .span3 -->
[% END # / UNLESS singleBranchMode %]
[% END %]
[% IF ( ( OpacAdvSearchOptions.grep('sorting').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('sorting').size > 0 and expanded_options ) ) %]
<div class="span3">
<!-- RANK LIMITS -->
<div id="sortby">
@ -228,9 +237,10 @@
</div>
<!-- RANK LIMITS -->
</div> <!-- / .span3 -->
[% END %]
</div> <!-- / .row-fluid -->
[% IF ( expanded_options ) %]
[% IF ( ( OpacAdvSearchOptions.grep('subtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('subtype').size > 0 and expanded_options ) ) %]
<div class="row-fluid">
[% IF ( usmarc ) %]
<!-- SUBTYPE LIMITS -->
@ -330,6 +340,7 @@
[% END # / IF expanded_options %]
</div> <!-- / .row-fluid -->
[% IF ( OpacAdvSearchMoreOptions.size > 0 and expanded_options ) or ( OpacAdvSearchOptions.size > 0 and not expanded_options ) %]
<div class="row-fluid">
<div class="span12">
<div class="text-center">
@ -339,7 +350,7 @@
</div>
</div> <!-- / .span12 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
[% END %]
</div> <!-- / .main -->
</form>
@ -347,11 +358,13 @@
[% BLOCK searchbuttons %]
<p>
<input class="btn btn-success" type="submit" accesskey="s" name="do" title="Search" value="Search" />
[% IF ( expanded_options ) %]
[% IF expanded_options %]
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=0" class="btn btn-default more-less-options">Fewer options</a>
[% ELSE %]
[% ELSIF not expanded_options %]
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=1" class="btn btn-default more-less-options">More options</a>
[% END %]
<a href="/cgi-bin/koha/opac-search.pl?do=Clear" class="btn btn-default new-search">New search</a>
</p>
[% END %]

View File

@ -306,9 +306,17 @@ if ( $template_type && $template_type eq 'advsearch' ) {
}
}
$template->param(uc( C4::Context->preference("marcflavour")) => 1, # we already did this for UNIMARC
advsearch => 1,
search_boxes_loop => \@search_boxes_array);
my @advsearch_limits = split /\|/, C4::Context->preference('OpacAdvSearchOptions');
my @advsearch_more_limits = split /\|/,
C4::Context->preference('OpacAdvSearchMoreOptions');
$template->param(
uc( C4::Context->preference("marcflavour") ) => 1, # we already did this for UNIMARC
advsearch => 1,
search_boxes_loop => \@search_boxes_array,
OpacAdvSearchOptions => \@advsearch_limits,
OpacAdvSearchMoreOptions => \@advsearch_more_limits,
);
# use the global setting by default
if ( C4::Context->preference("expandedSearchOption") == 1 ) {