Lines 16-24
Link Here
|
16 |
[% INCLUDE 'doc-head-close.inc' %] |
16 |
[% INCLUDE 'doc-head-close.inc' %] |
17 |
|
17 |
|
18 |
<style> |
18 |
<style> |
19 |
.required { |
19 |
#tag-error { |
20 |
background-color: #C00; |
20 |
display: block; |
21 |
} |
21 |
margin-top: 5px; |
|
|
22 |
} |
22 |
</style> |
23 |
</style> |
23 |
|
24 |
|
24 |
</head> |
25 |
</head> |
Lines 97-103
Link Here
|
97 |
</select> |
98 |
</select> |
98 |
</th> |
99 |
</th> |
99 |
<th id="filter-container"></th> |
100 |
<th id="filter-container"></th> |
100 |
<th><input type="text" size="5" name="tag"/></th> |
101 |
<th><input type="text" size="5" name="tag" class="required" required="required"/></th> |
101 |
<th> |
102 |
<th> |
102 |
<select name="preset"> |
103 |
<select name="preset"> |
103 |
<option value="" selected>Custom</option> |
104 |
<option value="" selected>Custom</option> |
Lines 132-139
Link Here
|
132 |
<option value="1">Delete</option> |
133 |
<option value="1">Delete</option> |
133 |
</select> |
134 |
</select> |
134 |
</th> |
135 |
</th> |
135 |
<th><button type="submit" class="btn btn-default btn-xs" title="Add" id="add" name="op" value="cud-add"><i class="fa fa-plus"></i> Add rule</button></th> |
136 |
<th><button type="submit" class="btn btn-default btn-xs" title="Add" id="add"><i class="fa fa-plus"></i> Add rule</button></th> |
136 |
<th><button type="submit" id="btn_batchremove" disabled="disabled" class="btn btn-default btn-xs" name="op" value="cud-remove" title="Batch remove"><i class="fa fa-trash-can"></i> Delete selected</button></th> |
137 |
<th><button type="button" class="btn btn-default btn-xs" id="btn_batchremove" disabled="disabled" title="Batch remove"><i class="fa fa-trash-can"></i> Delete selected</button></th> |
137 |
</tr> |
138 |
</tr> |
138 |
</tfoot> |
139 |
</tfoot> |
139 |
[% END %] |
140 |
[% END %] |
Lines 162-169
Link Here
|
162 |
</select> |
163 |
</select> |
163 |
</td> |
164 |
</td> |
164 |
<td id="filter-container" data-filter="[% rule.filter | html %]"></td> |
165 |
<td id="filter-container" data-filter="[% rule.filter | html %]"></td> |
165 |
<td><input type="text" size="3" name="tag" value="[% rule.tag | html %]"/></td> |
166 |
<td><input type="text" size="3" name="tag" value="[% rule.tag | html %]" class="required" required="required" /></td> |
166 |
<th> |
167 |
<td> |
167 |
<select name="preset"> |
168 |
<select name="preset"> |
168 |
<option value="" selected>Custom</option> |
169 |
<option value="" selected>Custom</option> |
169 |
<option value="protect">Protect</option> |
170 |
<option value="protect">Protect</option> |
Lines 172-178
Link Here
|
172 |
<option value="addappend">Add and append</option> |
173 |
<option value="addappend">Add and append</option> |
173 |
<option value="protectfromdeletion">Protect from deletion</option> |
174 |
<option value="protectfromdeletion">Protect from deletion</option> |
174 |
</select> |
175 |
</select> |
175 |
</th> |
176 |
</td> |
176 |
<td class="rule-operation-action-edit"> |
177 |
<td class="rule-operation-action-edit"> |
177 |
<select name="add"> |
178 |
<select name="add"> |
178 |
[% IF rule.add %] |
179 |
[% IF rule.add %] |
Lines 218-224
Link Here
|
218 |
</select> |
219 |
</select> |
219 |
</td> |
220 |
</td> |
220 |
<td class="actions"> |
221 |
<td class="actions"> |
221 |
<button class="btn btn-default btn-xs" title="Save" id="doedit" value="[% rule.id | html %]"><i class="fa fa-check"></i> Save</button> |
222 |
<button class="btn btn-default btn-xs" title="Save" type="submit" id="doedit" value="[% rule.id | html %]"><i class="fa fa-check"></i> Save</button> |
222 |
<a href="/cgi-bin/koha/admin/marc-overlay-rules.pl" class="btn btn-default btn-xs" title="Cancel"><i class="fa fa-times"></i> Cancel</a> |
223 |
<a href="/cgi-bin/koha/admin/marc-overlay-rules.pl" class="btn btn-default btn-xs" title="Cancel"><i class="fa fa-times"></i> Cancel</a> |
223 |
</td> |
224 |
</td> |
224 |
<td></td> |
225 |
<td></td> |
Lines 260-270
Link Here
|
260 |
<td class="rule-operation-action" data-operation="remove" data-value="[% rule.remove | html %]">[% IF rule.remove %]Remove[% ELSE %]Skip[% END %]</td> |
261 |
<td class="rule-operation-action" data-operation="remove" data-value="[% rule.remove | html %]">[% IF rule.remove %]Remove[% ELSE %]Skip[% END %]</td> |
261 |
<td class="rule-operation-action" data-operation="delete" data-value="[% rule.delete | html %]">[% IF rule.delete %]Delete[% ELSE %]Skip[% END %]</td> |
262 |
<td class="rule-operation-action" data-operation="delete" data-value="[% rule.delete | html %]">[% IF rule.delete %]Delete[% ELSE %]Skip[% END %]</td> |
262 |
<td class="actions"> |
263 |
<td class="actions"> |
263 |
<a title="Delete" class="btn btn-default btn-xs btn_remove"><i class="fa fa-trash-can"></i> Delete</a> |
264 |
<button type="button" title="Delete" class="btn btn-default btn-xs btn_remove" name="batchremove" value="[% rule.id | html %]"><i class="fa fa-trash-can"></i> Delete</button> |
264 |
<a href="?op=edit&id=[% rule.id | uri %]" title="Edit" class="btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
265 |
<a href="?op=edit&id=[% rule.id | uri %]" title="Edit" class="btn btn-default btn-xs"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a> |
265 |
</td> |
266 |
</td> |
266 |
<td> |
267 |
<td> |
|
|
268 |
[% UNLESS edit %] |
267 |
<input type="checkbox" name="batchremove" value="[% rule.id | html %]"/> |
269 |
<input type="checkbox" name="batchremove" value="[% rule.id | html %]"/> |
|
|
270 |
[% END %] |
268 |
</td> |
271 |
</td> |
269 |
[% END %] |
272 |
[% END %] |
270 |
</tr> |
273 |
</tr> |
Lines 291-297
Link Here
|
291 |
|
294 |
|
292 |
<script> |
295 |
<script> |
293 |
$(document).ready(function(){ |
296 |
$(document).ready(function(){ |
294 |
function doSubmit(op, id) { |
297 |
|
|
|
298 |
var validator = $( "#marc-overlay-rules-form" ).validate({ |
299 |
ignore: ".ignore" |
300 |
}); |
301 |
|
302 |
function prepareSubmit(op, id) { |
303 |
|
295 |
$('#marc-overlay-rules-form > input[name="op"]').val(op); |
304 |
$('#marc-overlay-rules-form > input[name="op"]').val(op); |
296 |
|
305 |
|
297 |
if(id) { |
306 |
if(id) { |
Lines 301-355
Link Here
|
301 |
.appendTo('#marc-overlay-rules-form'); |
310 |
.appendTo('#marc-overlay-rules-form'); |
302 |
} |
311 |
} |
303 |
|
312 |
|
304 |
var valid = true; |
|
|
305 |
if (op == 'cud-add' || op == 'cud-edit') { |
313 |
if (op == 'cud-add' || op == 'cud-edit') { |
306 |
var validate = [ |
314 |
$('#marc-overlay-rules-form input[name="tag"]').removeClass('ignore'); |
307 |
$('#marc-overlay-rules-form select[name="filter"]'), |
315 |
} else { |
308 |
$('#marc-overlay-rules-form input[name="tag"]') |
316 |
$('#marc-overlay-rules-form input[name="tag"]').addClass('ignore'); |
309 |
]; |
|
|
310 |
for(var i = 0; i < validate.length; i++) { |
311 |
if (validate[i].length) { |
312 |
if(validate[i].val().length == 0) { |
313 |
validate[i].addClass('required'); |
314 |
validate[i].focus(); |
315 |
valid = false; |
316 |
} else { |
317 |
validate[i].removeClass('required'); |
318 |
} |
319 |
} |
320 |
} |
321 |
} |
322 |
|
323 |
if (valid) { |
324 |
return $('#marc-overlay-rules-form').submit(); |
325 |
} |
317 |
} |
326 |
|
318 |
|
327 |
return valid; |
|
|
328 |
} |
319 |
} |
329 |
|
320 |
|
330 |
$('#doedit').on('click', function(){ |
321 |
$('#doedit').on('click', function(){ |
331 |
doSubmit('cud-edit', $("#doedit").attr('value')); |
322 |
prepareSubmit('cud-edit', $("#doedit").attr('value')); |
332 |
return false; |
|
|
333 |
}); |
323 |
}); |
334 |
$('#add').on('click', function(){ |
324 |
$('#add').on('click', function(){ |
335 |
doSubmit('cud-add'); |
325 |
prepareSubmit('cud-add'); |
336 |
return false; |
|
|
337 |
}); |
326 |
}); |
338 |
$('.btn_remove').on('click', function(el){ |
327 |
$('.btn_remove').on('click', function(el){ |
339 |
// mark delete checkbox in row |
328 |
// remove all earlier selections |
340 |
$(el.target).closest('tr').find('[name="batchremove"]').prop( "checked", true ); |
329 |
$('#marc-overlay-rules-form input[name="batchremove"]').each(function() { |
341 |
$('#btn_batchremove').removeAttr('disabled'); |
330 |
$(this).prop( "checked", false ); |
342 |
confirm_remove(); |
331 |
}); |
343 |
return false; |
332 |
|
|
|
333 |
confirm_remove(el.currentTarget.value); |
344 |
}); |
334 |
}); |
345 |
$('#btn_batchremove').on('click', function(){ |
335 |
$('#btn_batchremove').on('click', function(){ |
346 |
confirm_remove(); |
336 |
confirm_remove(); |
347 |
return false; |
|
|
348 |
}); |
337 |
}); |
349 |
|
338 |
|
350 |
function confirm_remove(){ |
339 |
function confirm_remove(id){ |
351 |
if (confirm(_("Are you sure you want to remove the selected rule(s)?"))){ |
340 |
if (confirm(_("Are you sure you want to remove the selected rule(s)?"))){ |
352 |
doSubmit('cud-remove'); |
341 |
prepareSubmit('cud-remove', id); |
|
|
342 |
$('#marc-overlay-rules-form').submit() |
353 |
} |
343 |
} |
354 |
} |
344 |
} |
355 |
|
345 |
|
356 |
- |
|
|