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