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