4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha › Tools › Stage MARC records for import</title>
6 [% INCLUDE 'doc-head-close.inc' %]
8 #fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
11 [% Asset.css("css/humanmsg.css") | $raw %]
14 <body id="tools_stage-marc-import" class="tools">
15 [% INCLUDE 'header.inc' %]
16 [% INCLUDE 'cat-search.inc' %]
18 <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>
20 <div class="main container-fluid">
22 <div class="col-sm-10 col-sm-push-2">
25 [% IF ( uploadmarc ) %]
26 <div id="toolbar" class="btn-toolbar">
27 <a class="btn btn-default" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-plus"></i> Stage MARC records</a>
28 <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>
32 <h1>Stage MARC records for import</h1>
33 [% IF ( uploadmarc ) %]
34 <p>MARC staging results :</p>
36 [% SWITCH (record_type) %]
38 <li>Processing bibliographic records</li>
40 <li>Processing authority records</li>
42 <li>[% total | html %] records in file</li>
43 <li>[% import_errors | html %] records not staged because of MARC error</li>
44 <li>[% staged | html %] records staged</li>
45 [% IF ( checked_matches ) %]
46 <li>[% matched | html %] records with at least one match in catalog per matching rule
47 "[% matcher_code | html %]"</li>
49 [% IF ( matcher_failed ) %]
50 <li>Record matching failed -- unable to retrieve selected matching rule.</li>
52 <li>Did not check for matches with existing records in catalog</li>
55 [% IF record_type == 'biblio' %]
56 <li>[% num_items | html %] item records found and staged</li>
58 [% IF ( label_batch ) %]
59 <li>New label batch created: # [% label_batch | html %] </li>
62 [% IF basketno && booksellerid %]
64 <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>
69 <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>
70 <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>
72 <form method="post" action="[% SCRIPT_NAME | html %]" id="uploadfile" enctype="multipart/form-data">
73 <fieldset class="rows" id="uploadform">
74 <legend>Stage records into the reservoir</legend>
77 <div id="fileuploadform">
78 <label for="fileToUpload">Select the file to stage: </label>
79 <input type="file" id="fileToUpload" name="fileToUpload" />
82 <fieldset class="action">
83 <button id="fileuploadbutton">Upload file</button>
84 <button id="fileuploadcancel">Cancel</button>
88 <div id="fileuploadpanel">
89 <div id="fileuploadstatus" class="progress_panel">Upload progress:
90 <progress id="fileuploadprogress" max="100" value="0">
92 <span class="fileuploadpercent">0</span>%
94 <div id="fileuploadfailed"></div>
98 <form method="post" id="processfile" action="[% SCRIPT_NAME | html %]" enctype="multipart/form-data">
99 [% IF basketno && booksellerid %]
100 <input type="hidden" name="basketno" id="basketno" value="[% basketno | html %]" />
101 <input type="hidden" name="booksellerid" id="booksellerid" value="[% booksellerid | html %]" />
103 <fieldset class="rows">
104 <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
105 <input type="hidden" name="runinbackground" id="runinbackground" value="" />
106 <input type="hidden" name="completedJobID" id="completedJobID" value="" />
108 <label for="comments">Comments about this file: </label>
109 <input type="text" id="comments" name="comments" />
113 <label for='record_type'>Record type:</label>
114 <select name='record_type' id='record_type'>
115 <option value='biblio' selected='selected'>Bibliographic</option>
116 <option value='auth'>Authority</option>
120 <label for="encoding">Character encoding: </label>
121 <select name="encoding" id="encoding">
122 <option value="UTF-8" selected="selected">UTF-8 (Default)</option>
123 <option value="MARC-8">MARC 8</option>
124 <option value="ISO_5426">ISO 5426</option>
125 <option value="ISO_6937">ISO 6937</option>
126 <option value="ISO_8859-1">ISO 8859-1</option>
127 <option value="EUC-KR">EUC-KR</option>
131 <label for='format'>Format:</label>
132 <select name='format' id='format'>
133 <option value='ISO2709'>MARC</option>
134 <option value='MARCXML'>MARCXML</option>
135 [% FOREACH p IN plugins %]
136 <option value="[% p.metadata.class | html %]">[% p.metadata.name | html %] ( other format via plugin)</option>
142 [% IF MarcModificationTemplatesLoop %]
143 <fieldset class="rows">
144 <legend>Use MARC Modification Template:</legend>
147 <label for="comments">Modify record using the following template: </label>
148 <select name="marc_modification_template_id" id="marc_modification_template_id">
149 <option value="">Do not use.</option>
150 [% FOREACH mmt IN MarcModificationTemplatesLoop %]
151 <option value="[% mmt.template_id | html %]">[% mmt.name | html %]</option>
159 <fieldset class="rows">
160 <legend>Look for existing records in catalog?</legend>
161 <ol><li><label for="matcher">Record matching rule:</label>
162 <select name="matcher" id="matcher">
163 <option value="">Do not look for matching records</option>
164 [% FOREACH available_matcher IN available_matchers %]
165 <option value="[% available_matcher.matcher_id | html %]">[% available_matcher.code | html %] ([% available_matcher.description | html %])
170 <li><label for="overlay_action">Action if matching record found: </label>
171 [% INCLUDE 'tools-overlay-action.inc' %]
173 <li><label for="nomatch_action">Action if no match is found: </label>
174 [% INCLUDE 'tools-nomatch-action.inc' %]
178 <fieldset class="rows" id="items">
179 <legend>Check for embedded item record data?</legend>
182 <input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
183 <label for="parse_itemsyes">Yes</label>
186 <input type="radio" id="parse_itemsno" name="parse_items" value="0" />
187 <label for="parse_itemsno">No</label>
191 <li><label for="item_action">How to process items: </label>
192 [% INCLUDE 'tools-item-action.inc' %]
196 <fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
198 <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
199 <div id="jobfailed"></div></div>
205 </div> <!-- /.col-sm-10.col-sm-push-2 -->
207 <div class="col-sm-2 col-sm-pull-10">
209 [% INCLUDE 'tools-menu.inc' %]
211 </div> <!-- /.col-sm-2.col-sm-pull-10 -->
212 </div> <!-- /.row -->
214 [% MACRO jsinclude BLOCK %]
215 [% Asset.js("js/tools-menu.js") | $raw %]
216 [% Asset.js("js/background-job-progressbar.js") | $raw %]
217 [% Asset.js("js/file-upload.js") | $raw %]
218 [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
221 $(document).ready(function(){
222 $("#processfile").hide();
223 $("#record_type").change(function() {
224 if ($(this).val() == 'auth') {
230 $("#fileuploadbutton").on("click",function(e){
234 $("#fileuploadcancel").on("click",function(e){
238 $("#mainformsubmit").on("click",function(){
239 return CheckForm( document.getElementById("processfile"));
242 function CheckForm(f) {
243 if ($("#fileToUpload").value == '') {
244 alert(_("Please upload a file first."));
246 return submitBackgroundJob(f);
250 function StartUpload() {
251 if( $('#fileToUpload').prop('files').length == 0 ) return;
252 $('#fileuploadbutton').hide();
253 $("#fileuploadfailed").hide();
254 $("#processfile").hide();
255 $("#fileuploadstatus").show();
256 $("#uploadedfileid").val('');
257 xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
258 $("#fileuploadcancel").show();
260 function CancelUpload() {
261 if( xhr ) xhr.abort();
262 $("#fileuploadstatus").hide();
263 $('#fileuploadbutton').show();
264 $("#fileuploadcancel").hide();
265 $("#fileuploadfailed").show();
266 $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
268 function cbUpload( status, fileid, errors ) {
269 if( status=='done' ) {
270 $("#uploadedfileid").val( fileid );
271 $('#fileToUpload').prop('disabled',true);
272 $('#fileuploadbutton').prop('disabled',true);
273 $('#fileuploadbutton').show();
274 $("#fileuploadcancel").hide();
275 var filename=$('#fileToUpload').prop('files')[0].name;
276 if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
277 $('#format').val('MARCXML');
279 $("#processfile").show();
281 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") ];
282 var errCode = errors[$('#fileToUpload').prop('files')[0].name].code;
283 $('#fileuploadbutton').show();
284 $("#fileuploadcancel").hide();
285 $("#fileuploadstatus").hide();
286 $("#fileuploadfailed").show();
287 $("#fileuploadfailed").text( _("Upload status: ") +
288 ( status=='failed'? _("Failed") + " - (" + errCode + ") " + errMsgs[errCode]:
289 ( status=='denied'? _("Denied"): status ))
296 [% INCLUDE 'intranet-bottom.inc' %]