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