From ad07dc3faddeca280969bf6825a6947e27419b96 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 31 Oct 2011 17:33:23 -0400 Subject: [PATCH] Vandelay; copy imported bib queue recs to bucket Adds a "Copy to Bucket" option within the Vandelay queue interface. User is given the option to name the bucket. If the bucket already exists, the records are added to the existing bucket. Otherwise, a new bucket is created and the records are added. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/templates/vandelay/inc/queue.tt2 | 13 +++++- Open-ILS/web/css/skin/default.css | 3 ++ .../web/js/dojo/openils/vandelay/nls/vandelay.js | 5 +++ Open-ILS/web/js/ui/default/vandelay/vandelay.js | 47 ++++++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/web/js/dojo/openils/vandelay/nls/vandelay.js diff --git a/Open-ILS/src/templates/vandelay/inc/queue.tt2 b/Open-ILS/src/templates/vandelay/inc/queue.tt2 index b645f33378..850d3422d1 100644 --- a/Open-ILS/src/templates/vandelay/inc/queue.tt2 +++ b/Open-ILS/src/templates/vandelay/inc/queue.tt2 @@ -16,6 +16,7 @@ if(confirm("[% l('Are you sure you want to delete this queue?') %]")) { vlDeleteQueue(currentType, currentQueueId, function() { displayGlobalDiv("vl-marc-upload-div"); });}'>[% l('Delete Queue') %] + [% l('Copy To Bucket') %] @@ -250,4 +251,14 @@ - +
+
+
+
[% l('Please enter the name of the bucket to append/create.') %]
+
+
+ + +
+
+
diff --git a/Open-ILS/web/css/skin/default.css b/Open-ILS/web/css/skin/default.css index a7ab2d6b64..4fa7215174 100644 --- a/Open-ILS/web/css/skin/default.css +++ b/Open-ILS/web/css/skin/default.css @@ -115,3 +115,6 @@ table { border-collapse: collapse; } .openils-widget-editpane-ro-value-cell { text-decoration: underline; } + +.pad-level-1 { padding: 5px; } +.center { text-align: center; } diff --git a/Open-ILS/web/js/dojo/openils/vandelay/nls/vandelay.js b/Open-ILS/web/js/dojo/openils/vandelay/nls/vandelay.js new file mode 100644 index 0000000000..c7bfbe9afc --- /dev/null +++ b/Open-ILS/web/js/dojo/openils/vandelay/nls/vandelay.js @@ -0,0 +1,5 @@ +{ + NO_BUCKET_ITEMS : 'No bucket was created because the selected queue has no imported records', + BUCKET_CREATE_SUCCESS : 'Successfully added ${0} record(s) to bucket "${1}".\n\nThe bucket now has ${2} total records.' +} + diff --git a/Open-ILS/web/js/ui/default/vandelay/vandelay.js b/Open-ILS/web/js/ui/default/vandelay/vandelay.js index ff4eba71d2..2b396122ca 100644 --- a/Open-ILS/web/js/ui/default/vandelay/vandelay.js +++ b/Open-ILS/web/js/ui/default/vandelay/vandelay.js @@ -43,6 +43,7 @@ dojo.require('openils.PermaCrud'); dojo.require('openils.widget.OrgUnitFilteringSelect'); dojo.require('openils.widget.AutoGrid'); dojo.require('openils.widget.AutoFieldWidget'); +dojo.require('openils.widget.ProgressDialog'); var globalDivs = [ @@ -90,11 +91,16 @@ var matchSets = {}; var mergeProfiles = []; var copyStatusCache = {}; var copyLocationCache = {}; +var localeStrings; /** * Grab initial data */ function vlInit() { + + dojo.requireLocalization("openils.vandelay", "vandelay"); + 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 initCount = 0; // how many async reponses we've received @@ -954,10 +960,12 @@ function buildRecordGrid(type) { openils.Util.show('vl-bib-queue-grid-wrapper'); openils.Util.hide('vl-auth-queue-grid-wrapper'); vlQueueGrid = vlBibQueueGrid; + openils.Util.show('add-to-bucket-action', 'table-row'); } else { openils.Util.show('vl-auth-queue-grid-wrapper'); openils.Util.hide('vl-bib-queue-grid-wrapper'); vlQueueGrid = vlAuthQueueGrid; + openils.Util.hide('add-to-bucket-action'); } @@ -1070,6 +1078,10 @@ var handleRetrieveRecords = function() { dojo.byId('vl-queue-summary-import-item-imported-count').innerHTML = summary.total_items_imported + ''; dojo.byId('vl-queue-summary-rec-error-count').innerHTML = summary.rec_import_errors + ''; dojo.byId('vl-queue-summary-item-error-count').innerHTML = summary.item_import_errors + ''; + + if (dojo.byId('create-bucket-dialog-name')) { + dojo.byId('create-bucket-dialog-name').value = summary.queue.name(); + } } ); } @@ -1089,6 +1101,36 @@ function vlFetchQueueSummary(qId, type, onload) { ); } +function handleCreateBucket(args) { + var bname = dojo.byId('create-bucket-dialog-name').value; + if (!bname) return; + + progressDialog.show(true); + fieldmapper.standardRequest( + ['open-ils.vandelay', 'open-ils.vandelay.bib_queue.to_bucket'], + { async : true, + params : [authtoken, currentQueueId, bname], + oncomplete : function(r) { + progressDialog.hide(); + setTimeout(function() { + var resp = openils.Util.readResponse(r); + if (resp.add_count == 0) { + alert(localeStrings.NO_BUCKET_ITEMS); + } else { + alert( + dojo.string.substitute( + localeStrings.BUCKET_CREATE_SUCCESS, + [resp.add_count, bname, resp.item_count] + ) + ); + } + }, 200); // give the dialog a chance to hide + } + } + ); +} + + var _importCancelHandler; var _importGoHandler; function vlHandleQueueItemsAction(action) { @@ -1147,6 +1189,11 @@ function vlHandleQueueItemsAction(action) { queueItemsImportDialog.show(); } + +function vlHandleCreateBucket() { + + create-bucket-dialog-name +} /* import user-selected records */ -- 2.11.0