ACQ Vandelay : Ui refactor for standalone vl agent part deux
authorBill Erickson <berick@esilibrary.com>
Thu, 1 Dec 2011 21:00:10 +0000 (16:00 -0500)
committerBill Erickson <berick@esilibrary.com>
Thu, 1 Dec 2011 21:00:10 +0000 (16:00 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/templates/acq/common/vlagent.tt2 [new file with mode: 0644]
Open-ILS/web/js/ui/default/acq/common/vlagent.js [new file with mode: 0644]

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..ce14f80
--- /dev/null
@@ -0,0 +1,40 @@
+<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>
+</tr>
+<tr>
+    <td>[% l('Select a Record Source') %]</td>
+    <td><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>
+
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..bd305af
--- /dev/null
@@ -0,0 +1,51 @@
+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 : 'match_set', cls : 'vms'},
+        {key : 'bib_source', cls : 'cbs'},
+        {key : 'merge_profile', cls : 'vmp'},
+        {key : 'fall_through_merge_profile', cls : 'vmp'}
+    ];
+
+    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(w) { widg.dijit = w }); 
+
+                } 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;
+    }
+}