Bug 20888: (follow-up) revert unecessary change on jquery selector
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / catalogue / itemsearch.tt
1 [% USE raw %]
2 [% USE To %]
3 [% USE Asset %]
4 [% USE AuthorisedValues %]
5
6 [%- BLOCK form_label -%]
7   [%- SWITCH label -%]
8     [%- CASE 'barcode' %]<span>Barcode</span>
9     [%- CASE 'itemcallnumber' %]<span>Call number</span>
10     [%- CASE 'stocknumber' %]<span>Inventory number</span>
11     [%- CASE 'title' %]<span>Title</span>
12     [%- CASE 'author' %]<span>Author</span>
13     [%- CASE 'publishercode' %]<span>Publisher</span>
14     [%- CASE 'publicationyear' %]<span>Publication date</span>
15     [%- CASE 'collectiontitle' %]<span>Collection title</span>
16     [%- CASE 'isbn' %]<span>ISBN</span>
17     [%- CASE 'issn' %]<span>ISSN</span>
18     [%- CASE 'homebranch' %]<span>Home library</span>
19     [%- CASE 'holdingbranch' %]<span>Current library</span>
20     [%- CASE 'All libraries' %]<span>All libraries</span>
21     [%- CASE 'location' %]<span>Shelving location</span>
22     [%- CASE 'All locations' %]<span>All locations</span>
23     [%- CASE 'itype' %]<span>Item type</span>
24     [%- CASE 'All item types' %]<span>All item types</span>
25     [%- CASE 'ccode' %]<span>Collection</span>
26     [%- CASE 'All collection codes' %]<span>All collections</span>
27     [%- CASE 'notforloan' %]<span>Status</span>
28     [%- CASE 'All statuses' %]<span>All statuses</span>
29     [%- CASE 'damaged' %]<span>Damaged</span>
30     [%- CASE 'itemlost' %]<span>Lost</span>
31     [%- CASE 'withdrawn' %]<span>Withdrawn</span>
32     [%- CASE 'new_status' %]<span>Is new</span>
33   [%- END -%]
34 [%- END -%]
35
36 [% BLOCK form_field_select %]
37   <div class="form-field form-field-select">
38     <label class="form-field-label" for="[% name | html %]">[% INCLUDE form_label label=name %]</label>
39     <select id="[% name | html %]_op" name="[% name | html %]_op">
40       <option value="=">is</option>
41       <option value="!=" >is not</option>
42     </select>
43     <select id="[% name | html %]" name="[% name | html %]" multiple="multiple" size="[% options.size < 4 ? options.size + 1 : 4 | html %]">
44       <option value="" selected="selected">
45         [% IF (empty_option) %][% INCLUDE form_label label=empty_option %][% ELSE %]<span>All</span>[% END %]
46       </option>
47       [% FOREACH option IN options %]
48         <option value="[% option.value | html %]">[% option.label | html %]</option>
49       [% END %]
50     </select>
51   </div>
52 [% END %]
53
54 [% BLOCK form_field_select_option %]
55   <option value="[% value | html %]">[% INCLUDE form_label label=value %]</option>
56 [% END %]
57
58 [% BLOCK form_field_select_text %]
59   <div class="form-field form-field-select-text">
60     <select name="c" class="form-field-conjunction" disabled="disabled">
61       <option value="and">AND</option>
62       <option value="or">OR</option>
63     </select>
64     <select name="f" class="form-field-column">
65       [% INCLUDE form_field_select_option value='barcode' %]
66       [% INCLUDE form_field_select_option value='itemcallnumber' %]
67       [% INCLUDE form_field_select_option value='stocknumber' %]
68       [% INCLUDE form_field_select_option value='title' %]
69       [% INCLUDE form_field_select_option value='author' %]
70       [% INCLUDE form_field_select_option value='publishercode' %]
71       [% INCLUDE form_field_select_option value='publicationyear' %]
72       [% INCLUDE form_field_select_option value='collectiontitle' %]
73       [% INCLUDE form_field_select_option value='isbn' %]
74       [% INCLUDE form_field_select_option value='issn' %]
75       [% IF items_search_fields.size %]
76         <optgroup label="Custom search fields">
77           [% FOREACH field IN items_search_fields %]
78             [% marcfield = field.tagfield %]
79             [% IF field.tagsubfield.defined AND field.tagsubfield != "" %]
80               [% marcfield = marcfield _ '$' _ field.tagsubfield %]
81             [% END %]
82             <option value="marc:[% marcfield | html %]" data-authorised-values-category="[% field.authorised_values_category | html %]">[% field.label | html %] ([% marcfield | html %])</option>
83           [% END %]
84         </optgroup>
85       [% END %]
86     </select>
87     [% IF params.exists('op') %]
88         <select name="op" class="form-field-not">
89            <option value="like">is</option>
90             [% IF params.op == 'not like' %]
91                <option value="not like" selected="selected">is not</option>
92             [% ELSE %]
93                <option value="not like">is not</option>
94             [% END %]
95         </select>
96     [% ELSE %]
97         <select name="op" class="form-field-not">
98            <option value="like">is</option>
99            <option value="not like">is not</option>
100         </select>
101     [% END %]
102     <input type="text" name="q" class="form-field-value" value="" />
103   </div>
104 [% END %]
105
106 [% BLOCK form_field_radio_yes_no %]
107   <div class="form-field [% divclass | html %]">
108     <label class="form-field-label">[% INCLUDE form_label label=name %]:</label>
109     <input type="radio" name="[% name | html %]" id="[% name | html %]_indifferent" value="" checked="checked"/>
110     <label for="[% name | html %]_indifferent">Ignore</label>
111     <input type="radio" name="[% name | html %]" id="[% name | html %]_yes" value="yes" />
112     <label for="[% name | html %]_yes">Yes</label>
113     <input type="radio" name="[% name | html %]" id="[% name | html %]_no" value="no" />
114     <label for="[% name | html %]_no">No</label>
115   </div>
116 [% END %]
117
118 [%# We need to escape html characters for 'value' and 'label' %]
119 [%- BLOCK escape_html_value_label -%]
120     [%- SET escaped = [] -%]
121     [%- FOR e IN elts -%]
122         [%- value = BLOCK %][% e.value | html %][% END -%]
123         [%- label = BLOCK %][% e.label | html %][% END -%]
124         [%- escaped.push({ 'value' => value, 'label' => label }) -%]
125     [%- END -%]
126     [%- To.json(escaped) | $raw -%]
127 [%- END -%]
128
129 [% notforloans = AuthorisedValues.GetDescriptionsByKohaField({ kohafield = 'items.notforloan' }) %]
130 [% FOREACH nfl IN notforloans %]
131     [% nfl.value = nfl.authorised_value %]
132     [% nfl.label = nfl.lib %]
133 [% END %]
134
135 [% locations = AuthorisedValues.GetDescriptionsByKohaField({ kohafield = 'items.location' }) %]
136 [% FOREACH loc IN locations %]
137     [% loc.value = loc.authorised_value %]
138     [% loc.label = loc.lib %]
139 [% END %]
140
141 [%# Page starts here %]
142
143 [% SET footerjs = 1 %]
144 [% INCLUDE 'doc-head-open.inc' %]
145   <title>Koha &rsaquo; Catalog &rsaquo; Item search</title>
146   [% INCLUDE 'doc-head-close.inc' %]
147   [% Asset.css("css/itemsearchform.css") | $raw %]
148 </head>
149
150 <body id="catalog_itemsearch" class="catalog">
151   [% INCLUDE 'header.inc' %]
152   [% INCLUDE 'home-search.inc' %]
153   <div id="breadcrumbs">
154     <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/catalogue/search.pl">Catalog</a> &rsaquo; Item search
155   </div>
156
157 <div class="main container-fluid">
158     <div class="row">
159         <div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
160
161     <div id="item-search-block">
162       <h1>Item search</h1>
163       <p><a href="/cgi-bin/koha/catalogue/search.pl">Go to advanced search</a></p>
164       <form action="/cgi-bin/koha/catalogue/itemsearch.pl" method="get" id="itemsearchform">
165           <div id="toolbar" class="btn-toolbar">
166               <fieldset class="action">
167                   <div class="btn-group">
168                       <button class="btn btn-default"><i class="fa fa-search"></i> Search</button>
169                   </div>
170               </fieldset>
171           </div>
172           <fieldset>
173             [% INCLUDE form_field_select name="homebranch" options = branches empty_option = "All libraries" %]
174             [% INCLUDE form_field_select name="holdingbranch" options = branches empty_option = "All libraries" %]
175             [% IF locations.size %]
176                 [% INCLUDE form_field_select name="location" options = locations empty_option = "All locations" %]
177             [% END %]
178           </fieldset>
179           <fieldset>
180             [% INCLUDE form_field_select name="itype" options = itemtypes empty_option = "All item types" %]
181             [% IF ccodes.size %]
182                 [% INCLUDE form_field_select name="ccode" options = ccodes empty_option = "All collection codes" %]
183             [% END %]
184             [% IF notforloans.size %]
185                 [% INCLUDE form_field_select name="notforloan" options = notforloans empty_option = "All statuses" %]
186             [% END %]
187             [% IF itemlosts.size %]
188                 [% INCLUDE form_field_select name="itemlost" options = itemlosts empty_option = "All statuses" %]
189             [% END %]
190             [% IF withdrawns.size %]
191                 [% INCLUDE form_field_select name="withdrawn" options = withdrawns empty_option = "All statuses" %]
192             [% END %]
193           </fieldset>
194           <fieldset>
195             [% INCLUDE form_field_select_text %]
196             <p class="hint">You can use the following wildcard characters: % _</p>
197             <p class="hint">% matches any number of characters</p>
198             <p class="hint">_ matches only a single character</p>
199           </fieldset>
200           <fieldset>
201             <div class="form-field">
202               <label class="form-field-label" for="itemcallnumber_from">From call number:</label>
203               <input type="text" id="itemcallnumber_from" name="itemcallnumber_from" value="" />
204               <span class="hint">(inclusive)</span>
205             </div>
206             <div class="form-field">
207               <label class="form-field-label" for="itemcallnumber_to">To call number:</label>
208               <input type="text" id="itemcallnumber_to" name="itemcallnumber_to" value="" />
209               <span class="hint">(inclusive)</span>
210             </div>
211             [% INCLUDE form_field_radio_yes_no name="damaged" %]
212             [% IF ( has_new_status ) %]
213                 [% INCLUDE form_field_radio_yes_no name="new_status" divclass='item-new-status' %]
214             [% END %]
215             <div class="form-field">
216               <label class="form-field-label" for="issues_op">Checkout count:</label>
217               <select id="issues_op" name="issues_op">
218                 <option value=">">&gt;</option>
219                 <option value="<">&lt;</option>
220                 <option value="=">=</option>
221                 <option value="!=">!=</option>
222               </select>
223               <input type="text" name="issues" />
224             </div>
225             <div class="form-field">
226               <label class="form-field-label" for="datelastborrowed_op">Last checkout date:</label>
227               <select id="datelastborrowed_op" name="datelastborrowed_op">
228                 <option value=">">After</option>
229                 <option value="<">Before</option>
230                 <option value="=">On</option>
231               </select>
232               <input type="text" name="datelastborrowed" />
233               <span class="hint">ISO Format (YYYY-MM-DD)</span>
234             </div>
235           </fieldset>
236           <fieldset>
237             <div class="form-field-radio">
238               <label>Output:</label>
239               <input type="radio" id="format-html" name="format" value="html" checked="checked" /> <label for="format-html">Screen</label>
240               <input type="radio" id="format-csv" name="format" value="csv" /> <label for="format-csv">CSV</label>
241               <input type="radio" id="format-barcodes" name="format" value="barcodes"/> <label for="format-barcodes">Barcodes file</label>
242             </div>
243           </fieldset>
244       </form>
245     </div>
246     </div>
247   </div>
248     <div class="row">
249         <div class="col-md-12">
250       <div id="results-wrapper"></div>
251         </div>
252       </div>
253
254 [% MACRO jsinclude BLOCK %]
255     [% INCLUDE 'datatables.inc' %]
256     [% Asset.js("lib/jquery/plugins/jquery.dataTables.columnFilter.js") | $raw %]
257     [% Asset.js("lib/hc-sticky.js") | $raw %]
258     <script>
259         var authorised_values = [% authorised_values_json | $raw %];
260
261         function loadAuthorisedValuesSelect(select) {
262             var selected = select.find('option:selected');
263             var category = selected.data('authorised-values-category');
264             var form_field_value = select.siblings('.form-field-value');
265             if (category && category in authorised_values) {
266                 var values = authorised_values[category];
267                 var html = '<select name="q" class="form-field-value">\n';
268                 for (i in values) {
269                     var value = values[i];
270                     html += '<option value="' + value.authorised_value + '">' + value.lib + '</option>\n';
271                 }
272                 html += '</select>\n';
273                 var new_form_field_value = $(html);
274                 new_form_field_value.val(form_field_value.val());
275                 form_field_value.replaceWith(new_form_field_value);
276             } else {
277                 if (form_field_value.prop('tagName').toLowerCase() == 'select') {
278                     html = '<input name="q" type="text" class="form-field-value" />';
279                     var new_form_field_value = $(html);
280                     form_field_value.replaceWith(new_form_field_value);
281                 }
282             }
283         }
284
285     function addNewField( link ) {
286             var form_field = $('div.form-field-select-text').last();
287             var copy = form_field.clone(true);
288             copy.find('input,select').not('[type="hidden"]').each(function() {
289                 $(this).val('');
290             });
291             copy.find('.form-field-conjunction').prop('disabled', false).val('and');
292             form_field.after(copy);
293       link.remove();
294             copy.find('select.form-field-column').change();
295         }
296
297         function submitForm($form) {
298             var tr = ''
299                 + '    <tr>'
300                 + '      <th id="items_checkbox"></th>'
301                 + '      <th id="items_title">' + _("Title") + '</th>'
302                 + '      <th id="items_pubdate">' + _("Publication date") + '</th>'
303                 + '      <th id="items_publisher">' + _("Publisher") + '</th>'
304                 + '      <th id="items_collection">' + _("Collection") + '</th>'
305                 + '      <th id="items_barcode">' + _("Barcode") + '</th>'
306                 + '      <th id="items_callno">' + _("Call number") + '</th>'
307                 + '      <th id="items_homebranch">' + _("Home library") + '</th>'
308                 + '      <th id="items_holdingbranch">' + _("Current library") + '</th>'
309                 + '      <th id="items_location">' + _("Shelving location") + '</th>'
310                 + '      <th id="items_itype">' + _("Itemtype") + '</th>'
311                 + '      <th id="item_inventoryno">' + _("Inventory number") + '</th>'
312                 + '      <th id="items_status">' + _("Not for loan status") + '</th>'
313                 + '      <th id="items_itemlost">' + _("Lost status") + '</th>'
314                 + '      <th id="items_widthdrawn">' + _("Withdrawn status") + '</th>'
315                 + '      <th id="items_checkouts">' + _("Checkouts") + '</th>'
316                 + '      <th id=""></th>'
317                 + '    </tr>'
318             var table = ''
319                 + '<table id="results">'
320                 + '  <thead>' + tr + tr + '</thead>'
321                 + '  <tbody></tbody>'
322                 + '</table>';
323
324             var advSearchLink = $('<a>')
325                 .attr('href', '/cgi-bin/koha/catalogue/search.pl')
326                 .html(_("Go to advanced search"));
327             var editSearchLink = $('<a>')
328                 .attr('href', '#')
329                 .html(_("Edit search"))
330                 .addClass('btn btn-default btn-xs')
331                 .on('click', function(e) {
332                     e.preventDefault();
333                     $('#item-search-block').show();
334                 });
335
336             function getCheckedItemnumbers () {
337                 var itemnumbers;
338                 try {
339                     itemnumbers = JSON.parse(sessionStorage.getItem('itemsearch_itemnumbers') || '[]');
340                 } catch (e) {
341                     itemnumbers = [];
342                 }
343
344                 return new Set(itemnumbers);
345             }
346
347             function exportItems(format) {
348               var itemnumbers = getCheckedItemnumbers();
349               if (itemnumbers.size > 0) {
350                 var href = '/cgi-bin/koha/catalogue/item-export.pl?format=' + format;
351                 href += '&itemnumber=' + Array.from(itemnumbers).join('&itemnumber=');
352                 location = href;
353               } else {
354                 $('#format-' + format).prop('checked', true);
355                 $('#itemsearchform').submit();
356                 $('#format-html').prop('checked', true);
357               }
358             }
359
360             var csvExportLink = $('<a>')
361                 .attr('href', '#')
362                 .html("CSV")
363                 .on('click', function(e) {
364                     e.preventDefault();
365                     exportItems('csv');
366                 });
367             var barcodesExportLink = $('<a>')
368                 .attr('href', '#')
369                 .html(_("Barcodes file"))
370                 .on('click', function(e) {
371                     e.preventDefault();
372                     exportItems('barcodes');
373               });
374
375             var exportButton = $('<div>')
376               .addClass('btn-group')
377               .append($('<button>')
378                   .addClass('btn btn-default btn-xs dropdown-toggle')
379                   .attr('id', 'export-button')
380                   .attr('data-toggle', 'dropdown')
381                   .attr('aria-haspopup', 'true')
382                   .attr('aria-expanded', 'false')
383                   .html(_("Export all results to") + ' <span class="caret"></span>'))
384               .append($('<ul>')
385                   .addClass('dropdown-menu')
386                   .append($('<li>').append(csvExportLink))
387                   .append($('<li>').append(barcodesExportLink)));
388
389             var selectVisibleRows = $('<a>')
390               .attr('href', '#')
391               .append('<i class="fa fa-check"></i> ')
392               .append(_("Select visible rows"))
393               .on('click', function(e) {
394                   e.preventDefault();
395                   $('#results input[type="checkbox"]').prop('checked', true).change();
396               });
397             var clearSelection = $('<a>')
398               .attr('href', '#')
399               .append('<i class="fa fa-remove"></i> ')
400               .append(_("Clear selection"))
401               .on('click', function(e) {
402                   e.preventDefault();
403                   sessionStorage.setItem('itemsearch_itemnumbers', '[]');
404                   $('#results input[type="checkbox"]').prop('checked', false).change();
405               });
406             var exportLinks = $('<p>')
407               .append(selectVisibleRows)
408               .append(' ')
409               .append(clearSelection)
410               .append(' | ')
411               .append(exportButton);
412
413             var results_heading = $('<div>').addClass('results-heading')
414                 .append("<h1>" + _("Item search results") + "</h1>")
415                 .append($('<p>').append(advSearchLink))
416                 .append($('<p>').append(editSearchLink))
417                 .append(exportLinks);
418             $('#results-wrapper').empty()
419                 .append(results_heading)
420                 .append(table);
421
422             var params = [];
423             $form.find('select:not(:disabled) option:selected,input[type="text"]:not(:disabled),input[type="hidden"]:not(:disabled),input[type="radio"]:checked').each(function() {
424                 if ( $(this).prop('tagName').toLowerCase() == 'option' ) {
425                     var name = $(this).parents('select').first().attr('name');
426                     var value = $(this).val();
427                     params.push({ 'name': name, 'value': value });
428                 } else {
429                     params.push({ 'name': $(this).attr('name'), 'value': $(this).val() });
430                 }
431             });
432
433             $('#results').dataTable($.extend(true, {}, dataTablesDefaults, {
434                 'bDestroy': true,
435                 'bServerSide': true,
436                 'bProcessing': true,
437                 'sAjaxSource': '/cgi-bin/koha/catalogue/itemsearch.pl',
438                 'fnServerData': function(sSource, aoData, fnCallback) {
439                     aoData.push( { 'name': 'format', 'value': 'json' } );
440                     for (i in params) {
441                         aoData.push(params[i]);
442                     }
443                     $.ajax({
444                         'dataType': 'json',
445                         'type': 'POST',
446                         'url': sSource,
447                         'data': aoData,
448                         'success': function(json){
449                             fnCallback(json);
450                         }
451                     });
452                 },
453                 'sDom': '<"top pager"ilp>t<"bottom pager"ip>r',
454                 'aaSorting': [[1, 'asc']],
455                 'aoColumns': [
456                     { 'sName': 'checkbox', 'bSortable': false },
457                     { 'sName': 'title' },
458                     { 'sName': 'publicationyear' },
459                     { 'sName': 'publishercode' },
460                     { 'sName': 'ccode' },
461                     { 'sName': 'barcode' },
462                     { 'sName': 'itemcallnumber' },
463                     { 'sName': 'homebranch' },
464                     { 'sName': 'holdingbranch' },
465                     { 'sName': 'location' },
466                     { 'sName': 'itype'},
467                     { 'sName': 'stocknumber' },
468                     { 'sName': 'notforloan' },
469                     { 'sName': 'itemlost' },
470                     { 'sName': 'withdrawn' },
471                     { 'sName': 'issues' },
472                     { 'sName': 'actions', 'bSortable': false }
473                 ],
474                 "sPaginationType": "full_numbers"
475             })).columnFilter({
476                 'sPlaceHolder': 'head:after',
477                 'aoColumns': [
478                     null,
479                     { 'type': 'text' },
480                     { 'type': 'text' },
481                     { 'type': 'text' },
482                     [% IF ccodes.size %]
483                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => ccodes %] },
484                     [% ELSE %]
485                         null,
486                     [% END %]
487                     { 'type': 'text' },
488                     { 'type': 'text' },
489                     { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => branches %] },
490                     { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => branches %] },
491                     [% IF locations.size %]
492                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => locations %] },
493                     [% ELSE %]
494                         null,
495                     [% END %]
496                     [% IF itemtypes.size %]
497                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => itemtypes %] },
498                     [% ELSE %]
499                         null,
500                     [% END %]
501                     { 'type': 'text' },
502                     [% IF notforloans.size %]
503                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => notforloans %] },
504                     [% ELSE %]
505                         null,
506                     [% END %]
507                     [% IF itemlosts.size %]
508                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => itemlosts %] },
509                     [% ELSE %]
510                         null,
511                     [% END %]
512                     [% IF withdrawns.size %]
513                         { 'type': 'select', 'values': [% INCLUDE escape_html_value_label elts => withdrawns %] },
514                     [% ELSE %]
515                         null,
516                     [% END %]
517                     { 'type': 'text' },
518                     null
519                 ]
520             });
521             $('#results').on('draw.dt', function (e, settings) {
522                 var itemnumbers = getCheckedItemnumbers();
523                 $(this).find('input[type="checkbox"][name="itemnumber"]').each(function () {
524                     var itemnumber = this.value;
525                     if (itemnumbers.has(itemnumber)) {
526                         this.checked = true;
527                     }
528                 });
529             });
530
531             sessionStorage.setItem('itemsearch_itemnumbers', '[]');
532
533             $('#results').on('change', 'input[type="checkbox"]', function() {
534               var itemnumber = this.value;
535               var itemnumbers = getCheckedItemnumbers();
536               if (this.checked) {
537                   itemnumbers.add(itemnumber);
538               } else {
539                   itemnumbers.delete(itemnumber);
540               }
541               sessionStorage.setItem('itemsearch_itemnumbers', JSON.stringify(Array.from(itemnumbers)));
542
543               var caret = ' <span class="caret">';
544               if (itemnumbers.size > 0) {
545                 $('#export-button').html(_("Export selected results (%s) to").format(itemnumbers.size) + caret);
546               } else {
547                 $('#export-button').html(_("Export all results to") + caret);
548               }
549             });
550         }
551         var Sticky;
552         $(document).ready(function () {
553             Sticky = $("#toolbar");
554             Sticky.hcSticky({
555                 stickTo: "#item-search-block",
556                 stickyClass: "floating"
557             });
558             // Add the "New field" link.
559             var form_field = $('div.form-field-select-text').last()
560             var NEW_FIELD = _("New field");
561       var button_field_new = $('<a href="#" class="button-field-new" title="Add a new field"><i class="fa fa-plus"></i> ' + NEW_FIELD + '</a>');
562       button_field_new.click(function(e) {
563           e.preventDefault();
564           addNewField( $(this) );
565             });
566       form_field.append(button_field_new);
567
568             // If a field is linked to an authorised values list, display the list.
569             $('div.form-field-select-text select[name="f"]').change(function() {
570                 loadAuthorisedValuesSelect($(this));
571             }).change();
572
573             // Prevent user to select the 'All ...' option with other options.
574             $('div.form-field-select').each(function() {
575                 $(this).find('select').filter(':last').change(function() {
576                     values = $(this).val();
577                     if (values.length > 1) {
578                         var idx = $.inArray('', values);
579                         if (idx != -1) {
580                             values.splice(idx, 1);
581                             $(this).val(values);
582                         }
583                     }
584                 });
585             });
586
587             $('#itemsearchform').submit(function() {
588                 var searchform = $(this);
589                 var format = searchform.find('input[name="format"]:checked').val();
590                 if (format == 'html') {
591                     submitForm(searchform);
592                     $("#item-search-block").hide();
593                     return false;
594                 }
595             });
596         });
597     </script>
598 [% END %]
599
600 [% INCLUDE 'intranet-bottom.inc' %]