if(confirm("[% l('Are you sure you want to delete this queue?') %]")) {
vlDeleteQueue(currentType, currentQueueId,
function() { displayGlobalDiv("vl-marc-upload-div"); });}'>[% l('Delete Queue') %]</a></td></tr>
+ <tr id='add-to-bucket-action'><td><a href='javascript:;' onclick='createBucketDialog.show()'>[% l('Copy To Bucket') %]</a></td></tr>
</tbody>
</table>
</td>
</div>
-
+<div jsId='progressDialog' dojoType='openils.widget.ProgressDialog'></div>
+<div jsId='createBucketDialog' dojoType="dijit.Dialog" class='center' title="[% l('Copy Records to Bucket') %]">
+ <div dojoType="dijit.layout.ContentPane" class='pad-level-1'>
+ <div class='pad-level-1'>[% l('Please enter the name of the bucket to append/create.') %]</div>
+ <div class='pad-level-1'><input dojoType='dijit.form.TextBox' name='name' id='create-bucket-dialog-name'/></div>
+ <div>
+ <button class='pad-level-1' dojoType="dijit.form.Button" type="submit" onClick="handleCreateBucket()">[% l('Apply') %]</button>
+ <button class='pad-level-1' dojoType="dijit.form.Button" type="submit" onClick="createBucketDialog.hide()">[% l('Cancel') %]</button>
+ </div>
+ </div>
+</div>
dojo.require('openils.widget.OrgUnitFilteringSelect');
dojo.require('openils.widget.AutoGrid');
dojo.require('openils.widget.AutoFieldWidget');
+dojo.require('openils.widget.ProgressDialog');
var globalDivs = [
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
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');
}
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();
+ }
}
);
}
);
}
+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) {
queueItemsImportDialog.show();
}
+
+function vlHandleCreateBucket() {
+
+ create-bucket-dialog-name
+}
/* import user-selected records */