acq vandelay : UI
authorBill Erickson <berick@esilibrary.com>
Tue, 6 Dec 2011 18:50:29 +0000 (13:50 -0500)
committerBill Erickson <berick@esilibrary.com>
Fri, 6 Jan 2012 15:05:31 +0000 (10:05 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/templates/acq/common/vlagent.tt2 [new file with mode: 0644]
Open-ILS/src/templates/acq/picklist/upload.tt2
Open-ILS/web/js/ui/default/acq/common/vlagent.js [new file with mode: 0644]
Open-ILS/web/js/ui/default/acq/picklist/upload.js

index 633d669..fcecae2 100644 (file)
@@ -533,7 +533,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
 
        <class id="vms" controller="open-ils.cstore open-ils.pcrud" oils_obj:fieldmapper="vandelay::match_set" oils_persist:tablename="vandelay.match_set" reporter:label="Record Matching Definition Set">
                <fields oils_persist:primary="id" oils_persist:sequence="vandelay.match_set_id_seq">
-                       <field reporter:label="Match Set ID" name="id" reporter:datatype="id"/>
+                       <field reporter:label="Match Set ID" name="id" reporter:datatype="id" reporter:selector="name"/>
                        <field reporter:label="Name" name="name" reporter:datatype="text"/>
                        <field reporter:label="Owning Library" name="owner" reporter:datatype="link"/>
                        <field reporter:label="Match Set Type" name="mtype" reporter:datatype="text"/>
diff --git a/Open-ILS/src/templates/acq/common/vlagent.tt2 b/Open-ILS/src/templates/acq/common/vlagent.tt2
new file mode 100644 (file)
index 0000000..ee5890b
--- /dev/null
@@ -0,0 +1,45 @@
+<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>
+
index 31b7620..742133f 100644 (file)
@@ -8,20 +8,13 @@
             <tr>
                 <td>Create Purchase Order</td>
                 <td>
-                    <input dojoType='dijit.form.CheckBox' name='create_po'></input>
+                    <input dojoType='dijit.form.CheckBox' jsId='acqPlUploadCreatePo'></input>
                 </td>
             </tr>
             <tr>
                 <td>Activate Purchase Order</td>
                 <td>
-                    <input dojoType='dijit.form.CheckBox' name='activate_po'></input>
-                </td>
-            </tr>
-            <tr>
-                <!-- XXX CHECK IMPORT PERMS TO ENABLE -->
-                <td>Load Bibs and Items into the ILS</td>
-                <td>
-                    <input dojoType='dijit.form.CheckBox' name='create_assets'></input>
+                    <input dojoType='dijit.form.CheckBox' jsId='acqPlUploadActivatePo'></input>
                 </td>
             </tr>
             <tr>
                     <select jsId='acqPlUploadPlSelector' dojoType='dijit.form.ComboBox'></select>
                 </td>
             </tr>
+
+            <tr><td colspan='2'><hr/></td></tr>
+            [% INCLUDE 'acq/common/vlagent.tt2' %]
+            <tr><td colspan='2'><hr/></td></tr>
+
             <tr>
-                <td>Records File</td>
-                <td><input size='36' type="file" name="marc_upload"></input></td>
-            </tr>
-            <tr>
-                <td align='center' colspan='2'>
-                    <button dojoType="dijit.form.Button" onClick="acqUploadRecords()">Upload</button>
+                <td colspan='5'>
+                    <span id="vl-file-label">[% l('File to Upload:') %]</span>
+                    <input size='48' style='border:1px solid #888;' type="file" name="marc_upload"/>
+                    <span style='margin-left:10px;'><button dojoType="dijit.form.Button" onclick="acqUploadRecords()">[% l('Upload') %]</button></span>
                 </td>
             </tr>
+
         </tbody>
     </table>
 
             <table class='oils-generic-table'>
                 <tbody>
                     <tr>
+                        <td>[% l('Vandelay Records Queued') %]</td>
+                        <td><span id='acq-pl-upload-vqbr-processed'>0</span></td>
+                    </tr>
+                    <tr>
                         <td>Lineitems Processed</td>
                         <td><span id='acq-pl-upload-li-processed'>0</span></td>
                     </tr>
                         <td><span id='acq-pl-upload-debits-processed'>0</span></td>
                     </tr>
                     <tr>
-                        <td>Bib Records Imported</td>
+                        <td>[% l('Bib Records Merged/Created') %]</td>
                         <td><span id='acq-pl-upload-bibs-processed'>0</span></td>
                     </tr>
                     <tr>
-                        <td>Bib Records Indexed</td>
-                        <td><span id='acq-pl-upload-indexed-processed'>0</span></td>
-                    </tr>
-                    <tr>
                         <td>Copies Created</td>
                         <td><span id='acq-pl-upload-copies-processed'>0</span></td>
                     </tr>
                     <tr><td colspan='2'>Upload Complete!</td></tr>
                     <tr><td colspan='2'><a id='acq-pl-upload-complete-po'>View Purchase Order</a></td></tr>
                     <tr><td colspan='2'><a id='acq-pl-upload-complete-pl'>View Selection List</a></td></tr>
+                    <tr><td colspan='2'><a id='acq-pl-upload-complete-q'></a></td></tr>
                 </tbody>
             </table>
         </div>
     </div>
 </form>
+<script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/common/vlagent.js'> </script>
 <script type="text/javascript" src='[% ctx.media_prefix %]/js/ui/default/acq/picklist/upload.js'> </script>
 [% END %]
diff --git a/Open-ILS/web/js/ui/default/acq/common/vlagent.js b/Open-ILS/web/js/ui/default/acq/common/vlagent.js
new file mode 100644 (file)
index 0000000..565d4b9
--- /dev/null
@@ -0,0 +1,55 @@
+dojo.require('openils.widget.AutoFieldWidget');
+
+function VLAgent(args) {
+    args = args || {};
+    for (var key in args) { 
+        this[key] = args[key]; 
+    }
+
+    this.widgets = [  
+        {key : 'import_no_match'},
+        {key : 'auto_overlay_exact'},
+        {key : 'auto_overlay_1match'},
+        {key : 'auto_overlay_best_match'},
+        {key : 'match_quality_ratio'},
+        {key : 'queue_name'},
+        {key : 'match_set', cls : 'vms'},
+        {key : 'bib_source', cls : 'cbs'},
+        {key : 'merge_profile', cls : 'vmp'},
+        {key : 'fall_through_merge_profile', cls : 'vmp'},
+        {key : 'existing_queue', cls : 'vbq'}
+    ];
+
+    this.init = function() {
+        var self = this;
+
+        dojo.forEach(this.widgets,
+            function(widg) {
+                if (widg.cls) { // selectors
+
+                    new openils.widget.AutoFieldWidget({
+                        fmClass : widg.cls,
+                        selfReference : true,
+                        orgLimitPerms : [self.limitPerm || 'CREATE_PURCHASE_ORDER'],
+                        parentNode : dojo.byId('acq_vl:' + widg.key)
+                    }).build(function(dijit) { 
+                        widg.dijit = dijit; 
+                    }); 
+
+                } else { // bools
+                    widg.dijit = dijit.byId('acq_vl:' + widg.key);
+                }
+            }
+        );
+    }
+
+    this.values = function() {
+        var values = {};
+        dojo.forEach(this.widgets,
+            function(widg) {
+                values[widg.key] = widg.dijit.attr('value');
+            }
+        );
+        return values;
+    }
+}
index 62a7145..eb1bb50 100644 (file)
@@ -13,6 +13,7 @@ dojo.require('openils.acq.Picklist');
 var VANDELAY_URL = '/vandelay-upload';
 var providerWidget;
 var orderAgencyWidget;
+var vlAgent;
 
 function init() {
     dojo.byId('acq-pl-upload-ses').value = openils.User.authtoken;
@@ -35,6 +36,9 @@ function init() {
         function(w) { orderAgencyWidget = w }
     );
 
+    vlAgent = new VLAgent();
+    vlAgent.init();
+
     fieldmapper.standardRequest(
         ['open-ils.acq', 'open-ils.acq.picklist.user.retrieve.atomic'],
         {   async: true,
@@ -79,11 +83,6 @@ function acqSendUploadForm(args) {
         method: "post",
         handleAs: "html",
         form: dojo.byId('acq-pl-upload-form'),
-        content : {
-            picklist : args.picklist,
-            provider : providerWidget.attr('value'),
-            ordering_agency : orderAgencyWidget.attr('value')
-        },
         handle: function(data, ioArgs){
             acqHandlePostUpload(data.documentElement.textContent);
         }
@@ -92,17 +91,36 @@ function acqSendUploadForm(args) {
 
 
 function acqHandlePostUpload(key) {
+
+    var args = {
+        picklist : acqPlUploadPlSelector.attr('value'),
+        provider : providerWidget.attr('value'),
+        ordering_agency : orderAgencyWidget.attr('value'),
+        create_po : acqPlUploadCreatePo.attr('value'),
+        activate_po : acqPlUploadActivatePo.attr('value'),
+        vandelay : vlAgent.values()
+    };
+
     fieldmapper.standardRequest(
         ['open-ils.acq', 'open-ils.acq.process_upload_records'],
         {   async: true,
-            params: [openils.User.authtoken, key],
+            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');
 
@@ -118,13 +136,12 @@ function acqHandlePostUpload(key) {
                             'href', oilsBasePath + '/acq/po/view/' + resp.purchase_order.id());
                     }
 
-                } else {
-                    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-indexed-processed').innerHTML = resp.indexed;
-                    dojo.byId('acq-pl-upload-copies-processed').innerHTML = resp.copies;
+                    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();
+                    }
                 }
             },
         }