From f0851d0cf39aa7b82d7994a7393b76775956b5cc Mon Sep 17 00:00:00 2001 From: erickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4> Date: Thu, 29 Apr 2010 15:53:35 +0000 Subject: [PATCH] added support for selecting merge/overlay options during import of already queued records, same as main upload page git-svn-id: svn://svn.open-ils.org/ILS/trunk@16345 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/web/js/ui/default/vandelay/vandelay.js | 69 +++++++++++++++++++++- .../web/templates/default/vandelay/inc/queue.tt2 | 46 ++++++++++++++- 2 files changed, 111 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index 0af7275abd..7346ef029b 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -109,6 +109,12 @@ function vlInit() { vlUploadMergeProfile.searchAttr = 'name'; vlUploadMergeProfile.startup(); + vlUploadMergeProfile2.store = new dojo.data.ItemFileReadStore({data:fieldmapper.vmp.toStoreData(profiles)}); + vlUploadMergeProfile2.labelAttr = 'name'; + vlUploadMergeProfile2.searchAttr = 'name'; + vlUploadMergeProfile2.startup(); + + // Fetch the bib and authority attribute definitions vlFetchBibAttrDefs(function () { checkInitDone(); }); vlFetchAuthAttrDefs(function () { checkInitDone(); }); @@ -793,6 +799,49 @@ function vlFetchQueueSummary(qId, type, onload) { } ); } + +function vlHandleQueueItemsAction(action) { + + dojo.connect( + queueItemsImportCancelButton, + 'onClick', + function() { + queueItemsImportDialog.hide(); + } + ); + + dojo.connect( + queueItemsImportGoButton, + 'onClick', + function() { + queueItemsImportDialog.hide(); + + // hack to set the widgets the import funcs will be looking at. Reset them below. + vlUploadQueueAutoImport.attr('value', vlUploadQueueAutoImport2.attr('value')); + vlUploadQueueAutoOverlayExact.attr('value', vlUploadQueueAutoOverlayExact2.attr('value')); + vlUploadQueueAutoOverlay1Match.attr('value', vlUploadQueueAutoOverlay1Match2.attr('value')); + vlUploadMergeProfile.attr('value', vlUploadMergeProfile2.attr('value')); + + if(action == 'import') { + vlImportSelectedRecords(); + } else if(action == 'import_all') { + vlImportAllRecords(); + } + + // reset the widgets to prevent accidental future actions + vlUploadQueueAutoImport.attr('value', false); + vlUploadQueueAutoImport2.attr('value', false); + vlUploadQueueAutoOverlayExact.attr('value', false); + vlUploadQueueAutoOverlayExact2.attr('value', false); + vlUploadQueueAutoOverlay1Match.attr('value', false); + vlUploadQueueAutoOverlay1Match2.attr('value', false); + vlUploadMergeProfile.attr('value', ''); + vlUploadMergeProfile2.attr('value', ''); + } + ); + + queueItemsImportDialog.show(); +} function vlImportSelectedRecords() { @@ -808,10 +857,27 @@ function vlImportSelectedRecords() { } } + var options = {overlay_map : currentOverlayRecordsMap}; + + if(vlUploadQueueAutoOverlayExact.checked) { + options.auto_overlay_exact = true; + vlUploadQueueAutoOverlayExact.checked = false; + } + + if(vlUploadQueueAutoOverlay1Match.checked) { + options.auto_overlay_1match = true; + vlUploadQueueAutoOverlay1Match.checked = false; + } + + var profile = vlUploadMergeProfile.attr('value'); + if(profile != null && profile != '') { + options.merge_profile = profile; + } + fieldmapper.standardRequest( ['open-ils.vandelay', 'open-ils.vandelay.'+currentType+'_record.list.import'], { async: true, - params: [authtoken, records, {overlay_map:currentOverlayRecordsMap}], + params: [authtoken, records, options], onresponse: function(r) { var resp = r.recv().content(); if(e = openils.Event.parse(resp)) @@ -849,7 +915,6 @@ function vlImportRecordQueue(type, queueId, noMatchOnly, onload) { options.auto_overlay_1match = true; vlUploadQueueAutoOverlay1Match.checked = false; } - var profile = vlUploadMergeProfile.attr('value'); if(profile != null && profile != '') { diff --git a/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 b/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 index 8f3c458053..5f0df1e831 100644 --- a/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 +++ b/Open-ILS/web/templates/default/vandelay/inc/queue.tt2 @@ -14,6 +14,48 @@ <br/> +<div jsId='queueItemsImportDialog' dojoType="dijit.Dialog" title="Import Items"> + <div dojoType="dijit.layout.ContentPane"> + <table class='form_table'> + <tbody> + <tr> + <td>&vandelay.auto.import.noncolliding;</td> + <td colspan='4'> + <input jsId='vlUploadQueueAutoImport2' dojoType='dijit.form.CheckBox'/> + </td> + </tr> + <tr> + <td>&vandelay.auto.import.auto_overlay_exact;</td> + <td colspan='4'> + <input jsId='vlUploadQueueAutoOverlayExact2' dojoType='dijit.form.CheckBox'/> + </td> + </tr> + <tr> + <td>&vandelay.auto.import.auto_overlay_1match;</td> + <td colspan='4'> + <input jsId='vlUploadQueueAutoOverlay1Match2' dojoType='dijit.form.CheckBox'/> + </td> + </tr> + <tr> + <td>&vandelay.auto.import.merge_profile;</td> + <td colspan='4'> + <div jsId='vlUploadMergeProfile2' + dojoType='dijit.form.FilteringSelect' required='false' labelAttr='name' searchAttr='name'/> + </td> + </tr> + <tr> + <td> + <button dojoType='dijit.form.Button' jsId='queueItemsImportCancelButton'>Cancel</button> + </td> + <td> + <button dojoType='dijit.form.Button' jsId='queueItemsImportGoButton'>Import</button> + </td> + </tr> + </tbody> + </table> + </div> +</div> + <!-- queue grid navigation row --> <div dojoType="dijit.layout.ContentPane" layoutAlign='client'> @@ -30,8 +72,8 @@ var sel = dojo.byId('vl-queue-actions-selector'); sel.onchange = function(evt) { switch(openils.Util.selectorValue(evt.target)) { - case 'import': vlImportSelectedRecords(); break;; - case 'import_all': vlImportAllRecords(); break;; + case 'import': vlHandleQueueItemsAction('import'); break;; + case 'import_all': vlHandleQueueItemsAction('import_all'); break;; case 'delete_queue': if(confirm('&vandelay.sure.to.delete.queue;')) { vlDeleteQueue(currentType, currentQueueId, -- 2.11.0