3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha › Tools › Stage MARC records for import</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 <style type="text/css">
7 #fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
11 <body id="tools_stage-marc-import" class="tools">
12 [% INCLUDE 'header.inc' %]
13 [% INCLUDE 'cat-search.inc' %]
15 <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>
17 <div id="doc3" class="yui-t2">
23 [% IF ( uploadmarc ) %]
24 <div id="toolbar" class="btn-toolbar">
25 <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>
26 <a class="btn btn-default btn-sm" href="/cgi-bin/koha/tools/manage-marc-import.pl?import_batch_id=[% import_batch_id %]"><i class="fa fa-list-ul"></i> Manage staged records</a>
30 <h1>Stage MARC records for import</h1>
31 [% IF ( uploadmarc ) %]
32 <p>MARC staging results :</p>
34 [% SWITCH (record_type) %]
36 <li>Processing bibliographic records</li>
38 <li>Processing authority records</li>
40 <li>[% total %] records in file</li>
41 <li>[% import_errors %] records not staged because of MARC error</li>
42 <li>[% staged %] records staged</li>
43 [% IF ( checked_matches ) %]
44 <li>[% matched %] records with at least one match in catalog per matching rule
45 "[% matcher_code %]"</li>
47 [% IF ( matcher_failed ) %]
48 <li>Record matching failed -- unable to retrieve selected matching rule.</li>
50 <li>Did not check for matches with existing records in catalog</li>
53 [% IF record_type == 'biblio' %]
54 <li>[% num_items %] item records found and staged</li>
56 [% IF ( label_batch ) %]
57 <li>New label batch created: # [% label_batch %] </li>
62 <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>
63 <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>
65 <form method="post" action="[% SCRIPT_NAME %]" id="uploadfile" enctype="multipart/form-data">
66 <fieldset class="rows" id="uploadform">
67 <legend>Stage records into the reservoir</legend>
70 <div id="fileuploadform">
71 <label for="fileToUpload">Select the file to stage: </label>
72 <input type="file" id="fileToUpload" name="fileToUpload" />
75 <fieldset class="action">
76 <button id="fileuploadbutton">Upload file</button>
77 <button id="fileuploadcancel">Cancel</button>
81 <div id="fileuploadpanel">
82 <div id="fileuploadstatus" class="progress_panel">Upload progress:
83 <progress id="fileuploadprogress" max="100" value="0">
85 <span class="fileuploadpercent">0</span>%
87 <div id="fileuploadfailed"></div>
91 <form method="post" id="processfile" action="[% SCRIPT_NAME %]" enctype="multipart/form-data">
92 <fieldset class="rows">
93 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
94 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
95 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
97 <label for="comments">Comments about this file: </label>
98 <input type="text" id="comments" name="comments" />
102 <label for='record_type'>Record type:</label>
103 <select name='record_type' id='record_type'>
104 <option value='biblio' selected='selected'>Bibliographic</option>
105 <option value='auth'>Authority</option>
109 <label for="encoding">Character encoding: </label>
110 <select name="encoding" id="encoding">
111 <option value="UTF-8" selected="selected">UTF-8 (Default)</option>
112 <option value="MARC-8">MARC 8</option>
113 <option value="ISO_5426">ISO 5426</option>
114 <option value="ISO_6937">ISO 6937</option>
115 <option value="ISO_8859-1">ISO 8859-1</option>
116 <option value="EUC-KR">EUC-KR</option>
120 <label for='format'>Format:</label>
121 <select name='format' id='format'>
122 <option value='ISO2709'>MARC</option>
123 <option value='MARCXML'>MARCXML</option>
124 [% FOREACH p IN plugins %]
125 <option value="[% p.metadata.class %]">[% p.metadata.name %] ( other format via plugin)</option>
131 [% IF MarcModificationTemplatesLoop %]
132 <fieldset class="rows">
133 <legend>Use MARC Modification Template:</legend>
136 <label for="comments">Modify record using the following template: </label>
137 <select name="marc_modification_template_id" id="marc_modification_template_id">
138 <option value="">Do not use.</option>
139 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
140 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
148 <fieldset class="rows">
149 <legend>Look for existing records in catalog?</legend>
150 <ol><li><label for="matcher">Record matching rule:</label>
151 <select name="matcher" id="matcher">
152 <option value="">Do not look for matching records</option>
153 [% FOREACH available_matcher IN available_matchers %]
154 <option value="[% available_matcher.matcher_id %]">[% available_matcher.code %] ([% available_matcher.description %])
159 <li><label for="overlay_action">Action if matching record found: </label>
160 [% INCLUDE 'tools-overlay-action.inc' %]
162 <li><label for="nomatch_action">Action if no match is found: </label>
163 [% INCLUDE 'tools-nomatch-action.inc' %]
167 <fieldset class="rows" id="items">
168 <legend>Check for embedded item record data?</legend>
171 <input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
172 <label for="parse_itemsyes">Yes</label>
175 <input type="radio" id="parse_itemsno" name="parse_items" value="0" />
176 <label for="parse_itemsno">No</label>
180 <li><label for="item_action">How to process items: </label>
181 [% INCLUDE 'tools-item-action.inc' %]
185 <fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
187 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
188 <div id="jobfailed"></div></div>
196 [% INCLUDE 'tools-menu.inc' %]
200 [% MACRO jsinclude BLOCK %]
201 [% Asset.js("js/tools-menu.js") %]
202 [% Asset.js("js/background-job-progressbar.js") %]
203 [% Asset.js("js/file-upload.js") %]
204 <script type="text/javascript">
206 $(document).ready(function(){
207 $("#processfile").hide();
208 $("#record_type").change(function() {
209 if ($(this).val() == 'auth') {
215 $("#fileuploadbutton").on("click",function(e){
219 $("#fileuploadcancel").on("click",function(e){
223 $("#mainformsubmit").on("click",function(){
224 return CheckForm( document.getElementById("processfile"));
227 function CheckForm(f) {
228 if ($("#fileToUpload").value == '') {
229 alert(_("Please upload a file first."));
231 return submitBackgroundJob(f);
235 function StartUpload() {
236 if( $('#fileToUpload').prop('files').length == 0 ) return;
237 $('#fileuploadbutton').hide();
238 $("#fileuploadfailed").hide();
239 $("#processfile").hide();
240 $("#fileuploadstatus").show();
241 $("#uploadedfileid").val('');
242 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
243 $("#fileuploadcancel").show();
245 function CancelUpload() {
246 if( xhr ) xhr.abort();
247 $("#fileuploadstatus").hide();
248 $('#fileuploadbutton').show();
249 $("#fileuploadcancel").hide();
250 $("#fileuploadfailed").show();
251 $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
253 function cbUpload( status, fileid, errors ) {
254 if( status=='done' ) {
255 $("#uploadedfileid").val( fileid );
256 $('#fileToUpload').prop('disabled',true);
257 $('#fileuploadbutton').prop('disabled',true);
258 $('#fileuploadbutton').show();
259 $("#fileuploadcancel").hide();
260 var filename=$('#fileToUpload').prop('files')[0].name;
261 if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
262 $('#format').val('MARCXML');
264 $("#processfile").show();
266 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") ];
267 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
268 $('#fileuploadbutton').show();
269 $("#fileuploadcancel").hide();
270 $("#fileuploadstatus").hide();
271 $("#fileuploadfailed").show();
272 $("#fileuploadfailed").text( _("Upload status: ") +
273 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
274 ( status=='denied'? _("Denied"): status ))
281 [% INCLUDE 'intranet-bottom.inc' %]