<!-- Form for choosing which queue to view -->
<h1>[% l('Select a Queue to Inspect') %]</h1><br/>
-<table class='form_table'>
- <tr>
- <td>[% l('Queue Type') %]</td>
- <td>
- <select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='vlShowQueueSelect();'>
- <option value='bib' selected='selected'>[% l('Bibliographic Records') %]</option>
- <option value='bib-acq'>[% l('Acquisitions Records') %]</option>
- <option value='auth'>[% l('Authority Records') %]</option>
- </select>
- </td>
- </tr>
- <tr>
- <td>[% l('Queue') %]</td>
- <td>
- <select jsId='vlQueueSelectQueueList' dojoType='dijit.form.FilteringSelect'>
- </select>
- </td>
- </tr>
- <tr>
- <td colspan='2'>
- <button dojoType='dijit.form.Button' onclick='vlFetchQueueFromForm();'>[% l('Retrieve Queue') %]</button>
- </td>
- </tr>
+[% l('Queue Type') %]
+<select jsId='vlQueueSelectType' dojoType='dijit.form.FilteringSelect' onchange='vlShowQueueSelect();'>
+ <option value='bib' selected='selected'>[% l('Bibliographic Records') %]</option>
+ <option value='bib-acq'>[% l('Acquisitions Records') %]</option>
+ <option value='auth'>[% l('Authority Records') %]</option>
+</select>
+<table>
+ <thead>
+ <tr>
+ <td><input type="checkbox" disabled="true" /> </td>
+ <td>[% l('Queue') %]</td>
+ </tr>
+ </thead>
+ <tbody id="vlQueueSelectList">
+ </tbody>
+ <tfoot>
+ <tr>
+ <td> </td>
+ <td><input type="button" value="[% l('Delete Selected') %]" onclick='
+ if(confirm("[% l('Are you sure you want to delete the selected queues?') %]")) {
+ vlDeleteSelectedQueues();
+ }' /></td>
+ </tr>
+ </tfoot>
</table>
dojo.style('vl-nav-bar', 'visibility', 'visible');
if(currentQueueId)
return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
- if (cgi.param('page', 'inspectq')) {
- vlShowQueueSelect();
- return displayGlobalDiv('vl-queue-select-div');
- }
+ if (cgi.param('page', 'inspectq'))
+ return vlShowQueueSelect();
vlShowUploadForm();
}
}
}
-
-function vlFleshQueueSelect(selector, type) {
- var data;
- if (type == 'bib') {
- var bibList = allUserBibQueues.filter(
- function(q) {
- return (q.queue_type() == 'bib');
- }
- );
- data = vbq.toStoreData(bibList);
- } else if (type == 'bib-acq') {
- // ACQ queues are a special type of bib queue
- var acqList = allUserBibQueues.filter(
- function(q) {
- return (q.queue_type() == 'acq');
- }
- );
- data = vbq.toStoreData(acqList);
- } else {
- data = vaq.toStoreData(allUserAuthQueues);
+// Inspect Queue no longer uses stores, so put type matching here instead
+function vlGetQueueData(type, asStore) {
+ var filter;
+ switch(type) {
+ case 'bib-acq':
+ filter = 'acq';
+ case 'bib':
+ if(!filter) filter = 'bib';
+ var bibList = allUserBibQueues.filter(
+ function(q) {
+ return (q.queue_type() == filter);
+ }
+ );
+ if (!asStore) return bibList;
+ return vbq.toStoreData(bibList);
+ case 'auth':
+ if (!asStore) return allUserAuthQueues;
+ return vaq.toStoreData(allUserAuthQueues);
}
+}
+function vlFleshQueueSelect(selector, type) {
+ var data = vlGetQueueData(type, true);
selector.store = new dojo.data.ItemFileReadStore({data:data});
selector.setValue(null);
selector.setDisplayedValue('');
}
+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');
- vlFleshQueueSelect(vlQueueSelectQueueList, vlQueueSelectType.getValue());
+ var type = vlQueueSelectType.attr('value');
+ var data = vlGetQueueData(type, false);
+ type = type.replace(/-.*/, ''); // To remove any sub-typeish info.
+ var tbody = document.getElementById('vlQueueSelectList');
+ // Clear it out
+ while(tbody.firstChild) {
+ tbody.removeChild(tbody.firstChild);
+ }
+ // Add entries
+ for(var entry in data) {
+ var name = data[entry].name();
+ if(!name.match(/\S/))
+ name = '-';
+ var tr = document.createElement('tr');
+ var td = document.createElement('td');
+ var checkbox = document.createElement('input');
+ checkbox.setAttribute('type', 'checkbox');
+ checkbox.setAttribute('name', 'delete');
+ checkbox.setAttribute('value', data[entry].id());
+ td.appendChild(checkbox);
+ tr.appendChild(td);
+ td = document.createElement('td');
+ var a = document.createElement('a');
+ a.textContent = name;
+ a.setAttribute('href', "javascript:retrieveQueuedRecords('" + type + "', " + data[entry].id() + ");");
+ td.appendChild(a);
+ tr.appendChild(td);
+ tbody.appendChild(tr);
+ }
}
function vlShowMatchSetEditor() {
);
}
-function vlFetchQueueFromForm() {
- currentType = vlQueueSelectType.attr('value').replace(/-.*/, ''); // trim bib-acq
- currentQueueId = vlQueueSelectQueueList.getValue();
- retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
-}
-
function vlOpenMarcEditWindow(rec, postReloadHTMLHandler) {
/*
To run in Firefox directly, must set signed.applets.codebase_principal_support