|
Lines 5-10
Link Here
|
| 5 |
<title>Koha › Cataloging › [% IF ( biblionumber ) %]Editing [% title | html %] (Record number [% biblionumber | html %])[% ELSE %]Add MARC record[% END %]</title> |
5 |
<title>Koha › Cataloging › [% IF ( biblionumber ) %]Editing [% title | html %] (Record number [% biblionumber | html %])[% ELSE %]Add MARC record[% END %]</title> |
| 6 |
[% INCLUDE 'doc-head-close.inc' %] |
6 |
[% INCLUDE 'doc-head-close.inc' %] |
| 7 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
7 |
[% Asset.js("lib/hc-sticky.js") | $raw %] |
|
|
8 |
<script> |
| 9 |
var CAN_user_parameters_manage_auth_values = "[% CAN_user_parameters_manage_auth_values | html %]"; |
| 10 |
</script> |
| 11 |
[% INCLUDE 'select2.inc' %] |
| 8 |
[% Asset.js("js/cataloging.js") | $raw %] |
12 |
[% Asset.js("js/cataloging.js") | $raw %] |
| 9 |
[% INCLUDE 'strings.inc' %] |
13 |
[% INCLUDE 'strings.inc' %] |
| 10 |
[% Asset.js("js/browser.js") | $raw %] |
14 |
[% Asset.js("js/browser.js") | $raw %] |
|
Lines 482-556
Link Here
|
| 482 |
</script> |
486 |
</script> |
| 483 |
[% Asset.css("css/addbiblio.css") | $raw %] |
487 |
[% Asset.css("css/addbiblio.css") | $raw %] |
| 484 |
|
488 |
|
| 485 |
[% INCLUDE 'select2.inc' %] |
|
|
| 486 |
<script> |
| 487 |
$(document).ready(function() { |
| 488 |
[% IF CAN_user_parameters_manage_auth_values %] |
| 489 |
var current_select2; |
| 490 |
$('.subfield_line select[data-category!=""]').select2({ |
| 491 |
tags: true, |
| 492 |
createTag: function (tag) { |
| 493 |
return { |
| 494 |
id: tag.term, |
| 495 |
text: tag.term, |
| 496 |
newTag: true |
| 497 |
}; |
| 498 |
}, |
| 499 |
templateResult: function(state) { |
| 500 |
if (state.newTag) { |
| 501 |
return state.text + " " + "(select to create)"; |
| 502 |
} |
| 503 |
return state.text; |
| 504 |
} |
| 505 |
}).on("select2:select", function(e) { |
| 506 |
if(e.params.data.newTag){ |
| 507 |
|
| 508 |
var category = $(this).data("category"); |
| 509 |
$("#avCreate #new_av_category").html(category); |
| 510 |
$("#avCreate input[name='category']").val(category); |
| 511 |
$("#avCreate input[name='value']").val(e.params.data.text); |
| 512 |
$("#avCreate input[name='description']").val(e.params.data.text); |
| 513 |
$('#avCreate').modal({show:true}); |
| 514 |
|
| 515 |
$(current_select2).val($(current_select2).find("option:first").val()).trigger('change'); |
| 516 |
|
| 517 |
current_select2 = this; |
| 518 |
|
| 519 |
} |
| 520 |
}).on("select2:clear", function () { |
| 521 |
$(this).on("select2:opening.cancelOpen", function (evt) { |
| 522 |
evt.preventDefault(); |
| 523 |
|
| 524 |
$(this).off("select2:opening.cancelOpen"); |
| 525 |
}); |
| 526 |
}); |
| 527 |
|
| 528 |
$("#add_new_av").on("submit", function(){ |
| 529 |
var data = { |
| 530 |
category: $(this).find('input[name="category"]').val(), |
| 531 |
value: $(this).find('input[name="value"]').val(), |
| 532 |
description: $(this).find('input[name="description"]').val(), |
| 533 |
opac_description: $(this).find('input[name="opac_description"]').val(), |
| 534 |
}; |
| 535 |
$.ajax({ |
| 536 |
type: "POST", |
| 537 |
url: "/api/v1/authorised_values", |
| 538 |
data:JSON.stringify(data), |
| 539 |
success: function(response) { |
| 540 |
$('#avCreate').modal('hide'); |
| 541 |
|
| 542 |
$(current_select2).append('<option selected value="'+data['value']+'">'+data['description']+'</option>'); |
| 543 |
}, |
| 544 |
error: function(err) { |
| 545 |
$("#avCreate .error").html(_("Something went wrong, maybe the value already exists?")) |
| 546 |
} |
| 547 |
}); |
| 548 |
return false; |
| 549 |
}); |
| 550 |
[% END %] |
| 551 |
}); |
| 552 |
</script> |
| 553 |
|
| 554 |
</head> |
489 |
</head> |
| 555 |
<body id="cat_addbiblio" class="cat"> |
490 |
<body id="cat_addbiblio" class="cat"> |
| 556 |
|
491 |
|
|
Lines 964-1010
Link Here
|
| 964 |
[%# End of fields for fast cataloging %] |
899 |
[%# End of fields for fast cataloging %] |
| 965 |
</form> <!-- /name=f --> |
900 |
</form> <!-- /name=f --> |
| 966 |
|
901 |
|
| 967 |
<div id="avCreate" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="avCreateLabel" aria-hidden="true"> |
902 |
[% INCLUDE 'modals/cataloguing_create_av.inc' %] |
| 968 |
<div class="modal-dialog"> |
|
|
| 969 |
<div class="modal-content"> |
| 970 |
<div class="modal-header"> |
| 971 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 972 |
<h3 id="avCreateLabel">Create a new authorised value</h3> |
| 973 |
</div> |
| 974 |
<form id="add_new_av" method="post"> |
| 975 |
<div class="modal-body"> |
| 976 |
<div class="error"></div> |
| 977 |
<fieldset class="rows"> |
| 978 |
<ol> |
| 979 |
<li> |
| 980 |
<span class="label">Category:</span> |
| 981 |
<input type="hidden" name="category" value="" /> |
| 982 |
<span id="new_av_category"></span> |
| 983 |
</li> |
| 984 |
<li> |
| 985 |
<span class="label" for="value">Authorised value:</span> |
| 986 |
<input type="text" id="value" name="value" /> |
| 987 |
</li> |
| 988 |
<li> |
| 989 |
<span class="label" for="description">Description:</span> |
| 990 |
<input type="text" id="description" name="description" /> |
| 991 |
</li> |
| 992 |
<li> |
| 993 |
<span class="label" for="opac_description">Description (OPAC):</span> |
| 994 |
<input type="text" id="opac_description" name="opac_description" /> |
| 995 |
</li> |
| 996 |
</ol> |
| 997 |
</fieldset> |
| 998 |
</div> |
| 999 |
<div class="modal-footer"> |
| 1000 |
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button> |
| 1001 |
<input type="hidden" name="select2" value="" /> |
| 1002 |
<input type="submit" class="btn btn-primary" value="Save"> |
| 1003 |
</div> |
| 1004 |
</form> |
| 1005 |
</div> <!-- /.modal-content --> |
| 1006 |
</div> <!-- /.modal-dialog --> |
| 1007 |
</div> <!-- /#avCreate --> |
| 1008 |
|
903 |
|
| 1009 |
</div> <!-- /.col-md-10.col-md-offset-1 --> |
904 |
</div> <!-- /.col-md-10.col-md-offset-1 --> |
| 1010 |
</div> <!-- /.row --> |
905 |
</div> <!-- /.row --> |