b5d174c7d9
Test plan: Using Chrome as web browser: * Go to opac advanced search * Press "more options" * Search for two keywords using "and" operator (on ktd search for idea AND behind, which matches 1 result) * Search for two keywords using "or" operator (on ktd search for idea OR behind, which matches 4 results) * Search for two keywords using "not" operator (on ktd search for idea NOT behind, which matches 2 results) Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
559 lines
36 KiB
Text
559 lines
36 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% USE Branches %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Advanced search › [% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% BLOCK cssinclude %][% END %]
|
|
</head>
|
|
[% INCLUDE 'bodytag.inc' bodyid='advsearch' bodyclass='scrollto' %]
|
|
[% INCLUDE 'masthead.inc' %]
|
|
<form id="advsearch_form" action="/cgi-bin/koha/opac-search.pl" method="get">
|
|
<input type="hidden" name="advsearch" value="1"/>
|
|
<div class="main">
|
|
[% WRAPPER breadcrumbs %]
|
|
[% WRAPPER breadcrumb_item bc_active= 1 %]
|
|
<span>Advanced search</span>
|
|
[% END %]
|
|
[% END #/ WRAPPER breadcrumbs %]
|
|
|
|
<div class="container-fluid">
|
|
<div class="row">
|
|
<div class="col order-first order-md-first order-lg-2">
|
|
<!-- BOOLEAN SEARCH OPTIONS -->
|
|
<div id="booleansearch" class="maincontent">
|
|
<h1>Advanced search</h1>
|
|
<fieldset>
|
|
<legend>Search for:</legend>
|
|
[% IF ( expanded_options ) %]
|
|
<div class="advanced-search-terms extended">
|
|
[% ELSE %]
|
|
<div class="advanced-search-terms">
|
|
[% END # /IF ( expanded_options ) %]
|
|
[% FOREACH search_box IN [ 1, 2, 3] %]
|
|
<div class="search-term-row">
|
|
<div class="search-term-input">
|
|
[% IF ( expanded_options ) %]
|
|
<select name="op" class="form-control">
|
|
<option value="AND" selected="selected">and</option>
|
|
<option value="OR">or</option>
|
|
<option value="NOT">not</option>
|
|
</select>
|
|
[% ELSE %]
|
|
<label for="search-field_[% loop.index | html %]">
|
|
[% IF loop.index == 0 %]
|
|
|
|
[% ELSE %]
|
|
and
|
|
[% END %]
|
|
</label>
|
|
[% END # /IF ( expanded_options ) %]
|
|
</div> <!-- .search-term-input -->
|
|
|
|
<div class="search-term-input">
|
|
<select class="form-control" name="idx" aria-label="Choose search type for field [% loop.index + 1 | html %]" id="search-field_[% loop.index | html %]">
|
|
<option value="kw">Keyword</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="kw,phr"> Keyword phrase</option>
|
|
[% END %]
|
|
<option value="su,wrdl">Subject</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="su,phr"> Subject phrase</option>
|
|
<option value="su-br"> Subject and broader terms</option>
|
|
<option value="su-na"> Subject and narrower terms</option>
|
|
<option value="su-rl"> Subject and related terms</option>
|
|
[% END %]
|
|
<option value="ti">Title</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="ti,phr"> Title phrase</option>
|
|
<option value="se,wrdl">Series title</option>
|
|
[% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
|
|
<option value="callnum,phr">Call number</option>
|
|
[% ELSE %]
|
|
<option value="callnum">Call number</option>
|
|
[% END %]
|
|
|
|
[% END %]
|
|
<option value="au,wrdl">Author</option>
|
|
[% IF ( expanded_options ) %]
|
|
<option value="au,phr"> Author phrase</option>
|
|
<option value="cpn,wrdl"> Corporate name</option>
|
|
<option value="cfn,wrdl"> Conference name</option>
|
|
<option value="cfn,phr"> Conference name phrase</option>
|
|
<option value="pn,wrdl"> Personal name</option>
|
|
<option value="pn,phr"> Personal name phrase</option>
|
|
[% END %]
|
|
[% IF ( expanded_options ) %]
|
|
<option value="nt">Notes/Comments</option>
|
|
[% IF (marcflavour != 'UNIMARC') %]
|
|
<option value="curriculum">Curriculum</option>
|
|
[% END %]
|
|
[% END %]
|
|
<option value="pb,wrdl">Publisher</option>
|
|
<option value="pl,wrdl">Publisher location</option>
|
|
[% IF ( expanded_options ) %]
|
|
[% IF ( Koha.Preference('OPACNumbersPreferPhrase') ) %]
|
|
<option value="ident,phr">Standard number</option>
|
|
[% ELSE %]
|
|
<option value="ident">Standard number</option>
|
|
[% END %]
|
|
<option value="nb"> ISBN</option>
|
|
<option value="ns"> ISSN</option>
|
|
[% ELSE %]
|
|
<option value="nb">ISBN</option>
|
|
[% END %]
|
|
<option value="bc">Barcode</option>
|
|
</select> <!-- /#search-field_[% loop.index | html %] -->
|
|
</div> <!-- .search-term-input -->
|
|
<div class="search-term-input">
|
|
<input class="form-control" type="text" name="q" aria-label="Enter field [% loop.index + 1 | html %] search terms" value="" />
|
|
</div> <!-- .search-term-input -->
|
|
[% IF ( expanded_options ) %]
|
|
<div class="search-term-input">
|
|
<a class="ButtonPlus" title="Add another field" href="#">
|
|
<i class="fa fa-plus-square" aria-hidden="true"></i>
|
|
</a>
|
|
<a class="ButtonLess" title="Remove field" href="#">
|
|
<i class="fa fa-minus-square" aria-hidden="true"></i>
|
|
</a>
|
|
</div> <!-- .search-term-input -->
|
|
[% END %]
|
|
</div> <!-- /.search-term-row -->
|
|
[% END # FOREACH search_box %]
|
|
[% IF ( expanded_options ) %]
|
|
[% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
|
|
<div id="weight_search">
|
|
<label>
|
|
<input type="checkbox" name="weight_search" checked="checked">
|
|
Apply field weights to search
|
|
</label>
|
|
</div>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<input type="hidden" name="weight_search" value="1" />
|
|
[% END %]
|
|
[% IF Koha.Preference('IncludeSeeFromInSearches') %]
|
|
<div class="hint included-see-from-headings-info">
|
|
<i class="fa fa-info-circle" aria-hidden="true"></i>
|
|
See from (non-preferred form) headings are included
|
|
</div>
|
|
[% END %]
|
|
</div> <!-- /.advanced-search-terms -->
|
|
</fieldset>
|
|
</div> <!-- /#booleansearch -->
|
|
</div> <!-- / .col -->
|
|
</div> <!-- / .row -->
|
|
|
|
<div class="text-center">
|
|
<!-- SEARCH BUTTONS -->
|
|
<fieldset class="action">
|
|
[% PROCESS searchbuttons %]
|
|
</fieldset>
|
|
<!-- /SEARCH BUTTONS -->
|
|
</div>
|
|
|
|
<div class="row">
|
|
[%# Following on one line for translatability %]
|
|
[% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
|
|
<div class="col order-first order-md-first order-lg-2">
|
|
[% WRAPPER tabs id= "advsearches" %]
|
|
[% WRAPPER tabs_nav %]
|
|
[% FOREACH advsearchloo IN advancedsearchesloop %]
|
|
[% WRAPPER tab_item tabname= "advsearch-tab-${advsearchloo.advanced_search_type}" bt_active= "0" %]
|
|
[% IF ( advsearchloo.advanced_search_type == 'itemtypes' ) %]<span>Item type</span>
|
|
[% ELSIF ( advsearchloo.advanced_search_type == 'ccode' ) %]<span>Collection</span>
|
|
[% ELSIF ( advsearchloo.advanced_search_type == 'loc' ) %]<span>Shelving location</span>
|
|
[% ELSE %]<span>Something else</span>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
[% END # /WRAPPER tabs_nav %]
|
|
[% WRAPPER tab_panels id= "advsearches" %]
|
|
[% FOREACH advsearchloo IN advancedsearchesloop %]
|
|
[% WRAPPER tab_panel tabname="advsearch-tab-${advsearchloo.advanced_search_type}" %]
|
|
<fieldset>
|
|
<legend>Limit to any of the following:</legend>
|
|
<div class="row">
|
|
[% FOREACH itemtypeloo IN advsearchloo.code_loop %]
|
|
[% IF (advsearchloo.advanced_search_type != 'itemtypes') OR (((!itemtypeloo.searchcategory) AND (itemtypeloo.cat == 0)) OR (itemtypeloo.cat == 1)) %]
|
|
<div class="col-sm-6 col-lg-3">
|
|
<input type="checkbox"
|
|
id="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]"
|
|
name="[% IF ( itemtypeloo.cat == 1 ) %]searchcat[% ELSE %]limit[% END %]"
|
|
value="[% IF ( itemtypeloo.cat == 1 ) %][% itemtypeloo.code | html %][% ELSE %]mc-[% itemtypeloo.ccl | html %]:[% itemtypeloo.code | html %][% END %]"
|
|
/>
|
|
<label for="[% itemtypeloo.ccl FILTER remove(',') | html %]-[% itemtypeloo.number | html %]">
|
|
[% UNLESS ( Koha.Preference('OpacNoItemTypeImages')) %]
|
|
[% IF ( itemtypeloo.imageurl ) %]
|
|
<img src="[% itemtypeloo.imageurl | html %]" alt="[% itemtypeloo.description | html %]" />
|
|
[% END %]
|
|
|
|
[% END %]
|
|
<span class="itypetext">[% itemtypeloo.description | html %]</span>
|
|
</label>
|
|
</div>
|
|
[% IF ( loop.last ) %]</div>[% ELSE %][% UNLESS ( loop.count % 4 ) %]</div><div class="row">[% END %][% END %]
|
|
[% END %]
|
|
[% END %]
|
|
</fieldset>
|
|
[% END # /tab_panel#advsearch-advsearchloo.advanced_search_type %]
|
|
[% END # / FOREACH advancedsearchesloop %]
|
|
[% END # /tab_panels %]
|
|
[% END # /WRAPPER tabs#advsearches %]
|
|
</div> <!-- / .col -->
|
|
[% END # /IF OpacAdvSearchOptions %]
|
|
</div> <!-- /.row -->
|
|
|
|
<div id="advsearch_limits" class="row">
|
|
|
|
[%# Following on one line for translatability %]
|
|
[% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('location').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('location').size > 0 and expanded_options ) ) %]
|
|
[% IF ( singleBranchMode ) %]
|
|
<div class="col-sm-6 col-lg-3">
|
|
<!-- AVAILABILITY LIMITS -->
|
|
<div id="location" class="advsearch_limit">
|
|
<fieldset>
|
|
<legend>Availability: </legend>
|
|
<div style="margin-top:.4em">
|
|
<label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
|
|
</div>
|
|
</fieldset>
|
|
</div> <!-- / #location -->
|
|
<!-- /AVAILABILITY LIMITS -->
|
|
</div> <!-- / .col -->
|
|
[% ELSE %]
|
|
<div class="col-sm-6 col-lg-3">
|
|
<!-- AVAILABILITY LIMITS -->
|
|
<div id="location" class="advsearch_limit">
|
|
<fieldset>
|
|
<label for="branchloop">Location and availability:</label>
|
|
<select name="limit" id="branchloop">
|
|
<option value="">All libraries</option>
|
|
[% FOREACH BranchesLoo IN Branches.all( selected => opac_name ) %]
|
|
[% NEXT UNLESS BranchesLoo.public %]
|
|
[% IF BranchesLoo.selected %]
|
|
<option value="branch:[% BranchesLoo.branchcode | html %]" selected="selected">[% BranchesLoo.branchname | html %]</option>
|
|
[% ELSE %]
|
|
<option value="branch:[% BranchesLoo.branchcode | html %]">[% BranchesLoo.branchname | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
[% IF search_groups %]
|
|
<p>OR</p>
|
|
<label for="categoryloop">Groups of libraries</label>
|
|
<select name="limit" id="categoryloop">
|
|
<option value=""> -- none -- </option>
|
|
[% FOREACH sg IN search_groups %]
|
|
<option value="multibranchlimit:[% sg.id | html %]">[% sg.title | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
[% END %]
|
|
<div style="margin-top:.4em">
|
|
<label for="available-items"><input type="checkbox" id="available-items" name="limit" value="available" /> Only items currently available for loan or reference</label>
|
|
</div>
|
|
</fieldset>
|
|
</div> <!-- / #location -->
|
|
<!-- /AVAILABILITY LIMITS -->
|
|
</div> <!-- / .col -->
|
|
[% END # / IF singleBranchMode %]
|
|
[% END %]
|
|
|
|
[%# Following on one line for translatability %]
|
|
[% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('sorting').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('sorting').size > 0 and expanded_options ) ) %]
|
|
<div class="col-sm-6 col-lg-3">
|
|
<!-- RANK LIMITS -->
|
|
<div id="sortby" class="advsearch_limit">
|
|
<fieldset>
|
|
<label for="sort_by">Sort by:</label>
|
|
<select id="sort_by" name="sort_by">
|
|
[% INCLUDE 'resort_form.inc' %]
|
|
</select>
|
|
</fieldset>
|
|
</div>
|
|
<!-- RANK LIMITS -->
|
|
</div> <!-- / .col -->
|
|
[% END %]
|
|
|
|
[%# Following on one line for translatability %]
|
|
[% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('pubdate').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('pubdate').size > 0 and expanded_options ) ) %]
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div id="pubrange" class="advsearch_limit">
|
|
<!-- PUB RANGE OPTION -->
|
|
<fieldset>
|
|
<label for="limit-yr">Publication date range</label>
|
|
<input type="text" size="30" id="limit-yr" name="limit-yr" title="Enter search terms" value="" />
|
|
<div class="hint">For example: 1999-2001. You could also use "-1987" for everything published in and before 1987 or "2008-" for everything published in 2008 and after.</div>
|
|
</fieldset>
|
|
<!-- /PUB RANGE OPTION -->
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
|
|
[%# Following on one line for translatability %]
|
|
[% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('language').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('language').size > 0 and expanded_options ) ) %]
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div id="langfilter" class="advsearch_limit">
|
|
<fieldset>
|
|
<!-- LANGUAGE LIMIT -->
|
|
<label for="language-limit">Language</label>
|
|
<select id="language-limit" name="limit">
|
|
<option value="">No limit</option>
|
|
[% FOREACH search_languages_loo IN search_languages_loop %]
|
|
[% IF ( search_languages_loo.selected ) %]
|
|
<option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]" selected="selected">[% search_languages_loo.language_description | html %]</option>
|
|
[% ELSE %]
|
|
<option value="ln,rtrn:[% search_languages_loo.iso639_2_code | html %]">[% search_languages_loo.language_description | html %]</option>
|
|
[% END %]
|
|
[% END %]
|
|
</select>
|
|
<!-- /LANGUAGE LIMIT -->
|
|
</fieldset>
|
|
</div> <!-- / #langfilter -->
|
|
</div> <!-- / .col -->
|
|
[% END %]
|
|
</div> <!-- / .row -->
|
|
|
|
[%# Following on one line for translatability %]
|
|
[% IF ( ( OpacAdvSearchOptions and OpacAdvSearchOptions.grep('subtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.grep('subtype').size > 0 and expanded_options ) ) %]
|
|
[% IF ( usmarc ) %]
|
|
<div id="subtypes" class="row">
|
|
<!-- SUBTYPE LIMITS -->
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="advsearch_limit">
|
|
<fieldset>
|
|
<label for="subtype_audience">Audience</label>
|
|
<select id="subtype_audience" name="limit" class="subtype">
|
|
<option value="" selected="selected" class="menuheader">Any audience</option>
|
|
<option value="aud:a">Preschool</option>
|
|
<option value="aud:b">Primary</option>
|
|
<option value="aud:c">Pre-adolescent</option>
|
|
<option value="aud:d">Adolescent</option>
|
|
<option value="aud:e">Adult</option>
|
|
<option value="aud:f">Specialized</option>
|
|
<option value="aud:g">General</option>
|
|
<option value="aud:j">Juvenile</option>
|
|
</select>
|
|
</fieldset>
|
|
</div> <!-- /.advsearch_limit -->
|
|
</div> <!-- / .col-sm-6 col-lg-3 -->
|
|
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="advsearch_limit">
|
|
<fieldset>
|
|
<label for="subtype_content">Content</label>
|
|
<select id="subtype_content" name="limit" class="subtype">
|
|
<option value="" selected="selected" class="menuheader">Any content</option>
|
|
<option value="fic:1">Fiction</option>
|
|
<option value="fic:0">Non-fiction</option>
|
|
<option value="bio:b">Biography</option>
|
|
<option value="mus:j">Musical recording</option>
|
|
<option value="mus:i">Non-musical recording</option>
|
|
</select>
|
|
</fieldset>
|
|
</div> <!-- /.advsearch_limit -->
|
|
</div>
|
|
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="advsearch_limit">
|
|
<fieldset>
|
|
<label for="subtype_format">Format</label>
|
|
<select id="subtype_format" name="limit" class="subtype">
|
|
<option value="" selected="selected" class="menuheader">Any format</option>
|
|
<option value="l-format:ta">Regular print</option>
|
|
<option value="l-format:tb">Large print</option>
|
|
<option value="l-format:tc or l-format:fb">Braille</option>
|
|
<option value="">-----------</option>
|
|
<option value="l-format:sd">CD audio</option>
|
|
<option value="l-format:ss">Cassette recording</option>
|
|
<option value="l-format:vf">VHS tape / Videocassette</option>
|
|
<option value="l-format:vd">DVD video / Videodisc</option>
|
|
<option value="l-format:co">CD software</option>
|
|
<option value="l-format:cr">Website</option>
|
|
</select>
|
|
</fieldset>
|
|
</div> <!-- /.advsearch_limit -->
|
|
</div> <!-- / .col-sm-6 col-lg-3 -->
|
|
|
|
<div class="col-sm-6 col-lg-3">
|
|
<div class="advsearch_limit">
|
|
<fieldset>
|
|
<label for="subtype_additional">Additional content types for books/printed materials</label>
|
|
<select id="subtype_additional" name="limit" class="subtype">
|
|
<option value="">Any</option>
|
|
<option value="ctype:a">Abstracts/summaries</option>
|
|
<option value="ctype:b">Bibliographies</option>
|
|
<option value="ctype:c">Catalogs</option>
|
|
<option value="ctype:d">Dictionaries</option>
|
|
<option value="ctype:e">Encyclopedias </option>
|
|
<option value="ctype:f">Handbooks</option>
|
|
<option value="ctype:g">Legal articles</option>
|
|
<option value="ctype:i">Indexes</option>
|
|
<option value="ctype:j">Patent document</option>
|
|
<option value="ctype:k">Discographies</option>
|
|
<option value="ctype:l">Legislation</option>
|
|
<option value="ctype:m">Theses</option>
|
|
<option value="ctype:n">Surveys</option>
|
|
<option value="ctype:o">Reviews</option>
|
|
<option value="ctype:p">Programmed texts</option>
|
|
<option value="ctype:q">Filmographies</option>
|
|
<option value="ctype:r">Directories</option>
|
|
<option value="ctype:s">Statistics</option>
|
|
<option value="ctype:t">Technical reports</option>
|
|
<option value="ctype:v">Legal cases and case notes</option>
|
|
<option value="ctype:w">Law reports and digests</option>
|
|
<option value="ctype:z">Treaties </option>
|
|
</select>
|
|
</fieldset>
|
|
</div> <!-- /.advsearch_limit -->
|
|
</div> <!-- / .col-sm-6 col-lg-3 -->
|
|
</div> <!-- / #subtypes.row -->
|
|
<!-- SUBTYPE LIMITS -->
|
|
[% END # / IF usmarc %]
|
|
|
|
[% IF ( UNIMARC ) %]
|
|
<div id="subtypes_unimarc" class="row">
|
|
<!-- SUBTYPE LIMITS -->
|
|
[% INCLUDE 'subtypes_unimarc.inc' %]
|
|
</div>
|
|
[% END %]
|
|
[% END # / IF expanded_options %]
|
|
|
|
[% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 and expanded_options ) or ( OpacAdvSearchOptions and OpacAdvSearchOptions.size > 0 and not expanded_options ) %]
|
|
<div class="text-center">
|
|
<fieldset class="action">
|
|
<!-- SEARCH BUTTONS -->
|
|
[% PROCESS searchbuttons %]
|
|
<!-- /SEARCH BUTTONS -->
|
|
</fieldset>
|
|
</div>
|
|
[% END %]
|
|
</div> <!-- / .container-fluid -->
|
|
</div> <!-- / .main -->
|
|
</form>
|
|
|
|
[% INCLUDE 'opac-bottom.inc' %]
|
|
[% BLOCK searchbuttons %]
|
|
<p>
|
|
<input class="btn btn-primary" type="submit" accesskey="s" name="do" title="Search" value="Search" />
|
|
|
|
[% IF ( OpacAdvSearchMoreOptions and OpacAdvSearchMoreOptions.size > 0 ) %]
|
|
[% IF expanded_options %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=0" class="btn btn-default more-less-options">Fewer options</a>
|
|
[% ELSIF not expanded_options %]
|
|
<a href="/cgi-bin/koha/opac-search.pl?expanded_options=1" class="btn btn-default more-less-options">More options</a>
|
|
[% END %]
|
|
[% END %]
|
|
|
|
<a href="/cgi-bin/koha/opac-search.pl?do=Clear" class="btn btn-default new-search">New search</a>
|
|
</p>
|
|
[% END %]
|
|
|
|
[% BLOCK jsinclude %]
|
|
[% Asset.js("lib/jquery/plugins/jquery.deserialize.min.js") | $raw %]
|
|
<script>
|
|
window.addEventListener('pageshow', function( e ){
|
|
$('.form-control:visible').prop('disabled' , false );
|
|
});
|
|
$(document).ready(function() {
|
|
[% IF search_groups %]
|
|
function branch_limit() {
|
|
if( $("#branchloop").val() != "" ){
|
|
$("#categoryloop").val("").prop('disabled',true);
|
|
} else {
|
|
$("#categoryloop").prop('disabled',false);
|
|
}
|
|
if ( $("#categoryloop").val() != "" ){
|
|
$("#branchloop").val("").prop('disabled',true);
|
|
} else {
|
|
$("#branchloop").prop('disabled',false);
|
|
}
|
|
}
|
|
branch_limit();
|
|
$("#branchloop,#categoryloop").on("change",function(){
|
|
branch_limit();
|
|
});
|
|
[% END %]
|
|
|
|
if( $("#advsearches .tab-pane.active").length < 1 ){
|
|
$("#advsearches li:first a").tab("show");
|
|
}
|
|
|
|
$('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide();
|
|
|
|
[% IF ( ReturnToSearch ) %]
|
|
if (form_serialized = JSON.parse( Cookies.get("form_serialized") ) ) {
|
|
// Add missing term inputs if there were more than 3
|
|
var count = (form_serialized.match(/&q=/g) || []).length;
|
|
for(var i = 3 ; i < count ; i++) {
|
|
$("a.ButtonPlus:last").click();
|
|
}
|
|
$('#advsearch form').deserialize(form_serialized);
|
|
}
|
|
if (form_serialized_limits = JSON.parse( Cookies.get("form_serialized_limits") ) ) {
|
|
$('#language-limit') .val(form_serialized_limits[0]);
|
|
$('#branchloop') .val(form_serialized_limits[1]);
|
|
$('#subtype_audience') .val(form_serialized_limits[2]);
|
|
$('#subtype_content') .val(form_serialized_limits[3]);
|
|
$('#subtype_format') .val(form_serialized_limits[4]);
|
|
$('#subtype_additional') .val(form_serialized_limits[5]);
|
|
$('#locloop') .val(form_serialized_limits[6]);
|
|
}
|
|
[% ELSE %]
|
|
//Clear all form cookies
|
|
Cookies.remove("form_serialized", { path: '/'});
|
|
Cookies.remove("form_serialized_limits", { path: '/'});
|
|
Cookies.remove("search_path_code", { path: '/'});
|
|
[% END %]
|
|
$('#advsearch_form').submit(function() {
|
|
$('[name^="limit"]').each(function(){
|
|
if( $(this).val() == '' ){
|
|
$(this).prop("disabled","disabled");
|
|
}
|
|
});
|
|
$(".search-term-row").each(function(){
|
|
if( $(this).find('input[name="q"]').val() == "" ){
|
|
$(this).find('input[name="q"]').prop("disabled","disabled");
|
|
$(this).find('select[name="op"]').prop("disabled","disabled");
|
|
$(this).find('select[name="idx"]').prop("disabled","disabled");
|
|
}
|
|
});
|
|
form_serialized = $(this).serialize();
|
|
Cookies.set("form_serialized", JSON.stringify( form_serialized ), { path: '/', sameSite: 'Lax' });
|
|
form_serialized_limits = [
|
|
$('#language-limit').val(), $('#branchloop').val(),
|
|
$('#subtype_audience').val(), $('#subtype_content').val(),
|
|
$('#subtype_format').val(), $('#subtype_additional').val(),
|
|
$('#locloop').val()
|
|
];
|
|
Cookies.set("form_serialized_limits", JSON.stringify( form_serialized_limits ),{ path: '/', sameSite: 'Lax' });
|
|
[% IF ( expanded_options ) %]
|
|
Cookies.set("search_path_code", 'exs', { path: '/', sameSite: 'Lax' });
|
|
[% ELSE %]
|
|
Cookies.set("search_path_code", 'ads', { path: '/', sameSite: 'Lax' });
|
|
[% END %]
|
|
});
|
|
|
|
});
|
|
/* This function allows to display a new field to search.
|
|
*/
|
|
$(document).on("click", '.ButtonPlus', function(e) {
|
|
e.preventDefault();
|
|
$('.ButtonLess').show();
|
|
var thisLine = $(this).parent().parent();
|
|
var newLine = thisLine.clone();
|
|
$(newLine).find('.search-term-input select[name="op"]').first().prop("disabled",false).show();
|
|
newLine.find('input').val('');
|
|
thisLine.after(newLine);
|
|
});
|
|
|
|
$(document).on("click", '.ButtonLess', function(e) {
|
|
e.preventDefault();
|
|
if( $("a.ButtonLess").length <= 2 ) {
|
|
$('.ButtonLess').hide();
|
|
}
|
|
$(this).parent().parent().remove();
|
|
$('.search-term-row .search-term-input select[name="op"]').first().prop("disabled",true).hide();
|
|
});
|
|
</script>
|
|
[% END %]
|