Koha/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc
Bernardo Gonzalez Kriegel e64c52866b Bug 11227: remove some JavaScript from staff PO files
This patch rewrites authorities_js.inc so translate
script will process it correctly. To do that I added
<script></script> at the file

To test:
1) Update po files for your preffered language

2) Check occurrence of mergeAuth on staff PO file
or try
egrep -n  "Merging with authority: |Cancel merge"
strings appear in a JS func

3) Apply the patch

4) Update translations again, check again, old
strings now begin with #~ (obsoleted) and there
are new entries for the messages

5) Check functionality provided by script

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Works as described and fixes a translation difficulty.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2014-04-27 21:35:34 +00:00

42 lines
1.8 KiB
PHP

<script type="text/javascript">
//<![CDATA[
function mergeAuth(authid, summary) {
var alreadySelected = $.cookie('auth_to_merge');
if (alreadySelected !== null) {
alreadySelected = JSON.parse(alreadySelected);
$.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 });
var refstring = "";
if (typeof alreadySelected.mergereference !== 'undefined') {
refstring = "&mergereference=" + alreadySelected.mergereference;
}
window.location.href = "/cgi-bin/koha/authorities/merge.pl?authid=" + authid + "&authid=" + alreadySelected.authid + refstring;
} else {
$.cookie('auth_to_merge', JSON.stringify({ 'authid': authid, 'summary': summary }), { 'path' : '/' });
showMergingInProgress();
}
}
function showMergingInProgress() {
var alreadySelected = $.cookie('auth_to_merge');
if (alreadySelected !== null) {
alreadySelected = JSON.parse(alreadySelected);
$('#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>");
$('#cancel_merge').click(function(event) {
event.preventDefault();
$.cookie('auth_to_merge', '', { 'path': '/', 'expires': -1 });
$('#merge_in_progress').empty();
});
} else {
$('#merge_in_progress').empty();
}
}
$(document).ready(function () {
showMergingInProgress();
$('.merge_auth').click(function (event) {
event.preventDefault();
mergeAuth($(this).parents('tr').attr('data-authid'), $(this).parents('tr').find('div.authorizedheading').text());
});
});
//]]>
</script>