1 function mergeAuth(authid, summary) {
2 var alreadySelected = $.cookie('auth_to_merge');
3 if (alreadySelected !== null) {
4 alreadySelected = JSON.parse(alreadySelected);
5 $.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 });
7 if (typeof alreadySelected.mergereference !== 'undefined') {
8 refstring = "&mergereference=" + alreadySelected.mergereference;
10 window.location.href = "/cgi-bin/koha/authorities/merge.pl?authid=" + authid + "&authid=" + alreadySelected.authid + refstring;
12 $.cookie('auth_to_merge', JSON.stringify({ 'authid': authid, 'summary': summary }), { 'path' : '/' });
13 showMergingInProgress();
17 function showMergingInProgress() {
18 var alreadySelected = $.cookie('auth_to_merge');
19 if (alreadySelected !== null) {
20 alreadySelected = JSON.parse(alreadySelected);
21 $('#merge_in_progress').html(_("Merging with authority: ") + "<a href='detail.pl?authid=" + alreadySelected.authid + "'><span class='authorizedheading'>" + alreadySelected.summary + "</span> (" + alreadySelected.authid + ")</a> <a href='#' id='cancel_merge'>" + _("Cancel merge") + "</a>");
22 $('#cancel_merge').click(function(event) {
23 event.preventDefault();
24 $.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 });
25 $('#merge_in_progress').empty();
28 $('#merge_in_progress').empty();
32 $(document).ready(function () {
33 showMergingInProgress();
34 $('.merge_auth').click(function (event) {
35 event.preventDefault();
36 mergeAuth($(this).parents('tr').attr('data-authid'), $(this).parents('tr').find('div.authorizedheading').text());