<h1>&vandelay.record.queue;</h1><br/>
+<div>
+ <span style='font-size:105%;' id='vl-queue-summary-name'/>
+ <span id='vl-queue-summary-import-count'/> / <span id='vl-queue-summary-total-count'/>
+</div>
<script>
var vlQueueGridLayout;
function resetVlQueueGridLayout() {
<button jsId='vlQueueGridColumnPickerButton'
onclick='
vlQueueGridColumePickerDialog.hide();
- vlQueueGridColumePicker.update(true);'
+ vlQueueGridColumePicker[currentType].update(true);'
dojoType='dijit.form.Button'>&vandelay.done;</button>
</td>
</tr>
<div dojoType="dijit.layout.ContentPane" layoutAlign='client'>
<table width='100%' style='margin-bottom:0px;'>
<tr>
- <td align='left'>
+ <td align='left' valign='bottom'>
<button dojoType='dijit.form.Button' onclick='vlImportSelectedRecords();'>&vandelay.import.selected;</button>
+ <button dojoType='dijit.form.Button' onclick='vlImportAllRecords();'>&vandelay.import.all;</button>
<button dojoType='dijit.form.Button' onclick="
if(confirm('&vandelay.sure.to.delete.queue;')) {
vlDeleteQueue(currentType, currentQueueId,
function() { displayGlobalDiv('vl-marc-upload-div'); });
}">&vandelay.delete.queue;</button>
</td>
- <td align='middle'>
+ <td align='middle' valign='bottom'>
<style>.filter_td { padding-right: 5px; border-right: 2px solid #e8e1cf; } </style>
<table><tr>
<td class='filter_td'>
- &vandelay.limit.to.collision.matches;
- <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches'/>
- </td>
- <td class='filter_td' style='padding-left:5px;'>
- &vandelay.limit.to.non.imported;
- <input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked'/>
+ <table class='small_form_table'><tr>
+ <td>&vandelay.limit.to.collision.matches;</td>
+ <td><input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowMatches'/></td>
+ </tr><tr>
+ <td>&vandelay.limit.to.non.imported;</td>
+ <td><input dojoType='dijit.form.CheckBox' jsId='vlQueueGridShowNonImport' checked='checked'/></td>
+ </tr></table>
</td>
<td class='filter_td' style='padding-left:5px;'>
- &vandelay.results.per.page;
- <select style='width:68px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
- <option value='10'>10</option>
- <option value='20'>20</option>
- <option value='50'>50</option>
- <option value='100'>100</option>
- </select>
+ <div class='nav_row_div'>&vandelay.results.per.page;</div>
+ <div class='nav_row_div'>
+ <select style='width:68px;' jsId='vlQueueDisplayLimit' dojoType='dijit.form.FilteringSelect' value='10'>
+ <option value='10'>10</option>
+ <option value='20'>20</option>
+ <option value='50'>50</option>
+ <option value='100'>100</option>
+ </select>
+ </div>
</td>
<td class='filter_td' style='padding-left:5px;'>
- &vandelay.page; <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
+ <div class='nav_row_div'>&vandelay.page;</div>
+ <div class='nav_row_div'>
+ <input style='width:36px;' dojoType='dijit.form.TextBox' jsId='vlQueueDisplayPage' value='1'/>
+ </div>
</td>
<td style='padding-left:5px;'>
<button dojoType='dijit.form.Button'
var allUserAuthQueues;
var selectableGridRecords;
var cgi = new openils.CGI();
-var vlQueueGridColumePicker;
+var vlQueueGridColumePicker = {};
/**
* Grab initial data
var limit = parseInt(vlQueueDisplayLimit.getValue());
var offset = limit * parseInt(vlQueueDisplayPage.getValue()-1);
+ var params = [authtoken, queueId, {clear_marc: 1, offset: offset, limit: limit}];
+ if(vlQueueGridShowNonImport.checked)
+ params[2].non_imported = 1;
+
fieldmapper.standardRequest(
['open-ils.vandelay', method],
{ async: true,
- params: [authtoken, queueId,
- { clear_marc: 1,
- offset: offset,
- limit: limit
- }
- ],
- /* intermittent bug in streaming, multipart requests prevents use of onreponse for now...
+ params: params,
+ /*
onresponse: function(r) {
+ console.log("ONREPONSE");
var rec = r.recv().content();
if(e = openils.Event.parse(rec))
return alert(e);
+ console.log("got record " + rec.id());
queuedRecords.push(rec);
queuedRecordsMap[rec.id()] = rec;
},
}
function getRecAttrFromCode(rec, attrCode) {
- var defId = attrDefMap[attrCode];
+ var defId = attrDefMap[currentType][attrCode];
var attrs = rec.attributes();
for(var i = 0; i < attrs.length; i++) {
var attr = attrs[i];
}
}
-var vlQueueGridBuilt = false;
+var valLastQueueType = null;
function buildRecordGrid(type) {
displayGlobalDiv('vl-queue-div');
- currentOverlayRecordsMap = {};
-
- if(!vlQueueGridBuilt) {
+ if(valLastQueueType != type) {
+ valLastQueueType = type;
+ resetVlQueueGridLayout();
var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
+ attrDefMap[type] = {};
for(var i = 0; i < defs.length; i++) {
var def = defs[i]
- attrDefMap[def.code()] = def.id();
+ attrDefMap[type][def.code()] = def.id();
var col = {
name:def.description(),
field:'attr.' + def.code(),
};
vlQueueGridLayout[0].cells[0].push(col);
}
- vlQueueGridBuilt = true;
}
var storeData;
null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
vlQueueGrid.setModel(model);
- if(vlQueueGridColumePicker) {
+
+ if(vlQueueGridColumePicker[type]) {
vlQueueGrid.update();
} else {
- vlQueueGridColumePicker =
+ vlQueueGridColumePicker[type] =
new openils.GridColumnPicker(vlQueueGridColumePickerDialog,
- vlQueueGrid, vlQueueGridLayout, authtoken, 'vandelay.queue');
- vlQueueGridColumePicker.load();
+ vlQueueGrid, vlQueueGridLayout, authtoken, 'vandelay.queue.'+type);
+ vlQueueGridColumePicker[type].load();
}
}
var handleRetrieveRecords = function() {
buildRecordGrid(currentType);
+ vlFetchQueueSummary(currentQueueId, currentType,
+ function(summary) {
+ dojo.byId('vl-queue-summary-name').innerHTML = summary.queue.name();
+ dojo.byId('vl-queue-summary-total-count').innerHTML = summary.total +'';
+ dojo.byId('vl-queue-summary-import-count').innerHTML = summary.imported + '';
+ }
+ );
}
+function vlFetchQueueSummary(qId, type, onload) {
+ fieldmapper.standardRequest(
+ ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.summary.retrieve'],
+ { async: true,
+ params: [authtoken, qId],
+ oncomplete : function(r) {
+ var summary = r.recv().content();
+ if(e = openils.Event.parse(summary))
+ return alert(e);
+ return onload(summary);
+ }
+ }
+ );
+}
+
+
function vlImportSelectedRecords() {
displayGlobalDiv('vl-generic-progress-with-total');
var records = [];
var resp = r.recv().content();
if(e = openils.Event.parse(resp))
return alert(e);
- vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
- },
- oncomplete: function() {
- return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
- }
+ if(resp.complete) {
+ return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
+ } else {
+ vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
+ }
+ },
}
);
}
+function vlImportAllRecords() {
+ vlImportRecordQueue(currentType, currentQueueId, false,
+ function(){displayGlobalDiv('vl-queue-div');});
+}
+
function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
displayGlobalDiv('vl-generic-progress-with-total');
var method = 'open-ils.vandelay.bib_queue.import';