Koha/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/merge.tt
Owen Leonard 408de34eaa Bug 30423: Convert authority merge page tabs to Bootstrap
This patch updates the authority merge page to use Bootstrap tabs
instead of jQueryUI.

To test, apply the patch go to Authorities in the staff interface.

- Perform an authority search which will return more than one
  authority record.
- On the results page, click Actions -> Merge for two authority
  records.
- Click "Next" after selecting a merge reference.
- On the next page you should see two tabs under "Source records."
  Confirm that they work correctly.
- Confirm that tag and subfield selection still works correctly.

Signed-off-by: Séverine Queune <severine.queune@bulac.fr>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
2022-04-12 11:40:17 +02:00

160 lines
6.6 KiB
Text

[% USE raw %]
[% USE Asset %]
[% PROCESS 'merge-record.inc' %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Merging records &rsaquo; Cataloging &rsaquo; Koha</title>
[% INCLUDE 'doc-head-close.inc' %]
<style>
div.record ul, div.record li { float:none; display:block; }
div#result { margin-top: 1em; }
/* We use this style "against" the li ui-tabs-nav style automatically applied */
</style>
</head>
<body id="auth_merge" class="cat">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'authorities-search.inc' %]
<nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
<ol>
<li>
<a href="/cgi-bin/koha/mainpage.pl">Home</a>
</li>
<li>
<a href="/cgi-bin/koha/authorities/authorities-home.pl">Authorities</a>
</li>
<li>
<a href="#" aria-current="page">
Merging records
</a>
</li>
</ol>
</nav>
<div class="main container-fluid">
<div class="row">
<div class="col-md-8 col-md-offset-2">
<main>
<h1>Merging records</h1>
[% IF ( errors ) %]
[% FOREACH error IN errors %]
<div class="dialog alert">
[% IF error.code == 'WRONG_COUNT' %]
Number of records provided for merging: [% error.value | html %]. Currently only 2 records can be merged at a time.
[% ELSIF error.code == 'DESTRUCTIVE_MERGE' %]
You cannot merge a record with itself. Please select two different authorities.
[% ELSIF error.code == 'WRONG_FRAMEWORK' %]
The default framework cannot be used, or the framework does not exist. Please select another framework for merging.
[% ELSIF error.code == 'EMPTY_MARC' %]
Sorry, but we did not find any MARC tags in the reference record.
[% ELSIF error.code == 'MISSING_RECORD' %]
Sorry, but we did not find a record for number: [% error.value | html %].
[% ELSE %]
[% error | html %]
[% END %]
</div>
[% END %]
[% ELSIF ( result ) %]
<p>The merging was successful. <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]">View the merged record.</a></p>
[% ELSIF ( choosereference ) %]
<p>Please choose which record will be the reference for the merge. The record chosen as reference will be kept, and the other will be deleted.</p>
<form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post">
<fieldset class="rows">
<legend>Merge reference</legend>
<ol>
<li class="radio"><input type="radio" value="[% recordid1 | uri %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 | html %]')" /><label for="mergereference1">[% title1 | html %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1 | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid1 | uri %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid1 | html %][% IF frameworklabel1 %] &mdash; [% frameworklabel1 | html %][% END %]</a>)</label></li>
<li class="radio"><input type="radio" value="[% recordid2 | uri %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 | html %]')" /><label for="mergereference2">[% title2 | html %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2 | html %][% END %] (<a href="/cgi-bin/koha/authorities/detail.pl?authid=[% recordid2 | uri %]" title="MARC" class="preview-merge-reference" target="_blank">[% recordid2 | html %][% IF frameworklabel2 %] &mdash; [% frameworklabel2 | html %][% END %]</a>)</label></li>
[% IF frameworkselect %]
<li><label for="frameworkcode">Using framework:</label>
<select name="frameworkcode" id="frameworkcode">
[% FOREACH frameworkcodeloo IN frameworkselect %]
[% IF frameworkcodeloo.authtypecode == frameworkcode1 %]
<option value="[% frameworkcodeloo.authtypecode | html %]" selected="selected">
[% ELSE %]
<option value="[% frameworkcodeloo.authtypecode | html %]">
[% END %]
[% frameworkcodeloo.authtypetext | html %]
</option>
[% END %]
</select></li>
[% END %]
</ol>
<input type="hidden" name="authid" value="[% recordid1 | html %]" />
<input type="hidden" name="authid" value="[% recordid2 | html %]" />
<fieldset class="action"><input type="submit" value="Next" /></fieldset>
</fieldset>
</form>
[% ELSE %]
<form id="mergeform" action="/cgi-bin/koha/authorities/merge.pl" method="post" onsubmit="return mergeformsubmit()">
<div class="row">
<div class="col-sm-6">
[% PROCESS mergesource sourcerecords=records %]
</div>
<div class="col-sm-6">
[% PROCESS mergetarget %]
</div>
</div>
<input type="hidden" name="recordid1" value="[% recordid1 | html %]" />
<input type="hidden" name="recordid2" value="[% recordid2 | html %]" />
<input type="hidden" name="mergereference" value="[% mergereference | html %]" />
<input type="hidden" name="frameworkcode" value="[% framework | html %]" />
<fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
</form>
[% END %]
</main>
</div> <!-- /.col-md-8 col-md-offset-2 -->
</div> <!-- /.row -->
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'authorities_js.inc' %]
[% Asset.js("js/merge-record.js") | $raw %]
<script>
// When submiting the form
function mergeformsubmit() {
$('#tabs').remove();
}
$(document).ready(function(){
// Getting marc structure via ajax
tagslib = [];
$.getJSON("/cgi-bin/koha/authorities/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) {
tagslib = json;
rebuild_target($("#tabs"), $("#resultul"));
});
$('.preview-merge-reference').click(function (ev) {
ev.preventDefault();
newin=window.open($(this).attr('href'),'merge_reference', 'width=1000,height=600,toolbar=false,scrollbars=yes');
});
if( $(".tab-pane.active").length < 1 ){
$("#tabs a:first").tab("show");
}
});
function changeFramework(fw) {
$("#Frameworks").val(fw);
}
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]