From c01ee522742065ab217e7a6276a8e1516599fc26 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 13 Feb 2013 10:56:59 -0500 Subject: [PATCH] Z39 Batch : vandelay match_bucket vandelay UI Signed-off-by: Bill Erickson --- Open-ILS/src/templates/vandelay/inc/upload.tt2 | 5 +++ Open-ILS/web/js/ui/default/vandelay/vandelay.js | 52 ++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/templates/vandelay/inc/upload.tt2 b/Open-ILS/src/templates/vandelay/inc/upload.tt2 index caae6dccab..eadbd6848f 100644 --- a/Open-ILS/src/templates/vandelay/inc/upload.tt2 +++ b/Open-ILS/src/templates/vandelay/inc/upload.tt2 @@ -30,6 +30,11 @@ + [% l('Limit matches to bucket') %] + + + [% l('Holdings Import Profile') %] diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 7df30687cd..084efe1ef6 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -88,6 +88,7 @@ var vlQueueGridColumePicker = {}; var vlBibSources = []; var importItemDefs = []; var matchSets = {}; +var matchBuckets = {}; var mergeProfiles = []; var copyStatusCache = {}; var copyLocationCache = {}; @@ -102,7 +103,7 @@ function vlInit() { localeStrings = dojo.i18n.getLocalization("openils.vandelay", "vandelay"); authtoken = openils.User.authtoken; - var initNeeded = 8; // how many async responses do we need before we're init'd + var initNeeded = 9; // how many async responses do we need before we're init'd var initCount = 0; // how many async reponses we've received openils.Util.registerEnterHandler( @@ -202,6 +203,22 @@ function vlInit() { } ); + fieldmapper.standardRequest( + ['open-ils.actor', 'open-ils.actor.container.retrieve_by_class'], + { async : true, + params : [authtoken, new openils.User().user.id(), 'biblio'], + oncomplete : function(r) { + var buckets = openils.Util.readResponse(r); + // only bib buckets are supported + matchBuckets.biblio = []; + dojo.forEach(buckets, function(buk) { + matchBuckets.biblio.push(buk); + }); + checkInitDone(); + } + } + ); + new openils.PermaCrud().retrieveAll('ccs', { async: true, oncomplete: function(r) { @@ -372,7 +389,9 @@ function uploadMARC(onload){ /** * Creates a new vandelay queue */ -function createQueue(queueName, type, onload, importDefId, matchSet) { +function createQueue( + queueName, type, onload, importDefId, matchSet, matchBucket) { + var name = (type=='bib') ? 'bib' : 'authority'; var method = 'open-ils.vandelay.'+ name +'_queue.create' @@ -386,7 +405,10 @@ function createQueue(queueName, type, onload, importDefId, matchSet) { fieldmapper.standardRequest( ['open-ils.vandelay', method], { async: true, - params: [authtoken, queueName, null, qType, matchSet, importDefId], + params: [ + authtoken, queueName, null, + qType, matchSet, importDefId, matchBucket + ], oncomplete : function(r) { var queue = r.recv().content(); if(e = openils.Event.parse(queue)) @@ -1360,7 +1382,8 @@ function batchUpload() { } else { createQueue(queueName, currentType, handleCreateQueue, vlUploadQueueHoldingsImportProfile.attr('value'), - vlUploadQueueMatchSet.attr('value') + vlUploadQueueMatchSet.attr('value'), + vlUploadQueueMatchBucket.attr('value') ); } } @@ -1406,11 +1429,13 @@ function vlFleshQueueSelect(selector, type) { vlUploadQueueHoldingsImportProfile.attr('disabled', true); vlUploadQueueMatchSet.attr('value', queue.match_set() || ''); vlUploadQueueMatchSet.attr('disabled', true); + vlUploadQueueMatchBucket.attr('value', queue.match_bucket() || ''); + vlUploadQueueMatchBucket.attr('disabled', true); } else { vlUploadQueueHoldingsImportProfile.attr('value', ''); vlUploadQueueHoldingsImportProfile.attr('disabled', false); - vlUploadQueueMatchSet.attr('value', ''); - vlUploadQueueMatchSet.attr('disabled', false); + vlUploadQueueMatchBucket.attr('value', ''); + vlUploadQueueMatchBucket.attr('disabled', false); } dojo.disconnect(qInput._onchange); qInput.attr('value', ''); @@ -1422,6 +1447,7 @@ function vlFleshQueueSelect(selector, type) { // user entered a new queue name. clear the selector vlUploadQueueHoldingsImportProfile.attr('disabled', false); vlUploadQueueMatchSet.attr('disabled', false); + vlUploadQueueMatchBucket.attr('disabled', false); dojo.disconnect(selector._onchange); selector.attr('value', ''); selector._onchange = dojo.connect(selector, 'onChange', selChange); @@ -1437,6 +1463,19 @@ function vlUpdateMatchSetSelector(type) { new dojo.data.ItemFileReadStore({data:vms.toStoreData(matchSets[type])}); } +function vlUpdateMatchBucketSelector(type) { + type = (type.match(/bib/)) ? 'biblio' : 'authority'; + if (type == 'authority') { + vlUploadQueueMatchBucket.attr('value', ''); + vlUploadQueueMatchBucket.attr('disabled', true); + } else { + vlUploadQueueMatchBucket.attr('disabled', false); + vlUploadQueueMatchBucket.store = + new dojo.data.ItemFileReadStore( + {data:cbreb.toStoreData(matchBuckets[type])}); + } +} + function vlShowUploadForm() { displayGlobalDiv('vl-marc-upload-div'); vlFleshQueueSelect(vlUploadQueueSelector, vlUploadRecordType.getValue()); @@ -1446,6 +1485,7 @@ function vlShowUploadForm() { vlUploadQueueHoldingsImportProfile.store = new dojo.data.ItemFileReadStore({data:viiad.toStoreData(importItemDefs)}); vlUpdateMatchSetSelector(vlUploadRecordType.getValue()); + vlUpdateMatchBucketSelector(vlUploadRecordType.getValue()); // use ratio from the merge profile if it's set dojo.connect( -- 2.11.0