Bug 16538: Improve the style of progress bars
[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         $("#processfile").show();
70     } else {
71         $('#fileuploadbutton').show();
72         $("#fileuploadcancel").hide();
73         $("#fileuploadstatus").hide();
74         $("#fileuploadfailed").show();
75         $("#fileuploadfailed").text( _("Upload status: ") +
76             ( status=='failed'? _("Failed"):
77             ( status=='denied'? _("Denied"): status ))
78         );
79     }
80 }
81 //]]>
82 </script>
83 </head>
84 <body id="tools_stage-marc-import" class="tools">
85 [% INCLUDE 'header.inc' %]
86 [% INCLUDE 'cat-search.inc' %]
87
88 <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>
89
90 <div id="doc3" class="yui-t2">
91    
92    <div id="bd">
93         <div id="yui-main">
94         <div class="yui-b">
95
96 [% IF ( uploadmarc ) %]
97 <div id="toolbar" class="btn-toolbar">
98         <a class="btn btn-small" href="/cgi-bin/koha/tools/stage-marc-import.pl"><i class="fa fa-plus"></i> Stage MARC records</a>
99         <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>
100 </div>
101 [% END %]
102
103 <h1>Stage MARC records for import</h1>
104 [% IF ( uploadmarc ) %]
105 <p>MARC staging results :</p>
106 <ul>
107     [% SWITCH (record_type) %]
108     [% CASE 'biblio' %]
109         <li>Processing bibliographic records</li>
110     [% CASE 'auth' %]
111         <li>Processing authority records</li>
112     [% END %]
113         <li>[% total %]  records in file</li>
114         <li>[% import_errors %] records not staged because of MARC error</li>
115         <li>[% staged %] records staged</li>
116     [% IF ( checked_matches ) %]
117         <li>[% matched %] records with at least one match in catalog per matching rule 
118         &quot;[% matcher_code %]&quot;</li>
119     [% ELSE %]
120         [% IF ( matcher_failed ) %]
121           <li>Record matching failed -- unable to retrieve selected matching rule.</li>
122         [% ELSE %]
123           <li>Did not check for matches with existing records in catalog</li>
124         [% END %]
125     [% END %]
126     [% IF record_type == 'biblio' %]
127         <li>[% num_items %] item records found and staged</li>
128     [% END %]
129         [% IF ( label_batch ) %]
130           <li>New label batch created: # [% label_batch %] </li>
131     [% END %]
132 </ul>
133 [% ELSE %]
134 <ul>
135     <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>
136     <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>
137 </ul>
138 <form method="post" action="[% SCRIPT_NAME %]" id="uploadfile" enctype="multipart/form-data">
139 <fieldset class="rows" id="uploadform">
140 <legend>Stage records into the reservoir</legend>
141 <ol>
142         <li>
143         <div id="fileuploadform">
144                 <label for="fileToUpload">Select the file to stage: </label>
145                 <input type="file" id="fileToUpload" name="fileToUpload" />
146         </div>  </li>
147 </ol>
148     <fieldset class="action">
149         <button id="fileuploadbutton">Upload file</button>
150         <button id="fileuploadcancel">Cancel</button>
151     </fieldset>
152 </fieldset>
153                 
154     <div id="fileuploadpanel">
155         <div id="fileuploadstatus" class="progress_panel">Upload progress:
156             <progress id="fileuploadprogress" max="100" value="0">
157             </progress>
158             <span class="fileuploadpercent">0</span>%
159         </div>
160         <div id="fileuploadfailed"></div>
161     </div>
162 </form>
163
164     <form method="post" id="processfile" action="[% SCRIPT_NAME %]" enctype="multipart/form-data">
165 <fieldset class="rows">
166         <input type="hidden" name="uploadedfileid" id="uploadedfileid" value="" />
167         <input type="hidden" name="runinbackground" id="runinbackground" value="" />
168         <input type="hidden" name="completedJobID" id="completedJobID" value="" />
169         <ol><li>
170                 <label for="comments">Comments about this file: </label>
171                 <input type="text" id="comments" name="comments" />
172                 
173         </li>
174     <li>
175         <label for='record_type'>Record type:</label>
176         <select name='record_type' id='record_type'>
177             <option value='biblio' selected='selected'>Bibliographic</option>
178             <option value='auth'>Authority</option>
179         </select>
180     </li>
181         <li>
182                 <label for="encoding">Character encoding: </label>
183             <select name="encoding" id="encoding">
184                 <option value="utf8" selected="selected">UTF-8 (Default)</option>
185                 <option value="MARC-8">MARC 8</option>
186                 <option value="ISO_5426">ISO 5426</option>
187                 <option value="ISO_6937">ISO 6937</option>
188                 <option value="ISO_8859-1">ISO 8859-1</option>
189                 <option value="EUC-KR">EUC-KR</option>
190             </select>
191         </li>
192 </ol></fieldset>
193
194   [% IF plugins %]
195     <fieldset class="rows">
196       <legend>Transform file to MARC:</legend>
197       <ol>
198         <li>
199           <label for="comments">Convert file to MARC using the following plugin: </label>
200           <select name="to_marc_plugin" id="to_marc_plugin">
201             <option value="">Do not use.</option>
202               [% FOREACH p IN plugins %]
203                 <option value="[% p.metadata.class %]">[% p.metadata.name %]</option>
204               [% END %]
205           </select>
206         </li>
207       </ol>
208     </fieldset>
209   [% END %]
210
211   [% IF MarcModificationTemplatesLoop %]
212     <fieldset class="rows">
213       <legend>Use MARC Modification Template:</legend>
214       <ol>
215         <li>
216           <label for="comments">Modify record using the following template: </label>
217           <select name="marc_modification_template_id" id="marc_modification_template_id">
218             <option value="">Do not use.</option>
219               [% FOREACH mmt IN MarcModificationTemplatesLoop %]
220                 <option value="[% mmt.template_id %]">[% mmt.name %]</option>
221               [% END %]
222           </select>
223         </li>
224       </ol>
225     </fieldset>
226   [% END %]
227
228   <fieldset class="rows">
229     <legend>Look for existing records in catalog?</legend>
230     <ol><li><label for="matcher">Record matching rule:</label>
231     <select name="matcher" id="matcher">
232        <option value="">Do not look for matching records</option> 
233        [% FOREACH available_matcher IN available_matchers %]
234           <option value="[% available_matcher.matcher_id %]">[% available_matcher.code %] ([% available_matcher.description %])
235           </option>
236        [% END %]
237     </select>
238     </li>
239       <li><label for="overlay_action">Action if matching record found: </label>
240            [% INCLUDE 'tools-overlay-action.inc' %]
241       </li>
242       <li><label for="nomatch_action">Action if no match is found: </label>
243            [% INCLUDE 'tools-nomatch-action.inc' %]
244       </li>
245     </ol>
246   </fieldset>
247   <fieldset class="rows" id="items">
248     <legend>Check for embedded item record data?</legend>
249     <ol>
250       <li class="radio">
251         <input type="radio" id="parse_itemsyes" name="parse_items" value="1" checked="checked" />
252         <label for="parse_itemsyes">Yes</label>
253       </li>
254       <li class="radio">
255         <input type="radio" id="parse_itemsno" name="parse_items" value="0" />
256         <label for="parse_itemsno">No</label>
257       </li>
258     </ol>
259     <ol>
260       <li><label for="item_action">How to process items: </label>
261            [% INCLUDE 'tools-item-action.inc' %]
262       </li>
263     </ol>
264   </fieldset>
265   <fieldset class="action"><input type="button" id="mainformsubmit" value="Stage for import" /></fieldset>
266  
267        <div id="jobpanel"><div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
268      <div id="jobfailed"></div></div>
269   
270 </form>
271 [% END %]
272
273 </div>
274 </div>
275 <div class="yui-b">
276 [% INCLUDE 'tools-menu.inc' %]
277 </div>
278 </div>
279 [% INCLUDE 'intranet-bottom.inc' %]