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