@records = map { ($_->target_biblio_record_entry) } @$recs;
}
+ my $type = $cgi->param('rectype') || 'biblio';
+ my $retrieve_func;
+ # STILL no records ...
+ my $queue_id = $cgi->param('queueid');
+ if ($queue_id) {
+ # check that we're logged in -- XXX necessary? conservative for now
+ my $authid = $cgi->cookie('ses') || $cgi->param('ses');
+ my $auth = verify_login($authid);
+ if (!$auth) {
+ return 403;
+ }
+
+ # validate type
+ my $queue_type;
+ if ($type eq 'biblio') {
+ $queue_type = 'bib';
+ } elsif ($type eq 'authority') {
+ $queue_type = $type;
+ } else {
+ return 400;
+ }
+
+ # does queue exist? This check is really just for better error logging
+ my $queue = $ses->request( "open-ils.cstore.direct.vandelay.${queue_type}_queue.retrieve", $queue_id )->gather(1);
+ unless($queue) {
+ $r->log->error("No such queue $queue_id");
+ $logger->error("No such queue $queue_id");
+ return Apache2::Const::NOT_FOUND;
+ }
+
+ # fetch the records
+ my $query = {queue => $queue_id};
+ if ($cgi->param('nonimported')) {
+ $query->{import_time} = undef;
+ }
+ $retrieve_func = "vandelay.queued_${queue_type}_record";
+ my $recs = $ses->request( "open-ils.cstore.direct.${retrieve_func}.id_list.atomic", $query )->gather(1);
+ @records = @$recs;
+ } else {
+ $retrieve_func = "$type.record_entry";
+ }
+
return show_template($r) unless (@records);
- my $type = $cgi->param('rectype') || 'biblio';
if ($type ne 'biblio' && $type ne 'authority') {
return 400;
}
try {
local $SIG{ALRM} = sub { die "TIMEOUT\n" };
alarm(1);
- $bib = $ses->request( "open-ils.cstore.direct.$type.record_entry.retrieve", $i, $flesh )->gather(1);
+ $bib = $ses->request( "open-ils.cstore.direct.$retrieve_func.retrieve", $i, $flesh )->gather(1);
alarm(0);
} otherwise {
warn "\n!!!!!! Timed out trying to read record $i\n";
<tr><td><a href='javascript:;' onclick='vlHandleQueueItemsAction("import")'>[% l('Import Selected Records') %]</a></td></tr>
<tr><td><a href='javascript:;' onclick='vlHandleQueueItemsAction("import_all")'>[% l('Import All Records') %]</a></td></tr>
<tr><td><a href='javascript:;' onclick='vlLoadErrorUIAll();'>[% l('View Import Items') %]</a></td></tr>
+ <tr><td><a href='javascript:;' onclick='vlExportRecordQueue({"nonimported":1})'>[% l('Export Non-Imported Records') %]</a></td></tr>
<tr><td><a href='javascript:;' onclick='
if(confirm("[% l('Are you sure you want to delete this queue?') %]")) {
vlDeleteQueue(currentType, currentQueueId,
var attrDefMap = {}; // maps attr def code names to attr def ids
var currentType;
var currentQueueId = null;
+var currentQueueName = null;
var userCache = {};
var currentMatchedRecords; // set of loaded matched bib records
var currentOverlayRecordsMap; // map of import record to overlay record
}
}
+/* export all (or just non-imported) queue records */
+function vlExportRecordQueue(opts) {
+ /* conform type to exporter */
+ var type = currentType == 'auth' ? 'auth' : 'biblio';
+ var url = '/exporter?format=xml&type='+type+'&queueid='+currentQueueId;
+ if (opts.nonimported) {
+ url += '&nonimported=1';
+ }
+
+ var req = new XMLHttpRequest();
+ req.open('GET',url,true);
+ req.send(null);
+ req.onreadystatechange = function () {
+ if (req.readyState == 4) {
+ var file_tag = opts.nonimported ? '_nonimported' : '';
+ openils.XUL.contentToFileSaveDialog(req.responseText, null, {
+ defaultString : currentQueueName + file_tag + '.xml',
+ defaultExtension : '.xml',
+ filterName : 'XML',
+ filterExtension : '*.xml',
+ filterAll : true
+ } );
+ }
+ }
+}
+
function retrieveQueuedRecords(type, queueId, onload, doExport) {
displayGlobalDiv('vl-generic-progress');
queuedRecords = [];
}
vlFetchQueueSummary(currentQueueId, currentType,
function(summary) {
- dojo.byId('vl-queue-summary-name').innerHTML = summary.queue.name();
+ currentQueueName = summary.queue.name();
+ dojo.byId('vl-queue-summary-name').innerHTML = currentQueueName;
dojo.byId('vl-queue-summary-total-count').innerHTML = summary.total +'';
dojo.byId('vl-queue-summary-import-count').innerHTML = summary.imported + '';
dojo.byId('vl-queue-summary-import-item-count').innerHTML = summary.total_items + '';