Line 0
Link Here
|
0 |
- |
1 |
/* global __ Cookies */ |
|
|
2 |
function mergeAuth(authid, summary) { |
3 |
var alreadySelected = Cookies.get("auth_to_merge"); |
4 |
if (alreadySelected !== undefined) { |
5 |
alreadySelected = JSON.parse(alreadySelected); |
6 |
Cookies.remove("auth_to_merge"); |
7 |
var refstring = ""; |
8 |
if (typeof alreadySelected.mergereference !== "undefined") { |
9 |
refstring = "&mergereference=" + alreadySelected.mergereference; |
10 |
} |
11 |
window.location.href = |
12 |
"/cgi-bin/koha/authorities/merge.pl?authid=" + |
13 |
authid + |
14 |
"&authid=" + |
15 |
alreadySelected.authid + |
16 |
refstring; |
17 |
} else { |
18 |
Cookies.set( |
19 |
"auth_to_merge", |
20 |
JSON.stringify({ authid: authid, summary: summary }), |
21 |
{ path: "/", sameSite: "Lax" } |
22 |
); |
23 |
showMergingInProgress(); |
24 |
} |
25 |
} |
26 |
|
27 |
function showMergingInProgress() { |
28 |
var alreadySelected = Cookies.get("auth_to_merge"); |
29 |
if (alreadySelected) { |
30 |
alreadySelected = JSON.parse(alreadySelected); |
31 |
$("#merge_in_progress") |
32 |
.show() |
33 |
.html( |
34 |
__("Merging with authority: ") + |
35 |
"<a href='detail.pl?authid=" + |
36 |
alreadySelected.authid + |
37 |
"'><span class='authorizedheading'>" + |
38 |
alreadySelected.summary + |
39 |
"</span> (" + |
40 |
alreadySelected.authid + |
41 |
")</a> <a href='#' id='cancel_merge'>" + |
42 |
__("Cancel merge") + |
43 |
"</a>" |
44 |
); |
45 |
$("#cancel_merge").click(function (event) { |
46 |
event.preventDefault(); |
47 |
Cookies.remove("auth_to_merge"); |
48 |
$("#merge_in_progress").hide().empty(); |
49 |
}); |
50 |
} else { |
51 |
$("#merge_in_progress").hide().empty(); |
52 |
} |
53 |
} |
54 |
|
55 |
$(document).ready(function () { |
56 |
showMergingInProgress(); |
57 |
|
58 |
$(".form_delete").submit(function () { |
59 |
if (confirm(__("Are you sure you want to delete this authority?"))) { |
60 |
return true; |
61 |
} |
62 |
// FIXME Close the dropdown $(this).closest('ul.dropdown-menu').dropdown('toggle'); |
63 |
return false; |
64 |
}); |
65 |
|
66 |
$(".merge_auth").click(function (event) { |
67 |
event.preventDefault(); |
68 |
mergeAuth( |
69 |
$(this).parents("tr").attr("data-authid"), |
70 |
$(this).parents("tr").find("div.authorizedheading").text() |
71 |
); |
72 |
}); |
73 |
|
74 |
$("#delAuth").click(function () { |
75 |
$(".form_delete").submit(); |
76 |
}); |
77 |
|
78 |
$("#z3950_new").click(function (e) { |
79 |
e.preventDefault(); |
80 |
window.open( |
81 |
"/cgi-bin/koha/cataloguing/z3950_auth_search.pl", |
82 |
"z3950search", |
83 |
"width=800,height=550,location=yes,toolbar=no,scrollbars=yes,resize=yes" |
84 |
); |
85 |
}); |
86 |
|
87 |
if (typeof authid !== undefined) { |
88 |
$("#z3950_replace").click(function (e) { |
89 |
e.preventDefault(); |
90 |
window.open( |
91 |
"/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=" + |
92 |
authid, |
93 |
"z3950search", |
94 |
"width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes" |
95 |
); |
96 |
}); |
97 |
} |
98 |
|
99 |
if (searchType) { |
100 |
if ("mainmainentry" == searchType.valueOf()) { |
101 |
$("#header_search a[href='#mainmain_heading_panel']").tab("show"); |
102 |
} else if ("mainentry" == searchType.valueOf()) { |
103 |
$("#header_search a[href='#main_heading_panel']").tab("show"); |
104 |
} else if ("match" == searchType.valueOf()) { |
105 |
$("#header_search a[href='#matchheading_search_panel']").tab( |
106 |
"show" |
107 |
); |
108 |
} else if ("all" == searchType.valueOf()) { |
109 |
$("#header_search a[href='#entire_record_panel']").tab("show"); |
110 |
} |
111 |
} |
112 |
}); |