Bug 10407: Add marcxml import (follow-up)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / stage-marc-import.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Tools &rsaquo; Stage MARC records for import</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4
5 <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
6 <script type="text/javascript" src="[% interface %]/[% theme %]/js/file-upload.js"></script>
7
8 <style type="text/css">
9     #fileuploadstatus,#fileuploadfailed,#fileuploadcancel,#jobpanel,#jobstatus,#jobfailed { display : none; }
10 </style>
11
12 <script type="text/javascript">
13 //<![CDATA[
14 var xhr;
15 $(document).ready(function(){
16         $("#processfile").hide();
17     $("#record_type").change(function() {
18         if ($(this).val() == 'auth') {
19             $('#items').hide();
20         } else {
21             $('#items').show();
22         }
23     });
24     $("#fileuploadbutton").on("click",function(e){
25         e.preventDefault();
26         StartUpload();
27     });
28     $("#fileuploadcancel").on("click",function(e){
29         e.preventDefault();
30         CancelUpload();
31     });
32     $("#mainformsubmit").on("click",function(){
33         return CheckForm( document.getElementById("processfile"));
34     });
35 });
36 function CheckForm(f) {
37     if ($("#fileToUpload").value == '') {
38         alert(_("Please upload a file first."));
39     } else {
40         return submitBackgroundJob(f);
41     }
42     return false;
43 }
44 function StartUpload() {
45     if( $('#fileToUpload').prop('files').length == 0 ) return;
46     $('#fileuploadbutton').hide();
47     $("#fileuploadfailed").hide();
48     $("#processfile").hide();
49     $("#fileuploadstatus").show();
50     $("#uploadedfileid").val('');
51     xhr= AjaxUpload( $('#fileToUpload'), $('#fileuploadprogress'), 'temp=1', cbUpload );
52     $("#fileuploadcancel").show();
53 }
54 function CancelUpload() {
55     if( xhr ) xhr.abort();
56     $("#fileuploadstatus").hide();
57     $('#fileuploadbutton').show();
58     $("#fileuploadcancel").hide();
59     $("#fileuploadfailed").show();
60     $("#fileuploadfailed").text( _("Upload status: Cancelled ") );
61 }
62 function cbUpload( status, fileid ) {
63     if( status=='done' ) {
64         $("#uploadedfileid").val( fileid );
65         $('#fileToUpload').prop('disabled',true);
66         $('#fileuploadbutton').prop('disabled',true);
67         $('#fileuploadbutton').show();
68         $("#fileuploadcancel").hide();
69         var filename=$('#fileToUpload').prop('files')[0].name;
70         if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
71             $('#format').val('MARCXML');
72         }
73         $("#processfile").show();
74     } else {
75         $('#fileuploadbutton').show();
76         $("#fileuploadcancel").hide();
77         $("#fileuploadstatus").hide();
78         $("#fileuploadfailed").show();
79         $("#fileuploadfailed").text( _("Upload status: ") +
80             ( status=='failed'? _("Failed"):
81             ( status=='denied'? _("Denied"): status ))
82         );
83     }
84 }
85 //]]>
86 </script>
87 </head>
88 <body id="tools_stage-marc-import" class="tools">
89 [% INCLUDE 'header.inc' %]
90 [% INCLUDE 'cat-search.inc' %]
91
92 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> &rsaquo; [% IF ( uploadmarc ) %]<a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a> &rsaquo; Upload Results[% ELSE %]Stage MARC records for import[% END %]</div>
93
94 <div id="doc3" class="yui-t2">
95    
96    <div id="bd">
97         <div id="yui-main">
98         <div class="yui-b">
99
100 [% IF ( uploadmarc ) %]
101 <div id="toolbar" class="btn-toolbar">
102         <a class="btn btn-small" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-plus"></i> Stage MARC records</a>
103         <a class="btn btn-small" 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>
104 </div>
105 [% END %]
106
107 <h1>Stage MARC records for import</h1>
108 [% IF ( uploadmarc ) %]
109 <p>MARC staging results :</p>
110 <ul>
111     [% SWITCH (record_type) %]
112     [% CASE 'biblio' %]
113         <li>Processing bibliographic records</li>
114     [% CASE 'auth' %]
115         <li>Processing authority records</li>
116     [% END %]
117         <li>[% total %]  records in file</li>
118         <li>[% import_errors %] records not staged because of MARC error</li>
119         <li>[% staged %] records staged</li>
120     [% IF ( checked_matches ) %]
121         <li>[% matched %] records with at least one match in catalog per matching rule 
122         &quot;[% matcher_code %]&quot;</li>
123     [% ELSE %]
124         [% IF ( matcher_failed ) %]
125           <li>Record matching failed -- unable to retrieve selected matching rule.</li>
126         [% ELSE %]
127           <li>Did not check for matches with existing records in catalog</li>
128         [% END %]
129     [% END %]
130     [% IF record_type == 'biblio' %]
131         <li>[% num_items %] item records found and staged</li>
132     [% END %]
133         [% IF ( label_batch ) %]
134           <li>New label batch created: # [% label_batch %] </li>
135     [% END %]
136 </ul>
137 [% ELSE %]
138 <ul>
139     <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>
140     <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>
141 </ul>
142 <form method="post" action="[% SCRIPT_NAME %]" id="uploadfile" enctype="multipart/form-data">
143 <fieldset class="rows" id="uploadform">
144 <legend>Stage records into the reservoir</legend>
145 <ol>
146         <li>
147         <div id="fileuploadform">
148                 <label for="fileToUpload">Select the file to stage: </label>
149                 <input type="file" id="fileToUpload" name="fileToUpload" />
150         </div>  </li>
151 </ol>
152     <fieldset class="action">
153         <button id="fileuploadbutton">Upload file</button>
154         <button id="fileuploadcancel">Cancel</button>
155     </fieldset>
156 </fieldset>
157                 
158     <div id="fileuploadpanel">
159         <div id="fileuploadstatus" class="progress_panel">Upload progress:
160             <progress id="fileuploadprogress" max="100" value="0">
161             </progress>
162             <span class="fileuploadpercent">0</span>%
163         </div>
164         <div id="fileuploadfailed"></div>
165     </div>
166 </form>
167
168     <form method="post" id="processfile" action="[% SCRIPT_NAME %]" enctype="multipart/form-data">
169 <fieldset class="rows">
170         <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
171         <input type="hidden" name="runinbackground" id="runinbackground" value="" />
172         <input type="hidden" name="completedJobID" id="completedJobID" value="" />
173         <ol><li>
174                 <label for="comments">Comments about this file: </label>
175                 <input type="text" id="comments" name="comments" />
176                 
177         </li>
178     <li>
179         <label for='record_type'>Record type:</label>
180         <select name='record_type' id='record_type'>
181             <option value='biblio' selected='selected'>Bibliographic</option>
182             <option value='auth'>Authority</option>
183         </select>
184     </li>
185         <li>
186                 <label for="encoding">Character encoding: </label>
187             <select name="encoding" id="encoding">
188                 <option value="UTF-8" selected="selected">UTF-8 (Default)</option>
189                 <option value="MARC-8">MARC 8</option>
190                 <option value="ISO_5426">ISO 5426</option>
191                 <option value="ISO_6937">ISO 6937</option>
192                 <option value="ISO_8859-1">ISO 8859-1</option>
193                 <option value="EUC-KR">EUC-KR</option>
194             </select>
195         </li>
196     <li>
197         <label for='format'>Format:</label>
198         <select name='format' id='format'>
199             <option value='ISO2709'>MARC</option>
200             <option value='MARCXML'>MARCXML</option>
201         </select>
202     </li>
203 </ol></fieldset>
204
205   [% IF plugins %]
206     <fieldset class="rows">
207       <legend>Transform file to MARC:</legend>
208       <ol>
209         <li>
210           <label for="comments">Convert file to MARC using the following plugin: </label>
211           <select name="to_marc_plugin" id="to_marc_plugin">
212             <option value="">Do not use.</option>
213               [% FOREACH p IN plugins %]
214                 <option value="[% p.metadata.class %]">[% p.metadata.name %]</option>
215               [% END %]
216           </select>
217         </li>
218       </ol>
219     </fieldset>
220   [% END %]
221
222   [% IF MarcModificationTemplatesLoop %]
223     <fieldset class="rows">
224       <legend>Use MARC Modification Template:</legend>
225       <ol>
226         <li>
227           <label for="comments">Modify record using the following template: </label>
228           <select name="marc_modification_template_id" id="marc_modification_template_id">
229             <option value="">Do not use.</option>
230               [% FOREACH mmt IN MarcModificationTemplatesLoop %]
231                 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
232               [% END %]
233           </select>
234         </li>
235       </ol>
236     </fieldset>
237   [% END %]
238
239   <fieldset class="rows">
240     <legend>Look for existing records in catalog?</legend>
241     <ol><li><label for="matcher">Record matching rule:</label>
242     <select name="matcher" id="matcher">
243        <option value="">Do not look for matching records</option> 
244        [% FOREACH available_matcher IN available_matchers %]
245           <option value="[% available_matcher.matcher_id %]">[% available_matcher.code %] ([% available_matcher.description %])
246           </option>
247        [% END %]
248     </select>
249     </li>
250       <li><label for="overlay_action">Action if matching record found: </label>
251            [% INCLUDE 'tools-overlay-action.inc' %]
252       </li>
253       <li><label for="nomatch_action">Action if no match is found: </label>
254            [% INCLUDE 'tools-nomatch-action.inc' %]
255       </li>
256     </ol>
257   </fieldset>
258   <fieldset class="rows" id="items">
259     <legend>Check for embedded item record data?</legend>
260     <ol>
261       <li class="radio">
262         <input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
263         <label for="parse_itemsyes">Yes</label>
264       </li>
265       <li class="radio">
266         <input type="radio" id="parse_itemsno" name="parse_items" value="0" />
267         <label for="parse_itemsno">No</label>
268       </li>
269     </ol>
270     <ol>
271       <li><label for="item_action">How to process items: </label>
272            [% INCLUDE 'tools-item-action.inc' %]
273       </li>
274     </ol>
275   </fieldset>
276   <fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
277  
278        <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
279      <div id="jobfailed"></div></div>
280   
281 </form>
282 [% END %]
283
284 </div>
285 </div>
286 <div class="yui-b">
287 [% INCLUDE 'tools-menu.inc' %]
288 </div>
289 </div>
290 [% INCLUDE 'intranet-bottom.inc' %]