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