From: berick Date: Tue, 3 May 2011 19:18:55 +0000 (-0400) Subject: match set selection support in vl uploage UI, part 1 X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=b81fd284cb7e600c6f4011741f9d7f91618cab12;p=evergreen%2Fmasslnc.git match set selection support in vl uploage UI, part 1 --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm index 0820cb0f04..510d6bf498 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Vandelay.pm @@ -60,6 +60,7 @@ sub create_bib_queue { my $name = shift; my $owner = shift; my $type = shift; + my $match_set = shift; my $import_def = shift; my $e = new_editor(authtoken => $auth, xact => 1); @@ -78,6 +79,7 @@ sub create_bib_queue { $queue->owner( $owner ); $queue->queue_type( $type ) if ($type); $queue->item_attr_def( $import_def ) if ($import_def); + $queue->match_set($match_set) if $match_set; my $new_q = $e->create_vandelay_bib_queue( $queue ); return $e->die_event unless ($new_q); @@ -100,6 +102,7 @@ sub create_auth_queue { my $name = shift; my $owner = shift; my $type = shift; + my $match_set = shift; my $e = new_editor(authtoken => $auth, xact => 1); diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 6ce390fe78..ad93a3cc3a 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -86,13 +86,14 @@ var cgi = new openils.CGI(); var vlQueueGridColumePicker = {}; var vlBibSources = []; var importItemDefs = []; +var matchSets = {}; /** * Grab initial data */ function vlInit() { authtoken = openils.User.authtoken; - var initNeeded = 6; // how many async responses do we need before we're init'd + var initNeeded = 7; // 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( @@ -165,6 +166,23 @@ function vlInit() { } ); + new openils.PermaCrud().search('vms', + {owner: owner.map(function(org) { return org.id(); })}, + { async: true, + oncomplete: function(r) { + var sets = openils.Util.readResponse(r); + dojo.forEach(sets, + function(set) { + if(!matchSets[set.mtype()]) + matchSets[set.mtype()] = []; + matchSets[set.mtype()].push(set); + } + ); + checkInitDone(); + } + } + ); + vlAttrEditorInit(); } @@ -319,13 +337,13 @@ function uploadMARC(onload){ /** * Creates a new vandelay queue */ -function createQueue(queueName, type, onload, importDefId) { +function createQueue(queueName, type, onload, importDefId, matchSet) { var name = (type=='bib') ? 'bib' : 'authority'; var method = 'open-ils.vandelay.'+ name +'_queue.create' fieldmapper.standardRequest( ['open-ils.vandelay', method], { async: true, - params: [authtoken, queueName, null, name, importDefId], + params: [authtoken, queueName, null, name, matchSet, importDefId], oncomplete : function(r) { var queue = r.recv().content(); if(e = openils.Event.parse(queue)) @@ -1111,7 +1129,10 @@ function batchUpload() { currentQueueId = vlUploadQueueSelector.getValue(); uploadMARC(handleUploadMARC); } else { - createQueue(queueName, currentType, handleCreateQueue, vlUploadQueueHoldingsImportProfile.attr('value')); + createQueue(queueName, currentType, handleCreateQueue, + vlUploadQueueHoldingsImportProfile.attr('value'), + vlUploadQueueMatchSet.attr('value') + ); } } @@ -1134,9 +1155,13 @@ function vlFleshQueueSelect(selector, type) { if(val) { vlUploadQueueHoldingsImportProfile.attr('value', queue.item_attr_def() || ''); vlUploadQueueHoldingsImportProfile.attr('disabled', true); + vlUploadQueueMatchSet.attr('value', queue.match_set() || ''); + vlUploadQueueMatchSet.attr('disabled', true); } else { vlUploadQueueHoldingsImportProfile.attr('value', ''); vlUploadQueueHoldingsImportProfile.attr('disabled', false); + vlUploadQueueMatchSet.attr('value', ''); + vlUploadQueueMatchSet.attr('disabled', false); } dojo.disconnect(qInput._onchange); qInput.attr('value', ''); @@ -1148,6 +1173,8 @@ function vlFleshQueueSelect(selector, type) { // user entered a new queue name. clear the selector vlUploadQueueHoldingsImportProfile.attr('value', ''); vlUploadQueueHoldingsImportProfile.attr('disabled', false); + vlUploadQueueMatchSet.attr('value', ''); + vlUploadQueueMatchSet.attr('disabled', false); dojo.disconnect(selector._onchange); selector.attr('value', ''); selector._onchange = dojo.connect(selector, 'onChange', selChange); @@ -1157,6 +1184,12 @@ function vlFleshQueueSelect(selector, type) { qInput._onchange = dojo.connect(qInput, 'onChange', inputChange); } +function vlUpdateMatchSetSelector(type) { + type = (type.match(/bib/)) ? 'biblio' : 'authority'; + vlUploadQueueMatchSet.store = + new dojo.data.ItemFileReadStore({data:vms.toStoreData(matchSets[type])}); +} + function vlShowUploadForm() { displayGlobalDiv('vl-marc-upload-div'); vlFleshQueueSelect(vlUploadQueueSelector, vlUploadRecordType.getValue()); @@ -1165,6 +1198,7 @@ function vlShowUploadForm() { vlUploadSourceSelector.setValue(vlBibSources[0].id()); vlUploadQueueHoldingsImportProfile.store = new dojo.data.ItemFileReadStore({data:viiad.toStoreData(importItemDefs)}); + vlUpdateMatchSetSelector(vlUploadRecordType.getValue()); } function vlShowQueueSelect() { diff --git a/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 b/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 index 8356075b63..909670e4b3 100644 --- a/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 +++ b/Open-ILS/web/templates/default/vandelay/inc/upload.tt2 @@ -24,6 +24,13 @@ + Record Match Set + + + + + Holdings Import Profile