Main Koha release repository
https://koha-community.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
296 lines
12 KiB
296 lines
12 KiB
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Tools › Stage MARC records for import</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
<style>
|
|
#fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
|
|
</style>
|
|
|
|
[% Asset.css("css/humanmsg.css") | $raw %]
|
|
|
|
</head>
|
|
<body id="tools_stage-marc-import" class="tools">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'cat-search.inc' %]
|
|
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> › [% IF ( uploadmarc ) %]<a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a> › Upload Results[% ELSE %]Stage MARC records for import[% END %]</div>
|
|
|
|
<div class="main container-fluid">
|
|
<div class="row">
|
|
<div class="col-sm-10 col-sm-push-2">
|
|
<main>
|
|
|
|
[% IF ( uploadmarc ) %]
|
|
<div id="toolbar" class="btn-toolbar">
|
|
<a class="btn btn-default" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-plus"></i> Stage MARC records</a>
|
|
<a class="btn btn-default" href="/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=[% import_batch_id | html %]"><i class="fa fa-list-ul"></i> Manage staged records</a>
|
|
</div>
|
|
[% END %]
|
|
|
|
<h1>Stage MARC records for import</h1>
|
|
[% IF ( uploadmarc ) %]
|
|
<p>MARC staging results :</p>
|
|
<ul>
|
|
[% SWITCH (record_type) %]
|
|
[% CASE 'biblio' %]
|
|
<li>Processing bibliographic records</li>
|
|
[% CASE 'auth' %]
|
|
<li>Processing authority records</li>
|
|
[% END %]
|
|
<li>[% total | html %] records in file</li>
|
|
<li>[% import_errors | html %] records not staged because of MARC error</li>
|
|
<li>[% staged | html %] records staged</li>
|
|
[% IF ( checked_matches ) %]
|
|
<li>[% matched | html %] records with at least one match in catalog per matching rule
|
|
"[% matcher_code | html %]"</li>
|
|
[% ELSE %]
|
|
[% IF ( matcher_failed ) %]
|
|
<li>Record matching failed -- unable to retrieve selected matching rule.</li>
|
|
[% ELSE %]
|
|
<li>Did not check for matches with existing records in catalog</li>
|
|
[% END %]
|
|
[% END %]
|
|
[% IF record_type == 'biblio' %]
|
|
<li>[% num_items | html %] item records found and staged</li>
|
|
[% END %]
|
|
[% IF ( label_batch ) %]
|
|
<li>New label batch created: # [% label_batch | html %] </li>
|
|
[% END %]
|
|
</ul>
|
|
[% IF basketno && booksellerid %]
|
|
<p>
|
|
<a id="addtobasket" class="btn btn-default" href="/cgi-bin/koha/acqui/addorderiso2709.pl?import_batch_id=[% import_batch_id | html %]&basketno=[% basketno | html %]&booksellerid=[% booksellerid | html %]">Add staged files to basket</a>
|
|
</p>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<ul>
|
|
<li>Select a MARC file to stage in the import reservoir. It will be parsed, and each valid record staged for later import into the catalog.</li>
|
|
<li>You can enter a name for this import. It may be useful, when creating a record, to remember where the suggested MARC data comes from!</li>
|
|
</ul>
|
|
<form method="post" action="[% SCRIPT_NAME | html %]" id="uploadfile" enctype="multipart/form-data">
|
|
<fieldset class="rows" id="uploadform">
|
|
<legend>Stage records into the reservoir</legend>
|
|
<ol>
|
|
<li>
|
|
<div id="fileuploadform">
|
|
<label for="fileToUpload">Select the file to stage: </label>
|
|
<input type="file" id="fileToUpload" name="fileToUpload" />
|
|
</div> </li>
|
|
</ol>
|
|
<fieldset class="action">
|
|
<button id="fileuploadbutton">Upload file</button>
|
|
<button id="fileuploadcancel">Cancel</button>
|
|
</fieldset>
|
|
</fieldset>
|
|
|
|
<div id="fileuploadpanel">
|
|
<div id="fileuploadstatus" class="progress_panel">Upload progress:
|
|
<progress id="fileuploadprogress" max="100" value="0">
|
|
</progress>
|
|
<span class="fileuploadpercent">0</span>%
|
|
</div>
|
|
<div id="fileuploadfailed"></div>
|
|
</div>
|
|
</form>
|
|
|
|
<form method="post" id="processfile" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
|
|
[% IF basketno && booksellerid %]
|
|
<input type="hidden" name="basketno" id="basketno" value="[% basketno | html %]" />
|
|
<input type="hidden" name="booksellerid" id="booksellerid" value="[% booksellerid | html %]" />
|
|
[% END %]
|
|
<fieldset class="rows">
|
|
<input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
|
|
<input type="hidden" name="runinbackground" id="runinbackground" value="" />
|
|
<input type="hidden" name="completedJobID" id="completedJobID" value="" />
|
|
<ol><li>
|
|
<label for="comments">Comments about this file: </label>
|
|
<input type="text" id="comments" name="comments" />
|
|
|
|
</li>
|
|
<li>
|
|
<label for='record_type'>Record type:</label>
|
|
<select name='record_type' id='record_type'>
|
|
<option value='biblio' selected='selected'>Bibliographic</option>
|
|
<option value='auth'>Authority</option>
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for="encoding">Character encoding: </label>
|
|
<select name="encoding" id="encoding">
|
|
<option value="UTF-8" selected="selected">UTF-8 (Default)</option>
|
|
<option value="MARC-8">MARC 8</option>
|
|
<option value="ISO_5426">ISO 5426</option>
|
|
<option value="ISO_6937">ISO 6937</option>
|
|
<option value="ISO_8859-1">ISO 8859-1</option>
|
|
<option value="EUC-KR">EUC-KR</option>
|
|
</select>
|
|
</li>
|
|
<li>
|
|
<label for='format'>Format:</label>
|
|
<select name='format' id='format'>
|
|
<option value='ISO2709'>MARC</option>
|
|
<option value='MARCXML'>MARCXML</option>
|
|
[% FOREACH p IN plugins %]
|
|
<option value="[% p.metadata.class | html %]">[% p.metadata.name | html %] ( other format via plugin)</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol></fieldset>
|
|
|
|
[% IF MarcModificationTemplatesLoop %]
|
|
<fieldset class="rows">
|
|
<legend>Use MARC Modification Template:</legend>
|
|
<ol>
|
|
<li>
|
|
<label for="comments">Modify record using the following template: </label>
|
|
<select name="marc_modification_template_id" id="marc_modification_template_id">
|
|
<option value="">Do not use.</option>
|
|
[% FOREACH mmt IN MarcModificationTemplatesLoop %]
|
|
<option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
[% END %]
|
|
|
|
<fieldset class="rows">
|
|
<legend>Look for existing records in catalog?</legend>
|
|
<ol><li><label for="matcher">Record matching rule:</label>
|
|
<select name="matcher" id="matcher">
|
|
<option value="">Do not look for matching records</option>
|
|
[% FOREACH available_matcher IN available_matchers %]
|
|
<option value="[% available_matcher.matcher_id | html %]">[% available_matcher.code | html %] ([% available_matcher.description | html %])
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
<li><label for="overlay_action">Action if matching record found: </label>
|
|
[% INCLUDE 'tools-overlay-action.inc' %]
|
|
</li>
|
|
<li><label for="nomatch_action">Action if no match is found: </label>
|
|
[% INCLUDE 'tools-nomatch-action.inc' %]
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="rows" id="items">
|
|
<legend>Check for embedded item record data?</legend>
|
|
<ol>
|
|
<li class="radio">
|
|
<input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
|
|
<label for="parse_itemsyes">Yes</label>
|
|
</li>
|
|
<li class="radio">
|
|
<input type="radio" id="parse_itemsno" name="parse_items" value="0" />
|
|
<label for="parse_itemsno">No</label>
|
|
</li>
|
|
</ol>
|
|
<ol>
|
|
<li><label for="item_action">How to process items: </label>
|
|
[% INCLUDE 'tools-item-action.inc' %]
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
|
|
|
|
<div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
|
|
<div id="jobfailed"></div></div>
|
|
|
|
</form>
|
|
[% END %]
|
|
|
|
</main>
|
|
</div> <!-- /.col-sm-10.col-sm-push-2 -->
|
|
|
|
<div class="col-sm-2 col-sm-pull-10">
|
|
<aside>
|
|
[% INCLUDE 'tools-menu.inc' %]
|
|
</aside>
|
|
</div> <!-- /.col-sm-2.col-sm-pull-10 -->
|
|
</div> <!-- /.row -->
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/tools-menu.js") | $raw %]
|
|
[% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
|
|
[% Asset.js("js/background-job-progressbar.js") | $raw %]
|
|
[% Asset.js("js/file-upload.js") | $raw %]
|
|
<script>
|
|
var xhr;
|
|
$(document).ready(function(){
|
|
$("#processfile").hide();
|
|
$("#record_type").change(function() {
|
|
if ($(this).val() == 'auth') {
|
|
$('#items').hide();
|
|
} else {
|
|
$('#items').show();
|
|
}
|
|
});
|
|
$("#fileuploadbutton").on("click",function(e){
|
|
e.preventDefault();
|
|
StartUpload();
|
|
});
|
|
$("#fileuploadcancel").on("click",function(e){
|
|
e.preventDefault();
|
|
CancelUpload();
|
|
});
|
|
$("#mainformsubmit").on("click",function(){
|
|
return CheckForm( document.getElementById("processfile"));
|
|
});
|
|
});
|
|
function CheckForm(f) {
|
|
if ($("#fileToUpload").value == '') {
|
|
alert(_("Please upload a file first."));
|
|
} else {
|
|
return submitBackgroundJob(f);
|
|
}
|
|
return false;
|
|
}
|
|
function StartUpload() {
|
|
if( $('#fileToUpload').prop('files').length == 0 ) return;
|
|
$('#fileuploadbutton').hide();
|
|
$("#fileuploadfailed").hide();
|
|
$("#processfile").hide();
|
|
$("#fileuploadstatus").show();
|
|
$("#uploadedfileid").val('');
|
|
xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
|
|
$("#fileuploadcancel").show();
|
|
}
|
|
function CancelUpload() {
|
|
if( xhr ) xhr.abort();
|
|
$("#fileuploadstatus").hide();
|
|
$('#fileuploadbutton').show();
|
|
$("#fileuploadcancel").hide();
|
|
$("#fileuploadfailed").show();
|
|
$("#fileuploadfailed").text( _("Upload status: Cancelled ") );
|
|
}
|
|
function cbUpload( status, fileid, errors ) {
|
|
if( status=='done' ) {
|
|
$("#uploadedfileid").val( fileid );
|
|
$('#fileToUpload').prop('disabled',true);
|
|
$('#fileuploadbutton').prop('disabled',true);
|
|
$('#fileuploadbutton').show();
|
|
$("#fileuploadcancel").hide();
|
|
var filename=$('#fileToUpload').prop('files')[0].name;
|
|
if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
|
|
$('#format').val('MARCXML');
|
|
}
|
|
$("#processfile").show();
|
|
} else {
|
|
var errMsgs = [ _("Error code 0 not used"), _("File already exists"), _("Directory is not writeable"), _("Root directory for uploads not defined"), _("Temporary directory for uploads not defined") ];
|
|
var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
|
|
$('#fileuploadbutton').show();
|
|
$("#fileuploadcancel").hide();
|
|
$("#fileuploadstatus").hide();
|
|
$("#fileuploadfailed").show();
|
|
$("#fileuploadfailed").text( _("Upload status: ") +
|
|
( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
|
|
( status=='denied'? _("Denied"): status ))
|
|
);
|
|
}
|
|
}
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|
|
|