</div>
+ [% PROCESS 'acq/common/vlagent.tt2' %]
<div class='hidden' id='acq-lit-asset-creator'>
<table class='oils-generic-table'>
<tbody>
- [% INCLUDE 'acq/common/vlagent.tt2' %]
+ [% PROCESS vlagent_form %]
<tr>
<td>
<span style='margin-left:10px;'>
</div>
<div class='hidden' id='acq-lit-progress-numbers'>
- <table class='oils-generic-table'>
- <tbody>
- <tr>
- <td>Lineitems Processed</td>
- <td><span id='acq-pl-lit-li-processed'>0</span></td>
- </tr>
- <tr>
- <td>[% l('Vandelay Records Queued') %]</td>
- <td><span id='acq-pl-lit-vqbr-processed'>0</span></td>
- </tr>
- <tr>
- <td>[% l('Bib Records Merged/Created') %]</td>
- <td><span id='acq-pl-lit-bibs-processed'>0</span></td>
- </tr>
- <tr>
- <td>Items Processed</td>
- <td><span id='acq-pl-lit-lid-processed'>0</span></td>
- </tr>
- <tr>
- <td>Debits Encumbered</td>
- <td><span id='acq-pl-lit-debits-processed'>0</span></td>
- </tr>
- <tr>
- <td>Bib Records Imported</td>
- <td><span id='acq-pl-lit-bibs-processed'>0</span></td>
- </tr>
- <tr>
- <td>Bib Records Indexed</td>
- <td><span id='acq-pl-lit-indexed-processed'>0</span></td>
- </tr>
- <tr>
- <td>Copies Processed</td>
- <td><span id='acq-pl-lit-copies-processed'>0</span></td>
- </tr>
- </tbody>
- </table>
+ [% PROCESS vlagent_results %]
</div>
<div class='hidden'>
-<tr>
- <td>[% l('Upload to Queue') %]</td>
- <td><div id='acq_vl:existing_queue'></div></td>
- <td>
- <span>[% l('Or create a new queue') %]</span>
- <input dojoType='dijit.form.TextBox' id='acq_vl:queue_name' size='32'></input>
- </td>
-</tr>
-<tr>
- <td>[% l('Record Match Set') %]</td>
- <td><div id='acq_vl:match_set'></div></td>
-</tr>
-<tr>
- <td>[% l('Merge Profile') %]</td>
- <td><div id='acq_vl:merge_profile'></div></td>
-</tr>
-<tr>
- <td>[% l('Import Non-Matching Records') %]</td>
- <td><input dojoType='dijit.form.CheckBox' id='acq_vl:import_no_match'></input></td>
- <td><span style='padding-right:10px;'>[% l('Record Source') %]</span> <div id='acq_vl:bib_source'></div></td>
-</tr>
-<tr>
- <td>[% l('Merge On Exact Match (901c)') %]</td>
- <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_exact'></input></td>
-</tr>
-<tr>
- <td>[% l('Merge On Single Match') %]</td>
- <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_1match'></input></td>
-</tr>
-<tr>
- <td>[% l('Merge On Best Match') %]</td>
- <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_best_match'></input></td>
-</tr>
-<tr>
- <td>[% l('Best/Single Match Minimum Quality Ratio') %]</td>
- <td colspan='4'>
- <input style='width:3em' value='0.0' id='acq_vl:match_quality_ratio' dojoType='dijit.form.TextBox'/>
- <span style='padding-left: 10px; font-size:90%'>[% l('New Record Quality / Quality of Best Match') %]</span>
- </td>
-</tr>
-<tr>
- <td>[% l('Insufficient Quality Fall-Through Profile') %]</td>
- <td><div id='acq_vl:fall_through_merge_profile'></div></td>
-</tr>
+[% BLOCK vlagent_form %]
+ <tr>
+ <td>[% l('Upload to Queue') %]</td>
+ <td><div id='acq_vl:existing_queue'></div></td>
+ <td>
+ <span>[% l('Or create a new queue') %]</span>
+ <input dojoType='dijit.form.TextBox' id='acq_vl:queue_name' size='32'></input>
+ </td>
+ </tr>
+ <tr>
+ <td>[% l('Record Match Set') %]</td>
+ <td><div id='acq_vl:match_set'></div></td>
+ </tr>
+ <tr>
+ <td>[% l('Merge Profile') %]</td>
+ <td><div id='acq_vl:merge_profile'></div></td>
+ </tr>
+ <tr>
+ <td>[% l('Import Non-Matching Records') %]</td>
+ <td><input dojoType='dijit.form.CheckBox' id='acq_vl:import_no_match'></input></td>
+ <td><span style='padding-right:10px;'>[% l('Record Source') %]</span> <div id='acq_vl:bib_source'></div></td>
+ </tr>
+ <tr>
+ <td>[% l('Merge On Exact Match (901c)') %]</td>
+ <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_exact'></input></td>
+ </tr>
+ <tr>
+ <td>[% l('Merge On Single Match') %]</td>
+ <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_1match'></input></td>
+ </tr>
+ <tr>
+ <td>[% l('Merge On Best Match') %]</td>
+ <td><input dojoType='dijit.form.CheckBox' id='acq_vl:auto_overlay_best_match'></input></td>
+ </tr>
+ <tr>
+ <td>[% l('Best/Single Match Minimum Quality Ratio') %]</td>
+ <td colspan='4'>
+ <input style='width:3em' value='0.0' id='acq_vl:match_quality_ratio' dojoType='dijit.form.TextBox'/>
+ <span style='padding-left: 10px; font-size:90%'>[% l('New Record Quality / Quality of Best Match') %]</span>
+ </td>
+ </tr>
+ <tr>
+ <td>[% l('Insufficient Quality Fall-Through Profile') %]</td>
+ <td><div id='acq_vl:fall_through_merge_profile'></div></td>
+ </tr>
+[% END %]
+
+[% BLOCK vlagent_results %]
+ <table class='oils-generic-table'>
+ <tbody>
+ <tr>
+ <td>[% l('Lineitems Processed') %]</td>
+ <td><span id='acq_vl:li-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Vandelay Records Queued') %]</td>
+ <td><span id='acq_vl:vqbr-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Bib Records Merged/Created') %]</td>
+ <td><span id='acq_vl:bibs-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Items Processed') %]</td>
+ <td><span id='acq_vl:lid-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Debits Encumbered') %]</td>
+ <td><span id='acq_vl:debits-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Bib Records Imported') %]</td>
+ <td><span id='acq_vl:bibs-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Bib Records Indexed') %]</td>
+ <td><span id='acq_vl:indexed-processed'>0</span></td>
+ </tr>
+ <tr>
+ <td>[% l('Copies Processed') %]</td>
+ <td><span id='acq_vl:copies-processed'>0</span></td>
+ </tr>
+ </tbody>
+ </table>
+[% END %]
</tr>
<tr><td colspan='2'><hr/></td></tr>
- [% INCLUDE 'acq/common/vlagent.tt2' %]
+ </tbody>
+ [% INCLUDE 'acq/common/vlagent.tt2' %]
+ <tbody>
<tr><td colspan='2'><hr/></td></tr>
<tr>
}
this._updateProgressNumbers = function(resp, reloadOnComplete) {
- if(!resp) return;
- dojo.byId('acq-pl-lit-li-processed').innerHTML = resp.li;
- dojo.byId('acq-pl-lit-lid-processed').innerHTML = resp.lid;
- dojo.byId('acq-pl-lit-debits-processed').innerHTML = resp.debits_accrued;
- dojo.byId('acq-pl-lit-bibs-processed').innerHTML = resp.bibs;
- dojo.byId('acq-pl-lit-indexed-processed').innerHTML = resp.indexed;
- dojo.byId('acq-pl-lit-copies-processed').innerHTML = resp.copies;
- dojo.byId('acq-pl-lit-vqbr-processed').innerHTML = resp.vqbr;
- if(resp.complete && reloadOnComplete)
- location.href = location.href;
+ this.vlAgent.handleResponse(resp,
+ function(resp, res) {
+ if(reloadOnComplete)
+ location.href = location.href;
+ }
+ );
}
);
return values;
}
+
+ this.handleResponse = function(resp, oncomplete) {
+ if(!resp) return;
+ var res = {}
+
+ console.log('vandelay import returned : ' + js2JSON(resp));
+
+ // update the display counts
+ dojo.byId('acq_vl:li-processed').innerHTML = resp.li;
+ dojo.byId('acq_vl:vqbr-processed').innerHTML = resp.vqbr;
+ dojo.byId('acq_vl:bibs-processed').innerHTML = resp.bibs;
+ dojo.byId('acq_vl:lid-processed').innerHTML = resp.lid;
+ dojo.byId('acq_vl:debits-processed').innerHTML = resp.debits_accrued;
+ dojo.byId('acq_vl:copies-processed').innerHTML = resp.copies;
+
+ if (resp.complete) {
+
+ if(resp.picklist) {
+ res.picklist_url = oilsBasePath + '/acq/picklist/view/' + resp.picklist.id();
+ }
+
+ if(resp.purchase_order) {
+ res.po_url = oilsBasePath + '/acq/po/view/' + resp.purchase_order.id();
+ }
+
+ if (resp.queue) {
+ res.queue_url = oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + resp.queue.id();
+ }
+
+ if (oncomplete) oncomplete(resp, res);
+ return res;
+ }
+
+ return false; // not yet complete
+ }
}
params: [openils.User.authtoken, key, args],
onresponse : function(r) {
var resp = openils.Util.readResponse(r);
- console.log(js2JSON(resp));
- if(!resp) return;
-
- dojo.byId('acq-pl-upload-vqbr-processed').innerHTML = resp.vqbr;
- dojo.byId('acq-pl-upload-li-processed').innerHTML = resp.li;
- dojo.byId('acq-pl-upload-lid-processed').innerHTML = resp.lid;
- dojo.byId('acq-pl-upload-debits-processed').innerHTML = resp.debits_accrued;
- dojo.byId('acq-pl-upload-bibs-processed').innerHTML = resp.bibs;
- dojo.byId('acq-pl-upload-copies-processed').innerHTML = resp.copies;
-
- if(resp.complete) {
- openils.Util.hide('acq-pl-upload-complete-pl');
- openils.Util.hide('acq-pl-upload-complete-po');
- openils.Util.hide('acq-pl-upload-complete-q');
- openils.Util.hide('acq-pl-upload-progress-bar');
- openils.Util.show('acq-pl-upload-complete');
-
- if(resp.picklist) {
- openils.Util.show('acq-pl-upload-complete-pl');
- dojo.byId('acq-pl-upload-complete-pl').setAttribute(
- 'href', oilsBasePath + '/acq/picklist/view/' + resp.picklist.id());
- }
-
- if(resp.purchase_order) {
- openils.Util.show('acq-pl-upload-complete-po');
- dojo.byId('acq-pl-upload-complete-po').setAttribute(
- 'href', oilsBasePath + '/acq/po/view/' + resp.purchase_order.id());
- }
- if (resp.queue) {
- link = dojo.byId('acq-pl-upload-complete-q');
- openils.Util.show(link);
- link.setAttribute('href', oilsBasePath + '/vandelay/vandelay?qtype=bib&qid=' + resp.queue.id());
- link.innerHTML = resp.queue.name();
+ vlAgent.handleResponse(resp,
+ function(resp, res) {
+
+ openils.Util.hide('acq-pl-upload-complete-pl');
+ openils.Util.hide('acq-pl-upload-complete-po');
+ openils.Util.hide('acq-pl-upload-complete-q');
+ openils.Util.hide('acq-pl-upload-progress-bar');
+ openils.Util.show('acq-pl-upload-complete');
+
+ if(res.picklist_url) {
+ openils.Util.show('acq-pl-upload-complete-pl');
+ dojo.byId('acq-pl-upload-complete-pl').setAttribute('href', res.picklist_url);
+ }
+
+ if(res.po_url) {
+ openils.Util.show('acq-pl-upload-complete-po');
+ dojo.byId('acq-pl-upload-complete-po').setAttribute('href', res.po_url);
+ }
+
+ if (res.queue_url) {
+ link = dojo.byId('acq-pl-upload-complete-q');
+ openils.Util.show(link);
+ link.setAttribute('href', res.queue_url);
+ link.innerHTML = resp.queue.name();
+ }
}
- }
+ );
},
}
);