inspect queue now gives option to inspect completed queues as well. added marc2html...
[Evergreen.git] / Open-ILS / web / vandelay / vandelay.js
1 /* ---------------------------------------------------------------------------
2 # Copyright (C) 2008  Georgia Public Library Service
3 # Bill Erickson <erickson@esilibrary.com>
4
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
9
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 # --------------------------------------------------------------------------- */
15 dojo.require("dojo.parser");
16 dojo.require("dojo.io.iframe"); 
17 dojo.require("dijit.ProgressBar"); 
18 dojo.require("dijit.form.Button"); 
19 dojo.require("dijit.form.FilteringSelect"); 
20 dojo.require("dijit.layout.LayoutContainer");
21 dojo.require("dijit.layout.ContentPane");
22 dojo.require("dijit.layout.TabContainer");
23 dojo.require("dijit.Dialog");
24 dojo.require("dojo.cookie");
25 dojo.require("dojox.grid.Grid");
26 dojo.require("dojo.data.ItemFileReadStore");
27 dojo.require('dojo.date.locale');
28 dojo.require('dojo.date.stamp');
29 dojo.require("fieldmapper.Fieldmapper");
30 dojo.require("fieldmapper.dojoData");
31 dojo.require('openils.CGI');
32 dojo.require('openils.User');
33 dojo.require('openils.Event');
34 dojo.require('openils.MarcXPathParser');
35 dojo.require('openils.GridColumnPicker');
36
37 var globalDivs = [
38     'vl-generic-progress',
39     'vl-generic-progress-with-total',
40     'vl-marc-upload-div',
41     'vl-queue-div',
42     'vl-match-div',
43     'vl-marc-html-div',
44     'vl-queue-select-div',
45     'vl-marc-upload-status-div'
46 ];
47
48 var authtoken;
49 var VANDELAY_URL = '/vandelay-upload';
50 var bibAttrDefs = [];
51 var authAttrDefs = [];
52 var queuedRecords = [];
53 var queuedRecordsMap = {};
54 var bibAttrsFetched = false;
55 var authAttrsFetched = false;
56 var attrDefMap = {}; // maps attr def code names to attr def ids
57 var currentType;
58 var currentQueueId = null;
59 var userCache = {};
60 var currentMatchedRecords; // set of loaded matched bib records
61 var currentOverlayRecordsMap; // map of import record to overlay record
62 var currentImportRecId; // when analyzing matches, this is the current import record
63 var userBibQueues = []; // only non-complete queues
64 var userAuthQueues = []; // only non-complete queues
65 var allUserBibQueues;
66 var allUserAuthQueues;
67 var selectableGridRecords;
68 var cgi = new openils.CGI();
69 var vlQueueGridColumePicker;
70
71 /**
72   * Grab initial data
73   */
74 function vlInit() {
75     authtoken = dojo.cookie('ses') || cgi.param('ses');
76     var initNeeded = 4; // how many async responses do we need before we're init'd 
77     var initCount = 0; // how many async reponses we've received
78
79     function checkInitDone() {
80         initCount++;
81         if(initCount == initNeeded)
82             runStartupCommands();
83     }
84
85     // Fetch the bib and authority attribute definitions
86     fieldmapper.standardRequest(
87         ['open-ils.permacrud', 'open-ils.permacrud.search.vqbrad'],
88         {   async: true,
89             params: [authtoken, {id:{'!=':null}}],
90             onresponse: function(r) {
91                 var def = r.recv().content(); 
92                 if(e = openils.Event.parse(def[0])) 
93                     return alert(e);
94                 bibAttrDefs.push(def);
95             },
96             oncomplete: function() {
97                 bibAttrDefs = bibAttrDefs.sort(
98                     function(a, b) {
99                         if(a.id() > b.id()) return 1;
100                         if(a.id() < b.id()) return -1;
101                         return 0;
102                     }
103                 );
104                 checkInitDone();
105             }
106         }
107     );
108
109     fieldmapper.standardRequest(
110         ['open-ils.permacrud', 'open-ils.permacrud.search.vqarad'],
111         {   async: true,
112             params: [authtoken, {id:{'!=':null}}],
113             onresponse: function(r) {
114                 var def = r.recv().content(); 
115                 if(e = openils.Event.parse(def[0])) 
116                     return alert(e);
117                 authAttrDefs.push(def);
118             },
119             oncomplete: function() {
120                 authAttrDefs = authAttrDefs.sort(
121                     function(a, b) {
122                         if(a.id() > b.id()) return 1;
123                         if(a.id() < b.id()) return -1;
124                         return 0;
125                     }
126                 );
127                 checkInitDone();
128             }
129         }
130     );
131
132     vlRetrieveQueueList('bib', null, 
133         function(list) {
134             allUserBibQueues = list;
135             for(var i = 0; i < allUserBibQueues.length; i++) {
136                 if(allUserBibQueues[i].complete() == 'f')
137                     userBibQueues.push(allUserBibQueues[i]);
138             }
139             checkInitDone();
140         }
141     );
142
143     vlRetrieveQueueList('auth', null, 
144         function(list) {
145             allUserAuthQueues = list;
146             for(var i = 0; i < allUserAuthQueues.length; i++) {
147                 if(allUserAuthQueues[i].complete() == 'f')
148                     userAuthQueues.push(allUserAuthQueues[i]);
149             }
150             checkInitDone();
151         }
152     );
153 }
154
155 function vlRetrieveQueueList(type, filter, onload) {
156     type = (type == 'bib') ? type : 'authority';
157     fieldmapper.standardRequest(
158         ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.owner.retrieve.atomic'],
159         {   async: true,
160             params: [authtoken, null, filter],
161             oncomplete: function(r) {
162                 var list = r.recv().content();
163                 if(e = openils.Event.parse(list[0]))
164                     return alert(e);
165                 onload(list);
166             }
167         }
168     );
169 }
170
171 function displayGlobalDiv(id) {
172     for(var i = 0; i < globalDivs.length; i++) {
173         try {
174             dojo.style(dojo.byId(globalDivs[i]), 'display', 'none');
175         } catch(e) {
176             alert('please define div ' + globalDivs[i]);
177         }
178     }
179     dojo.style(dojo.byId(id),'display','block');
180 }
181
182 function runStartupCommands() {
183     currentQueueId = cgi.param('qid');
184     currentType = cgi.param('qtype');
185     if(currentQueueId)
186         return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
187     vlShowUploadForm();
188 }
189
190 /**
191   * asynchronously upload a file of MARC records
192   */
193 function uploadMARC(onload){
194     dojo.byId('vl-upload-status-count').innerHTML = '0';
195     dojo.byId('vl-ses-input').value = authtoken;
196     displayGlobalDiv('vl-marc-upload-status-div');
197     dojo.io.iframe.send({
198         url: VANDELAY_URL,
199         method: "post",
200         handleAs: "html",
201         form: dojo.byId('vl-marc-upload-form'),
202         handle: function(data,ioArgs){
203             var content = data.documentElement.textContent;
204             onload(content);
205         }
206     });
207 }       
208
209 /**
210   * Creates a new vandelay queue
211   */
212 function createQueue(queueName, type, onload) {
213     fieldmapper.standardRequest(
214         ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.create'],
215         {   async: true,
216             params: [authtoken, queueName, null, type],
217             oncomplete : function(r) {
218                 var queue = r.recv().content();
219                 if(e = openils.Event.parse(queue)) 
220                     return alert(e);
221                 onload(queue);
222             }
223         }
224     );
225 }
226
227 /**
228   * Tells vendelay to pull a batch of records from the cache and explode them
229   * out into the vandelay tables
230   */
231 function processSpool(key, queueId, type, onload) {
232     fieldmapper.standardRequest(
233         ['open-ils.vandelay', 'open-ils.vandelay.'+type+'.process_spool'],
234         {   async: true,
235             params: [authtoken, key, queueId],
236             onresponse : function(r) {
237                 var resp = r.recv().content();
238                 if(e = openils.Event.parse(resp)) 
239                     return alert(e);
240                 dojo.byId('vl-upload-status-count').innerHTML = resp;
241             },
242             oncomplete : function(r) {onload();}
243         }
244     );
245 }
246
247 function retrieveQueuedRecords(type, queueId, onload) {
248     displayGlobalDiv('vl-generic-progress');
249     queuedRecords = [];
250     queuedRecordsMap = {};
251     currentOverlayRecordsMap = {};
252     selectableGridRecords = {};
253     resetVlQueueGridLayout();
254
255     var method = 'open-ils.vandelay.'+type+'_queue.records.retrieve.atomic';
256     if(vlQueueGridShowMatches.checked)
257         method = method.replace('records', 'records.matches');
258
259     var limit = parseInt(vlQueueDisplayLimit.getValue());
260     var offset = limit * parseInt(vlQueueDisplayPage.getValue()-1);
261
262     fieldmapper.standardRequest(
263         ['open-ils.vandelay', method],
264         {   async: true,
265             params: [authtoken, queueId, 
266                 {   clear_marc: 1, 
267                     offset: offset,
268                     limit: limit
269                 }
270             ],
271             /* intermittent bug in streaming, multipart requests prevents use of onreponse for now...
272             onresponse: function(r) {
273                 var rec = r.recv().content();
274                 if(e = openils.Event.parse(rec))
275                     return alert(e);
276                 queuedRecords.push(rec);
277                 queuedRecordsMap[rec.id()] = rec;
278             },
279             */
280             oncomplete: function(r){
281                 var recs = r.recv().content();
282                 if(e = openils.Event.parse(recs[0]))
283                     return alert(e);
284                 for(var i = 0; i < recs.length; i++) {
285                     var rec = recs[i];
286                     queuedRecords.push(rec);
287                     queuedRecordsMap[rec.id()] = rec;
288                 }
289                 onload();
290             }
291         }
292     );
293 }
294
295 function vlLoadMatchUI(recId, attrCode) {
296     displayGlobalDiv('vl-generic-progress');
297     var matches = getRecMatchesFromAttrCode(queuedRecordsMap[recId], attrCode);
298     var records = [];
299     currentImportRecId = recId;
300     for(var i = 0; i < matches.length; i++)
301         records.push(matches[i].eg_record());
302
303     var retrieve = ['open-ils.search', 'open-ils.search.biblio.record_entry.slim.retrieve'];
304     var params = [records];
305     if(currentType == 'auth') {
306         retrieve = ['open-ils.cat', 'open-ils.cat.authority.record.retrieve'];
307         parmas = [authtoken, records, {clear_marc:1}];
308     }
309
310     fieldmapper.standardRequest(
311         retrieve,
312         {   async: true,
313             params:params,
314             oncomplete: function(r) {
315                 var recs = r.recv().content();
316                 if(e = openils.Event.parse(recs))
317                     return alert(e);
318
319                 /* ui mangling */
320                 displayGlobalDiv('vl-match-div');
321                 resetVlMatchGridLayout();
322                 currentMatchedRecords = recs;
323                 vlMatchGrid.setStructure(vlMatchGridLayout);
324
325                 // build the data store or records with match information
326                 var dataStore = bre.toStoreData(recs, null, {virtualFields:['field_type']});
327                 for(var i = 0; i < dataStore.items.length; i++) {
328                     var item = dataStore.items[i];
329                     for(var j = 0; j < matches.length; j++) {
330                         var match = matches[j];
331                         if(match.eg_record() == item.id)
332                             item.field_type = match.field_type();
333                     }
334                 }
335                 // now populate the grid
336                 vlPopulateGrid(vlMatchGrid, dataStore);
337             }
338         }
339     );
340 }
341
342 function vlPopulateGrid(grid, data) {
343     var store = new dojo.data.ItemFileReadStore({data:data});
344     var model = new dojox.grid.data.DojoData(
345         null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
346     grid.setModel(model);
347     grid.update();
348 }
349
350
351 function vlLoadMARCHtml(recId, inCat, oncomplete) {
352     dijit.byId('vl-marc-html-done-button').onClick = oncomplete;
353     displayGlobalDiv('vl-generic-progress');
354     var api;
355     var params = [recId, 1];
356     if(inCat) {
357         api = ['open-ils.search', 'open-ils.search.biblio.record.html'];
358         if(currentType == 'auth')
359             api = ['open-ils.search', 'open-ils.search.authority.to_html'];
360     } else {
361         params = [authtoken, recId];
362         api = ['open-ils.vandelay', 'open-ils.vandelay.queued_bib_record.html'];
363         if(currentType == 'auth')
364             api = ['open-ils.vandelay', 'open-ils.vandelay.queued_authority_record.html'];
365     }
366     fieldmapper.standardRequest(
367         api, 
368         {   async: true,
369             params: params,
370             oncomplete: function(r) {
371             displayGlobalDiv('vl-marc-html-div');
372                 var html = r.recv().content();
373                 dojo.byId('vl-marc-record-html').innerHTML = html;
374             }
375         }
376     );
377 }
378
379
380 /**
381   * Given a record, an attribute definition code, and a matching record attribute,
382   * this will determine if there are any import matches and build the UI to
383   * represent those matches.  If no matches exist, simply returns the attribute value
384   */
385 function buildAttrColumnUI(rec, attrCode, attr) {
386     var matches = getRecMatchesFromAttrCode(rec, attrCode);
387     if(matches.length > 0) { // found some matches
388         return '<div class="match_div">' +
389             '<a href="javascript:void(0);" onclick="vlLoadMatchUI('+
390             rec.id()+',\''+attrCode+'\');">'+ 
391             attr.attr_value() + '&nbsp;('+matches.length+')</a></div>';
392     }
393
394     return attr.attr_value();
395 }
396
397 function getRecMatchesFromAttrCode(rec, attrCode) {
398     var matches = [];
399     var attr = getRecAttrFromCode(rec, attrCode);
400     for(var j = 0; j < rec.matches().length; j++) {
401         var match = rec.matches()[j];
402         if(match.matched_attr() == attr.id()) 
403             matches.push(match);
404     }
405     return matches;
406 }
407
408 function getRecAttrFromCode(rec, attrCode) {
409     var defId = attrDefMap[attrCode];
410     var attrs = rec.attributes();
411     for(var i = 0; i < attrs.length; i++) {
412         var attr = attrs[i];
413         if(attr.field() == defId) 
414             return attr;
415     }
416     return null;
417 }
418
419 function getAttrValue(rowIdx) {
420     var data = this.grid.model.getRow(rowIdx);
421     if(!data) return '';
422     var attrCode = this.field.split('.')[1];
423     var rec = queuedRecordsMap[data.id];
424     var attr = getRecAttrFromCode(rec, attrCode);
425     if(attr)
426         return buildAttrColumnUI(rec, attrCode, attr);
427     return '';
428 }
429
430 function vlGetDateTimeField(rowIdx) {
431     data = this.grid.model.getRow(rowIdx);
432     if(!data) return '';
433     if(!data[this.field]) return '';
434     var date = dojo.date.stamp.fromISOString(data[this.field]);
435     return dojo.date.locale.format(date, {selector:'date'});
436 }
437
438 function vlGetCreator(rowIdx) {
439     data = this.grid.model.getRow(rowIdx);
440     if(!data) return '';
441     var id = data.creator;
442     if(userCache[id])
443         return userCache[id].usrname();
444     var user = fieldmapper.standardRequest(
445         ['open-ils.actor', 'open-ils.actor.user.retrieve'], [authtoken, id]);
446     if(e = openils.Event.parse(user))
447         return alert(e);
448     userCache[id] = user;
449     return user.usrname();
450 }
451
452 function vlGetViewMARC(rowIdx) {
453     data = this.grid.model.getRow(rowIdx);
454     if(data) 
455         return this.value.replace('RECID', data.id);
456 }
457
458 function vlGetOverlayTargetSelector(rowIdx) {
459     data = this.grid.model.getRow(rowIdx);
460     if(data) {
461         var value = this.value.replace('ID', data.id);
462         var overlay = currentOverlayRecordsMap[currentImportRecId];
463         if(overlay && overlay == data.id) 
464             value = value.replace('/>', 'checked="checked"/>');
465         return value;
466     }
467 }
468
469 /**
470   * see if the user has enabled overlays for the current match set and, 
471   * if so, map the current import record to the overlay target.
472   */
473 function vlHandleOverlayTargetSelected() {
474     if(vlOverlayTargetEnable.checked) {
475         for(var i = 0; i < currentMatchedRecords.length; i++) {
476             var matchRecId = currentMatchedRecords[i].id();
477             if(dojo.byId('vl-overlay-target-'+matchRecId).checked) {
478                 console.log("found overlay target " + matchRecId);
479                 currentOverlayRecordsMap[currentImportRecId] = matchRecId;
480                 dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = true;
481                 dojo.byId('vl-record-list-selected-' + currentImportRecId).parentNode.className = 'overlay_selected';
482                 return;
483             }
484         }
485     } else {
486         delete currentOverlayRecordsMap[currentImportRecId];
487         dojo.byId('vl-record-list-selected-' + currentImportRecId).checked = false;
488     }
489 }
490
491 var vlQueueGridBuilt = false;
492 function buildRecordGrid(type) {
493     displayGlobalDiv('vl-queue-div');
494
495     currentOverlayRecordsMap = {};
496
497     if(!vlQueueGridBuilt) {
498         var defs = (type == 'bib') ? bibAttrDefs : authAttrDefs;
499         for(var i = 0; i < defs.length; i++) {
500             var def = defs[i]
501             attrDefMap[def.code()] = def.id();
502             var col = {
503                 name:def.description(), 
504                 field:'attr.' + def.code(),
505                 get: getAttrValue,
506                 selectableColumn:true
507             };
508             vlQueueGridLayout[0].cells[0].push(col);
509         }
510         vlQueueGridBuilt = true;
511     }
512
513     var storeData;
514     if(type == 'bib')
515         storeData = vqbr.toStoreData(queuedRecords);
516     else
517         storeData = vqar.toStoreData(queuedRecords);
518
519     var store = new dojo.data.ItemFileReadStore({data:storeData});
520     var model = new dojox.grid.data.DojoData(
521         null, store, {rowsPerPage: 100, clientSort: true, query:{id:'*'}});
522
523     vlQueueGrid.setModel(model);
524     if(vlQueueGridColumePicker) 
525         vlQueueGrid.setStructure(vlQueueGridColumePicker.structure);
526     else
527         vlQueueGrid.setStructure(vlQueueGridLayout);
528     vlQueueGrid.update();
529
530     if(!vlQueueGridColumePicker) {
531         vlQueueGridColumePicker = 
532             new openils.GridColumnPicker(vlQueueGridColumePickerDialog, vlQueueGrid);
533     }
534 }
535
536 function vlDeleteQueue(type, queueId, onload) {
537     fieldmapper.standardRequest(
538         ['open-ils.vandelay', 'open-ils.vandelay.'+type+'_queue.delete'],
539         {   async: true,
540             params: [authtoken, queueId],
541             oncomplete: function(r) {
542                 var resp = r.recv().content();
543                 if(e = openils.Event.parse(resp))
544                     return alert(e);
545                 onload();
546             }
547         }
548     );
549 }
550
551
552 function vlQueueGridDrawSelectBox(rowIdx) {
553     var data = this.grid.model.getRow(rowIdx);
554     if(!data) return '';
555     var domId = 'vl-record-list-selected-' +data.id;
556     selectableGridRecords[domId] = data.id;
557     return "<div><input type='checkbox' id='"+domId+"'/></div>";
558 }
559
560 function vlSelectAllQueueGridRecords() {
561     for(var id in selectableGridRecords) 
562         dojo.byId(id).checked = true;
563 }
564 function vlSelectNoQueueGridRecords() {
565     for(var id in selectableGridRecords) 
566         dojo.byId(id).checked = false;
567 }
568 function vlToggleQueueGridSelect() {
569     if(dojo.byId('vl-queue-grid-row-selector').checked)
570         vlSelectAllQueueGridRecords();
571     else
572         vlSelectNoQueueGridRecords();
573 }
574
575 var handleRetrieveRecords = function() {
576     buildRecordGrid(currentType);
577 }
578
579 function vlImportSelectedRecords() {
580     displayGlobalDiv('vl-generic-progress-with-total');
581     var records = [];
582
583     for(var id in selectableGridRecords) {
584         if(dojo.byId(id).checked) {
585             var recId = selectableGridRecords[id];
586             var rec = queuedRecordsMap[recId];
587             if(!rec.import_time()) 
588                 records.push(recId);
589         }
590     }
591
592     fieldmapper.standardRequest(
593         ['open-ils.vandelay', 'open-ils.vandelay.'+currentType+'_record.list.import'],
594         {   async: true,
595             params: [authtoken, records, {overlay_map:currentOverlayRecordsMap}],
596             onresponse: function(r) {
597                 var resp = r.recv().content();
598                 if(e = openils.Event.parse(resp))
599                     return alert(e);
600                 vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
601             },
602             oncomplete: function() {
603                 return retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
604             }
605         }
606     );
607 }
608
609 function vlImportRecordQueue(type, queueId, noMatchOnly, onload) {
610     displayGlobalDiv('vl-generic-progress-with-total');
611     var method = 'open-ils.vandelay.bib_queue.import';
612     if(noMatchOnly)
613         method = method.replace('import', 'nomatch.import');
614     if(type == 'auth')
615         method = method.replace('bib', 'auth');
616
617     fieldmapper.standardRequest(
618         ['open-ils.vandelay', method],
619         {   async: true,
620             params: [authtoken, queueId],
621             onresponse: function(r) {
622                 var resp = r.recv().content();
623                 if(e = openils.Event.parse(resp))
624                     return alert(e);
625                 vlControlledProgressBar.update({maximum:resp.total, progress:resp.progress});
626             },
627             oncomplete: function() {onload();}
628         }
629     );
630 }
631
632
633 /**
634   * Create queue, upload MARC, process spool, load the newly created queue 
635   */
636 function batchUpload() {
637     var queueName = dijit.byId('vl-queue-name').getValue();
638     currentType = dijit.byId('vl-record-type').getValue();
639
640     var handleProcessSpool = function() {
641         console.log('records uploaded and spooled');
642         if(vlUploadQueueAutoImport.checked) {
643             vlImportRecordQueue(currentType, currentQueueId, true,  
644                 function() {
645                     retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
646                 }
647             );
648         } else {
649             retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
650         }
651     }
652
653     var handleUploadMARC = function(key) {
654         console.log('marc uploaded');
655         dojo.style(dojo.byId('vl-upload-status-processing'), 'display', 'block');
656         processSpool(key, currentQueueId, currentType, handleProcessSpool);
657     };
658
659     var handleCreateQueue = function(queue) {
660         console.log('queue created ' + queue.name());
661         currentQueueId = queue.id();
662         uploadMARC(handleUploadMARC);
663     };
664     
665     if(vlUploadQueueSelector.getValue() && !queueName) {
666         currentQueueId = vlUploadQueueSelector.getValue();
667         console.log('adding records to existing queue ' + currentQueueId);
668         uploadMARC(handleUploadMARC);
669     } else {
670         createQueue(queueName, currentType, handleCreateQueue);
671     }
672 }
673
674
675 function vlFleshQueueSelect(selector, type) {
676     var data = (type == 'bib') ? vbq.toStoreData(allUserBibQueues) : vaq.toStoreData(allUserAuthQueues);
677     selector.store = new dojo.data.ItemFileReadStore({data:data});
678     selector.setValue(null);
679     selector.setDisplayedValue('');
680     if(data[0])
681         selector.setValue(data[0].id());
682 }
683
684 function vlShowUploadForm() {
685     displayGlobalDiv('vl-marc-upload-div');
686     vlFleshQueueSelect(vlUploadQueueSelector, vlUploadRecordType.getValue());
687 }
688
689 function vlShowQueueSelect() {
690     displayGlobalDiv('vl-queue-select-div');
691     vlFleshQueueSelect(vlQueueSelectQueueList, vlQueueSelectType.getValue());
692 }
693
694 function vlFetchQueueFromForm() {
695     currentType = vlQueueSelectType.getValue();
696     currentQueueId = vlQueueSelectQueueList.getValue();
697     retrieveQueuedRecords(currentType, currentQueueId, handleRetrieveRecords);
698 }
699
700 dojo.addOnLoad(vlInit);