9e975aaf24
New ids: cat_<filename> New class: cat Exceptions: moveitem and linkitem are accessible from the catalog pages, so have been made 'catalog' for styling. Signed-off-by: Owen Leonard <oleonard@myacpl.org>
377 lines
13 KiB
Text
377 lines
13 KiB
Text
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Cataloging › Merging records</title>
|
|
[% INCLUDE 'greybox.inc' %]
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<style type="text/css">
|
|
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>
|
|
<script type="text/javascript">
|
|
//<![CDATA[
|
|
|
|
// When submiting the form
|
|
function mergeformsubmit() {
|
|
$("ul#ulrecord1").remove();
|
|
$("ul#ulrecord2").remove();
|
|
}
|
|
|
|
|
|
$(document).ready(function(){
|
|
// Creating tabs
|
|
$("#tabs > ul").tabs();
|
|
|
|
// Getting marc structure via ajax
|
|
tagslib = [];
|
|
$.getJSON("/cgi-bin/koha/cataloguing/merge_ajax.pl", {frameworkcode : "[% framework %]" }, function(json) {
|
|
tagslib = json;
|
|
});
|
|
|
|
|
|
// Toggle a field / subfield
|
|
function toggleField(pField) {
|
|
|
|
// Getting the key of the clicked checkbox
|
|
var ckid = $(pField).attr("id");
|
|
var tab = ckid.split('_');
|
|
var source = tab[1]; // From which record the click came from
|
|
var key = tab[2];
|
|
var type = $(pField).attr("class");
|
|
|
|
// Getting field/subfield
|
|
var field;
|
|
var subfield;
|
|
if (type == "subfieldpick") {
|
|
|
|
field = $(pField).parent().parent().parent().find("span.field").text();
|
|
subfield = $(pField).parent().find("span.subfield").text();
|
|
} else {
|
|
|
|
field = $(pField).parent().find("span.field").text();
|
|
}
|
|
|
|
// If the field has just been checked
|
|
if (pField.checked) {
|
|
|
|
// We check for repeatability
|
|
var canbeadded = true;
|
|
if (type == "subfieldpick") {
|
|
var repeatable = 1;
|
|
var alreadyexists = 0;
|
|
if (tagslib[field] && tagslib[field][subfield]) {
|
|
repeatable = tagslib[field][subfield].repeatable; // Note : we can't use the dot notation here (tagslib.021) because the key is a number
|
|
// TODO : Checking for subfields
|
|
}
|
|
} else {
|
|
if (tagslib[field]) {
|
|
repeatable = tagslib[field].repeatable;
|
|
alreadyexists = $("#resultul span.field:contains(" + field + ")");
|
|
if (repeatable == 0 && alreadyexists.length != 0) {
|
|
canbeadded = false;
|
|
}
|
|
}
|
|
}
|
|
// If the field is not repeatable, we check if it already exists in the result table
|
|
if (canbeadded == false) {
|
|
alert(_('The field is non-repeatable and already exists in the destination record. Therefore, you cannot add it.'));
|
|
pField.checked = 0;
|
|
} else {
|
|
|
|
// Cloning the field or subfield we picked
|
|
var clone = $(pField).parent().clone();
|
|
|
|
// Removing the checkboxes from it
|
|
$(clone).find("input.subfieldpick, input.fieldpick").each(function() {
|
|
$(this).remove();
|
|
});
|
|
|
|
|
|
// If we are a subfield
|
|
if (type == "subfieldpick") {
|
|
// then we need to find who is our parent field...
|
|
fieldkey = $(pField).parent().parent().parent().attr("id");
|
|
|
|
// Find where to add the subfield
|
|
|
|
// First, check if the field is not already in the destination record
|
|
if ($("#resultul li#" + fieldkey).length > 0) {
|
|
// If so, we add our field to it
|
|
$("#resultul li#" + fieldkey + " ul").append(clone);
|
|
} else {
|
|
// If not, we add the subfield to the first matching field
|
|
var where = 0;
|
|
$("#resultul li span.field").each(function() {
|
|
if (where == 0 && $(this).text() == field) {
|
|
where = this;
|
|
}
|
|
});
|
|
|
|
// If there is no matching field in the destination record
|
|
if (where == 0) {
|
|
|
|
// TODO:
|
|
// We select the whole field and removing non-selected subfields, instead of...
|
|
|
|
// Alerting the user
|
|
alert(_('This subfield cannot be added: there is no ' + field + ' field in the destination record.'));
|
|
pField.checked = false;
|
|
|
|
} else {
|
|
$(where).nextAll("ul").append(clone);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
// If we are a field
|
|
var where = 0;
|
|
// Find where to add the field
|
|
$("#resultul li span.field").each(function() {
|
|
if (where == 0 && $(this).text() > field) {
|
|
where = this;
|
|
}
|
|
});
|
|
|
|
$(where).parent().before(clone);
|
|
}
|
|
}
|
|
} else {
|
|
|
|
// Else, we remove it from the results tab
|
|
$("ul#resultul li#k" + key).remove();
|
|
}
|
|
}
|
|
|
|
|
|
// When a field is checked / unchecked
|
|
$('input.fieldpick').click(function() {
|
|
toggleField(this);
|
|
// (un)check all subfields
|
|
var ischecked = this.checked;
|
|
$(this).parent().find("input.subfieldpick").each(function() {
|
|
this.checked = ischecked;
|
|
});
|
|
});
|
|
|
|
// When a field or subfield is checked / unchecked
|
|
$("input.subfieldpick").click(function() {
|
|
toggleField(this);
|
|
});
|
|
|
|
});
|
|
|
|
function changeFramework(fw) {
|
|
$("#Frameworks").val(fw);
|
|
}
|
|
|
|
//]]>
|
|
</script>
|
|
</head>
|
|
<body id="cat_merge" class="cat">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cataloging-search.inc' %]
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/cataloguing/addbooks.pl">Cataloging</a> › Merging records</div>
|
|
|
|
<div id="doc" class="yui-t7">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
|
|
|
|
<h1>Merging records</h1>
|
|
[% IF ( result ) %]
|
|
[% IF ( errors ) %]
|
|
[% FOREACH error IN errors %]
|
|
<div class="dialog alert">[% error.error %].<br />Therefore, the record to be merged has not been deleted.</div>
|
|
[% END %]
|
|
|
|
[% ELSE %]
|
|
<script type="text/javascript">window.location.href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% biblio1 %]"</script>
|
|
<p>The merging was successful. <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% biblio1 %]">Click here to see the merged record.</a></p>
|
|
[% END %]
|
|
|
|
[% ELSE %]
|
|
|
|
[% IF ( 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/cataloguing/merge.pl" method="post">
|
|
<fieldset class="rows">
|
|
<legend>Merge reference</legend>
|
|
<ol>
|
|
<li class="radio"><input type="radio" value="[% biblio1 %]" checked="checked" id="mergereference1" name="mergereference" onclick="changeFramework('[% frameworkcode1 %]')" /><label for="mergereference1">[% title1 %] [% FOREACH subtitl1 IN subtitle1 %] [% subtitl1.subfield %][% END %] (<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblio1 %]" title="MARC" rel="gb_page_center[600,500]">[% biblio1 %]</a>)</label></li>
|
|
<li class="radio"><input type="radio" value="[% biblio2 %]" id="mergereference2" name="mergereference" onclick="changeFramework('[% frameworkcode2 %]')" /><label for="mergereference2">[% title2 %] [% FOREACH subtitl2 IN subtitle2 %] [% subtitl2.subfield %][% END %] (<a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblio2 %]" title="MARC" rel="gb_page_center[600,500]">[% biblio2 %]</a>)</label></li>
|
|
|
|
[% IF frameworkselect %]
|
|
<li><label for="frameworkcode">Using framework:</label>
|
|
<select name="frameworkcode" id="frameworkcode">
|
|
<option value="Default">Default</option>
|
|
[% FOREACH frameworkcodeloo IN frameworkselect %]
|
|
[% IF ( frameworkcodeloo.selected ) %]
|
|
<option value="[% frameworkcodeloo.value %]" selected="selected">
|
|
[% ELSE %]
|
|
<option value="[% frameworkcodeloo.value %]">
|
|
[% END %]
|
|
[% frameworkcodeloo.frameworktext %]
|
|
</option>
|
|
[% END %]
|
|
</select></li>
|
|
[% END %]
|
|
</ol>
|
|
|
|
<input type="hidden" name="biblionumber" value="[% biblio1 %]" />
|
|
<input type="hidden" name="biblionumber" value="[% biblio2 %]" />
|
|
<fieldset class="action"><input type="submit" value="Next" /></fieldset>
|
|
</fieldset>
|
|
</form>
|
|
[% ELSE %]
|
|
[% IF ( errors ) %]
|
|
[% FOREACH error IN errors %]
|
|
<div class="error">[% error.error %]</div>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<form id="mergeform" action="/cgi-bin/koha/cataloguing/merge.pl" method="post" onsubmit="return mergeformsubmit()">
|
|
|
|
<div class="yui-g">
|
|
<div class="yui-u first">
|
|
<div id="tabs" class="toptabs">
|
|
<h2>Source records</h2>
|
|
<ul>
|
|
<li><a href="#tabrecord1">[% biblio1 %]</a></li>
|
|
<li><a href="#tabrecord2">[% biblio2 %]</a></li>
|
|
</ul>
|
|
<div id="tabrecord1">
|
|
[% IF ( record1 ) %]
|
|
|
|
<div class="record">
|
|
<ul id="ulrecord1">
|
|
[% FOREACH record IN record1 %]
|
|
[% FOREACH fiel IN record.field %]
|
|
<li id="k[% fiel.key %]">
|
|
<input type="checkbox" checked="checked" class="fieldpick" id="rec_1_[% fiel.key %]" />
|
|
<span class="field">[% fiel.tag %]</span>
|
|
|
|
<input type="hidden" name="tag_[% fiel.tag %]_indicator1_[% fiel.key %]" value="[% fiel.indicator1 %]" />
|
|
<input type="hidden" name="tag_[% fiel.tag %]_indicator2_[% fiel.key %]" value="[% fiel.indicator2 %]" />
|
|
[% IF ( fiel.value ) %] / [% fiel.value %]
|
|
<input type="hidden" name="tag_[% fiel.tag %]_code_00_[% fiel.key %]" value="00" />
|
|
<input type="hidden" name="tag_[% fiel.tag %]_subfield_00_[% fiel.key %]" value="[% fiel.value %]" />
|
|
[% END %]
|
|
|
|
[% IF ( fiel.subfield ) %]
|
|
<ul>
|
|
[% FOREACH subfiel IN fiel.subfield %]
|
|
<li id="k[% subfiel.subkey %]">
|
|
<input type="checkbox" checked="checked" class="subfieldpick" id="rec_1_[% subfiel.subkey %]" />
|
|
<span class="subfield">[% subfiel.subtag %]</span> / [% subfiel.value %]
|
|
<input type="hidden" name="tag_[% subfiel.tag %]_code_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.subtag %]" />
|
|
<input type="hidden" name="tag_[% subfiel.tag %]_subfield_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.value |html%]" />
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
[% END %]
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
</div><!-- /div.record -->
|
|
[% END %]
|
|
</div><!-- /div#tabrecord1 -->
|
|
<div id="tabrecord2">
|
|
[% IF ( record2 ) %]
|
|
|
|
<div class="record">
|
|
<ul id="ulrecord2">
|
|
[% FOREACH record IN record2 %]
|
|
[% FOREACH fiel IN record.field %]
|
|
<li id="k[% fiel.key %]">
|
|
<input type="checkbox" class="fieldpick" id="rec_2_[% fiel.key %]" />
|
|
<span class="field">[% fiel.tag %]</span>
|
|
|
|
<input type="hidden" name="tag_[% fiel.tag %]_indicator1_[% fiel.key %]" value="[% fiel.indicator1 %]" />
|
|
<input type="hidden" name="tag_[% fiel.tag %]_indicator2_[% fiel.key %]" value="[% fiel.indicator2 %]" />
|
|
[% IF ( fiel.value ) %] / [% fiel.value %]
|
|
<input type="hidden" name="tag_[% fiel.tag %]_code_00_[% fiel.key %]" value="00" />
|
|
<input type="hidden" name="tag_[% fiel.tag %]_subfield_00_[% fiel.key %]" value="[% fiel.value |html%]" />
|
|
[% END %]
|
|
|
|
[% IF ( fiel.subfield ) %]
|
|
<ul>
|
|
[% FOREACH subfiel IN fiel.subfield %]
|
|
<li id="k[% subfiel.subkey %]">
|
|
<input type="checkbox" class="subfieldpick" id="rec_2_[% subfiel.subkey %]" />
|
|
<span class="subfield">[% subfiel.subtag %]</span> / [% subfiel.value %]
|
|
<input type="hidden" name="tag_[% subfiel.tag %]_code_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.subtag %]" />
|
|
<input type="hidden" name="tag_[% subfiel.tag %]_subfield_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.value |html%]" />
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
[% END %]
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
</div>
|
|
<!-- /div.record -->
|
|
|
|
|
|
|
|
|
|
[% END %]
|
|
</div><!-- /div#tabrecord2 -->
|
|
</div> <!-- // #tabs -->
|
|
</div>
|
|
<div class="yui-u">
|
|
<div id="result">
|
|
<h2>Destination record</h2>
|
|
<div style="border:1px solid #E8E8E8;padding:1em;margin-top:2em;">
|
|
<ul id="resultul">
|
|
[% FOREACH record IN record1 %]
|
|
[% FOREACH fiel IN record.field %]<li id="k[% fiel.key %]"><span class="field">[% fiel.tag %]</span>
|
|
<input type="hidden" name="tag_[% fiel.tag %]_indicator1_[% fiel.key %]" value="[% fiel.indicator1 %]" />
|
|
<input type="hidden" name="tag_[% fiel.tag %]_indicator2_[% fiel.key %]" value="[% fiel.indicator2 %]" />
|
|
[% IF ( fiel.value ) %] /
|
|
[% fiel.value %]
|
|
<input type="hidden" name="tag_[% fiel.tag %]_code_00_[% fiel.key %]" value="00" />
|
|
<input type="hidden" name="tag_[% fiel.tag %]_subfield_00_[% fiel.key %]" value="[% fiel.value |html%]" />
|
|
[% END %]
|
|
|
|
[% IF ( fiel.subfield ) %]
|
|
<ul>
|
|
[% FOREACH subfiel IN fiel.subfield %]
|
|
<li id="k[% subfiel.subkey %]">
|
|
<span class="subfield">[% subfiel.subtag %]</span> / [% subfiel.value %]
|
|
<input type="hidden" name="tag_[% subfiel.tag %]_code_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.subtag %]" />
|
|
<input type="hidden" name="tag_[% subfiel.tag %]_subfield_[% subfiel.subtag %]_[% subfiel.key %]_[% subfiel.subkey %]" value="[% subfiel.value |html%]" />
|
|
</li>
|
|
[% END %]
|
|
</ul>
|
|
[% END %]
|
|
|
|
[% END %]
|
|
</li>
|
|
[% END %]
|
|
|
|
</ul>
|
|
</div>
|
|
</div> <!-- // #result -->
|
|
</div> <!-- .yui-u -->
|
|
|
|
<input type="hidden" name="biblio1" value="[% biblio1 %]" />
|
|
<input type="hidden" name="biblio2" value="[% biblio2 %]" />
|
|
<input type="hidden" name="mergereference" value="[% mergereference %]" />
|
|
<input type="hidden" name="frameworkcode" value="[% framework %]" />
|
|
|
|
<fieldset class="action"><input type="submit" name="merge" value="Merge" /></fieldset>
|
|
</div>
|
|
</form>
|
|
[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|