Koha/koha-tmpl/intranet-tmpl/prog/en/includes/authorities_js.inc
Owen Leonard ac6869eed1 Bug 19785: Move template JavaScript to the footer: Authorities, part 1
This patch modifies even more staff client authorities templates so
that JavaScript is included in the footer instead of the header.

To test, apply the patch and test the JavaScript-driven features of the
modified templates: All button controls, DataTables functionality, tabs,
etc.

 - Authorities
   - New from Z39.50
   -> Search
      -> Results
         - New from Z39.50
         - Deletion confirmation
         - Merge records -> Merge
           - Tabs
           - Tag selection
         -> Authority detail
            - Tabs
            - Deletion confirmation
            - New from Z39.50

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-02-18 16:48:44 -03:00

92 lines
3.6 KiB
PHP

<script type="text/javascript">
function mergeAuth(authid, summary) {
var alreadySelected = $.cookie('auth_to_merge');
if (alreadySelected !== undefined) {
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 !== undefined) {
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();
}
}
function confirm_deletion(id) {
var is_confirmed = confirm(_("Are you sure you want to delete this authority?"));
if( !id ){
id = "[% authid %]";
}
if (is_confirmed) {
window.location="authorities-home.pl?op=delete"
+ "&authid=" + id
+ "&type=intranet"
+ "&authtypecode=[% authtypecode %]"
+ "&marclist=[% marclist %]"
+ "&and_or=[% and_or %]"
+ "&excluding=[% excluding %]"
+ "&operator=[% operator %]"
+ "&orderby=[% orderby %]"
+ "&value=[% value |url %]"
+ "&startfrom=[% startfrom %]"
+ "&resultsperpage=[% resultsperpage %]"
+ "&csrf_token=[% csrf_token %]";
}
}
$(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());
});
$("#delAuth").click(function(){
confirm_deletion();
return false;
});
$("#z3950submit").click(function(){
[% IF ( authid ) %]
if (confirm(_("Please note that this Z39.50 search could replace the current record."))){
window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl?authid=[% authid %]","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes');
}
[% ELSE %]
window.open("/cgi-bin/koha/cataloguing/z3950_auth_search.pl","z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes');
[% END %]
return false;
});
var searchType = '[% marclist %]';
if (searchType) {
if ('mainentry' == searchType) {
$("#header_search").tabs( "option", "selected", 0 );
} else if ('match' == searchType) {
$("#header_search").tabs( "option", "selected", 1 );
} else if ('all' == searchType) {
$("#header_search").tabs( "option", "selected", 2 );
}
}
});
</script>