Martin Renvoize
c1b08d24da
This patch adds a new cataloging-home template and controller and replaces most cases of links to addbooks. This serves to provide a new cataloging home page for the cataloging module and keeps it distinct from the current addbooks page it partially replaces as a starting point for cataloging. We migrate most cataloging related tools from the 'Tools' module whilst opting to move 'Rotating collections' to the 'Circulation' section of the 'Tools' homepage. We also add links to the cataloging tab of system preferences and a the adminstration pages if the user has the correct permissions to have access to these areas. Signed-off-by: KIT <michaela.sieber@kit.edu> Signed-off-by: Emmanuel Bétemps <e.betemps@gmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
314 lines
12 KiB
Text
314 lines
12 KiB
Text
[% USE raw %]
|
||
[% USE Asset %]
|
||
[% SET footerjs = 1 %]
|
||
[% PROCESS 'merge-record.inc' %]
|
||
|
||
[% INCLUDE 'doc-head-open.inc' %]
|
||
<title>Merging records › Cataloging › 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 */
|
||
#dataPreview { width : 80%; } @media (max-width: 767px) { #dataPreview { margin: 0; width : auto; } }
|
||
</style>
|
||
</head>
|
||
|
||
<body id="cat_merge" class="cat">
|
||
[% WRAPPER 'header.inc' %]
|
||
[% INCLUDE 'cataloging-search.inc' %]
|
||
[% END %]
|
||
|
||
[% WRAPPER 'sub-header.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/cataloguing/cataloging-home.pl">Cataloging</a>
|
||
</li>
|
||
<li>
|
||
<a href="#" aria-current="page">
|
||
Merging records
|
||
</a>
|
||
</li>
|
||
</ol>
|
||
</nav>
|
||
[% END %]
|
||
|
||
<div class="main container-fluid">
|
||
<div class="row">
|
||
<div class="col-md-10 col-md-offset-1 col-lg-8 col-lg-offset-2">
|
||
|
||
<h1>Merging records</h1>
|
||
[% IF ( result ) %]
|
||
[% IF ( errors.size ) %]
|
||
[% FOREACH error IN errors %]
|
||
<div class="dialog alert">
|
||
[% IF error.code == 'CANNOT_MOVE' %]
|
||
The following items could not be moved from the old record to the new one: [% error.value | html %]
|
||
[% ELSE %]
|
||
[% error | html %]
|
||
[% END %]
|
||
<br />
|
||
Therefore, the record to be merged has not been deleted.
|
||
</div>
|
||
[% END %]
|
||
|
||
[% ELSE %]
|
||
<p>The merge was successful. <a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% ref_biblionumber | uri %]">View the merged record.</a></p>
|
||
<h3>Report</h3>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Biblionumber</th>
|
||
[% FOREACH key IN report_header.keys.sort %]
|
||
[% tag = key.substr(0, 3) %]
|
||
[% code = key.substr(3, 1) %]
|
||
[% IF code == '@' %]
|
||
[% header = tag %]
|
||
[% ELSE %]
|
||
[% header = tag _ '$' _ code %]
|
||
[% END %]
|
||
<th>[% header | html %]</th>
|
||
[% END %]
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
[% FOREACH record IN report_records %]
|
||
<tr>
|
||
<td>
|
||
[% record.biblionumber | html %]
|
||
[% IF loop.first %]
|
||
<span>(record kept)</span>
|
||
[% END %]
|
||
</td>
|
||
[% FOREACH key IN report_header.keys.sort %]
|
||
<td>
|
||
[% values = record.fields.$key %]
|
||
[% IF values %]
|
||
[% FOREACH value IN record.fields.$key %]
|
||
[% value | html %]
|
||
[% UNLESS loop.last %]<br />[% END %]
|
||
[% END %]
|
||
[% END %]
|
||
</td>
|
||
[% END %]
|
||
</tr>
|
||
[% END %]
|
||
</tbody>
|
||
</table>
|
||
[% 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>
|
||
[% FOREACH record IN records %]
|
||
<li class="radio">
|
||
[% IF loop.first %]
|
||
<input type="radio" value="[% record.biblionumber | html %]" checked="checked" id="ref_biblionumber[% record.biblionumber | html %]" name="ref_biblionumber" onclick="changeFramework('[% record.frameworkcode | html %]')" />
|
||
[% ELSE %]
|
||
<input type="radio" value="[% record.biblionumber | html %]" id="ref_biblionumber[% record.biblionumber | html %]" name="ref_biblionumber" onclick="changeFramework('[% record.frameworkcode | html %]')" />
|
||
[% END %]
|
||
<label for="ref_biblionumber[% record.biblionumber | html %]">
|
||
[% INCLUDE 'biblio-title.inc' biblio=record.data %]
|
||
([% record.biblionumber | uri %]) <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% record.biblionumber | uri %]" class="previewData">View MARC</a>
|
||
</label>
|
||
</li>
|
||
[% END %]
|
||
|
||
<li>
|
||
<label for="frameworkcode">Using framework:</label>
|
||
<select name="frameworkcode" id="frameworkcode">
|
||
<option value="">Default</option>
|
||
[% FOREACH framework IN frameworks %]
|
||
<option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
|
||
[% END %]
|
||
</select>
|
||
</li>
|
||
</ol>
|
||
|
||
[% FOREACH record IN records %]
|
||
<input type="hidden" name="biblionumber" value="[% record.biblionumber | html %]" />
|
||
[% END %]
|
||
<fieldset class="action">
|
||
<input type="submit" value="Next" />
|
||
</fieldset>
|
||
</fieldset>
|
||
</form>
|
||
|
||
<div id="dataPreview" class="modal" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<h3 id="dataPreviewLabel">Preview</h3>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
[% ELSE %]
|
||
[% IF ( errors.size ) %]
|
||
<div class="dialog alert">
|
||
[% FOREACH error IN errors %]
|
||
<p>[% error | html %]</p>
|
||
[% END %]
|
||
</div>
|
||
[% ELSE %]
|
||
<form id="mergeform" action="/cgi-bin/koha/cataloguing/merge.pl" method="post" onsubmit="return mergeformsubmit()">
|
||
|
||
<div class="col-sm-6">
|
||
[% PROCESS mergesource sourcerecords=records %]
|
||
</div>
|
||
<div class="col-sm-6">
|
||
[% PROCESS mergetarget %]
|
||
</div> <!-- .col-sm-6 -->
|
||
|
||
<input type="hidden" name="ref_biblionumber" value="[% ref_biblionumber | html %]" />
|
||
[% FOREACH record IN records %]
|
||
<input type="hidden" name="biblionumber" value="[% record.recordid | html %]" />
|
||
[% END %]
|
||
<input type="hidden" name="frameworkcode" value="[% framework | html %]" />
|
||
|
||
<fieldset class="action">
|
||
<input type="submit" name="merge" value="Merge" />
|
||
<label for="report_fields">Fields to display in report:</label>
|
||
<input type="text" name="report_fields" id="report_fields" value="[% MergeReportFields | html %]" />
|
||
<span class="hint">(Example: "001,245ab,600")</span>
|
||
</fieldset>
|
||
</form>
|
||
[% END %]
|
||
[% END %]
|
||
[% END %]
|
||
|
||
</div>
|
||
</div>
|
||
|
||
[% MACRO jsinclude BLOCK %]
|
||
[% Asset.js("js/merge-record.js") | $raw %]
|
||
<script>
|
||
[% UNLESS (result) %]
|
||
[% IF (choosereference) %]
|
||
function changeFramework(fw) {
|
||
$("#frameworkcode").val(fw);
|
||
}
|
||
$(document).ready(function(){
|
||
$(".previewData").on("click", function(e){
|
||
e.preventDefault();
|
||
var ltitle = $(this).text();
|
||
var page = $(this).attr("href");
|
||
$("#dataPreviewLabel").text(ltitle);
|
||
$("#dataPreview .modal-body").load(page + " div");
|
||
$('#dataPreview').modal({show:true});
|
||
});
|
||
$("#dataPreview").on("hidden.bs.modal", function(){
|
||
$("#dataPreviewLabel").html("");
|
||
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
|
||
});
|
||
});
|
||
[% ELSE %]
|
||
function check_mandatory () {
|
||
var missing = {
|
||
'fields': [],
|
||
'subfields': []
|
||
};
|
||
for (tag in tagslib) {
|
||
if (tag == '000' || tag == '001')
|
||
continue;
|
||
if (tagslib[tag].mandatory == 1) {
|
||
if ($("#resultul span.field:contains("+ tag +")").length == 0) {
|
||
missing.fields.push(tag);
|
||
}
|
||
}
|
||
for (subfieldcode in tagslib[tag]) {
|
||
if (subfieldcode == 'lib' || subfieldcode == 'mandatory'
|
||
|| subfieldcode == 'repeatable' || subfieldcode == 'tab'
|
||
|| subfieldcode == '@') {
|
||
continue;
|
||
}
|
||
if (tagslib[tag][subfieldcode].mandatory == 1 && tagslib[tag][subfieldcode].tab >= 0) {
|
||
var fields = $("#resultul span.field:contains("+ tag +")");
|
||
$(fields).each(function() {
|
||
var subfields = $(this).parents('li').find("span.subfield:contains("+ subfieldcode +")");
|
||
if (subfields.length == 0) {
|
||
missing.subfields.push( {
|
||
'tag': tag,
|
||
'subfieldcode': subfieldcode
|
||
} );
|
||
}
|
||
});
|
||
}
|
||
}
|
||
}
|
||
return missing;
|
||
}
|
||
|
||
// When submiting the form
|
||
function mergeformsubmit() {
|
||
var missing = check_mandatory();
|
||
var alert_msg = '';
|
||
var error = 0;
|
||
if (missing.fields.length > 0) {
|
||
alert_msg += _("Following required fields are missing:") + "\n";
|
||
for (var i in missing.fields) {
|
||
alert_msg += "\t- " + missing.fields[i] + "\n";
|
||
error ++;
|
||
}
|
||
alert_msg += "\n";
|
||
}
|
||
if (missing.subfields.length > 0) {
|
||
alert_msg += _("Following required subfields are missing:") + "\n";
|
||
for (var i in missing.subfields) {
|
||
var subfield = missing.subfields[i];
|
||
alert_msg += "\t- " + subfield.tag + "$" + subfield.subfieldcode + "\n";
|
||
error ++;
|
||
}
|
||
}
|
||
|
||
if (error != 0) {
|
||
alert(alert_msg);
|
||
return false;
|
||
} else {
|
||
$("#tabs").remove();
|
||
}
|
||
}
|
||
|
||
$(document).ready(function(){
|
||
tagslib = [];
|
||
$.getJSON("/cgi-bin/koha/cataloguing/merge_ajax.pl", {frameworkcode : "[% framework | html %]" }, function(json) {
|
||
tagslib = json;
|
||
rebuild_target($("#tabs"), $("#resultul"));
|
||
});
|
||
|
||
if( $(".tab-pane.active").length < 1 ){
|
||
$("#tabs a:first").tab("show");
|
||
}
|
||
|
||
// Uncheck all checkboxes in both tabs, then check all checkboxes in first tab
|
||
// to avoid inconsistencies from a page refresh.
|
||
$("#tabs input[type='checkbox']").prop("checked", false);
|
||
$("#tabrecord[% ref_biblionumber | html %] input[type='checkbox']").prop("checked", true );
|
||
|
||
//Set focus to cataloging search
|
||
$("input[name=q]:eq(0)").focus();
|
||
});
|
||
|
||
[% END %]
|
||
[% END %]
|
||
</script>
|
||
[% END %]
|
||
|
||
[% INCLUDE 'intranet-bottom.inc' %]
|