Lines 51-83
Link Here
|
51 |
|
51 |
|
52 |
<form action="search.pl" method="get"> |
52 |
<form action="search.pl" method="get"> |
53 |
<div id="advanced-search"> |
53 |
<div id="advanced-search"> |
54 |
<input type="hidden" name="advsearch" value="1"/> |
54 |
[% IF edit_filter %] |
55 |
<h1>Advanced search</h1> |
|
|
56 |
[% IF searchid %] |
57 |
<div id="previous_search_link"></div> |
58 |
[% END %] |
59 |
|
60 |
<!-- SEARCH BUTTONS --> |
61 |
<div id="toolbar" class="btn-toolbar"> |
55 |
<div id="toolbar" class="btn-toolbar"> |
|
|
56 |
<legend>Editing filter: [% edit_filter.name | html %]</legend> |
62 |
<div class="btn-group"> |
57 |
<div class="btn-group"> |
63 |
<button class="btn btn-primary" type="submit" accesskey="s"><i class="fa fa-search"></i> Search</button> |
58 |
<label for="filter_edit_opac">Show in OPAC?</label> |
64 |
</div> |
59 |
[% IF edit_filter.opac %] |
65 |
<div class="btn-group"> |
60 |
<input type="checkbox" id="show_filter_opac" name="show_filter_opac" checked="checked"> |
66 |
[% IF ( expanded_options ) %] |
61 |
[% ELSE %] |
67 |
<a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=0" class="btn btn-link"><i class="fa fa-search-minus"></i> Fewer options</a> |
62 |
<input type="checkbox" id="show_filter_opac" name="show_filter_opac"> |
68 |
</div> |
63 |
[% END %] |
69 |
[% ELSE %] |
64 |
<label for="filter_edit_staff_client">Show in Staff client?</label> |
70 |
<a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=1" class="btn btn-link"><i class="fa fa-search-plus"></i> More options</a> |
65 |
[% IF edit_filter.staff_client %] |
|
|
66 |
<input type="checkbox" id="filter_edit_staff_client" name="filter_edit_staff_client" checked="checked"> |
67 |
[% ELSE %] |
68 |
<input type="checkbox" id="filter_edit_staff_client" name="filter_edit_staff_client"> |
69 |
[% END %] |
71 |
</div> |
70 |
</div> |
72 |
[% END %] |
71 |
<hr> |
73 |
<div class="btn-group"> |
72 |
<div class="btn-group"> |
74 |
<a href="/cgi-bin/koha/catalogue/search.pl?do=Clear&expanded_options=[% expanded_options | uri %]" class="btn btn-link"><i class="fa fa-trash"></i> Clear fields</a> |
73 |
<button id="save_filter" class="btn btn-default"><i class="fa fa-save"></i> Save filter</button> |
|
|
74 |
<button class="btn btn-default" type="submit" accesskey="s"><i class="fa fa-search"></i> Search using filter</button> |
75 |
</div> |
75 |
</div> |
76 |
<div class="btn-group"> |
76 |
<div class="btn-group"> |
77 |
<a href="/cgi-bin/koha/catalogue/itemsearch.pl" class="btn btn-link"><i class="fa fa-search"></i> Go to item search</a> |
77 |
<a href="/cgi-bin/koha/catalogue/search.pl?do=Clear&expanded_options=[% expanded_options | uri %]" class="btn btn-link"><i class="fa fa-trash"></i> Cancel</a> |
78 |
</div> |
78 |
</div> |
79 |
</div> <!-- /#toolbar --> |
79 |
</div> |
80 |
<!-- /SEARCH BUTTONS --> |
80 |
[% ELSE %] |
|
|
81 |
<input type="hidden" name="advsearch" value="1"/> |
82 |
<h1>Advanced search</h1> |
83 |
|
84 |
<!-- SEARCH BUTTONS --> |
85 |
<div id="toolbar" class="btn-toolbar"> |
86 |
<div class="btn-group"> |
87 |
<button class="btn btn-default" type="submit" accesskey="s"><i class="fa fa-search"></i> Search</button> |
88 |
</div> |
89 |
<div class="btn-group"> |
90 |
[% IF ( expanded_options ) %] |
91 |
<a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=0" class="btn btn-link"><i class="fa fa-search-minus"></i> Fewer options</a> |
92 |
</div> |
93 |
[% ELSE %] |
94 |
<a href="/cgi-bin/koha/catalogue/search.pl?expanded_options=1" class="btn btn-link"><i class="fa fa-search-plus"></i> More options</a> |
95 |
</div> |
96 |
[% END %] |
97 |
<div class="btn-group"> |
98 |
<a href="/cgi-bin/koha/catalogue/search.pl?do=Clear&expanded_options=[% expanded_options | uri %]" class="btn btn-link"><i class="fa fa-trash"></i> Clear fields</a> |
99 |
</div> |
100 |
<div class="btn-group"> |
101 |
<a href="/cgi-bin/koha/catalogue/itemsearch.pl" class="btn btn-link"><i class="fa fa-search"></i> Go to item search</a> |
102 |
</div> |
103 |
</div> <!-- /#toolbar --> |
104 |
<!-- /SEARCH BUTTONS --> |
105 |
[% END %] |
81 |
|
106 |
|
82 |
[% IF ( outer_servers_loop ) %] |
107 |
[% IF ( outer_servers_loop ) %] |
83 |
<!-- DATABASES --> |
108 |
<!-- DATABASES --> |
Lines 115-180
Link Here
|
115 |
<!-- /REMOTE DATABASES --> |
140 |
<!-- /REMOTE DATABASES --> |
116 |
[% END %] |
141 |
[% END %] |
117 |
|
142 |
|
118 |
<!-- BOOLEAN SEARCH OPTIONS --> |
143 |
<!-- BOOLEAN SEARCH OPTIONS --> |
119 |
<fieldset id="searchterms"> |
144 |
<fieldset id="searchterms"> |
120 |
<legend>Search for </legend> |
145 |
<legend>Search for </legend> |
121 |
[% FOREACH query IN queries %] |
146 |
[% FOREACH query IN operands %] |
122 |
[% IF ( expanded_options ) %] |
147 |
[% IF ( expanded_options ) %] |
123 |
[% IF loop.first %] |
148 |
[% IF loop.first %] |
124 |
<div class="search-term-row" style="text-indent: 4.25em;"> |
149 |
<div class="search-term-row" style="text-indent: 4.25em;"> |
125 |
[% ELSE %] |
150 |
[% ELSE %] |
126 |
<div class="search-term-row"> |
151 |
<div class="search-term-row"> |
127 |
[% SET opindex = loop.index - 1 %] |
152 |
[% SET opindex = loop.index - 1 %] |
128 |
<select name="op"> |
153 |
<select name="op"> |
129 |
[% IF operators.$opindex == 'OR' %] |
154 |
[% IF operators.$opindex == 'OR' %] |
130 |
<option value="AND">and</option> |
155 |
<option value="AND">and</option> |
131 |
<option value="OR" selected="selected">or</option> |
156 |
<option value="OR" selected="selected">or</option> |
132 |
<option value="NOT">not</option> |
157 |
<option value="NOT">not</option> |
133 |
[% ELSIF operators.$opindex == 'NOT' %] |
158 |
[% ELSIF operators.$opindex == 'NOT' %] |
134 |
<option value="AND">and</option> |
159 |
<option value="AND">and</option> |
135 |
<option value="OR">or</option> |
160 |
<option value="OR">or</option> |
136 |
<option value="NOT" selected="selected">not</option> |
161 |
<option value="NOT" selected="selected">not</option> |
137 |
[% ELSE %] |
|
|
138 |
<option value="AND" selected="selected">and</option> |
139 |
<option value="OR">or</option> |
140 |
<option value="NOT">not</option> |
141 |
[% END %] |
142 |
</select> |
143 |
[% END # /IF loop.first %] |
144 |
[% ELSE %] |
162 |
[% ELSE %] |
145 |
<div> |
163 |
<option value="AND" selected="selected">and</option> |
146 |
[% END # /IF ( expanded_options ) %] |
164 |
<option value="OR">or</option> |
147 |
|
165 |
<option value="NOT">not</option> |
148 |
[% SET preselect = 'ms_' _ indexes.${loop.index}.replace(',','comma') %] |
166 |
[% END %] |
149 |
[% INCLUDE 'search_indexes.inc' %] |
167 |
</select> |
150 |
<input type="text" size="30" name="q" title="Enter search terms" value="[% query | html %]" /> |
168 |
[% END %] |
151 |
[% IF ( expanded_options ) %] |
169 |
[% ELSE %] |
152 |
[% IF ( loop.last ) %] |
170 |
<div> |
153 |
<a href="JavaScript:add_field();" id="ButtonPlus" title="Add another field">[+]</a> |
171 |
[% END %] |
154 |
[% END %] |
172 |
[% SET preselect = 'ms_' _ indexes.${loop.index}.replace(',','comma') %] |
155 |
[% IF ( loop.first ) %] |
173 |
[% INCLUDE 'search_indexes.inc' %] |
156 |
<label for="scan">Scan indexes:</label> <input type="checkbox" name="scan" id="scan" value="1" /> |
174 |
<input type="text" size="30" name="q" title="Enter search terms" value="[% query | html %]" /> |
|
|
175 |
[% IF ( expanded_options ) %] |
176 |
[% IF ( loop.last ) %] |
177 |
<a href="JavaScript:add_field();" id="ButtonPlus" title="Add another field">[+]</a> |
178 |
[% END %] |
179 |
[% IF ( loop.first ) %] |
180 |
<label for="scan">Scan indexes:</label> <input type="checkbox" name="scan" id="scan" value="1" /> |
181 |
[% END %] |
182 |
[% END %] |
183 |
</div> |
184 |
[% END %] |
185 |
[% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %] |
186 |
[% IF ( expanded_options ) %] |
187 |
<p> |
188 |
[% IF Koha.Preference('ElasticsearchMARCFormat') == 'ARRAY' %] |
189 |
<label><input type="checkbox" name="whole_record" /> Search entire MARC record</label> |
157 |
[% END %] |
190 |
[% END %] |
158 |
[% END # /IF ( expanded_options ) %] |
191 |
<span id="weight_search"> |
159 |
</div> <!-- /.search-term-row --> |
192 |
<label><input type="checkbox" name="weight_search" checked="checked" /> Apply field weights to search</label> |
160 |
[% END # /FOREACH query IN queries %] |
193 |
</span> |
161 |
|
194 |
<p> |
162 |
[% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %] |
195 |
[% ELSE %] |
163 |
[% IF ( expanded_options ) %] |
196 |
<input type="hidden" name="weight_search" value="1" /> |
164 |
<p> |
197 |
[% END %] |
165 |
[% IF Koha.Preference('ElasticsearchMARCFormat') == 'ARRAY' %] |
198 |
[% END %] |
166 |
<label><input type="checkbox" name="whole_record" /> Search entire MARC record</label> |
199 |
</fieldset> |
167 |
[% END %] |
200 |
<!-- /BOOLEAN SEARCH OPTIONS --> |
168 |
<span id="weight_search"> |
|
|
169 |
<label><input type="checkbox" name="weight_search" checked="checked" /> Apply field weights to search</label> |
170 |
</span> |
171 |
<p> |
172 |
[% ELSE %] |
173 |
<input type="hidden" name="weight_search" value="1" /> |
174 |
[% END # /IF ( expanded_options ) %] |
175 |
[% END #/IF Koha.Preference('SearchEngine') %] |
176 |
</fieldset> <!-- /#searchterms --> |
177 |
<!-- /BOOLEAN SEARCH OPTIONS --> |
178 |
</div> <!-- /#advanced-search --> |
201 |
</div> <!-- /#advanced-search --> |
179 |
|
202 |
|
180 |
<!-- MC-TYPE LIMITS --> |
203 |
<!-- MC-TYPE LIMITS --> |
Lines 372-377
Link Here
|
372 |
[% MACRO jsinclude BLOCK %] |
395 |
[% MACRO jsinclude BLOCK %] |
373 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
396 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
374 |
[% Asset.js("js/browser.js") | $raw %] |
397 |
[% Asset.js("js/browser.js") | $raw %] |
|
|
398 |
[% Asset.css("css/humanmsg.css") | $raw %] |
399 |
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %] |
375 |
<script> |
400 |
<script> |
376 |
/** |
401 |
/** |
377 |
* Function add_field(); |
402 |
* Function add_field(); |
Lines 427-432
Link Here
|
427 |
browser.show_back_link(); |
452 |
browser.show_back_link(); |
428 |
[% END %] |
453 |
[% END %] |
429 |
|
454 |
|
|
|
455 |
[% IF edit_filter %] |
456 |
$("#save_filter").click(function(e){ |
457 |
e.preventDefault(); |
458 |
let operators = []; |
459 |
let indexes = []; |
460 |
let operands = []; |
461 |
let limits =[]; |
462 |
let opac = $("#show_filter_opac").prop('checked'); |
463 |
let staff_client = $("#show_filter_staff_client").prop('checked'); |
464 |
$("select[name='op']").each(function(){ |
465 |
operators.push( $(this).val() ); |
466 |
}); |
467 |
$("select[name='idx']").each(function(){ |
468 |
indexes.push( $(this).val() ); |
469 |
}); |
470 |
$("input[name='q']").each(function(){ |
471 |
operands.push( $(this).val() ); |
472 |
}); |
473 |
$("select[name='limit'],input[name='limit']:checked").each(function(){ |
474 |
if( $(this).val() != ""){ |
475 |
limits.push( $(this).val() ); |
476 |
} |
477 |
}); |
478 |
let year_limit = $("#limit-yr").val(); |
479 |
if( year_limit ){ |
480 |
limits.push( "yr,st-numeric:"+year_limit ); |
481 |
} |
482 |
let options = { |
483 |
url: '/api/v1/search_filters/'+ [% edit_filter.id | html %], |
484 |
method: "PUT", |
485 |
contentType: "application/json", |
486 |
data: JSON.stringify({ |
487 |
name: "[% edit_filter.name | html %]", |
488 |
filter_query: JSON.stringify({ operands: operands, indexes: indexes, operators:operators }), |
489 |
filter_limits: JSON.stringify({ limits: limits }), |
490 |
opac: opac, |
491 |
staff_client: staff_client, |
492 |
}) |
493 |
}; |
494 |
$.ajax(options) |
495 |
.then(function(result) { |
496 |
humanMsg.displayAlert( _("Saved filter: ") + result.name , { className: 'human Success' } ); |
497 |
}) |
498 |
.fail( function(err){ |
499 |
humanMsg.displayAlert( _("There was an error during saving:") + err.responseText, { className: 'humanError' } ); |
500 |
}); |
501 |
|
502 |
|
503 |
}); |
504 |
[% END %] |
505 |
|
506 |
|
430 |
}); |
507 |
}); |
431 |
</script> |
508 |
</script> |
432 |
[% END %] |
509 |
[% END %] |