View | Details | Raw Unified | Return to bug 19265
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/manage-marc-import.tt (-122 / +2 lines)
Lines 343-350 Link Here
343
343
344
[% IF import_batch_id %]
344
[% IF import_batch_id %]
345
    <div id="toolbar" class="btn-toolbar">
345
    <div id="toolbar" class="btn-toolbar">
346
        <button class="btn btn-small" id="import-additional" title="Import extra records into this batch"><i class="icon-plus"></i> <span>Import additional records</span></button>
346
        <button class="btn btn-default btn-sm" id="import-additional" title="Import extra records into this batch"><i class="icon-plus"></i> <span>Import additional records</span></button>
347
        <button class="btn btn-small" id="export-selected" title="Import extra records into this batch"><i class="fa fa-hdd-o"></i> <span>Export selected records</span></button>
347
        <button class="btn btn-default btn-sm" id="export-selected" title="Export selected records from this batch"><i class="fa fa-hdd-o"></i> <span>Export selected records</span></button>
348
    </div>
348
    </div>
349
349
350
    <table id="records-table">
350
    <table id="records-table">
Lines 398-502 Link Here
398
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
398
    <script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script>
399
    <script>
399
    <script>
400
        $(document).ready(function(){
400
        $(document).ready(function(){
401
            $("#staged-record-matching-rules select").change(function(){
402
                var str = $(this).attr("id");
403
                $("#reset_"+str).parent().show();
404
            });
405
            $("a.reset").click(function(){
406
                var str = $(this).attr("id");
407
                str = str.replace("reset_","")
408
                $("#"+str+" option[selected='selected']").attr("selected","selected");
409
                $(this).parent().hide();
410
            });
411
412
            [% IF import_batch_id %]
413
                $("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, {
414
                    "bAutoWidth": false,
415
                    "bFilter": false,
416
                    "bProcessing": true,
417
                    "bServerSide": true,
418
                    "sAjaxSource": 'batch_records_ajax.pl',
419
                    "sPaginationType": "full_numbers",
420
                    "sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">',
421
                    "aoColumns": [
422
                        { "mDataProp": "import_record_id" },
423
                        { "mDataProp": "citation" },
424
                        { "mDataProp": "status" },
425
                        { "mDataProp": "overlay_status" },
426
                        { "mDataProp": "match_citation" },
427
                        { "mDataProp": "diff_url" },
428
                        { "mDataProp": "matched" }
429
                    ],
430
                    "fnServerData": function ( sSource, aoData, fnCallback ) {
431
                        aoData.push( { "name": "import_batch_id", "value": [% import_batch_id | html %] } );
432
433
                        $.ajax({
434
                            'dataType': 'json',
435
                            'type': 'POST',
436
                            'url': sSource,
437
                            'data': aoData,
438
                            'success': function(json){
439
                                fnCallback(json);
440
                            }
441
                        });
442
                    },
443
                    "fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
444
                      [% IF ( record_type == 'auth' ) %]
445
                          var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid=";
446
                      [% ELSE %]
447
                          var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber=";
448
                      [% END %]
449
450
                      $('td:eq(1)', nRow).html(
451
                          '<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>'
452
                      );
453
454
                      $('td:eq(2)', nRow).html(
455
                          aData['status'] == 'imported' ? _("Imported") :
456
                          aData['status'] == 'ignored'  ? _("Ignored")  :
457
                          aData['status'] == 'reverted' ? _("Reverted") :
458
                          aData['status'] == 'staged'   ? _("Staged")   :
459
                          aData['status'] == 'error'    ? _("Error")    :
460
                          aData['status']
461
                      );
462
463
                      $('td:eq(3)', nRow).html(
464
                          aData['overlay_status'] == 'no_match'      ? _("No match")       :
465
                          aData['overlay_status'] == 'match_applied' ? _("Match applied")  :
466
                          aData['overlay_status'] == 'auto_match'    ? _("Match found")    :
467
                          aData['overlay_status']
468
                      );
469
470
                      if ( aData['match_id'] ) {
471
                          [% IF ( record_type == 'auth' ) -%]
472
                          var matching_msg = _("Matches authority %s (score=%s):%s");
473
                          [%- ELSE -%]
474
                          var matching_msg = _("Matches bibliographic record %s (score=%s):%s");
475
                          [%- END %]
476
                          $('td:eq(4)', nRow).html(
477
                              matching_msg.format(aData['match_id'], aData['score'],
478
                              '<a target="_blank" href="' + record_details_url
479
                              + aData['match_id'] + '">' + aData['match_citation'] + '</a>')
480
                          );
481
                      }
482
                      if (aData['diff_url']){
483
                          $('td:eq(5)', nRow).html(
484
                              '<a href="'+aData['diff_url']+'">' + _("View") + '</a>'
485
                          );
486
                      }
487
                      $('td:eq(6)', nRow).html(
488
                          '<a target="_blank" href="' + record_details_url
489
                              + aData['matched'] + '">' + aData['matched'] + '</a>'
490
                      );
491
                    },
492
                }));
493
                $("#import_batch_form").on("submit",function(){
494
                    return submitBackgroundJob( document.getElementById("import_batch_form") );
495
                });
496
                $("#revert_batch_form").on("submit",function(){
497
                    return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) &&   submitBackgroundJob( document.getElementById("revert_batch_form") );
498
                });
499
            [% END %]
500
            $("body").on("click",".previewMARC", function(e){
401
            $("body").on("click",".previewMARC", function(e){
501
                e.preventDefault();
402
                e.preventDefault();
502
                var ltitle = $(this).text();
403
                var ltitle = $(this).text();
Lines 655-680 Link Here
655
                    return false;
556
                    return false;
656
                });
557
                });
657
            [% END %]
558
            [% END %]
658
659
            $("body").on("click",".previewMARC", function(e){
660
                e.preventDefault();
661
                var ltitle = $(this).text();
662
                var page = $(this).attr("href");
663
                $("#marcPreviewLabel").text(ltitle);
664
                $("#marcPreview .modal-body").load(page + " table");
665
                $('#marcPreview').modal({show:true});
666
            });
667
            $("#marcPreview").on("hidden", function(){
668
                $("#marcPreviewLabel").html("");
669
                $("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
670
            });
671
            $(".batch_form").on("submit",function(){
672
                if( $(this).hasClass("batch_delete") ){
673
                    return confirm( _("Are you sure you want to permanently delete this batch?") );
674
                } else {
675
                    return confirm( _("Clear all reservoir records staged in this batch?  This cannot be undone.") );
676
                }
677
            });
678
        });
559
        });
679
    </script>
560
    </script>
680
[% END %]
561
[% END %]
681
- 

Return to bug 19265