11e389ace1069a4d76ab8fe2e80a2e25d13b4b16
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-advsearch.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE Koha %]
4 [% USE Branches %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Advanced search</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 [% BLOCK cssinclude %][% END %]
9 </head>
10 [% INCLUDE 'bodytag.inc' bodyid='advsearch' bodyclass='scrollto' %]
11 [% INCLUDE 'masthead.inc' %]
12 <form action="/cgi-bin/koha/opac-search.pl" method="get">
13     <div class="main">
14         <ul class="breadcrumb">
15             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
16             <li><a href="#">Advanced search</a></li>
17         </ul>
18
19         <div class="container-fluid">
20             <div class="row-fluid">
21                 <div class="span12">
22                     <!-- BOOLEAN SEARCH OPTIONS -->
23                     <div id="booleansearch" class="maincontent">
24                         <fieldset>
25                             <legend>Search for:</legend>
26                             [% FOREACH search_box IN search_boxes_loop %]
27                                 <p>
28                                     [% IF ( expanded_options ) %]
29                                         [% IF ( search_box.boolean ) %]
30                                             <select name="op">
31                                                 <option value="and" selected="selected">and</option>
32                                                 <option value="or">or</option>
33                                                 <option value="not">not</option>
34                                             </select>
35                                         [% END %]
36                                     [% ELSE %]
37                                         <label for="search-field_[% loop.index | html %]">
38                                             [% IF loop.index == 0 %]
39                                                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
40                                             [% ELSE %]
41                                                 and
42                                             [% END %]
43                                         </label>
44                                     [% END %]
45                                     [% IF ( expanded_options ) %][% left_content | html %][% END %]
46                                     <select name="idx" id="search-field_[% loop.index | html %]">
47                                         <option value="kw">Keyword</option>
48                                         <option value="su,wrdl">Subject</option>
49                                         [% IF ( expanded_options ) %]
50                                             <option value="su,phr">&nbsp;&nbsp;&nbsp;&nbsp; Subject phrase</option>
51                                             <option value="su-br">&nbsp;&nbsp;&nbsp;&nbsp; Subject and broader terms</option>
52                                             <option value="su-na">&nbsp;&nbsp;&nbsp;&nbsp; Subject and narrower terms</option>
53                                             <option value="su-rl">&nbsp;&nbsp;&nbsp;&nbsp; Subject and related terms</option>
54                                         [% END %]
55                                         <option value="ti">Title</option>
56                                         [% IF ( expanded_options ) %]
57                                             <option value="ti,phr">&nbsp;&nbsp;&nbsp;&nbsp; Title phrase</option>
58                                             <option value="se,wrdl">Series title</option>
59                                             [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
60                                                 <option value="callnum,phr">Call number</option>
61                                             [% ELSE %]
62                                                 <option value="callnum">Call number</option>
63                                             [% END %]
64
65                                         [% END %]
66                                         <option value="au,wrdl">Author</option>
67                                         [% IF ( expanded_options ) %]
68                                             <option value="au,phr">&nbsp;&nbsp;&nbsp;&nbsp; Author phrase</option>
69                                             <option value="cpn,wrdl">&nbsp;&nbsp;&nbsp;&nbsp; Corporate name</option>
70                                             <option value="cfn,wrdl">&nbsp;&nbsp;&nbsp;&nbsp; Conference name</option>
71                                             <option value="cfn,phr">&nbsp;&nbsp;&nbsp;&nbsp; Conference name phrase</option>
72                                             <option value="pn,wrdl">&nbsp;&nbsp;&nbsp;&nbsp; Personal name</option>
73                                             <option value="pn,phr">&nbsp;&nbsp;&nbsp;&nbsp; Personal name phrase</option>
74                                         [% END %]
75                                         [% IF ( expanded_options ) %]
76                                             <option value="nt">Notes/Comments</option>
77                                             [% IF (marcflavour != 'UNIMARC') %]
78                                                 <option value="curriculum">Curriculum</option>
79                                             [% END %]
80                                         [% END %]
81                                         <option value="pb,wrdl">Publisher</option>
82                                         <option value="pl,wrdl">Publisher location</option>
83                                         [% IF ( expanded_options ) %]
84                                             [% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
85                                                 <option value="ident,phr">Standard number</option>
86                                             [% ELSE %]
87                                                 <option value="ident">Standard number</option>
88                                             [% END %]
89                                             <option value="nb">&nbsp;&nbsp;&nbsp;&nbsp; ISBN</option>
90                                             <option value="ns">&nbsp;&nbsp;&nbsp;&nbsp; ISSN</option>
91                                         [% ELSE %]
92                                             <option value="nb">ISBN</option>
93                                         [% END %]
94                                         <option value="bc">Barcode</option>
95                                     </select>
96                                     <input type="text" size="30" name="q" title="Enter search terms" value="" />
97                                     [% IF ( expanded_options ) %]
98                                         [% IF ( !loop.first ) %]
99                                             <a class="ButtonPlus" name="ButtonPlus" title="Add another field" href="#">[+]</a>
100                                             <a class="ButtonLess" title="Remove field" href="#">[-]</a>
101                                         [% END %]
102                                     [% END %]
103                                 </p>
104                             [% END # FOREACH search_box %]
105                         </fieldset>
106                     </div> <!-- /BOOLEAN SEARCH OPTIONS -->
107                 </div> <!-- / .span12 -->
108             </div> <!-- / .row-fluid -->
109                     <div class="text-center">
110                         <!-- SEARCH BUTTONS -->
111                         [% PROCESS searchbuttons %]
112                         <!-- /SEARCH BUTTONS -->
113                     </div>
114
115             <div class="row-fluid">
116               [%# Following on one line for translatability %]
117               [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
118                 <div class="span12">
119                     <div id="advsearches" class="toptabs">
120                         <ul>
121                             [% FOREACH advsearchloo IN advancedsearchesloop %]
122                                 <li id="advsearch-tab-[% advsearchloo.advanced_search_type | html %]">
123                                 <a href="#advsearch-[% advsearchloo.advanced_search_type | uri %]">
124                                [% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]Item type
125                                [% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]Collection
126                                [% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]Shelving location
127                                [% ELSE %]Something else
128                                [% END %]
129                                </a></li>
130                             [% END %]
131                         </ul>
132
133                         [% FOREACH advsearchloo IN advancedsearchesloop %]
134                             <div id="advsearch-[% advsearchloo.advanced_search_type | html %]" class="advsearch">
135                                 <fieldset>
136                                     <legend>Limit to any of the following:</legend>
137                                     <div class="row-fluid">
138                                         [% FOREACH itemtypeloo IN advsearchloo.code_loop %]
139                                             [% IF (advsearchloo.advanced_search_type != 'itemtypes') OR (((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1)) %]
140                                                 <div class="span3">
141                                                     <input type="checkbox"
142                                                         id="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]"
143                                                         name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]"
144                                                         value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code | html %][% ELSE %]mc-[% itemtypeloo.ccl | html %]:[% itemtypeloo.code | html %][% END %]"
145                                                     />
146                                                     <label for="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]">
147                                                         [% UNLESS ( noItemTypeImages ) %]
148                                                             [% IF ( itemtypeloo.imageurl ) %]
149                                                                 <img src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
150                                                             [% END %]
151                                                             &nbsp;
152                                                         [% END %]
153                                                         [% itemtypeloo.description | html %]
154                                                     </label>
155                                                 </div>
156                                             [% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row-fluid">[% END %][% END %]
157                                             [% END %]
158                                         [% END %]
159                                 </fieldset>
160                             </div> <!-- / #advsearch-[% advsearchloo.advanced_search_type | html %] -->
161                         [% END # / FOREACH advancedsearchesloop %]
162                     </div> <!-- / #advsearches -->
163                 </div> <!-- / .span12 -->
164               [% END %]
165
166                 <div class="row-fluid">
167                   [%# Following on one line for translatability %]
168                   [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('pubdate').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('pubdate').size > 0 and expanded_options ) ) %]
169                     <div class="span3">
170                         <div id="pubrange">
171                             <!-- PUB RANGE OPTION -->
172                             <fieldset>
173                                 <legend>Publication date range</legend>
174                                 <label for="limit-yr">Date range:</label>
175                                 <input type="text" size="30" id="limit-yr" name="limit-yr" title="Enter search terms" value="" />
176                                 <p>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.</p>
177                             </fieldset>
178                             <!-- /PUB RANGE OPTION -->
179                         </div>
180                     </div>
181                   [% END %]
182
183                   [%# Following on one line for translatability %]
184                   [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('language').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('language').size > 0 and expanded_options ) ) %]
185                     <div class="span3">
186                         <div id="langfilter">
187                             <fieldset>
188                                 <legend>Language</legend>
189                                 <!-- LANGUAGE LIMIT -->
190                                 <p>
191                                     <label for="language-limit">Language: </label>
192                                     <select id="language-limit" name="limit">
193                                         <option value="">No limit</option>
194                                             [% FOREACH search_languages_loo IN search_languages_loop %]
195                                                 [% IF ( search_languages_loo.selected ) %]
196                                                     <option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]" selected="selected">[% search_languages_loo.language_description | html %]</option>
197                                                 [% ELSE %]
198                                                     <option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]">[% search_languages_loo.language_description | html %]</option>
199                                                 [% END %]
200                                             [% END %]
201                                     </select>
202                                 </p>
203                                 <!-- /LANGUAGE LIMIT -->
204                             </fieldset>
205                         </div> <!-- / #langfilter -->
206                     </div> <!-- / .span3 -->
207                   [% END %]
208
209                   [%# Following on one line for translatability %]
210                   [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('location').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('location').size > 0 and expanded_options ) ) %]
211                     [% UNLESS ( singleBranchMode ) %]
212                         <div class="span3">
213                             <!-- AVAILABILITY LIMITS -->
214                             <div id="location">
215                                 <fieldset>
216                                     <legend>Location and availability: </legend>
217                                     <label for="branchloop">Library:</label>
218                                     <select name="limit" id="branchloop">
219                                     <option value="">All libraries</option>
220                                     [% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
221                                         [% IF BranchesLoo.selected %]
222                                             <option value="branch:[% BranchesLoo.branchcode | html %]" selected="selected">[% BranchesLoo.branchname | html %]</option>
223                                         [% ELSE %]
224                                             <option value="branch:[% BranchesLoo.branchcode | html %]">[% BranchesLoo.branchname | html %]</option>
225                                         [% END %]
226                                     [% END %]
227                                     </select>
228                                     [% IF search_groups %]
229                                         <p>OR</p>
230                                         <label for="categoryloop">Groups of libraries</label>
231                                         <select name="multibranchlimit" id="categoryloop">
232                                             <option value=""> -- none -- </option>
233                                             [% FOREACH sg IN search_groups %]
234                                                 <option value="[% sg.id | html %]">[% sg.title | html %]</option>
235                                             [% END %]
236                                         </select>
237                                     [% END %]
238                                     <div style="margin-top:.4em">
239                                         <label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
240                                     </div>
241                                 </fieldset>
242                             </div> <!-- / #location -->
243                             <!-- /AVAILABILITY LIMITS -->
244                         </div> <!-- / .span3 -->
245                     [% END # / UNLESS singleBranchMode %]
246                   [% END %]
247
248                   [%# Following on one line for translatability %]
249                   [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('sorting').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('sorting').size > 0 and expanded_options ) ) %]
250                     <div class="span3">
251                     <!-- RANK LIMITS -->
252                         <div id="sortby">
253                             <fieldset>
254                                 <legend>Sorting: </legend>
255                                 <label for="sort_by">Sort by:</label>
256                                 <select id="sort_by" name="sort_by">
257                                     [% INCLUDE 'resort_form.inc' %]
258                                 </select>
259                             </fieldset>
260                         </div>
261                     <!-- RANK LIMITS -->
262                     </div> <!-- / .span3 -->
263                   [% END %]
264                 </div> <!-- / .row-fluid -->
265
266                 [%# Following on one line for translatability %]
267                 [% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('subtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('subtype').size > 0 and expanded_options ) ) %]
268                     <div class="row-fluid">
269                         [% IF ( usmarc ) %]
270                             <!-- SUBTYPE LIMITS -->
271                                 <div id="subtypes">
272                                     <div class="span3">
273                                         <fieldset>
274                                             <legend>Audience</legend>
275                                             <select id="subtype_audience" name="limit" class="subtype">
276                                             <option value="" selected="selected" class="menuheader">Any audience</option>
277                                                 <option value="aud:a">Preschool</option>
278                                                 <option value="aud:b">Primary</option>
279                                                 <option value="aud:c">Pre-adolescent</option>
280                                                 <option value="aud:d">Adolescent</option>
281                                                 <option value="aud:e">Adult</option>
282                                                 <option value="aud:f">Specialized</option>
283                                                 <option value="aud:g">General</option>
284                                                 <option value="aud:j">Juvenile</option>
285                                             </select>
286                                         </fieldset>
287                                     </div> <!-- / .span3 -->
288
289                                     <div class="span3">
290                                         <fieldset>
291                                             <legend>Content</legend>
292                                             <select id="subtype_content"  name="limit" class="subtype">
293                                                 <option value="" selected="selected" class="menuheader">Any content</option>
294                                                 <option value="fic:1">Fiction</option>
295                                                 <option value="fic:0">Non-fiction</option>
296                                                 <option value="bio:b">Biography</option>
297                                                 <option value="mus:j">Musical recording</option>
298                                                 <option value="mus:i">Non-musical recording</option>
299                                             </select>
300                                         </fieldset>
301                                     </div>
302
303                                     <div class="span3">
304                                         <fieldset>
305                                             <legend>Format</legend>
306                                             <select id="subtype_format" name="limit" class="subtype">
307                                                 <option value="" selected="selected" class="menuheader">Any format</option>
308                                                 <option value="l-format:ta">Regular print</option>
309                                                 <option value="l-format:tb">Large print</option>
310                                                 <option value="l-format:fk">Braille</option>
311                                                 <option value="">-----------</option>
312                                                 <option value="l-format:sd">CD audio</option>
313                                                 <option value="l-format:ss">Cassette recording</option>
314                                                 <option value="l-format:vf">VHS tape / Videocassette</option>
315                                                 <option value="l-format:vd">DVD video / Videodisc</option>
316                                                 <option value="l-format:co">CD software</option>
317                                                 <option value="l-format:cr">Website</option>
318                                             </select>
319                                         </fieldset>
320                                     </div> <!-- / .span3 -->
321
322                                     <div class="span3">
323                                         <fieldset>
324                                             <legend>Additional content types for books/printed materials</legend>
325                                             <select id="subtype_additional" name="limit" class="subtype">
326                                                 <option value="">Any</option>
327                                                 <option value="ctype:a">Abstracts/summaries</option>
328                                                 <option value="ctype:b">Bibliographies</option>
329                                                 <option value="ctype:c">Catalogs</option>
330                                                 <option value="ctype:d">Dictionaries</option>
331                                                 <option value="ctype:e">Encyclopedias </option>
332                                                 <option value="ctype:f">Handbooks</option>
333                                                 <option value="ctype:g">Legal articles</option>
334                                                 <option value="ctype:i">Indexes</option>
335                                                 <option value="ctype:j">Patent document</option>
336                                                 <option value="ctype:k">Discographies</option>
337                                                 <option value="ctype:l">Legislation</option>
338                                                 <option value="ctype:m">Theses</option>
339                                                 <option value="ctype:n">Surveys</option>
340                                                 <option value="ctype:o">Reviews</option>
341                                                 <option value="ctype:p">Programmed texts</option>
342                                                 <option value="ctype:q">Filmographies</option>
343                                                 <option value="ctype:r">Directories</option>
344                                                 <option value="ctype:s">Statistics</option>
345                                                 <option value="ctype:t">Technical reports</option>
346                                                 <option value="ctype:v">Legal cases and case notes</option>
347                                                 <option value="ctype:w">Law reports and digests</option>
348                                                 <option value="ctype:z">Treaties </option>
349                                             </select>
350                                         </fieldset>
351                                     </div> <!-- / .span3 -->
352                                 </div> <!-- / #subtypes -->
353                             <!-- SUBTYPE LIMITS -->
354                         [% END # / IF usmarc %]
355
356                             [% IF ( UNIMARC ) %]
357                                 <div id="subtypes_unimarc">
358                                     <!-- SUBTYPE LIMITS -->
359                                     [% INCLUDE 'subtypes_unimarc.inc' %]
360                                 </div>
361                             [% END %]
362
363                     </div> <!-- / .row-fluid -->
364                 [% END # / IF expanded_options %]
365             </div> <!-- / .row-fluid -->
366
367             [% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 and expanded_options ) or
368                   ( OpacAdvSearchOptions     and OpacAdvSearchOptions.size > 0     and not expanded_options ) %]
369                 <div class="row-fluid">
370                     <div class="span12">
371                         <div class="text-center">
372                             <!-- SEARCH BUTTONS -->
373                             [% PROCESS searchbuttons %]
374                             <!-- /SEARCH BUTTONS -->
375                         </div>
376                     </div> <!-- / .span12 -->
377                 </div> <!-- / .row-fluid -->
378             [% END %]
379         </div> <!-- / .container-fluid -->
380    </div> <!-- / .main -->
381 </form>
382
383 [% INCLUDE 'opac-bottom.inc' %]
384 [% BLOCK searchbuttons %]
385     <p>
386         <input class="btn btn-success" type="submit" accesskey="s" name="do" title="Search" value="Search" />
387
388         [% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 ) %]
389             [% IF expanded_options %]
390                 <a href="/cgi-bin/koha/opac-search.pl?expanded_options=0" class="btn btn-default more-less-options">Fewer options</a>
391             [% ELSIF not expanded_options %]
392                 <a href="/cgi-bin/koha/opac-search.pl?expanded_options=1" class="btn btn-default more-less-options">More options</a>
393             [% END %]
394         [% END %]
395
396         <a href="/cgi-bin/koha/opac-search.pl?do=Clear" class="btn btn-default new-search">New search</a>
397     </p>
398 [% END %]
399
400 [% BLOCK jsinclude %]
401 [% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %]
402 [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
403 <script>//<![CDATA[
404 $(document).ready(function() {
405     $('#advsearches').tabs();
406     jQuery.cookie.json = true;
407     //$('#advsearches > ul').tabs();
408
409     [% IF ( ReturnToSearch ) %]
410         if (form_serialized = jQuery.cookie("form_serialized")) {
411             $('#advsearch form').deserialize(form_serialized);
412         }
413         if (form_serialized_limits = jQuery.cookie("form_serialized_limits")) {
414             $('#language-limit')     .val(form_serialized_limits[0]);
415             $('#branchloop')         .val(form_serialized_limits[1]);
416             $('#subtype_audience')   .val(form_serialized_limits[2]);
417             $('#subtype_content')    .val(form_serialized_limits[3]);
418             $('#subtype_format')     .val(form_serialized_limits[4]);
419             $('#subtype_additional') .val(form_serialized_limits[5]);
420             $('#locloop')            .val(form_serialized_limits[6]);
421         }
422     [% ELSE %]
423         //Clear all form cookies
424         jQuery.removeCookie("form_serialized", { path: '/'});
425         jQuery.removeCookie("form_serialized_limits", { path: '/'});
426         jQuery.removeCookie("num_paragraph", { path: '/'});
427         jQuery.removeCookie("search_path_code", { path: '/'});
428     [% END %]
429     $('#advsearch form').submit(function() {
430         form_serialized = $(this).serialize();
431         jQuery.cookie("form_serialized", form_serialized,{ path: '/'});
432         form_serialized_limits = [
433             $('#language-limit').val(),   $('#branchloop').val(),
434             $('#subtype_audience').val(), $('#subtype_content').val(),
435             $('#subtype_format').val(),   $('#subtype_additional').val(),
436             $('#locloop').val()
437         ];
438         jQuery.cookie("form_serialized_limits", form_serialized_limits,{ path: '/'});
439         [% IF ( expanded_options ) %]
440         var numPar = $("#booleansearch fieldset p").size();
441         if (numPar > [% search_boxes_count | html %]){
442             jQuery.cookie("num_paragraph", numPar,{ path: '/'});
443         }else{
444             jQuery.removeCookie("num_paragraph", { path: '/'});
445         }
446         jQuery.cookie("search_path_code", 'exs',{ path: '/'});
447         [% ELSE %]
448         jQuery.cookie("search_path_code", 'ads',{ path: '/'});
449         jQuery.removeCookie("num_paragraph", { path: '/'});
450         [% END %]
451     });
452
453 });
454     /* This function allows to display a new field to search.
455     */
456     $(document).on("click", '.ButtonPlus', function(e) {
457         e.preventDefault();
458         $('.ButtonLess').show();
459         var thisLine = $(this).parent();
460         var newLine = thisLine.clone();
461         newLine.find('input').val('');
462         thisLine.after(newLine);
463     });
464
465     $(document).on("click", '.ButtonLess', function(e) {
466         e.preventDefault();
467         if($(this).parent().siblings().length <= 3 ) {
468            $('.ButtonLess').hide();
469         }
470         $(this).parent().remove();
471     });
472     //]]>
473 </script>
474 [% END %]