Bug 27846: (follow-up) Add id back to breadcrumbs container
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / tools / manage-marc-import.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE KohaDates %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Tools &rsaquo; Manage staged MARC records
7     [% IF ( import_batch_id ) %]
8         &rsaquo; Batch [% import_batch_id | html %]
9     [% END %]
10 </title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 [% Asset.css("css/humanmsg.css") | $raw %]
13 <style>
14     #jobpanel,#jobstatus,#jobfailed { display : none; }
15     span.change-status { font-style:italic; color:#666; display:none; }
16 </style>
17 </head>
18
19 <body id="tools_manage-marc-import" class="tools">
20     [% INCLUDE 'header.inc' %]
21     [% INCLUDE 'cat-search.inc' %]
22
23     <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
24         <ol>
25             <li>
26                 <a href="/cgi-bin/koha/mainpage.pl">Home</a>
27             </li>
28             <li>
29                 <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
30             </li>
31             [% IF ( import_batch_id ) %]
32                 <li>
33                     <a href="[% script_name | url %]">Manage staged MARC records</a>
34                 </li>
35                 <li>
36                     <a href="#" aria-current="page">
37                         Batch [% import_batch_id | html %]
38                     </a>
39                 </li>
40             [% ELSE %]
41                 <li>
42                     <a href="#" aria-current="page">
43                         Manage staged MARC records
44                     </a>
45                 </li>
46             [% END %]
47         </ol>
48     </nav>
49
50     <div class="main container-fluid">
51         <div class="row">
52             <div class="col-sm-10 col-sm-push-2">
53                 <main>
54                     <h1>Manage staged MARC records
55                         [% IF ( import_batch_id ) %]
56                             &rsaquo; Batch [% import_batch_id | html %]
57                         [% END %]
58                     </h1>
59
60                     [% IF ( label_batch_msg ) %]
61                         [% IF ( alert ) %]
62                             <div class="alert">
63                         [% ELSE %]
64                             <div class="dialog message">
65                         [% END %]
66                             <p><strong>
67                                 [% IF ( label_batch_msg == "error" ) %]
68                                     Error attempting to create label batch. Please ask your system administrator to check the log for more details.
69                                 [% ELSE %]
70                                     Label <a href="/cgi-bin/koha/labels/label-edit-batch.pl?op=edit&element_id=[% label_batch_msg | uri %]" >batch #[% label_batch_msg | html %]</a> created.
71                                 [% END %]
72                             </strong></p>
73                         </div>
74                     [% END %]
75
76                     [% IF ( did_clean ) %]
77                         <div class="dialog message">Cleaned import batch #[% import_batch_id | html %]</div>
78                     [% END %]
79
80                     [% IF ( did_delete ) %]
81                         <div class="dialog message">Import batch deleted successfully</div>
82                     [% END %]
83
84                     [% UNLESS ( batch_list ) %]
85                         [% UNLESS ( batch_info ) %]
86                             <div class="dialog message">
87                                 <p>No records have been staged.</p>
88                                 <p><a href="/cgi-bin/koha/tools/stage-marc-import.pl">Stage MARC records for import</a>.</p>
89                             </div>
90                         [% END %]
91                     [% END %]
92
93                     [% IF ( batch_info ) %]
94                         [% IF ( can_commit ) %]
95                             <form action="[% script_name | html %]" method="post">
96                                 <input type="hidden" name="op" value="redo-matching" />
97                                 <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
98                                 <input type="hidden" name="current_matcher_id" value="[% current_matcher_id | html %]" />
99                         [% END %]
100
101                         [% IF ( rematch_attempted ) %]
102                             [% IF ( rematch_failed ) %]
103                                 <div class="dialog alert">Failed to apply different matching rule</div>
104                             [% ELSE %]
105                                 <div class="dialog message">Applied different matching rule. Number of records matched now
106                                     [% num_with_matches | html %]
107                                 </div>
108                             [% END %]
109                         [% END %]
110
111                         [% IF ( changed_overlay_action ) %]
112                             <div class="dialog message">Changed action if matching record found</div>
113                         [% END %]
114
115                         [% IF ( changed_nomatch_action ) %]
116                             <div class="dialog message">Changed action if no match found</div>
117                         [% END %]
118
119                         [% IF ( changed_item_action ) %]
120                             <div class="dialog message">Changed item processing option</div>
121                         [% END %]
122
123                         <fieldset class="rows" id="staged-record-matching-rules">
124                             <ol>
125                                 <li><span class="label">File name:</span> [% file_name | html %]</li>
126                                 <li><span class="label">Profile:</span> [% IF (profile) %][% profile | html %][% ELSE %](none)[% END %]</li>
127                                 <li><span class="label">Comments:</span> [% IF ( comments ) %][% comments | html %][% ELSE %](none)[% END %]</li>
128                                 <li><span class="label">Type:</span> [% IF ( record_type == 'auth' ) %]Authority records[% ELSE %]Bibliographic records[% END %]</li>
129                                 <li><span class="label">Staged:</span> [% upload_timestamp | $KohaDates with_hours=1 %]</li>
130                                 <li><span class="label">Status:</span>
131                                     [% IF ( import_status == 'cleaned' ) %]
132                                         Cleaned
133                                     [% ELSIF ( import_status == 'imported' ) %]
134                                         Imported
135                                     [% ELSIF ( import_status == 'importing' ) %]
136                                         Importing
137                                     [% ELSIF ( import_status == 'reverted' ) %]
138                                         Reverted
139                                     [% ELSIF ( import_status == 'reverting' ) %]
140                                         Reverting
141                                     [% ELSIF ( import_status == 'staged' ) %]
142                                         Staged
143                                     [% ELSE %]
144                                         [% import_status | html %]
145                                     [% END %]
146                                 </li>
147                                 <li>
148                                     [% IF ( can_commit ) %]
149                                         <label for="new_matcher_id">Matching rule applied:</label>
150                                         <select name="new_matcher_id" id="new_matcher_id">
151                                             <option value="">Do not look for matching records</option>
152                                             [% FOREACH available_matcher IN available_matchers %]
153                                                 [% IF ( available_matcher.selected ) %]
154                                                     <option value="[% available_matcher.matcher_id | html %]" selected="selected">
155                                                         [% available_matcher.code | html %] ([% available_matcher.description | html %])
156                                                     </option>
157                                                 [% ELSE %]
158                                                     <option value="[% available_matcher.matcher_id | html %]">
159                                                         [% available_matcher.code | html %] ([% available_matcher.description | html %])
160                                                     </option>
161                                                 [% END %]
162                                             [% END %]
163                                         </select>
164                                         <span class="change-status">Changed. <a href="#" class="reset" id="reset_new_matcher_id">Reset</a></span>
165                                     [% ELSE %]
166                                         <span class="label">Matching rule applied</span>
167                                         [% IF ( current_matcher_id ) %]
168                                             [% current_matcher_code | html %] ([% current_matcher_description | html %])
169                                         [% ELSE %]
170                                             No matching rule in effect
171                                         [% END %]
172                                     [% END %]
173                                 </li>
174                                 <li>
175                                     [% IF ( can_commit ) %]
176                                         <label for="overlay_action">Action if matching record found:</label>
177                                         [% INCLUDE 'tools-overlay-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_overlay_action">Reset</a></span>
178                                     [% ELSE %]
179                                         <span class="label">Action if matching record found:</span>
180                                         [% IF ( overlay_action == 'replace' ) %]
181                                             Replace existing record with incoming record
182                                         [% ELSIF ( overlay_action == 'create_new' ) %]
183                                             Add incoming record
184                                         [% ELSIF ( overlay_action == 'ignore' ) %]
185                                             Ignore incoming record (its items may still be processed)
186                                         [% ELSE %]
187                                             [% overlay_action | html %]
188                                         [% END %]
189                                     [% END %]
190                                 </li>
191                                 <li>
192                                     [% IF ( can_commit ) %]
193                                         <label for="nomatch_action">Action if no match found:</label>
194                                         [% INCLUDE 'tools-nomatch-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_nomatch_action">Reset</a></span>
195                                     [% ELSE %]
196                                         <span class="label">Action if no match found:</span>
197                                         [% IF ( nomatch_action == 'create_new' ) %]
198                                             Add incoming record
199                                         [% ELSIF ( nomatch_action == 'ignore' ) %]
200                                             Ignore incoming record (its items may still be processed)
201                                         [% ELSE %]
202                                             [% nomatch_action | html %]
203                                         [% END %]
204                                     [% END %]
205                                 </li>
206                                 [% IF ( record_type == 'biblio' ) %]
207                                     <li>
208                                         [% IF ( can_commit ) %]
209                                             <label for="item_action">Item processing:</label>
210                                             [% INCLUDE 'tools-item-action.inc' %] <span class="change-status">Changed. <a href="#" class="reset" id="reset_item_action">Reset</a></span>
211                                         [% ELSE %]
212                                             <span class="label">Item processing:</span>
213                                             [% IF ( item_action == 'always_add' ) %]
214                                                 Always add items
215                                             [% ELSIF ( item_action == 'add_only_for_matches' ) %]
216                                                 Add items only if matching bib was found
217                                             [% ELSIF ( item_action == 'add_only_for_new' ) %]
218                                                 Add items only if no matching bib was found
219                                             [% ELSIF ( item_action == 'ignore' ) %]
220                                                 Ignore items
221                                             [% ELSE %]
222                                                 [% item_action | html %]
223                                             [% END %]
224                                         [% END %]
225                                     </li>
226                                 [% END %]
227                             </ol>
228                             [% IF ( can_commit ) %]
229                                     <fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset>
230                                 </form>
231                             [% END %]
232                         </fieldset> <!-- /#staged-record-matching-rules -->
233
234                         <div>
235                             [% IF ( can_commit ) %]
236                                 <form action="[% script_name | html %]" method="post" id="import_batch_form">
237                                     <input type="hidden" name="op" value="commit-batch" />
238                                     <input type="hidden" name="runinbackground" value="" />
239                                     <input type="hidden" name="completedJobID" value="" />
240                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
241                                     <fieldset class="action">
242                                         [% IF ( record_type != 'auth' ) %]
243                                             Add new bibliographic records into this framework:
244                                             <select name="framework" id="frameworks">
245                                                 <option value="">Default</option>
246                                                 [% FOREACH framework IN frameworks %]
247                                                     <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
248                                                 [% END %]
249                                             </select>
250                                         [% END %]
251                                         <br />
252                                         <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
253                                     </fieldset>
254                                 </form> <!-- /#import_batch_form -->
255                                 <div id="jobpanel">
256                                     <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
257                                     <div id="jobfailed"></div>
258                                 </div>
259                             [% END # /IF can_commit %]
260                             [% IF ( can_revert ) %]
261                                 <form action="[% script_name | html %]" method="post" id="revert_batch_form">
262                                     <input type="hidden" name="op" value="revert-batch" />
263                                     <input type="hidden" name="runinbackground" value="" />
264                                     <input type="hidden" name="completedJobID" value="" />
265                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
266                                     <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
267                                 </form>
268                                 <div id="jobpanel">
269                                     <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
270                                     <div id="jobfailed"></div>
271                                 </div>
272                             [% END # /IF can_revert %]
273                         </div>
274
275                         [% IF ( did_commit ) %]
276                             <div class="dialog message">Completed import of records</div>
277                             <table>
278                                 <tr>
279                                     <td>Number of records added</td>
280                                     <td>[% num_added | html %]</td>
281                                 </tr>
282                                 <tr>
283                                     <td>Number of records updated</td>
284                                     <td>[% num_updated | html %]</td>
285                                 </tr>
286                                 <tr>
287                                     <td>Number of records ignored</td>
288                                     <td>[% num_ignored | html %]</td>
289                                 </tr>
290                                 [% IF ( record_type == 'biblio' ) %]
291                                     <tr>
292                                         <td>Number of items added</td>
293                                         <td>[% num_items_added | html %]</td>
294                                     </tr>
295                                     <tr>
296                                         <td>Number of items replaced</td>
297                                         <td>[% num_items_replaced | html %]</td>
298                                     </tr>
299                                     <tr>
300                                         <td>Number of items ignored because of duplicate barcode</td>
301                                         <td>[% num_items_errored | html %]</td>
302                                     </tr>
303                                 [% END %]
304                             </table>
305                         [% END #/ IF did_commit %]
306
307                         [% IF ( did_revert ) %]
308                             <div class="dialog message">Success: Import reversed</div>
309                             <table>
310                                 <tr>
311                                     <td>Number of records deleted</td>
312                                     <td>[% num_deleted | html %]</td>
313                                 </tr>
314                                 [% IF ( record_type == 'biblio' ) %]
315                                     <tr>
316                                         <td>Number of items deleted</td>
317                                         <td>[% num_items_deleted | html %]</td>
318                                     </tr>
319                                     <tr>
320                                         <td>Number of records not deleted due to items on loan</td>
321                                         <td>[% num_errors | html %]</td>
322                                     </tr>
323                                 [% END %]
324                                 <tr>
325                                     <td>Number of records changed back</td>
326                                     <td>[% num_reverted | html %]</td>
327                                 </tr>
328                                 <tr>
329                                     <td>Number of records ignored</td>
330                                     <td>[% num_ignored | html %]</td>
331                                 </tr>
332                             </table>
333                         [% END  # /IF did_revert%]
334
335                     [% END # /IF batch_info %]
336
337                     <br style="clear:both;" />
338
339                     [% IF ( batch_list ) %]
340                         [% IF ( pages ) %]
341                             [% PROCESS pagination %]
342                         [% END %]
343
344                         <table>
345                             <tr>
346                                 <th>#</th>
347                                 <th>File name</th>
348                                 <th>Profile</th>
349                                 <th>Comments</th>
350                                 <th>Type</th>
351                                 <th>Status</th>
352                                 <th>Staged</th>
353                                 <th># Records</th>
354                                 <th># Items</th>
355                                 <th>Action</th>
356                             </tr>
357                             [% FOREACH batch_lis IN batch_list %]
358                                 <tr>
359                                     <td>[% batch_lis.import_batch_id | html %]</td>
360                                     <td><a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]">[% batch_lis.file_name | html %]</a></td>
361                                     <td>[% batch_lis.profile | html %]</td>
362                                     <td>[% batch_lis.comments | html %]</td>
363                                     <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
364                                     <td>
365                                         [% IF ( batch_lis.import_status == 'cleaned' ) %]
366                                             Cleaned
367                                         [% ELSIF ( batch_lis.import_status == 'imported' ) %]
368                                             Imported
369                                         [% ELSIF ( batch_lis.import_status == 'importing' ) %]
370                                             Importing
371                                         [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
372                                             Reverted
373                                         [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
374                                             Reverting
375                                         [% ELSIF ( batch_lis.import_status == 'staged' ) %]
376                                             Staged
377                                         [% ELSE %]
378                                             [% batch_lis.import_status | html %]
379                                         [% END %]
380                                     </td>
381                                     <td>[% batch_lis.upload_timestamp | $KohaDates with_hours=1 %]</td>
382                                     <td>[% batch_lis.num_records | html %]</td>
383                                     <td>[% batch_lis.num_items | html %]
384                                         [% IF ( batch_lis.num_items && batch_lis.import_status == 'imported' ) %]
385                                             (<a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;op=create_labels">Create label batch</a>)
386                                         [% END %]
387                                     </td>
388                                     <td class="actions">
389                                         [% IF ( batch_lis.can_clean ) %]
390                                             <form method="post" action="[% batch_lis.script_name | html %]" name="clean_batch_[% batch_lis.import_batch_id | html %]" id="clean_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_clean">
391                                                 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
392                                                 <input type="hidden" name="op" value="clean-batch" />
393                                                 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-eraser"></i> Clean</button>
394                                             </form>
395                                         [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
396                                             <form method="post" action="/cgi-bin/koha/tools/manage-marc-import.pl" name="delete_batch_[% batch_lis.import_batch_id | html %]" id="delete_batch_[% batch_lis.import_batch_id | html %]" class="batch_form batch_delete">
397                                                 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
398                                                 <input type="hidden" name="op" value="delete-batch" />
399                                                 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
400                                             </form>
401                                         [% END %]
402                                     </td>
403                                 </tr>
404                             [% END # /FOREACH batch_lis %]
405                         </table>
406
407                         [% IF ( pages ) %]
408                             [% PROCESS pagination %]
409                         [% END %]
410                     [% END # /IF batch_lis %]
411
412                     [% IF import_batch_id && !did_clean %]
413                         <table id="records-table">
414                             <thead>
415                                 <tr>
416                                     <th>#</th>
417                                     <th>Citation</th>
418                                     <th>Status</th>
419                                     <th>Match type</th>
420                                     <th>Match details</th>
421                                     <th><abbr title="Differences between the original bibliographic record and the imported">Diff</abbr></th>
422                                     <th>Record</th>
423                                 </tr>
424                             </thead>
425                         </table>
426
427                         <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
428                             <div class="modal-dialog modal-wide">
429                                 <div class="modal-content">
430                                     <div class="modal-header">
431                                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
432                                         <h3 id="marcPreviewLabel">MARC preview</h3>
433                                     </div>
434                                     <div class="modal-body">
435                                         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
436                                     </div>
437                                     <div class="modal-footer">
438                                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
439                                     </div>
440                                 </div>
441                             </div>
442                         </div> <!-- /#marcPreview -->
443                     [% END # /IF import_batch_id %]
444                 </main>
445
446             </div> <!-- /.col-sm-10.col-sm-push-2 -->
447             <div class="col-sm-2 col-sm-pull-10">
448                 <aside>
449                     [% INCLUDE 'tools-menu.inc' %]
450                 </aside>
451             </div> <!-- .col-sm-2.col-sm-pull-10 -->
452         </div> <!-- /.row -->
453
454 [% MACRO jsinclude BLOCK %]
455     [% Asset.js("js/tools-menu.js") | $raw %]
456     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
457     [% Asset.js("js/background-job-progressbar.js") | $raw %]
458     [% INCLUDE 'datatables.inc' %]
459     <script>
460         $(document).ready(function() {
461             $("#staged-record-matching-rules select").change(function() {
462                 var str = $(this).attr("id");
463                 $("#reset_" + str).parent().show();
464             });
465             $("a.reset").click(function() {
466                 var str = $(this).attr("id");
467                 str = str.replace("reset_", "")
468                 $("#" + str + " option[selected='selected']").attr("selected", "selected");
469                 $(this).parent().hide();
470             });
471
472             [% IF import_batch_id %]
473                 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
474                     "bAutoWidth": false,
475                     "bFilter": false,
476                     "bProcessing": true,
477                     "bServerSide": true,
478                     "sAjaxSource": 'batch_records_ajax.pl',
479                     "sPaginationType": "full_numbers",
480                     "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
481                     "aoColumns": [
482                         { "mDataProp": "import_record_id" },
483                         { "mDataProp": "citation" },
484                         { "mDataProp": "status" },
485                         { "mDataProp": "overlay_status" },
486                         { "mDataProp": "match_citation" },
487                         { "mDataProp": "diff_url" },
488                         { "mDataProp": "matched" }
489                     ],
490                     "fnServerData": function(sSource, aoData, fnCallback) {
491                         aoData.push({ "name": "import_batch_id", "value": [% import_batch_id | html %] });
492
493                         $.ajax({
494                             'dataType': 'json',
495                             'type': 'POST',
496                             'url': sSource,
497                             'data': aoData,
498                             'success': function(json) {
499                                 fnCallback(json);
500                             }
501                         });
502                     },
503                     "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
504                         [% IF(record_type == 'auth') %]
505                             var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
506                         [% ELSE %]
507                             var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
508                         [% END %]
509
510                         var additional_details = "";
511                         if( aData['author'] ){
512                             additional_details += " " + aData['author'] + " ";
513                         }
514
515                         if( aData['isbn'] ){
516                             additional_details += " (" + aData['isbn'] + ") ";
517                         }
518
519                         if( aData['issn'] ){
520                             additional_details += " (" + aData['issn'] + ") ";
521                         }
522
523                         $('td:eq(1)', nRow).html(
524                             '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a> ' + additional_details
525                         );
526
527                         $('td:eq(2)', nRow).html(
528                             aData['status'] == 'imported' ? _("Imported") :
529                             aData['status'] == 'ignored' ? _("Ignored") :
530                             aData['status'] == 'reverted' ? _("Reverted") :
531                             aData['status'] == 'staged' ? _("Staged") :
532                             aData['status'] == 'error' ? _("Error") :
533                             aData['status']
534                         );
535
536                         $('td:eq(3)', nRow).html(
537                             aData['overlay_status'] == 'no_match' ? _("No match") :
538                             aData['overlay_status'] == 'match_applied' ? _("Match applied") :
539                             aData['overlay_status'] == 'auto_match' ? _("Match found") :
540                             aData['overlay_status']
541                         );
542
543                         if (aData['match_id']) {
544                             [% IF(record_type == 'auth') -%]
545                                 var matching_msg = _("Matches authority %s (score=%s):%s");
546                             [%- ELSE -%]
547                                 var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
548                             [%- END %]
549                             $('td:eq(4)', nRow).html(
550                                 matching_msg.format(aData['match_id'], aData['score'],
551                                     '<a target="_blank" href="' + record_details_url
552                                     + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
553                             );
554                         }
555                         if (aData['diff_url']) {
556                             $('td:eq(5)', nRow).html(
557                                 '<a href="' + aData['diff_url'] + '">' + _("View") + '</a>'
558                             );
559                         }
560                         $('td:eq(6)', nRow).html(
561                             '<a target="_blank" href="' + record_details_url
562                             + aData['matched'] + '">' + aData['matched'] + '</a>'
563                         );
564                     },
565                 }));
566                 $("#import_batch_form").on("submit", function() {
567                     return submitBackgroundJob(document.getElementById("import_batch_form"));
568                 });
569                 $("#revert_batch_form").on("submit", function() {
570                     return confirm(_("Are you sure you want to undo the import of this batch into the catalog?")) && submitBackgroundJob(document.getElementById("revert_batch_form"));
571                 });
572             [% END %]
573
574             $("body").on("click", ".previewMARC", function(e) {
575                 e.preventDefault();
576                 var ltitle = $(this).text();
577                 var page = $(this).attr("href");
578                 $("#marcPreviewLabel").text(ltitle);
579                 $("#marcPreview .modal-body").load(page + " table");
580                 $('#marcPreview').modal({ show: true });
581             });
582             $("#marcPreview").on("hidden.bs.modal", function() {
583                 $("#marcPreviewLabel").html("");
584                 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
585             });
586             $(".batch_form").on("submit", function() {
587                 if ($(this).hasClass("batch_delete")) {
588                     return confirm(_("Are you sure you want to permanently delete this batch?"));
589                 } else {
590                     return confirm(_("Clear all reservoir records staged in this batch?  This cannot be undone."));
591                 }
592             });
593         });
594
595     </script>
596 [% END %]
597 [% INCLUDE 'intranet-bottom.inc' %]
598 [% BLOCK pagination %]
599     <nav>
600         <ul class="pagination">
601             [% FOREACH page IN pages %]
602                 [% IF ( page.current_page && page.page_number > 1 ) %]
603                     <li><a href="[% page.script_name | url %]?offset=0" class="nav"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li>
604                     <li><a href="[% page.script_name | url %]?offset=[% offset - results_per_page | uri %]"><i class="fa fa-fw fa-angle-left"></i> Previous</a></li>
605                 [% END %]
606             [% END %]
607             [% FOREACH page IN pages %]
608                 [% IF ( page.current_page ) %]
609                     [% SET current_page = page.page_number %]
610                     <li class="active"><span class="current">[% page.page_number | html %]</span></li>
611                 [% ELSE %]
612                     <li><a class="nav" href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a></li>
613                 [% END %]
614             [% END %]
615             [% IF ( current_page < pages.size() ) %]
616                 <li>
617                     <a href="[% page.script_name | url %]?offset=[% offset + results_per_page | uri %]" class="nav">Next <i class="fa fa-fw fa-angle-right"></i></a>
618                 </li>
619                 <li>
620                     <a href="[% page.script_name | url %]?offset=[% ( results_per_page * ( pages.size - 1 ) ) | uri %]" class="nav">Last <i class="fa fa-fw fa-angle-double-right"></i></a>
621                 </li>
622             [% END %]
623         </ul>
624     </nav>
625 [% END %]