4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Stage MARC records for import</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 <style type="text/css">
8 #fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
12 <body id="tools_stage-marc-import" class="tools">
13 [% INCLUDE 'header.inc' %]
14 [% INCLUDE 'cat-search.inc' %]
16 <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>
18 <div id="doc3" class="yui-t2">
24 [% IF ( uploadmarc ) %]
25 <div id="toolbar" class="btn-toolbar">
26 <a class="btn btn-default btn-sm" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-plus"></i> Stage MARC records</a>
27 <a class="btn btn-default btn-sm" 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>
31 <h1>Stage MARC records for import</h1>
32 [% IF ( uploadmarc ) %]
33 <p>MARC staging results :</p>
35 [% SWITCH (record_type) %]
37 <li>Processing bibliographic records</li>
39 <li>Processing authority records</li>
41 <li>[% total | html %] records in file</li>
42 <li>[% import_errors | html %] records not staged because of MARC error</li>
43 <li>[% staged | html %] records staged</li>
44 [% IF ( checked_matches ) %]
45 <li>[% matched | html %] records with at least one match in catalog per matching rule
46 "[% matcher_code | html %]"</li>
48 [% IF ( matcher_failed ) %]
49 <li>Record matching failed -- unable to retrieve selected matching rule.</li>
51 <li>Did not check for matches with existing records in catalog</li>
54 [% IF record_type == 'biblio' %]
55 <li>[% num_items | html %] item records found and staged</li>
57 [% IF ( label_batch ) %]
58 <li>New label batch created: # [% label_batch | html %] </li>
63 <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>
64 <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>
66 <form method="post" action="[% SCRIPT_NAME | html %]" id="uploadfile" enctype="multipart/form-data">
67 <fieldset class="rows" id="uploadform">
68 <legend>Stage records into the reservoir</legend>
71 <div id="fileuploadform">
72 <label for="fileToUpload">Select the file to stage: </label>
73 <input type="file" id="fileToUpload" name="fileToUpload" />
76 <fieldset class="action">
77 <button id="fileuploadbutton">Upload file</button>
78 <button id="fileuploadcancel">Cancel</button>
82 <div id="fileuploadpanel">
83 <div id="fileuploadstatus" class="progress_panel">Upload progress:
84 <progress id="fileuploadprogress" max="100" value="0">
86 <span class="fileuploadpercent">0</span>%
88 <div id="fileuploadfailed"></div>
92 <form method="post" id="processfile" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
93 <fieldset class="rows">
94 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
95 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
96 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
98 <label for="comments">Comments about this file: </label>
99 <input type="text" id="comments" name="comments" />
103 <label for='record_type'>Record type:</label>
104 <select name='record_type' id='record_type'>
105 <option value='biblio' selected='selected'>Bibliographic</option>
106 <option value='auth'>Authority</option>
110 <label for="encoding">Character encoding: </label>
111 <select name="encoding" id="encoding">
112 <option value="UTF-8" selected="selected">UTF-8 (Default)</option>
113 <option value="MARC-8">MARC 8</option>
114 <option value="ISO_5426">ISO 5426</option>
115 <option value="ISO_6937">ISO 6937</option>
116 <option value="ISO_8859-1">ISO 8859-1</option>
117 <option value="EUC-KR">EUC-KR</option>
121 <label for='format'>Format:</label>
122 <select name='format' id='format'>
123 <option value='ISO2709'>MARC</option>
124 <option value='MARCXML'>MARCXML</option>
125 [% FOREACH p IN plugins %]
126 <option value="[% p.metadata.class | html %]">[% p.metadata.name | html %] ( other format via plugin)</option>
132 [% IF MarcModificationTemplatesLoop %]
133 <fieldset class="rows">
134 <legend>Use MARC Modification Template:</legend>
137 <label for="comments">Modify record using the following template: </label>
138 <select name="marc_modification_template_id" id="marc_modification_template_id">
139 <option value="">Do not use.</option>
140 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
141 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
149 <fieldset class="rows">
150 <legend>Look for existing records in catalog?</legend>
151 <ol><li><label for="matcher">Record matching rule:</label>
152 <select name="matcher" id="matcher">
153 <option value="">Do not look for matching records</option>
154 [% FOREACH available_matcher IN available_matchers %]
155 <option value="[% available_matcher.matcher_id | html %]">[% available_matcher.code | html %] ([% available_matcher.description | html %])
160 <li><label for="overlay_action">Action if matching record found: </label>
161 [% INCLUDE 'tools-overlay-action.inc' %]
163 <li><label for="nomatch_action">Action if no match is found: </label>
164 [% INCLUDE 'tools-nomatch-action.inc' %]
168 <fieldset class="rows" id="items">
169 <legend>Check for embedded item record data?</legend>
172 <input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
173 <label for="parse_itemsyes">Yes</label>
176 <input type="radio" id="parse_itemsno" name="parse_items" value="0" />
177 <label for="parse_itemsno">No</label>
181 <li><label for="item_action">How to process items: </label>
182 [% INCLUDE 'tools-item-action.inc' %]
186 <fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
188 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
189 <div id="jobfailed"></div></div>
197 [% INCLUDE 'tools-menu.inc' %]
201 [% MACRO jsinclude BLOCK %]
202 [% Asset.js("js/tools-menu.js") | $raw %]
203 [% Asset.js("js/background-job-progressbar.js") | $raw %]
204 [% Asset.js("js/file-upload.js") | $raw %]
205 <script type="text/javascript">
207 $(document).ready(function(){
208 $("#processfile").hide();
209 $("#record_type").change(function() {
210 if ($(this).val() == 'auth') {
216 $("#fileuploadbutton").on("click",function(e){
220 $("#fileuploadcancel").on("click",function(e){
224 $("#mainformsubmit").on("click",function(){
225 return CheckForm( document.getElementById("processfile"));
228 function CheckForm(f) {
229 if ($("#fileToUpload").value == '') {
230 alert(_("Please upload a file first."));
232 return submitBackgroundJob(f);
236 function StartUpload() {
237 if( $('#fileToUpload').prop('files').length == 0 ) return;
238 $('#fileuploadbutton').hide();
239 $("#fileuploadfailed").hide();
240 $("#processfile").hide();
241 $("#fileuploadstatus").show();
242 $("#uploadedfileid").val('');
243 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
244 $("#fileuploadcancel").show();
246 function CancelUpload() {
247 if( xhr ) xhr.abort();
248 $("#fileuploadstatus").hide();
249 $('#fileuploadbutton').show();
250 $("#fileuploadcancel").hide();
251 $("#fileuploadfailed").show();
252 $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
254 function cbUpload( status, fileid, errors ) {
255 if( status=='done' ) {
256 $("#uploadedfileid").val( fileid );
257 $('#fileToUpload').prop('disabled',true);
258 $('#fileuploadbutton').prop('disabled',true);
259 $('#fileuploadbutton').show();
260 $("#fileuploadcancel").hide();
261 var filename=$('#fileToUpload').prop('files')[0].name;
262 if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
263 $('#format').val('MARCXML');
265 $("#processfile").show();
267 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") ];
268 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
269 $('#fileuploadbutton').show();
270 $("#fileuploadcancel").hide();
271 $("#fileuploadstatus").hide();
272 $("#fileuploadfailed").show();
273 $("#fileuploadfailed").text( _("Upload status: ") +
274 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
275 ( status=='denied'? _("Denied"): status ))
282 [% INCLUDE 'intranet-bottom.inc' %]