dojo.require('openils.widget.AutoGrid');
dojo.require('openils.widget.AutoFieldWidget');
dojo.require('openils.widget.ProgressDialog');
+dojo.require('dojox.form.CheckedMultiSelect');
var globalDivs = [
var vlQueueGridColumePicker = {};
var vlBibSources = [];
var importItemDefs = [];
-var matchSets = {};
+var matchSets = {biblio : [], authority : []};
var mergeProfiles = [];
var copyStatusCache = {};
var copyLocationCache = {};
var localeStrings;
+var trashGroups = [];
// org settings
var orgSettings = {};
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(
{ async: true,
oncomplete: function(r) {
var stats = openils.Util.readResponse(r);
- dojo.forEach(stats, function(stat){copyStatusCache[stat.id()] = stat});
+ dojo.forEach(stats,
+ function(stat){copyStatusCache[stat.id()] = stat});
+ checkInitDone();
+ }
+ }
+ );
+
+ new openils.PermaCrud().search('vibtg',
+ { always_apply : 'f',
+ owner: owner.map(function(org) { return org.id(); })
+ },
+ { order_by : {vibtg : ['label']},
+ async: true,
+ oncomplete: function(r) {
+ trashGroups = openils.Util.readResponse(r);
+
+ if (trashGroups.length == 0) {
+ openils.Util.hide('vl-trash-groups-row');
+ openils.Util.hide('vl-trash-groups-row2');
+ checkInitDone();
+ return;
+ }
+
+ dojo.forEach(trashGroups, function(grp) {
+ var sn = fieldmapper.aou.findOrgUnit(grp.owner()).shortname();
+ var opt = {
+ label : grp.label() + ' (' + sn + ')',
+ value : grp.id()
+ };
+ vlUploadTrashGroups.addOption(opt);
+ vlUploadTrashGroups2.addOption(opt);
+ });
+
checkInitDone();
}
}
vlUploadQueueAutoOverlayBestMatch.attr('value', vlUploadQueueAutoOverlayBestMatch2.attr('value'));
vlUploadQueueAutoOverlayBestMatchRatio.attr('value', vlUploadQueueAutoOverlayBestMatchRatio2.attr('value'));
+ // attr('value') and various other incantations won't let me set
+ // the value on the checkedmultiselect, so we temporarily swap
+ // the dijits instead.
+ var tmpTrashGroup = vlUploadTrashGroups;
+ vlUploadTrashGroups = vlUploadTrashGroups2;
+
if(action == 'import') {
vlImportSelectedRecords();
} else if(action == 'import_all') {
vlUploadMergeProfile2.attr('value', '');
vlUploadFtMergeProfile.attr('value', '');
vlUploadFtMergeProfile2.attr('value', '');
+ vlUploadTrashGroups.attr('value', '');
+ vlUploadTrashGroups2.attr('value', '');
vlUploadQueueAutoOverlayBestMatch.attr('value', false);
vlUploadQueueAutoOverlayBestMatch2.attr('value', false);
vlUploadQueueAutoOverlayBestMatchRatio.attr('value', '0.0');
vlUploadQueueAutoOverlayBestMatchRatio2.attr('value', '0.0');
+
+ // and... swap them back
+ vlUploadTrashGroups2 = vlUploadTrashGroups;
+ vlUploadTrashGroups = tmpTrashGroup;
}
);
- queueItemsImportDialog.show();
-}
-
-function vlHandleCreateBucket() {
+ if (currentType.match(/auth/) || trashGroups.length == 0) {
+ openils.Util.hide('vl-trash-groups-row2');
+ } else {
+ openils.Util.show('vl-trash-groups-row2', 'table-row');
+ }
- create-bucket-dialog-name
+ queueItemsImportDialog.show();
}
-
/* import user-selected records */
function vlImportSelectedRecords() {
options.fall_through_merge_profile = ftprofile;
}
+ var strip_grps = vlUploadTrashGroups.attr('value');
+ if (strip_grps != null && strip_grps.length) {
+ options.strip_field_groups = strip_grps;
+ }
/* determine which method we're calling */
new dojo.data.ItemFileReadStore({data:viiad.toStoreData(importItemDefs)});
vlUpdateMatchSetSelector(vlUploadRecordType.getValue());
+ if (vlUploadRecordType.attr('value').match(/auth/) || trashGroups.length == 0) {
+ openils.Util.hide('vl-trash-groups-row');
+ } else {
+ openils.Util.show('vl-trash-groups-row', 'table-row');
+ }
+
// use ratio from the merge profile if it's set
dojo.connect(
vlUploadMergeProfile,
vlUploadQueueAutoOverlayBestMatchRatio2.attr('value', profile.lwm_ratio()+'');
}
);
+}
+
+function vlDeleteSelectedQueues() {
+ var checkboxes = document.getElementById('vlQueueSelectList').getElementsByTagName('input');
+ var type = vlQueueSelectType.attr('value').replace(/-.*/, '');
+ for(var i = 0; i < checkboxes.length; i++) {
+ if(checkboxes[i].getAttribute('name') == 'delete' && checkboxes[i].checked) {
+ vlDeleteQueue(type, checkboxes[i].getAttribute('value'), function () {});
+ }
+ }
+ window.location.reload();
+}
+
+function vlShowQueueSelect() {
+ displayGlobalDiv('vl-queue-select-div');
+ var type = vlQueueSelectType.attr('value');
+ var data = vlGetQueueData(type, false);
+ type = type.replace(/-.*/, ''); // To remove any sub-typeish info.
+ var tbody = document.getElementById('vlQueueSelectList');
}