Bug 16241 - Move staff client CSS out of language directory
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / manage-marc-import.tt
1 [% BLOCK final_match_link %]
2     [% IF ( record.record_type == 'biblio' ) %]
3         <a target="_blank" href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% record.final_match_id %]">[% record.final_match_id %]</a>
4     [% ELSIF ( record.record_type == 'auth' ) %]
5         <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% record.final_match_id %]">[% record.final_match_id %]</a>
6     [% END %]
7 [% END %]
8 [% BLOCK match_link %]
9     [% IF ( record_lis.match_id ) %]
10         <tr>
11             <td />
12             [% IF ( record.record_type == 'biblio' ) %]
13                 <td colspan="5">Matches biblio [% record_lis.match_id %] (score = [% record_lis.match_score %]): <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% record_lis.match_id %]">[% record_lis.match_citation %]</a></td>
14             [% ELSIF ( record.record_type == 'auth' ) %]
15                 <td colspan="5">Matches authority [% record_lis.match_id %] (score = [% record_lis.match_score %]): <a href="/cgi-bin/koha/authorities/detail.pl?authid=[% record_lis.match_id %]">[% record_lis.match_citation %]</a> |
16         <a href="/cgi-bin/koha/authorities/merge.pl?mergereference=breeding&authid=[% record_lis.match_id %]&authid=[% record_lis.import_record_id %]">Merge</a>
17                 </td>
18             [% END %]
19         </tr>
20     [% ELSIF ( record.record_type == 'auth') %]
21         <tr data-authid="[% record_lis.import_record_id %]">
22             <td />
23             <td  colspan="4"><a href="#" class="merge_auth">Search for a record to merge in a new window</a></td>
24         </tr>
25     [% END %]
26 [% END %]
27
28 [% INCLUDE 'doc-head-open.inc' %]
29 <title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
30 [% IF ( import_batch_id ) %]
31  &rsaquo; Batch [% import_batch_id %]
32 [% END %]
33 </title>
34 [% INCLUDE 'doc-head-close.inc' %]
35 <script type="text/javascript" src="[% themelang %]/js/background-job-progressbar.js"></script>
36 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
37 [% INCLUDE 'datatables.inc' %]
38 <script type="text/javascript">
39 //<![CDATA[
40 var MSG_CONFIRM_CLEAN = _("Clear all reservoir records staged in this batch?  This cannot be undone.");
41 var MSG_CONFIRM_UNDO_IMPORT = _("Are you sure you want to undo the import of this batch into the catalog?");
42
43 $(document).ready(function(){
44   $("#staged-record-matching-rules select").change(function(){
45       var str = $(this).attr("id");
46       $("#reset_"+str).parent().show();
47   });
48   $("a.reset").click(function(){
49       var str = $(this).attr("id");
50       str = str.replace("reset_","")
51       $("#"+str+" option[selected='selected']").attr("selected","selected");
52       $(this).parent().hide();
53   });
54
55   [% IF import_batch_id %]
56       $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
57           "bAutoWidth": false,
58           "bFilter": false,
59           "bProcessing": true,
60           "bServerSide": true,
61           "sAjaxSource": 'batch_records_ajax.pl',
62           "sPaginationType": "full_numbers",
63           "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
64           "aoColumns": [
65               { "mDataProp": "import_record_id" },
66               { "mDataProp": "citation" },
67               { "mDataProp": "status" },
68               { "mDataProp": "overlay_status" },
69               { "mDataProp": "match_citation" },
70               { "mDataProp": "diff_url" },
71               { "mDataProp": "matched" }
72           ],
73           "fnServerData": function ( sSource, aoData, fnCallback ) {
74               aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } );
75
76               $.ajax({
77                   'dataType': 'json',
78                   'type': 'POST',
79                   'url': sSource,
80                   'data': aoData,
81                   'success': function(json){
82                       fnCallback(json);
83                   }
84               });
85           },
86           "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
87             [% IF ( record_type == 'auth' ) %]
88                 var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
89             [% ELSE %]
90                 var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
91             [% END %]
92
93             $('td:eq(1)', nRow).html(
94                 '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
95             );
96
97             $('td:eq(2)', nRow).html(
98                 aData['status'] == 'imported' ? _("Imported") :
99                 aData['status'] == 'ignored'  ? _("Ignored")  :
100                 aData['status'] == 'reverted' ? _("Reverted") :
101                 aData['status'] == 'staged'   ? _("Staged")   :
102                 aData['status'] == 'error'    ? _("Error")    :
103                 aData['status']
104             );
105
106             $('td:eq(3)', nRow).html(
107                 aData['overlay_status'] == 'no_match'      ? _("No match")       :
108                 aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
109                 aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
110                 aData['overlay_status']
111             );
112
113             if ( aData['match_id'] ) {
114                 [% IF ( record_type == 'auth' ) -%]
115                 var matching_msg = _("Matches authority %s (score=%s):%s");
116                 [%- ELSE -%]
117                 var matching_msg = _("Matches biblio %s (score=%s):%s");
118                 [%- END %]
119                 $('td:eq(4)', nRow).html(
120                     matching_msg.format(aData['match_id'], aData['score'],
121                     '<a target="_blank" href="' + record_details_url
122                     + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
123                 );
124             }
125             if (aData['diff_url']){
126                 $('td:eq(5)', nRow).html(
127                     '<a href="'+aData['diff_url']+'">View</a>'
128                 );
129             }
130             $('td:eq(6)', nRow).html(
131                 '<a target="_blank" href="' + record_details_url
132                     + aData['matched'] + '">' + aData['matched'] + '</a>'
133             );
134           },
135       }));
136     [% END %]
137     $("body").on("click",".previewMARC", function(e){
138         e.preventDefault();
139         var ltitle = $(this).text();
140         var page = $(this).attr("href");
141         $("#marcPreviewLabel").text(ltitle);
142         $("#marcPreview .modal-body").load(page + " table");
143         $('#marcPreview').modal({show:true});
144     });
145     $("#marcPreview").on("hidden", function(){
146         $("#marcPreviewLabel").html("");
147         $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/loading-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
148     });
149 });
150
151 //]]>
152 </script>
153 <style type="text/css">
154         #jobpanel,#jobstatus,#jobfailed { display : none; }
155         #jobstatus { margin:.4em; }
156     #jobprogress{ width:200px;height:10px;border:1px solid #666;background:url('[% interface %]/[% theme %]/img/progress.png') -300px 0px no-repeat; } span.change-status { font-style:italic; color:#666; display:none; }#marcPreview { width : 80%; margin-left : -40%; } @media (max-width: 767px) { #marcPreview { margin: 0; width : auto; } }
157 </style>
158 </head>
159 <body id="tools_manage-marc-import" class="tools">
160 [% INCLUDE 'header.inc' %]
161 [% INCLUDE 'cat-search.inc' %]
162
163 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> 
164 [% IF ( import_batch_id ) %]
165  &rsaquo;
166  <a href="[% script_name %]">Manage staged MARC records</a>
167  &rsaquo; Batch [% import_batch_id %]
168 [% ELSE %]
169  &rsaquo; Manage staged MARC records
170 [% END %]
171 </div>
172
173 <div id="doc3" class="yui-t2">
174    
175    <div id="bd">
176         <div id="yui-main">
177         <div class="yui-b">
178
179 <h1>Manage staged MARC records
180 [% IF ( import_batch_id ) %]
181  &rsaquo; Batch [% import_batch_id %]
182 [% END %]
183 </h1>
184 [% IF ( label_batch_msg ) %]
185 [% IF ( alert ) %]
186 <div class="alert">
187 [% ELSE %]
188 <div class="dialog message">
189 [% END %]
190 <b><p>[% label_batch_msg %]</p></b>
191 </div>
192 [% END %]
193
194 [% IF ( did_clean ) %]
195   <div class="dialog message">Cleaned import batch #[% import_batch_id %]</div>
196 [% END %]
197
198 [% UNLESS ( batch_list ) %]
199    [% UNLESS ( batch_info ) %]
200    <div class="dialog message">
201      <p>No records have been staged.</p>
202      <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
203    </div>
204    [% END %]
205 [% END %]
206
207 [% IF ( batch_info ) %]
208
209 [% IF ( can_commit ) %]
210 <form action="[% script_name %]" method="post">
211 <input type="hidden" name="op" value="redo-matching" />
212 <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
213 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id %]" />
214 [% END %]
215
216   [% IF ( rematch_attempted ) %]
217     [% IF ( rematch_failed ) %]
218       <div class="dialog alert">Failed to apply different matching rule</div>
219     [% ELSE %]
220       <div class="dialog message">Applied different matching rule.  Number of records matched now
221        [% num_with_matches %]
222       </div>
223     [% END %]
224   [% END %]
225   [% IF ( changed_overlay_action ) %]
226       <div class="dialog message">Changed action if matching record found</div>
227   [% END %]
228   [% IF ( changed_nomatch_action ) %]
229       <div class="dialog message">Changed action if no match found</div>
230   [% END %]
231   [% IF ( changed_item_action ) %]
232       <div class="dialog message">Changed item processing option</div>
233   [% END %]
234
235 <fieldset class="rows" id="staged-record-matching-rules">
236   <ol>
237     <li><span class="label">File name:</span> [% file_name %]</li>
238     <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments %][% ELSE %](none)[% END %]</li>
239     <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
240     <li><span class="label">Staged:</span> [% upload_timestamp %]</li>
241     <li><span class="label">Status:</span>
242       [% IF ( import_status == 'cleaned' ) %]
243          Cleaned
244       [% ELSIF ( import_status == 'imported' ) %]
245         Imported
246       [% ELSIF ( import_status == 'importing' ) %]
247         Importing
248       [% ELSIF ( import_status == 'reverted' ) %]
249          Reverted
250       [% ELSIF ( import_status == 'reverting' ) %]
251          Reverting
252       [% ELSIF ( import_status == 'staged' ) %]
253           Staged
254       [% ELSE %]
255           [% import_status %]
256       [% END %]
257       </li>
258     <li>
259 [% IF ( can_commit ) %]<label for="new_matcher_id">Matching rule applied:</label><select name="new_matcher_id" id="new_matcher_id">
260        <option value="">Do not look for matching records</option> 
261        [% FOREACH available_matcher IN available_matchers %]
262           [% IF ( available_matcher.selected ) %]
263           <option value="[% available_matcher.matcher_id %]" selected="selected">
264              [% available_matcher.code %] ([% available_matcher.description %])
265           </option>
266           [% ELSE %]
267           <option value="[% available_matcher.matcher_id %]">
268             [% available_matcher.code %] ([% available_matcher.description %])
269           </option>
270           [% END %]
271        [% END %]
272     </select> <span class="change-status">Changed. <a href="#" class="reset" id="reset_new_matcher_id">Reset</a></span>[% ELSE %]<span class="label">Matching rule applied</span>[% IF ( current_matcher_id ) %]
273   [% current_matcher_code %] ([% current_matcher_description %])
274 [% ELSE %]
275   No matching rule in effect
276 [% END %][% END %]
277     </li>
278     <li>
279         [% IF ( can_commit ) %]
280             <label for="overlay_action">Action if matching record found:</label>
281             [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
282         [% ELSE %]
283             <span class="label">Action if matching record found:</span>
284             [% IF ( overlay_action == 'replace' ) %]
285                 Replace existing record with incoming record
286             [% ELSIF ( overlay_action == 'create_new' ) %]
287                 Add incoming record
288             [% ELSIF ( overlay_action == 'ignore' ) %]
289                 Ignore incoming record (its items may still be processed)
290             [% ELSE %]
291                 [% overlay_action %]
292             [% END %]
293         [% END %]</li>
294      
295     <li>
296         [% IF ( can_commit ) %]
297             <label for="nomatch_action">Action if no match found:</label>
298             [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
299         [% ELSE %]
300             <span class="label">Action if no match found:</span>
301             [% IF ( nomatch_action == 'create_new' ) %]
302                 Add incoming record
303             [% ELSIF ( nomatch_action == 'ignore' ) %]
304                 Ignore incoming record (its items may still be processed)
305             [% ELSE %]
306                 [% nomatch_action %]
307             [% END %]
308         [% END %]
309     </li>
310
311     [% IF ( record_type == 'biblio' ) %]
312     <li>
313         [% IF ( can_commit ) %]
314             <label for="item_action">Item processing:</label>
315             [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
316         [% ELSE %]
317             <span class="label">Item processing:</span>
318             [% IF ( item_action == 'always_add' ) %]
319                 Always add items
320             [% ELSIF ( item_action == 'add_only_for_matches' ) %]
321                 Add items only if matching bib was found
322             [% ELSIF ( item_action == 'add_only_for_new' ) %]
323                 Add items only if no matching bib was found
324             [% ELSIF ( item_action == 'ignore' ) %]
325                 Ignore items
326             [% ELSE %]
327                 [% item_action %]
328             [% END %]
329         [% END %]
330     </li>
331     [% END %]
332   </ol>
333 [% IF ( can_commit ) %]<fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset></form>[% END %]
334 </fieldset>
335
336
337 <div>
338   [% IF ( can_commit ) %]
339   <form action="[% script_name %]" method="post">
340     <input type="hidden" name="op" value="commit-batch" />
341     <input type="hidden" name="runinbackground" value="" />
342     <input type="hidden" name="completedJobID" value="" />
343     <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
344     <fieldset class="action">
345     <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" onclick="return submitBackgroundJob(this.form);" />
346     <br/>
347     [% IF ( record_type != 'auth' ) %]
348     Add new bibliographic records into this framework:
349     <select name="framework" id="frameworks">
350       <option value="">Default</option>
351       [% FOREACH framework IN frameworks %]
352           <option value="[% framework.value %]">[% framework.label %]</option>
353       [% END %]
354     </select>
355     [% END %]
356     </fieldset>
357   </form>
358   <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
359      <div id="jobfailed"></div></div>
360   [% END %]
361   [% IF ( can_revert ) %]
362   <form action="[% script_name %]" method="post">
363     <input type="hidden" name="op" value="revert-batch" />
364     <input type="hidden" name="runinbackground" value="" />
365     <input type="hidden" name="completedJobID" value="" />
366     <input type="hidden" name="import_batch_id" value="[% import_batch_id %]" />
367     <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" onclick="return confirm(MSG_CONFIRM_UNDO_IMPORT) && submitBackgroundJob(this.form);" /></fieldset>
368   </form>
369   <div id="jobpanel"><div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
370      <div id="jobfailed"></div></div>
371   [% END %]
372 </div>
373   [% IF ( did_commit ) %]
374   <div class="dialog message">Completed import of records</div>
375   <table>
376   <tr><td>Number of records added</td><td>[% num_added %]</td></tr>
377   <tr><td>Number of records updated</td><td>[% num_updated %]</td></tr>
378   <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
379   [% IF ( record_type == 'biblio' ) %]
380       <tr><td>Number of items added</td><td>[% num_items_added %]</td></tr>
381       <tr><td>Number of items replaced</td><td>[% num_items_replaced %]</td></tr>
382       <tr><td>Number of items ignored because of duplicate barcode</td><td>[% num_items_errored %]</td></tr>
383   [% END %]
384   </table>
385   [% END %]
386   [% IF ( did_revert ) %]
387   <div class="dialog message">Success: Import reversed</div>
388   <table>
389   <tr><td>Number of records deleted</td><td>[% num_deleted %]</td></tr>
390   [% IF ( record_type == 'biblio' ) %]
391     <tr><td>Number of items deleted</td><td>[% num_items_deleted %]</td></tr>
392     <tr><td>Number of records not deleted due to items on loan</td><td>[% num_errors %]</td></tr>
393   [% END %]
394   <tr><td>Number of records changed back</td><td>[% num_reverted %]</td></tr>
395   <tr><td>Number of records ignored</td><td>[% num_ignored %]</td></tr>
396   </table>
397   [% END %]
398 [% END %]
399 <br style="clear:both;" />
400
401 [% IF ( batch_list ) %]
402   [% IF ( pages ) %]
403 <div class="pages">
404 Page 
405     [% FOREACH page IN pages %]
406       [% IF ( page.current_page ) %]
407       <span class="current">[% page.page_number %]</span>
408       [% ELSE %]
409       <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
410       [% END %]
411     [% END %]
412 </div>
413   [% END %]
414 <table>
415   <tr>
416     <th>#</th>
417     <th>File name</th>
418     <th>Comments</th>
419     <th>Type</th>
420     <th>Status</th>
421     <th>Staged</th>
422     <th># Records</th>
423     <th># Items</th>
424     <th>Action</th>
425   </tr>
426   [% FOREACH batch_lis IN batch_list %]
427     <tr>
428     <td>[% batch_lis.import_batch_id %]</td>
429     <td><a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]">[% batch_lis.file_name %]</a></td>
430     <td>[% batch_lis.comments %]</td>
431     <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
432     <td>
433       [% IF ( batch_lis.import_status == 'cleaned' ) %]
434          Cleaned
435       [% ELSIF ( batch_lis.import_status == 'imported' ) %]
436         Imported
437       [% ELSIF ( batch_lis.import_status == 'importing' ) %]
438         Importing
439       [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
440          Reverted
441       [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
442          Reverting
443       [% ELSIF ( batch_lis.import_status == 'staged' ) %]
444           Staged
445       [% ELSE %]
446           [% batch_lis.import_status %]
447       [% END %]
448     </td>
449     <td>[% batch_lis.upload_timestamp %]</td>
450     <td>[% batch_lis.num_records %]</td>
451     <td>[% batch_lis.num_items %][% IF ( batch_lis.num_items ) %] <a href="[% batch_lis.script_name %]?import_batch_id=[% batch_lis.import_batch_id %]&amp;op=create_labels">(Create label batch)</a>[% END %]</td>
452     <td>[% IF ( batch_lis.can_clean ) %]
453           <form method="post" action="[% batch_lis.script_name %]" name="clean_batch_[% batch_lis.import_batch_id %]" id="clean_batch_[% batch_lis.import_batch_id %]" >
454             <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id %]" />
455             <input type="hidden" name="op" value="clean-batch" />
456             <button class="btn btn-small" onclick="return confirm(MSG_CONFIRM_CLEAN);">Clean</button>
457           </form>
458         [% END %]
459     </td>
460   </tr>
461   [% END %]
462 </table>
463   [% IF ( pages ) %]
464 <div class="pages">
465 Page 
466     [% FOREACH page IN pages %]
467       [% IF ( page.current_page ) %]
468       <span class="current">[% page.page_number %]</span>
469       [% ELSE %]
470       <a class="nav" href="[% page.script_name %]?offset=[% page.offset %]">[% page.page_number %]</a>
471       [% END %]
472     [% END %]
473 </div>
474   [% END %]
475 [% END %]
476
477 [% IF import_batch_id %]
478     <table id="records-table">
479         <thead>
480             <tr>
481                 <th>#</th>
482                 <th>Citation</th>
483                 <th>Status</th>
484                 <th>Match type</th>
485                 <th>Match details</th>
486                 <th><abbr title="Differences between the original biblio and the imported" lang="en">Diff</abbr></th>
487                 <th>Record</th>
488             </tr>
489         </thead>
490     </table>
491
492     <div id="marcPreview" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
493         <div class="modal-header">
494             <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
495             <h3 id="marcPreviewLabel">MARC preview</h3>
496         </div>
497         <div class="modal-body">
498             <div id="loading"> <img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /> Loading </div>
499         </div>
500         <div class="modal-footer">
501             <button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
502         </div>
503     </div>
504 [% END %]
505
506 </div>
507 </div>
508 <div class="yui-b">
509 [% INCLUDE 'tools-menu.inc' %]
510 </div>
511 </div>
512 [% INCLUDE 'intranet-bottom.inc' %]