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