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