5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog › Advanced search</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% BLOCK cssinclude %][% END %]
10 [% INCLUDE 'bodytag.inc' bodyid='advsearch' bodyclass='scrollto' %]
11 [% INCLUDE 'masthead.inc' %]
12 <form action="/cgi-bin/koha/opac-search.pl" method="get">
13 <input type="hidden" name="advsearch" value="1"/>
15 <nav aria-label="breadcrumb">
16 <ul class="breadcrumb">
17 <li class="breadcrumb-item">
18 <a href="/cgi-bin/koha/opac-main.pl">Home</a>
20 <li class="breadcrumb-item active" aria-current="page">
21 <a href="#">Advanced search</a>
26 <div class="container-fluid">
28 <div class="col order-first order-md-first order-lg-2">
29 <!-- BOOLEAN SEARCH OPTIONS -->
30 <div id="booleansearch" class="maincontent">
32 <legend>Search for:</legend>
33 [% IF ( expanded_options ) %]
34 <div class="advanced-search-terms extended">
36 <div class="advanced-search-terms">
37 [% END # /IF ( expanded_options ) %]
38 [% FOREACH search_box IN [ 1, 2, 3] %]
39 <div class="search-term-row">
40 <div class="search-term-input">
41 [% IF ( expanded_options ) %]
42 [% IF ( !loop.first ) %]
43 <select name="op" class="form-control">
44 <option value="and" selected="selected">and</option>
45 <option value="or">or</option>
46 <option value="not">not</option>
50 <label for="search-field_[% loop.index | html %]">
51 [% IF loop.index == 0 %]
52
57 [% END # /IF ( expanded_options ) %]
58 </div> <!-- .search-term-input -->
60 <div class="search-term-input">
61 <select class="form-control" name="idx" id="search-field_[% loop.index | html %]">
62 <option value="kw">Keyword</option>
63 [% IF ( expanded_options ) %]
64 <option value="kw,phr"> Keyword phrase</option>
66 <option value="su,wrdl">Subject</option>
67 [% IF ( expanded_options ) %]
68 <option value="su,phr"> Subject phrase</option>
69 <option value="su-br"> Subject and broader terms</option>
70 <option value="su-na"> Subject and narrower terms</option>
71 <option value="su-rl"> Subject and related terms</option>
73 <option value="ti">Title</option>
74 [% IF ( expanded_options ) %]
75 <option value="ti,phr"> Title phrase</option>
76 <option value="se,wrdl">Series title</option>
77 [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
78 <option value="callnum,phr">Call number</option>
80 <option value="callnum">Call number</option>
84 <option value="au,wrdl">Author</option>
85 [% IF ( expanded_options ) %]
86 <option value="au,phr"> Author phrase</option>
87 <option value="cpn,wrdl"> Corporate name</option>
88 <option value="cfn,wrdl"> Conference name</option>
89 <option value="cfn,phr"> Conference name phrase</option>
90 <option value="pn,wrdl"> Personal name</option>
91 <option value="pn,phr"> Personal name phrase</option>
93 [% IF ( expanded_options ) %]
94 <option value="nt">Notes/Comments</option>
95 [% IF (marcflavour != 'UNIMARC') %]
96 <option value="curriculum">Curriculum</option>
99 <option value="pb,wrdl">Publisher</option>
100 <option value="pl,wrdl">Publisher location</option>
101 [% IF ( expanded_options ) %]
102 [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
103 <option value="ident,phr">Standard number</option>
105 <option value="ident">Standard number</option>
107 <option value="nb"> ISBN</option>
108 <option value="ns"> ISSN</option>
110 <option value="nb">ISBN</option>
112 <option value="bc">Barcode</option>
113 </select> <!-- /#search-field_[% loop.index | html %] -->
114 </div> <!-- .search-term-input -->
115 <div class="search-term-input">
116 <input class="form-control" type="text" size="" name="q" title="Enter search terms" value="" />
117 </div> <!-- .search-term-input -->
118 [% IF ( expanded_options ) %]
119 <div class="search-term-input">
120 [% IF ( !loop.first ) %]
121 <a class="ButtonPlus" title="Add another field" href="#">
122 <i class="fa fa-plus-square" aria-hidden="true"></i>
124 <a class="ButtonLess" title="Remove field" href="#">
125 <i class="fa fa-minus-square" aria-hidden="true"></i>
128 </div> <!-- .search-term-input -->
130 </div> <!-- /.search-term-row -->
131 [% END # FOREACH search_box %]
132 [% IF ( expanded_options ) %]
133 [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
134 <div id="weight_search">
136 <input type="checkbox" name="weight_search" checked="checked">
137 Apply field weights to search
142 <input type="hidden" name="weight_search" value="1" />
144 </div> <!-- /.search-terms -->
146 </div> <!-- /#booleansearch -->
147 </div> <!-- / .col -->
148 </div> <!-- / .row -->
150 <div class="text-center">
151 <!-- SEARCH BUTTONS -->
152 <fieldset class="action">
153 [% PROCESS searchbuttons %]
155 <!-- /SEARCH BUTTONS -->
159 [%# Following on one line for translatability %]
160 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
161 <div class="col order-first order-md-first order-lg-2">
162 <div id="advsearches" class="toptabs">
164 [% FOREACH advsearchloo IN advancedsearchesloop %]
165 <li id="advsearch-tab-[% advsearchloo.advanced_search_type | html %]">
166 <a href="#advsearch-[% advsearchloo.advanced_search_type | uri %]">
167 [% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]Item type
168 [% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]Collection
169 [% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]Shelving location
170 [% ELSE %]Something else
176 [% FOREACH advsearchloo IN advancedsearchesloop %]
177 <div id="advsearch-[% advsearchloo.advanced_search_type | html %]" class="advsearch">
179 <legend>Limit to any of the following:</legend>
181 [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
182 [% IF (advsearchloo.advanced_search_type != 'itemtypes') OR (((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1)) %]
183 <div class="col-sm-6 col-lg-3">
184 <input type="checkbox"
185 id="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]"
186 name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]"
187 value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code | html %][% ELSE %]mc-[% itemtypeloo.ccl | html %]:[% itemtypeloo.code | html %][% END %]"
189 <label for="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]">
190 [% UNLESS ( Koha.Preference('OpacNoItemTypeImages')) %]
191 [% IF ( itemtypeloo.imageurl ) %]
192 <img src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
196 [% itemtypeloo.description | html %]
199 [% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row">[% END %][% END %]
203 </div> <!-- / #advsearch-[% advsearchloo.advanced_search_type | html %] -->
204 [% END # / FOREACH advancedsearchesloop %]
205 </div> <!-- / #advsearches -->
206 </div> <!-- / .col -->
207 [% END # /IF OpacAdvSearchOptions %]
210 <div id="advsearch_limits" class="row">
212 [%# Following on one line for translatability %]
213 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('location').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('location').size > 0 and expanded_options ) ) %]
214 [% IF ( singleBranchMode ) %]
215 <div class="col-sm-6 col-lg-3">
216 <!-- AVAILABILITY LIMITS -->
217 <div id="location" class="advsearch_limit">
219 <legend>Availability: </legend>
220 <div style="margin-top:.4em">
221 <label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
224 </div> <!-- / #location -->
225 <!-- /AVAILABILITY LIMITS -->
226 </div> <!-- / .col -->
228 <div class="col-sm-6 col-lg-3">
229 <!-- AVAILABILITY LIMITS -->
230 <div id="location" class="advsearch_limit">
232 <label for="branchloop">Location and availability:</label>
233 <select name="limit" id="branchloop">
234 <option value="">All libraries</option>
235 [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
236 [% IF BranchesLoo.selected %]
237 <option value="branch:[% BranchesLoo.branchcode | html %]" selected="selected">[% BranchesLoo.branchname | html %]</option>
239 <option value="branch:[% BranchesLoo.branchcode | html %]">[% BranchesLoo.branchname | html %]</option>
243 [% IF search_groups %]
245 <label for="categoryloop">Groups of libraries</label>
246 <select name="multibranchlimit" id="categoryloop">
247 <option value=""> -- none -- </option>
248 [% FOREACH sg IN search_groups %]
249 <option value="[% sg.id | html %]">[% sg.title | html %]</option>
253 <div style="margin-top:.4em">
254 <label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
257 </div> <!-- / #location -->
258 <!-- /AVAILABILITY LIMITS -->
259 </div> <!-- / .col -->
260 [% END # / IF singleBranchMode %]
263 [%# Following on one line for translatability %]
264 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('sorting').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('sorting').size > 0 and expanded_options ) ) %]
265 <div class="col-sm-6 col-lg-3">
267 <div id="sortby" class="advsearch_limit">
269 <label for="sort_by">Sort by:</label>
270 <select id="sort_by" name="sort_by">
271 [% INCLUDE 'resort_form.inc' %]
276 </div> <!-- / .col -->
279 [%# Following on one line for translatability %]
280 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('pubdate').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('pubdate').size > 0 and expanded_options ) ) %]
281 <div class="col-sm-6 col-lg-3">
282 <div id="pubrange" class="advsearch_limit">
283 <!-- PUB RANGE OPTION -->
285 <label for="limit-yr">Publication date range</label>
286 <input type="text" size="30" id="limit-yr" name="limit-yr" title="Enter search terms" value="" />
287 <div class="hint">For example: 1999-2001. You could also use "-1987" for everything published in and before 1987 or "2008-" for everything published in 2008 and after.</div>
289 <!-- /PUB RANGE OPTION -->
294 [%# Following on one line for translatability %]
295 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('language').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('language').size > 0 and expanded_options ) ) %]
296 <div class="col-sm-6 col-lg-3">
297 <div id="langfilter" class="advsearch_limit">
299 <!-- LANGUAGE LIMIT -->
300 <label for="language-limit">Language</label>
301 <select id="language-limit" name="limit">
302 <option value="">No limit</option>
303 [% FOREACH search_languages_loo IN search_languages_loop %]
304 [% IF ( search_languages_loo.selected ) %]
305 <option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]" selected="selected">[% search_languages_loo.language_description | html %]</option>
307 <option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]">[% search_languages_loo.language_description | html %]</option>
311 <!-- /LANGUAGE LIMIT -->
313 </div> <!-- / #langfilter -->
314 </div> <!-- / .col -->
316 </div> <!-- / .row -->
318 [%# Following on one line for translatability %]
319 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('subtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('subtype').size > 0 and expanded_options ) ) %]
321 <div id="subtypes" class="row">
322 <!-- SUBTYPE LIMITS -->
323 <div class="col-sm-6 col-lg-3">
324 <div class="advsearch_limit">
326 <label for="subtype_audience">Audience</label>
327 <select id="subtype_audience" name="limit" class="subtype">
328 <option value="" selected="selected" class="menuheader">Any audience</option>
329 <option value="aud:a">Preschool</option>
330 <option value="aud:b">Primary</option>
331 <option value="aud:c">Pre-adolescent</option>
332 <option value="aud:d">Adolescent</option>
333 <option value="aud:e">Adult</option>
334 <option value="aud:f">Specialized</option>
335 <option value="aud:g">General</option>
336 <option value="aud:j">Juvenile</option>
339 </div> <!-- /.advsearch_limit -->
340 </div> <!-- / .col-sm-6 col-lg-3 -->
342 <div class="col-sm-6 col-lg-3">
343 <div class="advsearch_limit">
345 <label for="subtype_content">Content</label>
346 <select id="subtype_content" name="limit" class="subtype">
347 <option value="" selected="selected" class="menuheader">Any content</option>
348 <option value="fic:1">Fiction</option>
349 <option value="fic:0">Non-fiction</option>
350 <option value="bio:b">Biography</option>
351 <option value="mus:j">Musical recording</option>
352 <option value="mus:i">Non-musical recording</option>
355 </div> <!-- /.advsearch_limit -->
358 <div class="col-sm-6 col-lg-3">
359 <div class="advsearch_limit">
361 <label for="subtype_format">Format</label>
362 <select id="subtype_format" name="limit" class="subtype">
363 <option value="" selected="selected" class="menuheader">Any format</option>
364 <option value="l-format:ta">Regular print</option>
365 <option value="l-format:tb">Large print</option>
366 <option value="l-format:tc or l-format:fb">Braille</option>
367 <option value="">-----------</option>
368 <option value="l-format:sd">CD audio</option>
369 <option value="l-format:ss">Cassette recording</option>
370 <option value="l-format:vf">VHS tape / Videocassette</option>
371 <option value="l-format:vd">DVD video / Videodisc</option>
372 <option value="l-format:co">CD software</option>
373 <option value="l-format:cr">Website</option>
376 </div> <!-- /.advsearch_limit -->
377 </div> <!-- / .col-sm-6 col-lg-3 -->
379 <div class="col-sm-6 col-lg-3">
380 <div class="advsearch_limit">
382 <label for="subtype_additional">Additional content types for books/printed materials</label>
383 <select id="subtype_additional" name="limit" class="subtype">
384 <option value="">Any</option>
385 <option value="ctype:a">Abstracts/summaries</option>
386 <option value="ctype:b">Bibliographies</option>
387 <option value="ctype:c">Catalogs</option>
388 <option value="ctype:d">Dictionaries</option>
389 <option value="ctype:e">Encyclopedias </option>
390 <option value="ctype:f">Handbooks</option>
391 <option value="ctype:g">Legal articles</option>
392 <option value="ctype:i">Indexes</option>
393 <option value="ctype:j">Patent document</option>
394 <option value="ctype:k">Discographies</option>
395 <option value="ctype:l">Legislation</option>
396 <option value="ctype:m">Theses</option>
397 <option value="ctype:n">Surveys</option>
398 <option value="ctype:o">Reviews</option>
399 <option value="ctype:p">Programmed texts</option>
400 <option value="ctype:q">Filmographies</option>
401 <option value="ctype:r">Directories</option>
402 <option value="ctype:s">Statistics</option>
403 <option value="ctype:t">Technical reports</option>
404 <option value="ctype:v">Legal cases and case notes</option>
405 <option value="ctype:w">Law reports and digests</option>
406 <option value="ctype:z">Treaties </option>
409 </div> <!-- /.advsearch_limit -->
410 </div> <!-- / .col-sm-6 col-lg-3 -->
411 </div> <!-- / #subtypes.row -->
412 <!-- SUBTYPE LIMITS -->
413 [% END # / IF usmarc %]
416 <div id="subtypes_unimarc" class="row">
417 <!-- SUBTYPE LIMITS -->
418 [% INCLUDE 'subtypes_unimarc.inc' %]
421 [% END # / IF expanded_options %]
423 [% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 and expanded_options ) or ( OpacAdvSearchOptions and OpacAdvSearchOptions.size > 0 and not expanded_options ) %]
424 <div class="text-center">
425 <fieldset class="action">
426 <!-- SEARCH BUTTONS -->
427 [% PROCESS searchbuttons %]
428 <!-- /SEARCH BUTTONS -->
432 </div> <!-- / .container-fluid -->
433 </div> <!-- / .main -->
436 [% INCLUDE 'opac-bottom.inc' %]
437 [% BLOCK searchbuttons %]
439 <input class="btn btn-primary" type="submit" accesskey="s" name="do" title="Search" value="Search" />
441 [% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 ) %]
442 [% IF expanded_options %]
443 <a href="/cgi-bin/koha/opac-search.pl?expanded_options=0" class="btn btn-default more-less-options">Fewer options</a>
444 [% ELSIF not expanded_options %]
445 <a href="/cgi-bin/koha/opac-search.pl?expanded_options=1" class="btn btn-default more-less-options">More options</a>
449 <a href="/cgi-bin/koha/opac-search.pl?do=Clear" class="btn btn-default new-search">New search</a>
453 [% BLOCK jsinclude %]
454 [% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %]
455 [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
457 $(document).ready(function() {
458 $('#advsearches').tabs();
459 jQuery.cookie.json = true;
460 //$('#advsearches > ul').tabs();
462 [% IF ( ReturnToSearch ) %]
463 if (form_serialized = jQuery.cookie("form_serialized")) {
464 // Add missing term inputs if there were more than 3
465 var count = (form_serialized.match(/&q=/g) || []).length;
466 for(var i = 3 ; i < count ; i++) {
467 $("a.ButtonPlus:last").click();
469 $('#advsearch form').deserialize(form_serialized);
471 if (form_serialized_limits = jQuery.cookie("form_serialized_limits")) {
472 $('#language-limit') .val(form_serialized_limits[0]);
473 $('#branchloop') .val(form_serialized_limits[1]);
474 $('#subtype_audience') .val(form_serialized_limits[2]);
475 $('#subtype_content') .val(form_serialized_limits[3]);
476 $('#subtype_format') .val(form_serialized_limits[4]);
477 $('#subtype_additional') .val(form_serialized_limits[5]);
478 $('#locloop') .val(form_serialized_limits[6]);
481 //Clear all form cookies
482 jQuery.removeCookie("form_serialized", { path: '/'});
483 jQuery.removeCookie("form_serialized_limits", { path: '/'});
484 jQuery.removeCookie("search_path_code", { path: '/'});
486 $('#advsearch form').submit(function() {
487 $('[name^="limit"]').each(function(){
488 if( $(this).val() == '' ){
489 $(this).prop("disabled","disabled");
492 $(".search-term-row").each(function(){
493 if( $(this).find('input[name="q"]').val() == "" ){
494 $(this).find('input[name="q"]').prop("disabled","disabled");
495 $(this).find('select[name="op"]').prop("disabled","disabled");
496 $(this).find('select[name="idx"]').prop("disabled","disabled");
499 form_serialized = $(this).serialize();
500 jQuery.cookie("form_serialized", form_serialized,{ path: '/'});
501 form_serialized_limits = [
502 $('#language-limit').val(), $('#branchloop').val(),
503 $('#subtype_audience').val(), $('#subtype_content').val(),
504 $('#subtype_format').val(), $('#subtype_additional').val(),
507 jQuery.cookie("form_serialized_limits", form_serialized_limits,{ path: '/'});
508 [% IF ( expanded_options ) %]
509 jQuery.cookie("search_path_code", 'exs',{ path: '/'});
511 jQuery.cookie("search_path_code", 'ads',{ path: '/'});
516 /* This function allows to display a new field to search.
518 $(document).on("click", '.ButtonPlus', function(e) {
520 $('.ButtonLess').show();
521 var thisLine = $(this).parent().parent();
522 var newLine = thisLine.clone();
523 newLine.find('input').val('');
524 thisLine.after(newLine);
527 $(document).on("click", '.ButtonLess', function(e) {
529 if($(this).parent().parent().siblings().length <= 3 ) {
530 $('.ButtonLess').hide();
532 $(this).parent().parent().remove();