|
Lines 8-184
Link Here
|
| 8 |
</title> |
8 |
</title> |
| 9 |
[% INCLUDE 'doc-head-close.inc' %] |
9 |
[% INCLUDE 'doc-head-close.inc' %] |
| 10 |
[% Asset.css("css/datatables.css") %] |
10 |
[% Asset.css("css/datatables.css") %] |
| 11 |
<script type="text/javascript" src="[% interface %]/[% theme %]/js/background-job-progressbar.js"></script> |
|
|
| 12 |
<link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> |
| 13 |
[% INCLUDE 'datatables.inc' %] |
| 14 |
<script type="text/javascript"> |
| 15 |
//<![CDATA[ |
| 16 |
$(document).ready(function(){ |
| 17 |
$("#staged-record-matching-rules select").change(function(){ |
| 18 |
var str = $(this).attr("id"); |
| 19 |
$("#reset_"+str).parent().show(); |
| 20 |
}); |
| 21 |
$("a.reset").click(function(){ |
| 22 |
var str = $(this).attr("id"); |
| 23 |
str = str.replace("reset_","") |
| 24 |
$("#"+str+" option[selected='selected']").attr("selected","selected"); |
| 25 |
$(this).parent().hide(); |
| 26 |
}); |
| 27 |
|
| 28 |
[% IF import_batch_id %] |
| 29 |
var checkedRecords = {}; |
| 30 |
$("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 31 |
"bAutoWidth": false, |
| 32 |
"bFilter": false, |
| 33 |
"bProcessing": true, |
| 34 |
"bServerSide": true, |
| 35 |
"sAjaxSource": 'batch_records_ajax.pl', |
| 36 |
"sPaginationType": "full_numbers", |
| 37 |
"sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', |
| 38 |
"aaSorting": [ [ 1, 'asc' ] ], |
| 39 |
"aoColumns": [ |
| 40 |
{ |
| 41 |
"bSortable": false, |
| 42 |
"mDataProp": null, |
| 43 |
"sDefaultContent": '' |
| 44 |
}, |
| 45 |
{ "mDataProp": "import_record_id" }, |
| 46 |
{ "mDataProp": "citation" }, |
| 47 |
{ "mDataProp": "status" }, |
| 48 |
{ "mDataProp": "overlay_status" }, |
| 49 |
{ "mDataProp": "match_citation" }, |
| 50 |
{ "mDataProp": "diff_url" }, |
| 51 |
{ "mDataProp": "matched" }, |
| 52 |
{ |
| 53 |
"bSortable": false, |
| 54 |
"mDataProp": null, |
| 55 |
"sDefaultContent": '' |
| 56 |
} |
| 57 |
], |
| 58 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
| 59 |
aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } ); |
| 60 |
|
| 61 |
$.ajax({ |
| 62 |
'dataType': 'json', |
| 63 |
'type': 'POST', |
| 64 |
'url': sSource, |
| 65 |
'data': aoData, |
| 66 |
'success': function(json){ |
| 67 |
fnCallback(json); |
| 68 |
} |
| 69 |
}); |
| 70 |
}, |
| 71 |
"fnRowCallback": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) { |
| 72 |
[% IF ( record_type == 'auth' ) %] |
| 73 |
var record_details_url = "/cgi-bin/koha/authorities/detail.pl?authid="; |
| 74 |
[% ELSE %] |
| 75 |
var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
| 76 |
[% END %] |
| 77 |
|
| 78 |
var record_id = aData['import_record_id']; |
| 79 |
var $checkbox = $('<input type="checkbox"></input>'); |
| 80 |
$('td:eq(0)', nRow).append($checkbox); |
| 81 |
$checkbox.prop( 'checked', checkedRecords[record_id] ); |
| 82 |
$checkbox.change( function() { |
| 83 |
if ( this.checked ) { |
| 84 |
checkedRecords[record_id] = true; |
| 85 |
} else { |
| 86 |
delete checkedRecords[record_id]; |
| 87 |
} |
| 88 |
} ); |
| 89 |
|
| 90 |
$('td:eq(2)', nRow).html( |
| 91 |
'<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '" class="previewMARC">' + aData['citation'] + '</a>' |
| 92 |
); |
| 93 |
|
| 94 |
$('td:eq(3)', nRow).html( |
| 95 |
aData['status'] == 'imported' ? _("Imported") : |
| 96 |
aData['status'] == 'ignored' ? _("Ignored") : |
| 97 |
aData['status'] == 'reverted' ? _("Reverted") : |
| 98 |
aData['status'] == 'staged' ? _("Staged") : |
| 99 |
aData['status'] == 'error' ? _("Error") : |
| 100 |
aData['status'] |
| 101 |
); |
| 102 |
|
| 103 |
$('td:eq(4)', nRow).html( |
| 104 |
aData['overlay_status'] == 'no_match' ? _("No match") : |
| 105 |
aData['overlay_status'] == 'match_applied' ? _("Match applied") : |
| 106 |
aData['overlay_status'] == 'auto_match' ? _("Match found") : |
| 107 |
aData['overlay_status'] |
| 108 |
); |
| 109 |
|
| 110 |
if ( aData['match_id'] ) { |
| 111 |
[% IF ( record_type == 'auth' ) -%] |
| 112 |
var matching_msg = _("Matches authority %s (score=%s):%s"); |
| 113 |
[%- ELSE -%] |
| 114 |
var matching_msg = _("Matches biblio %s (score=%s):%s"); |
| 115 |
[%- END %] |
| 116 |
$('td:eq(4)', nRow).html( |
| 117 |
matching_msg.format(aData['match_id'], aData['score'], |
| 118 |
'<a target="_blank" href="' + record_details_url |
| 119 |
+ aData['match_id'] + '">' + aData['match_citation'] + '</a>') |
| 120 |
); |
| 121 |
} |
| 122 |
if (aData['diff_url']){ |
| 123 |
$('td:eq(6)', nRow).html( |
| 124 |
'<a rel="gb_page_center[960,600]" href="'+aData['diff_url']+'">View</a>' |
| 125 |
); |
| 126 |
} |
| 127 |
$('td:eq(7)', nRow).html( |
| 128 |
'<a target="_blank" href="' + record_details_url |
| 129 |
+ aData['matched'] + '">' + aData['matched'] + '</a>' |
| 130 |
); |
| 131 |
$('td:eq(8)', nRow).html( |
| 132 |
'<a target="_blank" href="/cgi-bin/koha/cataloguing/editor.pl#batch:[% import_batch_id %]/' + record_id |
| 133 |
+ '">' + _("Edit") + '</a>' |
| 134 |
); |
| 135 |
}, |
| 136 |
})); |
| 137 |
$("#import_batch_form").on("submit",function(){ |
| 138 |
return submitBackgroundJob( document.getElementById("import_batch_form") ); |
| 139 |
}); |
| 140 |
$("#revert_batch_form").on("submit",function(){ |
| 141 |
return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) && submitBackgroundJob( document.getElementById("revert_batch_form") ); |
| 142 |
}); |
| 143 |
$('#export-selected').click( function() { |
| 144 |
var options = { |
| 145 |
import_record_id: $.map( checkedRecords, function( undef, key ) { return key; } ).join('|'), |
| 146 |
}; |
| 147 |
|
| 148 |
if ( options.import_record_id.length == 0 ) return false;_ |
| 149 |
|
| 150 |
window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) ); |
| 151 |
return false; |
| 152 |
}); |
| 153 |
$('#import-additional').click( function() { |
| 154 |
window.open( '/cgi-bin/koha/tools/stage-marc-import.pl?existing_batch_id=' + [% import_batch_id %] ); |
| 155 |
return false; |
| 156 |
}); |
| 157 |
[% END %] |
| 158 |
$("body").on("click",".previewMARC", function(e){ |
| 159 |
e.preventDefault(); |
| 160 |
var ltitle = $(this).text(); |
| 161 |
var page = $(this).attr("href"); |
| 162 |
$("#marcPreviewLabel").text(ltitle); |
| 163 |
$("#marcPreview .modal-body").load(page + " table"); |
| 164 |
$('#marcPreview').modal({show:true}); |
| 165 |
}); |
| 166 |
$("#marcPreview").on("hidden", function(){ |
| 167 |
$("#marcPreviewLabel").html(""); |
| 168 |
$("#marcPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface %]/[% theme %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>"); |
| 169 |
}); |
| 170 |
$(".batch_form").on("submit",function(){ |
| 171 |
if( $(this).hasClass("batch_delete") ){ |
| 172 |
return confirm( _("Are you sure you want to permanently delete this batch?") ); |
| 173 |
} else { |
| 174 |
return confirm( _("Clear all reservoir records staged in this batch? This cannot be undone.") ); |
| 175 |
} |
| 176 |
}); |
| 177 |
}); |
| 178 |
|
| 179 |
//]]> |
| 180 |
</script> |
| 181 |
>>>>>>> Bug 19265: Rancor - Add export of selected records, edit button to manage imports |
| 182 |
<style type="text/css"> |
11 |
<style type="text/css"> |
| 183 |
#jobpanel,#jobstatus,#jobfailed { display : none; } |
12 |
#jobpanel,#jobstatus,#jobfailed { display : none; } |
| 184 |
span.change-status { font-style:italic; color:#666; display:none; } |
13 |
span.change-status { font-style:italic; color:#666; display:none; } |
|
Lines 514-521
$(document).ready(function(){
Link Here
|
| 514 |
|
343 |
|
| 515 |
[% IF import_batch_id %] |
344 |
[% IF import_batch_id %] |
| 516 |
<div id="toolbar" class="btn-toolbar"> |
345 |
<div id="toolbar" class="btn-toolbar"> |
| 517 |
<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> |
| 518 |
<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> |
| 519 |
</div> |
348 |
</div> |
| 520 |
|
349 |
|
| 521 |
<table id="records-table"> |
350 |
<table id="records-table"> |
|
Lines 577-582
$(document).ready(function(){
Link Here
|
| 577 |
}); |
406 |
}); |
| 578 |
|
407 |
|
| 579 |
[% IF import_batch_id %] |
408 |
[% IF import_batch_id %] |
|
|
409 |
var checkedRecords = {}; |
| 580 |
$("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, { |
410 |
$("#records-table").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 581 |
"bAutoWidth": false, |
411 |
"bAutoWidth": false, |
| 582 |
"bFilter": false, |
412 |
"bFilter": false, |
|
Lines 585-598
$(document).ready(function(){
Link Here
|
| 585 |
"sAjaxSource": 'batch_records_ajax.pl', |
415 |
"sAjaxSource": 'batch_records_ajax.pl', |
| 586 |
"sPaginationType": "full_numbers", |
416 |
"sPaginationType": "full_numbers", |
| 587 |
"sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', |
417 |
"sDom": '<"top pager"iflp>rt<"bottom pager"flp><"clear">', |
|
|
418 |
"aaSorting": [ [ 1, 'asc' ] ], |
| 588 |
"aoColumns": [ |
419 |
"aoColumns": [ |
|
|
420 |
{ |
| 421 |
"bSortable": false, |
| 422 |
"mDataProp": null, |
| 423 |
"sDefaultContent": '' |
| 424 |
}, |
| 589 |
{ "mDataProp": "import_record_id" }, |
425 |
{ "mDataProp": "import_record_id" }, |
| 590 |
{ "mDataProp": "citation" }, |
426 |
{ "mDataProp": "citation" }, |
| 591 |
{ "mDataProp": "status" }, |
427 |
{ "mDataProp": "status" }, |
| 592 |
{ "mDataProp": "overlay_status" }, |
428 |
{ "mDataProp": "overlay_status" }, |
| 593 |
{ "mDataProp": "match_citation" }, |
429 |
{ "mDataProp": "match_citation" }, |
| 594 |
{ "mDataProp": "diff_url" }, |
430 |
{ "mDataProp": "diff_url" }, |
| 595 |
{ "mDataProp": "matched" } |
431 |
{ "mDataProp": "matched" }, |
|
|
432 |
{ |
| 433 |
"bSortable": false, |
| 434 |
"mDataProp": null, |
| 435 |
"sDefaultContent": '' |
| 436 |
}, |
| 596 |
], |
437 |
], |
| 597 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
438 |
"fnServerData": function ( sSource, aoData, fnCallback ) { |
| 598 |
aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } ); |
439 |
aoData.push( { "name": "import_batch_id", "value": [% import_batch_id %] } ); |
|
Lines 614-624
$(document).ready(function(){
Link Here
|
| 614 |
var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
455 |
var record_details_url = "/cgi-bin/koha/catalogue/detail.pl?biblionumber="; |
| 615 |
[% END %] |
456 |
[% END %] |
| 616 |
|
457 |
|
| 617 |
$('td:eq(1)', nRow).html( |
458 |
var record_id = aData['import_record_id']; |
|
|
459 |
var $checkbox = $('<input type="checkbox"></input>'); |
| 460 |
|
| 461 |
$('td:eq(0)', nRow).append($checkbox); |
| 462 |
$checkbox.prop( 'checked', checkedRecords[record_id] ); |
| 463 |
$checkbox.change( function() { |
| 464 |
if ( this.checked ) { |
| 465 |
checkedRecords[record_id] = true; |
| 466 |
} else { |
| 467 |
delete checkedRecords[record_id]; |
| 468 |
} |
| 469 |
}); |
| 470 |
|
| 471 |
$('td:eq(2)', nRow).html( |
| 618 |
'<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>' |
472 |
'<a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=' + aData['import_record_id'] + '&viewas=html" class="previewMARC">' + aData['citation'] + '</a>' |
| 619 |
); |
473 |
); |
| 620 |
|
474 |
|
| 621 |
$('td:eq(2)', nRow).html( |
475 |
$('td:eq(3)', nRow).html( |
| 622 |
aData['status'] == 'imported' ? _("Imported") : |
476 |
aData['status'] == 'imported' ? _("Imported") : |
| 623 |
aData['status'] == 'ignored' ? _("Ignored") : |
477 |
aData['status'] == 'ignored' ? _("Ignored") : |
| 624 |
aData['status'] == 'reverted' ? _("Reverted") : |
478 |
aData['status'] == 'reverted' ? _("Reverted") : |
|
Lines 627-633
$(document).ready(function(){
Link Here
|
| 627 |
aData['status'] |
481 |
aData['status'] |
| 628 |
); |
482 |
); |
| 629 |
|
483 |
|
| 630 |
$('td:eq(3)', nRow).html( |
484 |
$('td:eq(4)', nRow).html( |
| 631 |
aData['overlay_status'] == 'no_match' ? _("No match") : |
485 |
aData['overlay_status'] == 'no_match' ? _("No match") : |
| 632 |
aData['overlay_status'] == 'match_applied' ? _("Match applied") : |
486 |
aData['overlay_status'] == 'match_applied' ? _("Match applied") : |
| 633 |
aData['overlay_status'] == 'auto_match' ? _("Match found") : |
487 |
aData['overlay_status'] == 'auto_match' ? _("Match found") : |
|
Lines 647-660
$(document).ready(function(){
Link Here
|
| 647 |
); |
501 |
); |
| 648 |
} |
502 |
} |
| 649 |
if (aData['diff_url']){ |
503 |
if (aData['diff_url']){ |
| 650 |
$('td:eq(5)', nRow).html( |
504 |
$('td:eq(6)', nRow).html( |
| 651 |
'<a href="'+aData['diff_url']+'">' + _("View") + '</a>' |
505 |
'<a rel="gb_page_center[960,600]" href="'+aData['diff_url']+'">View</a>' |
| 652 |
); |
506 |
); |
| 653 |
} |
507 |
} |
| 654 |
$('td:eq(6)', nRow).html( |
508 |
$('td:eq(7)', nRow).html( |
| 655 |
'<a target="_blank" href="' + record_details_url |
509 |
'<a target="_blank" href="' + record_details_url |
| 656 |
+ aData['matched'] + '">' + aData['matched'] + '</a>' |
510 |
+ aData['matched'] + '">' + aData['matched'] + '</a>' |
| 657 |
); |
511 |
); |
|
|
512 |
$('td:eq(8)', nRow).html( |
| 513 |
'<a target="_blank" href="/cgi-bin/koha/cataloguing/editor.pl#batch:[% import_batch_id %]/' + record_id |
| 514 |
+ '">' + _("Edit") + '</a>' |
| 515 |
); |
| 658 |
}, |
516 |
}, |
| 659 |
})); |
517 |
})); |
| 660 |
$("#import_batch_form").on("submit",function(){ |
518 |
$("#import_batch_form").on("submit",function(){ |
|
Lines 663-668
$(document).ready(function(){
Link Here
|
| 663 |
$("#revert_batch_form").on("submit",function(){ |
521 |
$("#revert_batch_form").on("submit",function(){ |
| 664 |
return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) && submitBackgroundJob( document.getElementById("revert_batch_form") ); |
522 |
return confirm( _("Are you sure you want to undo the import of this batch into the catalog?") ) && submitBackgroundJob( document.getElementById("revert_batch_form") ); |
| 665 |
}); |
523 |
}); |
|
|
524 |
$('#export-selected').click( function() { |
| 525 |
var options = { |
| 526 |
import_record_id: $.map( checkedRecords, function( undef, key ) { return key; } ).join('|'), |
| 527 |
}; |
| 528 |
if ( options.import_record_id.length == 0 ) return false;_ |
| 529 |
window.open( '/cgi-bin/koha/svc/cataloguing/import_batches/' + [% import_batch_id %] + '?download=1&' + $.param( options ) ); |
| 530 |
return false; |
| 531 |
}); |
| 666 |
[% END %] |
532 |
[% END %] |
| 667 |
$("body").on("click",".previewMARC", function(e){ |
533 |
$("body").on("click",".previewMARC", function(e){ |
| 668 |
e.preventDefault(); |
534 |
e.preventDefault(); |
| 669 |
- |
|
|