added edit support for lwm_ratio on merge_profile; default ratio to that of the merge...
authorberick <berick@esilibrary.com>
Thu, 5 May 2011 14:28:15 +0000 (10:28 -0400)
committerBill Erickson <berick@esilibrary.com>
Wed, 6 Jul 2011 18:50:52 +0000 (14:50 -0400)
Open-ILS/web/js/ui/default/vandelay/vandelay.js
Open-ILS/web/templates/default/vandelay/inc/profiles.tt2

index 4aeef8f..b72438c 100644 (file)
@@ -87,6 +87,7 @@ var vlQueueGridColumePicker = {};
 var vlBibSources = [];
 var importItemDefs = [];
 var matchSets = {};
+var mergeProfiles = [];
 
 /**
   * Grab initial data
@@ -106,13 +107,13 @@ function vlInit() {
             runStartupCommands();
     }
 
-    var profiles = new openils.PermaCrud().retrieveAll('vmp');
-    vlUploadMergeProfile.store = new dojo.data.ItemFileReadStore({data:fieldmapper.vmp.toStoreData(profiles)});
+    mergeProfiles = new openils.PermaCrud().retrieveAll('vmp');
+    vlUploadMergeProfile.store = new dojo.data.ItemFileReadStore({data:fieldmapper.vmp.toStoreData(mergeProfiles)});
     vlUploadMergeProfile.labelAttr = 'name';
     vlUploadMergeProfile.searchAttr = 'name';
     vlUploadMergeProfile.startup();
 
-    vlUploadMergeProfile2.store = new dojo.data.ItemFileReadStore({data:fieldmapper.vmp.toStoreData(profiles)});
+    vlUploadMergeProfile2.store = new dojo.data.ItemFileReadStore({data:fieldmapper.vmp.toStoreData(mergeProfiles)});
     vlUploadMergeProfile2.labelAttr = 'name';
     vlUploadMergeProfile2.searchAttr = 'name';
     vlUploadMergeProfile2.startup();
@@ -1226,6 +1227,18 @@ function vlShowUploadForm() {
     vlUploadQueueHoldingsImportProfile.store = 
         new dojo.data.ItemFileReadStore({data:viiad.toStoreData(importItemDefs)});
     vlUpdateMatchSetSelector(vlUploadRecordType.getValue());
+
+    // use ratio from the merge profile if it's set
+    dojo.connect(
+        vlUploadMergeProfile, 
+        'onChange',
+        function(val) {
+            if(!val) return;
+            var profile = mergeProfiles.filter(function(p) { return (p.id() == val); })[0];
+            if(profile.lwm_ratio() != null)
+               vlUploadQueueAutoOverlayBestMatchRatio.attr('value', profile.lwm_ratio()+''); 
+        }
+    );
 }
 
 function vlShowQueueSelect() {
index 5bd4d4d..ca67f3a 100644 (file)
@@ -13,9 +13,9 @@
     </div>
     <table  jsId="pGrid"
             dojoType="openils.widget.AutoGrid"
-            fieldOrder="['name', 'owner', 'preserve_spec', 'replace_spec', 'add_spec', 'strip_spec']"
+            fieldOrder="['name', 'owner', 'preserve_spec', 'replace_spec', 'add_spec', 'strip_spec', 'lwm_ratio']"
             query="{id: '*'}"
-            defaultCellWidth='"auto"'
+            defaultCellWidth='"14%"'
             fmClass='vmp'
             showPaginator='true'
             editOnEnter='true'>