Bug 29602: Surround strings with span tag
[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>
7     [% IF ( import_batch_id ) %]
8         Batch [% import_batch_id | html %] &rsaquo; [% END %]
9     Manage staged MARC records &rsaquo; Tools &rsaquo; Koha
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                                             <span>No matching rule in effect</span>
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                                             <span>Replace existing record with incoming record</span>
182                                         [% ELSIF ( overlay_action == 'create_new' ) %]
183                                             <span>Add incoming record</span>
184                                         [% ELSIF ( overlay_action == 'ignore' ) %]
185                                             <span>Ignore incoming record (its items may still be processed)</span>
186                                         [% ELSE %]
187                                             <span>[% overlay_action | html %]</span>
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                                                 <span>Always add items</span>
215                                             [% ELSIF ( item_action == 'add_only_for_matches' ) %]
216                                                 <span>Add items only if matching bib was found</span>
217                                             [% ELSIF ( item_action == 'add_only_for_new' ) %]
218                                                 <span>Add items only if no matching bib was found</span>
219                                             [% ELSIF ( item_action == 'ignore' ) %]
220                                                 <span>Ignore items</span>
221                                             [% ELSE %]
222                                                 <span>[% item_action | html %]</span>
223                                             [% END %]
224                                         [% END %]
225                                     </li>
226                                 [% ELSE %]
227                                     <input type ="hidden" name="item_action" value="ignore">
228                                 [% END %]
229                             </ol>
230                             [% IF ( can_commit ) %]
231                                     <fieldset class="action"><input type="submit" value="Apply different matching rules" class="button" /></fieldset>
232                                 </form>
233                             [% END %]
234                         </fieldset> <!-- /#staged-record-matching-rules -->
235
236                         <div>
237                             [% IF ( can_commit ) %]
238                                 <form action="[% script_name | html %]" method="post" id="import_batch_form">
239                                     <input type="hidden" name="op" value="commit-batch" />
240                                     <input type="hidden" name="runinbackground" value="" />
241                                     <input type="hidden" name="completedJobID" value="" />
242                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
243                                     <fieldset class="action">
244                                         [% IF ( record_type != 'auth' ) %]
245                                             Add new bibliographic records into this framework:
246                                             <select name="framework" id="frameworks">
247                                                 <option value="">Default</option>
248                                                 [% FOREACH framework IN frameworks %]
249                                                     <option value="[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</option>
250                                                 [% END %]
251                                             </select>
252                                         [% END %]
253                                         <br />
254                                         <input type="submit" class="button" name="mainformsubmit" value="Import this batch into the catalog" />
255                                     </fieldset>
256                                 </form> <!-- /#import_batch_form -->
257                                 <div id="jobpanel">
258                                     <div id="jobstatus" class="progress_panel">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
259                                     <div id="jobfailed"></div>
260                                 </div>
261                             [% END # /IF can_commit %]
262                             [% IF ( can_revert ) %]
263                                 <form action="[% script_name | html %]" method="post" id="revert_batch_form">
264                                     <input type="hidden" name="op" value="revert-batch" />
265                                     <input type="hidden" name="runinbackground" value="" />
266                                     <input type="hidden" name="completedJobID" value="" />
267                                     <input type="hidden" name="import_batch_id" value="[% import_batch_id | html %]" />
268                                     <fieldset class="action"><input type="submit" class="button" name="mainformsubmit" value="Undo import into catalog" /></fieldset>
269                                 </form>
270                                 <div id="jobpanel">
271                                     <div id="jobstatus">Job progress: <div id="jobprogress"></div> <span id="jobprogresspercent">0</span>%</div>
272                                     <div id="jobfailed"></div>
273                                 </div>
274                             [% END # /IF can_revert %]
275                         </div>
276
277                         [% IF ( did_commit ) %]
278                             <div class="dialog message">Completed import of records</div>
279                             <table>
280                                 <tr>
281                                     <td>Number of records added</td>
282                                     <td>[% num_added | html %]</td>
283                                 </tr>
284                                 <tr>
285                                     <td>Number of records updated</td>
286                                     <td>[% num_updated | html %]</td>
287                                 </tr>
288                                 <tr>
289                                     <td>Number of records ignored</td>
290                                     <td>[% num_ignored | html %]</td>
291                                 </tr>
292                                 [% IF ( record_type == 'biblio' ) %]
293                                     <tr>
294                                         <td>Number of items added</td>
295                                         <td>[% num_items_added | html %]</td>
296                                     </tr>
297                                     <tr>
298                                         <td>Number of items replaced</td>
299                                         <td>[% num_items_replaced | html %]</td>
300                                     </tr>
301                                     <tr>
302                                         <td>Number of items ignored because of duplicate barcode</td>
303                                         <td>[% num_items_errored | html %]</td>
304                                     </tr>
305                                 [% END %]
306                             </table>
307                         [% END #/ IF did_commit %]
308
309                         [% IF ( did_revert ) %]
310                             <div class="dialog message">Success: Import reversed</div>
311                             <table>
312                                 <tr>
313                                     <td>Number of records deleted</td>
314                                     <td>[% num_deleted | html %]</td>
315                                 </tr>
316                                 [% IF ( record_type == 'biblio' ) %]
317                                     <tr>
318                                         <td>Number of items deleted</td>
319                                         <td>[% num_items_deleted | html %]</td>
320                                     </tr>
321                                     <tr>
322                                         <td>Number of records not deleted due to items on loan</td>
323                                         <td>[% num_errors | html %]</td>
324                                     </tr>
325                                 [% END %]
326                                 <tr>
327                                     <td>Number of records changed back</td>
328                                     <td>[% num_reverted | html %]</td>
329                                 </tr>
330                                 <tr>
331                                     <td>Number of records ignored</td>
332                                     <td>[% num_ignored | html %]</td>
333                                 </tr>
334                             </table>
335                         [% END  # /IF did_revert%]
336
337                     [% END # /IF batch_info %]
338
339                     <br style="clear:both;" />
340
341                     [% IF ( batch_list ) %]
342                         [% IF ( pages ) %]
343                             [% PROCESS pagination %]
344                         [% END %]
345
346                         <table>
347                             <tr>
348                                 <th>#</th>
349                                 <th>File name</th>
350                                 <th>Profile</th>
351                                 <th>Comments</th>
352                                 <th>Type</th>
353                                 <th>Status</th>
354                                 <th>Staged</th>
355                                 <th># Records</th>
356                                 <th># Items</th>
357                                 <th>Action</th>
358                             </tr>
359                             [% FOREACH batch_lis IN batch_list %]
360                                 <tr>
361                                     <td>[% batch_lis.import_batch_id | html %]</td>
362                                     <td><a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]">[% batch_lis.file_name | html %]</a></td>
363                                     <td>[% batch_lis.profile | html %]</td>
364                                     <td>[% batch_lis.comments | html %]</td>
365                                     <td>[% IF ( batch_lis.record_type == 'auth' ) %]Authority[% ELSE %]Bibliographic[% END %]</td>
366                                     <td>
367                                         [% IF ( batch_lis.import_status == 'cleaned' ) %]
368                                             <span>Cleaned</span>
369                                         [% ELSIF ( batch_lis.import_status == 'imported' ) %]
370                                             <span>Imported</span>
371                                         [% ELSIF ( batch_lis.import_status == 'importing' ) %]
372                                             <span>Importing</span>
373                                         [% ELSIF ( batch_lis.import_status == 'reverted' ) %]
374                                             <span>Reverted</span>
375                                         [% ELSIF ( batch_lis.import_status == 'reverting' ) %]
376                                             <span>Reverting</span>
377                                         [% ELSIF ( batch_lis.import_status == 'staged' ) %]
378                                             <span>Staged</span>
379                                         [% ELSE %]
380                                             <span>[% batch_lis.import_status | html %]</span>
381                                         [% END %]
382                                     </td>
383                                     <td>[% batch_lis.upload_timestamp | $KohaDates with_hours=1 %]</td>
384                                     <td>[% batch_lis.num_records | html %]</td>
385                                     <td>[% batch_lis.num_items | html %]
386                                         [% IF ( batch_lis.num_items && batch_lis.import_status == 'imported' ) %]
387                                             (<a href="[% batch_lis.script_name | url %]?import_batch_id=[% batch_lis.import_batch_id | uri %]&amp;op=create_labels">Create label batch</a>)
388                                         [% END %]
389                                     </td>
390                                     <td class="actions">
391                                         [% IF ( batch_lis.can_clean ) %]
392                                             <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">
393                                                 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
394                                                 <input type="hidden" name="op" value="clean-batch" />
395                                                 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-eraser"></i> Clean</button>
396                                             </form>
397                                         [% ELSIF ( batch_lis.import_status == 'cleaned' ) %]
398                                             <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">
399                                                 <input type="hidden" name="import_batch_id" value="[% batch_lis.import_batch_id | html %]" />
400                                                 <input type="hidden" name="op" value="delete-batch" />
401                                                 <button type="submit" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</button>
402                                             </form>
403                                         [% END %]
404                                     </td>
405                                 </tr>
406                             [% END # /FOREACH batch_lis %]
407                         </table>
408
409                         [% IF ( pages ) %]
410                             [% PROCESS pagination %]
411                         [% END %]
412                     [% END # /IF batch_lis %]
413
414                     [% IF import_batch_id && !did_clean %]
415                         <table id="records-table">
416                             <thead>
417                                 <tr>
418                                     <th>#</th>
419                                     <th>Citation</th>
420                                     <th>Status</th>
421                                     <th>Match type</th>
422                                     <th>Match details</th>
423                                     <th><abbr title="Differences between the original bibliographic record and the imported">Diff</abbr></th>
424                                     <th>Record</th>
425                                 </tr>
426                             </thead>
427                         </table>
428
429                         <div id="marcPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="marcPreviewLabel" aria-hidden="true">
430                             <div class="modal-dialog modal-wide">
431                                 <div class="modal-content">
432                                     <div class="modal-header">
433                                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
434                                         <h3 id="marcPreviewLabel">MARC preview</h3>
435                                     </div>
436                                     <div class="modal-body">
437                                         <div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
438                                     </div>
439                                     <div class="modal-footer">
440                                         <button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
441                                     </div>
442                                 </div>
443                             </div>
444                         </div> <!-- /#marcPreview -->
445                     [% END # /IF import_batch_id %]
446                 </main>
447
448             </div> <!-- /.col-sm-10.col-sm-push-2 -->
449             <div class="col-sm-2 col-sm-pull-10">
450                 <aside>
451                     [% INCLUDE 'tools-menu.inc' %]
452                 </aside>
453             </div> <!-- .col-sm-2.col-sm-pull-10 -->
454         </div> <!-- /.row -->
455
456 [% MACRO jsinclude BLOCK %]
457     [% Asset.js("js/tools-menu.js") | $raw %]
458     [% Asset.js("lib/jquery/plugins/humanmsg.js") | $raw %]
459     [% Asset.js("js/background-job-progressbar.js") | $raw %]
460     [% INCLUDE 'datatables.inc' %]
461     <script>
462         $(document).ready(function() {
463             $("#staged-record-matching-rules select").change(function() {
464                 var str = $(this).attr("id");
465                 $("#reset_" + str).parent().show();
466             });
467             $("a.reset").click(function() {
468                 var str = $(this).attr("id");
469                 str = str.replace("reset_", "")
470                 $("#" + str + " option[selected='selected']").attr("selected", "selected");
471                 $(this).parent().hide();
472             });
473
474             [% IF import_batch_id %]
475                 $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
476                     "bAutoWidth": false,
477                     "bFilter": false,
478                     "bProcessing": true,
479                     "bServerSide": true,
480                     "sAjaxSource": 'batch_records_ajax.pl',
481                     "sPaginationType": "full_numbers",
482                     "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
483                     "aoColumns": [
484                         { "mDataProp": "import_record_id" },
485                         { "mDataProp": "citation" },
486                         { "mDataProp": "status" },
487                         { "mDataProp": "overlay_status" },
488                         { "mDataProp": "match_citation" },
489                         { "mDataProp": "diff_url" },
490                         { "mDataProp": "matched" }
491                     ],
492                     "fnServerData": function(sSource, aoData, fnCallback) {
493                         aoData.push({ "name": "import_batch_id", "value": [% import_batch_id | html %] });
494
495                         $.ajax({
496                             'dataType': 'json',
497                             'type': 'POST',
498                             'url': sSource,
499                             'data': aoData,
500                             'success': function(json) {
501                                 fnCallback(json);
502                             }
503                         });
504                     },
505                     "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
506                         [% IF(record_type == 'auth') %]
507                             var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
508                         [% ELSE %]
509                             var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
510                         [% END %]
511                         [% IF(record_type == 'auth') %]
512                             var record_edit_url = "/cgi-bin/koha/authorities/authorities.pl?authid=";
513                         [% ELSE %]
514                             var record_edit_url = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=";
515                         [% END %]
516
517                         var additional_details = "";
518                         if( aData['author'] ){
519                             additional_details += " " + aData['author'] + " ";
520                         }
521
522                         if( aData['isbn'] ){
523                             additional_details += " (" + aData['isbn'] + ") ";
524                         }
525
526                         if( aData['issn'] ){
527                             additional_details += " (" + aData['issn'] + ") ";
528                         }
529
530                         $('td:eq(1)', nRow).html(
531                             '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a> ' + additional_details
532                         );
533
534                         $('td:eq(2)', nRow).html(
535                             aData['status'] == 'imported' ? _("Imported") :
536                             aData['status'] == 'ignored' ? _("Ignored") :
537                             aData['status'] == 'reverted' ? _("Reverted") :
538                             aData['status'] == 'staged' ? _("Staged") :
539                             aData['status'] == 'error' ? _("Error") :
540                             aData['status']
541                         );
542
543                         $('td:eq(3)', nRow).html(
544                             aData['overlay_status'] == 'no_match' ? _("No match") :
545                             aData['overlay_status'] == 'match_applied' ? _("Match applied") :
546                             aData['overlay_status'] == 'auto_match' ? _("Match found") :
547                             aData['overlay_status']
548                         );
549
550                         if (aData['match_id']) {
551                             [% IF(record_type == 'auth') -%]
552                                 var matching_msg = _("Matches authority %s (score=%s):%s");
553                             [%- ELSE -%]
554                                 var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
555                             [%- END %]
556                             $('td:eq(4)', nRow).html(
557                                 matching_msg.format(aData['match_id'], aData['score'],
558                                     '<a target="_blank" href="' + record_details_url
559                                     + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
560                             );
561                         }
562                         if (aData['diff_url']) {
563                             $('td:eq(5)', nRow).html(
564                                 '<a href="' + aData['diff_url'] + '">' + _("View") + '</a>'
565                             );
566                         }
567                         if (aData['matched']) {
568                             $('td:eq(6)', nRow).html(
569                                 '<a class="btn btn-default btn-xs" target="_blank" href="' + record_details_url
570                                 + aData['matched'] + '"><i class="fa fa-eye"></i> ' + _("View") + '</a> '
571                                 [% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
572                                     + '<a class="btn btn-default btn-xs" target="_blank" href="' + record_edit_url
573                                     + aData['matched'] + '"><i class="fa fa-pencil"></i> ' + _("Edit") + '</a>'
574                                 [% END %]
575                             );
576                         }
577                     },
578                 }));
579                 $("#import_batch_form").on("submit", function() {
580                     return submitBackgroundJob(document.getElementById("import_batch_form"));
581                 });
582                 $("#revert_batch_form").on("submit", function() {
583                     return confirm(_("Are you sure you want to undo the import of this batch into the catalog?")) && submitBackgroundJob(document.getElementById("revert_batch_form"));
584                 });
585             [% END %]
586
587             $("body").on("click", ".previewMARC", function(e) {
588                 e.preventDefault();
589                 var ltitle = $(this).text();
590                 var page = $(this).attr("href");
591                 $("#marcPreviewLabel").text(ltitle);
592                 $("#marcPreview .modal-body").load(page + " table");
593                 $('#marcPreview').modal({ show: true });
594             });
595             $("#marcPreview").on("hidden.bs.modal", function() {
596                 $("#marcPreviewLabel").html("");
597                 $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> " + _("Loading") + "</div>");
598             });
599             $(".batch_form").on("submit", function() {
600                 if ($(this).hasClass("batch_delete")) {
601                     return confirm(_("Are you sure you want to permanently delete this batch?"));
602                 } else {
603                     return confirm(_("Clear all reservoir records staged in this batch?  This cannot be undone."));
604                 }
605             });
606         });
607
608     </script>
609 [% END %]
610 [% INCLUDE 'intranet-bottom.inc' %]
611 [% BLOCK pagination %]
612     <nav>
613         <ul class="pagination">
614             [% FOREACH page IN pages %]
615                 [% IF ( page.current_page && page.page_number > 1 ) %]
616                     <li><a href="[% page.script_name | url %]?offset=0" class="nav"><i class="fa fa-fw fa-angle-double-left"></i> First</a></li>
617                     <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>
618                 [% END %]
619             [% END %]
620             [% FOREACH page IN pages %]
621                 [% IF ( page.current_page ) %]
622                     [% SET current_page = page.page_number %]
623                     <li class="active"><span class="current">[% page.page_number | html %]</span></li>
624                 [% ELSE %]
625                     <li><a class="nav" href="[% page.script_name | url %]?offset=[% page.offset | uri %]">[% page.page_number | html %]</a></li>
626                 [% END %]
627             [% END %]
628             [% IF ( current_page < pages.size() ) %]
629                 <li>
630                     <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>
631                 </li>
632                 <li>
633                     <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>
634                 </li>
635             [% END %]
636         </ul>
637     </nav>
638 [% END %]