svn commit: r1037486 - /ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1037486 - /ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js

jleroux@apache.org
Author: jleroux
Date: Sun Nov 21 16:00:42 2010
New Revision: 1037486

URL: http://svn.apache.org/viewvc?rev=1037486&view=rev
Log:
Fixes and issue I found on TimeDuration screen, and refactores the code a bit

Modified:
    ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js

Modified: ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js
URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js?rev=1037486&r1=1037485&r2=1037486&view=diff
==============================================================================
--- ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js (original)
+++ ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js Sun Nov 21 16:00:42 2010
@@ -630,10 +630,9 @@ if (obj_caller == null && window.opener
     obj_caller = parent;
 }
 
-var bkColor = "yellow";
 function setSourceColor(src) {
-    if (src != null) {
-     src.css({"background-color": bkColor});
+    if (target && target != null) {
+        src.css("background-color", "yellow");
     }
 }
 // function passing selected value to calling window, using only in the TimeDuration case
@@ -642,14 +641,11 @@ function set_duration_value (value) {
         obj_caller.target = GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).target;
     }
     else{
-        obj_caller.target = obj_caller.targetW;
+        obj_caller.target = jQuery(obj_caller.targetW);
     }    
     var target = obj_caller.target;
-    if (!target) return;
-    
-    setSourceColor(target);
-    target.value = value;    
-    
+
+    write_value(value, target);
     closeLookup();
 }
 // function passing selected value to calling window
@@ -675,7 +671,7 @@ function set_values (value, value2) {
         obj_caller.target2 = GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).target2;
     }
     else{
-        obj_caller.target = obj_caller.targetW;        
+        obj_caller.target = jQuery(obj_caller.targetW);        
     }
     var target = obj_caller.target;
     var target2 = obj_caller.target2;
@@ -687,11 +683,10 @@ function set_values (value, value2) {
 }
 
 function write_value (value, target) {
-    if (! target) return;
-    if (target == null) return;
-    
-    setSourceColor(target);
-    target.val(value);
+    if (target && target != null) {
+        setSourceColor(target);
+        target.val(value);
+    }
 }
 
 function set_multivalues(value) {