Lines 29-35
Link Here
|
29 |
$(document).ready(function() { |
29 |
$(document).ready(function() { |
30 |
$("#tabs").tabs(); |
30 |
$("#tabs").tabs(); |
31 |
$('.delete').click(function() { |
31 |
$('.delete').click(function() { |
32 |
$(this).parents('tr').remove(); |
32 |
if( $(this).hasClass('mandatory') && $(".mandatory[data-field_name="+$(this).attr('data-field_name')+"]").length < 2 ){ |
|
|
33 |
alert("This field is mandatory and must have at least one mapping"); |
34 |
return; |
35 |
} else { |
36 |
$(this).parents('tr').remove(); |
37 |
} |
33 |
}); |
38 |
}); |
34 |
|
39 |
|
35 |
$("table.mappings").tableDnD( { |
40 |
$("table.mappings").tableDnD( { |
Lines 87-92
a.add, a.delete {
Link Here
|
87 |
[% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %] |
92 |
[% tx("(search field {field_name} with mapping {marc_field}.)", { field_name = m.values.field_name, marc_field = m.values.marc_field }) | html %] |
88 |
[% CASE 'invalid_field_weight' %] |
93 |
[% CASE 'invalid_field_weight' %] |
89 |
[% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %] |
94 |
[% tx("Invalid field weight '{weight}', must be a positive decimal number.", { weight = m.weight }) | html %] |
|
|
95 |
[% CASE 'missing_mandatory_fields' %] |
96 |
[% t("You attempted to delete all mappings for a required index, you must leave at least one mapping") | $raw %] |
90 |
[% CASE 'error_on_update_es_mappings' %] |
97 |
[% CASE 'error_on_update_es_mappings' %] |
91 |
[% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %] |
98 |
[% tx("An error occurred when updating Elasticsearch index mappings: {message}.", { message = m.message }) | html %] |
92 |
[% CASE 'reindex_required' %] |
99 |
[% CASE 'reindex_required' %] |
Lines 176-232
a.add, a.delete {
Link Here
|
176 |
</thead> |
183 |
</thead> |
177 |
<tbody> |
184 |
<tbody> |
178 |
[% FOREACH search_field IN all_search_fields %] |
185 |
[% FOREACH search_field IN all_search_fields %] |
|
|
186 |
[% IF search_field.mandatory %] |
187 |
[% SET is_readonly = "readonly" %] |
188 |
[% ELSE %] |
189 |
[% SET is_readonly = "" %] |
190 |
[% END %] |
179 |
<tr> |
191 |
<tr> |
180 |
<td> |
192 |
<td> |
181 |
<input type="text" name="search_field_name" value="[% search_field.name | html %]" /> |
193 |
<input type="text" name="search_field_name" value="[% search_field.name | html %]" [% is_readonly %]/> |
182 |
</td> |
194 |
</td> |
183 |
<td> |
195 |
<td> |
184 |
<input type="text" name="search_field_label" value="[% search_field.label | html %]" /> |
196 |
<input type="text" name="search_field_label" value="[% search_field.label | html %]" [% is_readonly %]/> |
185 |
</td> |
|
|
186 |
<td> |
197 |
<td> |
187 |
<select name="search_field_type"> |
198 |
<<<<<<< HEAD |
188 |
<option value=""></option> |
199 |
[% IF is_readonly %] |
189 |
[% IF search_field.type == "string" %] |
200 |
<input type="hidden" name="search_field_type" value="[% search_field.type | html %]" /> |
190 |
<option value="string" selected="selected">String</option> |
201 |
<select name="search_field_type" disabled> |
191 |
[% ELSE %] |
202 |
[% ELSE %] |
192 |
<option value="string">String</option> |
203 |
<select name="search_field_type"> |
193 |
[% END %] |
204 |
<option value=""></option> |
194 |
[% IF search_field.type == "date" %] |
205 |
[% IF search_field.type == "string" %] |
195 |
<option value="date" selected="selected">Date</option> |
206 |
<option value="string" selected="selected">String</option> |
196 |
[% ELSE %] |
207 |
[% ELSE %] |
197 |
<option value="date">Date</option> |
208 |
<option value="string">String</option> |
198 |
[% END %] |
209 |
[% END %] |
199 |
[% IF search_field.type == "year" %] |
210 |
[% IF search_field.type == "date" %] |
200 |
<option value="year" selected="selected">Year</option> |
211 |
<option value="date" selected="selected">Date</option> |
201 |
[% ELSE %] |
212 |
[% ELSE %] |
202 |
<option value="year">Year</option> |
213 |
<option value="date">Date</option> |
203 |
[% END %] |
214 |
[% END %] |
204 |
[% IF search_field.type == "number" %] |
215 |
[% IF search_field.type == "year" %] |
205 |
<option value="number" selected="selected">Number</option> |
216 |
<option value="year" selected="selected">Year</option> |
206 |
[% ELSE %] |
217 |
[% ELSE %] |
207 |
<option value="number">Number</option> |
218 |
<option value="year">Year</option> |
208 |
[% END %] |
219 |
[% END %] |
209 |
[% IF search_field.type == "boolean" %] |
220 |
[% IF search_field.type == "number" %] |
210 |
<option value="boolean" selected="selected">Boolean</option> |
221 |
<option value="number" selected="selected">Number</option> |
211 |
[% ELSE %] |
222 |
[% ELSE %] |
212 |
<option value="boolean">Boolean</option> |
223 |
<option value="number">Number</option> |
213 |
[% END %] |
224 |
[% END %] |
214 |
[% IF search_field.type == "sum" %] |
225 |
[% IF search_field.type == "boolean" %] |
215 |
<option value="sum" selected="selected">Sum</option> |
226 |
<option value="boolean" selected="selected">Boolean</option> |
216 |
[% ELSE %] |
227 |
[% ELSE %] |
217 |
<option value="sum">Sum</option> |
228 |
<option value="boolean">Boolean</option> |
218 |
[% END %] |
229 |
[% END %] |
219 |
[% IF search_field.type == "isbn" %] |
230 |
[% IF search_field.type == "sum" %] |
220 |
<option value="isbn" selected="selected">ISBN</option> |
231 |
<option value="sum" selected="selected">Sum</option> |
221 |
[% ELSE %] |
232 |
[% ELSE %] |
222 |
<option value="isbn">ISBN</option> |
233 |
<option value="sum">Sum</option> |
223 |
[% END %] |
234 |
[% END %] |
224 |
[% IF search_field.type == "stdno" %] |
235 |
[% IF search_field.type == "isbn" %] |
225 |
<option value="stdno" selected="selected">Std. Number</option> |
236 |
<option value="isbn" selected="selected">ISBN</option> |
226 |
[% ELSE %] |
237 |
[% ELSE %] |
227 |
<option value="stdno">Std. Number</option> |
238 |
<option value="isbn">ISBN</option> |
228 |
[% END %] |
239 |
[% END %] |
229 |
</select> |
240 |
[% IF search_field.type == "stdno" %] |
|
|
241 |
<option value="stdno" selected="selected">Std. Number</option> |
242 |
[% ELSE %] |
243 |
<option value="stdno">Std. Number</option> |
244 |
[% END %] |
245 |
</select> |
246 |
[% END %] |
230 |
</td> |
247 |
</td> |
231 |
<td> |
248 |
<td> |
232 |
<select name="search_field_staff_client"> |
249 |
<select name="search_field_staff_client"> |
Lines 278-351
a.add, a.delete {
Link Here
|
278 |
</thead> |
295 |
</thead> |
279 |
<tbody> |
296 |
<tbody> |
280 |
[% FOREACH mapping IN index.mappings %] |
297 |
[% FOREACH mapping IN index.mappings %] |
281 |
<tr> |
298 |
[% IF mapping.search_field_mandatory && mapping.search_field_label != loop.next.search_field_label && mapping.search_field_label != loop.prev.search_field_label %] |
282 |
<td> |
299 |
<tr> |
283 |
<input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" /> |
300 |
<td> |
284 |
<input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]"> |
301 |
<input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" /> |
285 |
[% mapping.search_field_label | html %] |
302 |
<input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]"> |
286 |
</td> |
303 |
[% mapping.search_field_label | html %] |
287 |
<td> |
304 |
</td> |
288 |
<select name="mapping_sort"> |
305 |
<td> |
289 |
[% IF mapping.sort == 'undef' %] |
306 |
<input type="hidden" name="mapping_sort" value="[% mapping.sort | html %]" readonly />[% IF mapping.sort == 'undef' %]Undef[% ELSE %][% mapping.sort | html %][% END %] |
290 |
<option value="undef" selected="selected">Undef</option> |
307 |
</td> |
291 |
[% ELSE %] |
308 |
<td> |
292 |
<option value="undef">Undef</option> |
309 |
<input type="hidden" name="mapping_facet" value="[% mapping.facet | html %]" readonly />[% IF mapping.facet == 1 %]Yes[% ELSE %]No[% END %] |
293 |
[% END %] |
310 |
</td> |
294 |
[% IF mapping.sort == 0 %] |
311 |
<td> |
295 |
<option value="0" selected="selected">0</option> |
312 |
<input type="hidden" name="mapping_suggestible" value="[% mapping.suggestible | html %]" readonly />[% IF mapping.suggestible == 1 %]Yes[% ELSE %]No[% END %] |
296 |
[% ELSE %] |
313 |
</td> |
297 |
<option value="0">0</option> |
314 |
<td> |
298 |
[% END %] |
315 |
<input type="hidden" name="mapping_search" value="[% mapping.search | html %]" readonly />[% IF mapping.search == 1 %]Yes[% ELSE %]No[% END %] |
299 |
[% IF mapping.sort == 1 %] |
316 |
</td> |
300 |
<option value="1" selected="selected">1</option> |
317 |
<td> |
301 |
[% ELSE %] |
318 |
<input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" /> |
302 |
<option value="1">1</option> |
319 |
</td> |
303 |
[% END %] |
320 |
</tr> |
304 |
</select> |
321 |
[% ELSE %] |
305 |
</td> |
322 |
<tr> |
306 |
<td> |
323 |
<td> |
307 |
[% IF mapping.is_facetable %] |
324 |
<input type="hidden" name="mapping_index_name" value="[% index.index_name | html %]" /> |
308 |
<select name="mapping_facet"> |
325 |
<input type="hidden" name="mapping_search_field_name" value="[% mapping.search_field_name | html %]"> |
309 |
[% IF mapping.facet %] |
326 |
[% mapping.search_field_label | html %] |
310 |
<option value="0">No</option> |
327 |
</td> |
311 |
<option value="1" selected="selected">Yes</option> |
328 |
<td> |
|
|
329 |
<select name="mapping_sort"> |
330 |
[% IF mapping.sort == 'undef' %] |
331 |
<option value="undef" selected="selected">Undef</option> |
332 |
[% ELSE %] |
333 |
<option value="undef">Undef</option> |
334 |
[% END %] |
335 |
[% IF mapping.sort == 0 %] |
336 |
<option value="0" selected="selected">0</option> |
337 |
[% ELSE %] |
338 |
<option value="0">0</option> |
339 |
[% END %] |
340 |
[% IF mapping.sort == 1 %] |
341 |
<option value="1" selected="selected">1</option> |
342 |
[% ELSE %] |
343 |
<option value="1">1</option> |
344 |
[% END %] |
345 |
</select> |
346 |
</td> |
347 |
<td> |
348 |
[% IF mapping.is_facetable %] |
349 |
<select name="mapping_facet"> |
350 |
[% IF mapping.facet %] |
351 |
<option value="0">No</option> |
352 |
<option value="1" selected="selected">Yes</option> |
353 |
[% ELSE %] |
354 |
<option value="0" selected="selected">No</option> |
355 |
<option value="1">Yes</option> |
356 |
[% END %] |
357 |
</select> |
312 |
[% ELSE %] |
358 |
[% ELSE %] |
313 |
<option value="0" selected="selected">No</option> |
359 |
<input type="hidden" name="mapping_facet" value="0" /> |
314 |
<option value="1">Yes</option> |
360 |
No |
315 |
[% END %] |
361 |
[% END %] |
316 |
</select> |
362 |
</td> |
317 |
[% ELSE %] |
363 |
<td> |
318 |
<input type="hidden" name="mapping_facet" value="0" /> |
364 |
<select name="mapping_suggestible"> |
319 |
No |
365 |
[% IF mapping.suggestible %] |
320 |
[% END %] |
366 |
<option value="0">No</option> |
321 |
</td> |
367 |
<option value="1" selected="selected">Yes</option> |
322 |
<td> |
368 |
[% ELSE %] |
323 |
<select name="mapping_suggestible"> |
369 |
<option value="0" selected="selected">No</option> |
324 |
[% IF mapping.suggestible %] |
370 |
<option value="1">Yes</option> |
325 |
<option value="0">No</option> |
371 |
[% END %] |
326 |
<option value="1" selected="selected">Yes</option> |
372 |
</select> |
327 |
[% ELSE %] |
373 |
</td> |
328 |
<option value="0" selected="selected">No</option> |
374 |
<td> |
329 |
<option value="1">Yes</option> |
375 |
<select name="mapping_search"> |
330 |
[% END %] |
376 |
[% IF mapping.search %] |
331 |
</select> |
377 |
<option value="0">No</option> |
332 |
</td> |
378 |
<option value="1" selected="selected">Yes</option> |
333 |
<td> |
379 |
[% ELSE %] |
334 |
<select name="mapping_search"> |
380 |
<option value="0" selected="selected">No</option> |
335 |
[% IF mapping.search %] |
381 |
<option value="1">Yes</option> |
336 |
<option value="0">No</option> |
382 |
[% END %] |
337 |
<option value="1" selected="selected">Yes</option> |
383 |
</select> |
|
|
384 |
</td> |
385 |
<td> |
386 |
<input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" /> |
387 |
</td> |
388 |
[% IF mapping.search_field_mandatory %] |
389 |
<td><a class="btn btn-default btn-xs delete mandatory" data-field_name="[% mapping.search_field_name %]" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td> |
338 |
[% ELSE %] |
390 |
[% ELSE %] |
339 |
<option value="0" selected="selected">No</option> |
391 |
<td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td> |
340 |
<option value="1">Yes</option> |
|
|
341 |
[% END %] |
392 |
[% END %] |
342 |
</select> |
393 |
</tr> |
343 |
</td> |
394 |
[% END %] |
344 |
<td> |
|
|
345 |
<input name="mapping_marc_field" type="text" value="[% mapping.marc_field | html %]" /> |
346 |
</td> |
347 |
<td><a class="btn btn-default btn-xs delete" style="cursor: pointer;"><i class="fa fa-trash"></i> Delete</a></td> |
348 |
</tr> |
349 |
[% END %] |
395 |
[% END %] |
350 |
</tbody> |
396 |
</tbody> |
351 |
<tfoot> |
397 |
<tfoot> |
352 |
- |
|
|