Author: jleroux
Date: Mon Oct 18 09:16:57 2010 New Revision: 1023701 URL: http://svn.apache.org/viewvc?rev=1023701&view=rev Log: A modified patch from Sascha "Lookup bug fixes" (https://issues.apache.org/jira/browse/OFBIZ-3989) - OFBIZ-3989 Sascha: * The decorator issue for the milli sec lookup https://issues.apache.org/jira/browse/OFBIZ-3814 * A lookup in lookup issue regards to the identification of the called lookup (lookup chaining) JLR: Actually I completely rewrote the milli sec lookup case (see comment in Jira), though if I had enough time I'd have even replaced the timeDuration.ftl template by a form... Modified: ofbiz/branches/jquery/framework/common/webcommon/includes/timeDuration.ftl ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml ofbiz/branches/jquery/framework/common/widget/LookupScreens.xml ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js Modified: ofbiz/branches/jquery/framework/common/webcommon/includes/timeDuration.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/webcommon/includes/timeDuration.ftl?rev=1023701&r1=1023700&r2=1023701&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/common/webcommon/includes/timeDuration.ftl (original) +++ ofbiz/branches/jquery/framework/common/webcommon/includes/timeDuration.ftl Mon Oct 18 09:16:57 2010 @@ -33,7 +33,7 @@ under the License. duration += minutes == null ? 0 : minutes * 60000; duration += seconds == null ? 0 : seconds * 1000; duration += millis == null ? 0 : millis; - set_value(duration); + set_duration_value(duration); } </script> <form name="TimeDuration" action="javascript:setTimeDuration()"> Modified: ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml?rev=1023701&r1=1023700&r2=1023701&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml (original) +++ ofbiz/branches/jquery/framework/common/widget/CommonScreens.xml Mon Oct 18 09:16:57 2010 @@ -256,7 +256,10 @@ under the License. <field-map field-name="visualThemeId"/> <field-map field-name="themeResources" from-field="layoutSettings"/> </service> + <set field="layoutSettings" from-field="themeResources" default-value="${layoutSettings}" global="true"/> + <set field="layoutSettings.javaScripts[]" value="/images/fieldlookup.js" global="true"/> + <set field="messagesTemplateLocation" from-field="layoutSettings.VT_MSG_TMPLT_LOC[0]" default-value="component://common/webcommon/includes/messages.ftl"/> <property-to-field field="defaultCurrencyUomId" property="currency.uom.id.default" resource="general"/> <set field="defaultOrganizationPartyId" from-field="userPreferences.ORGANIZATION_PARTY" global="true"/> Modified: ofbiz/branches/jquery/framework/common/widget/LookupScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/jquery/framework/common/widget/LookupScreens.xml?rev=1023701&r1=1023700&r2=1023701&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/common/widget/LookupScreens.xml (original) +++ ofbiz/branches/jquery/framework/common/widget/LookupScreens.xml Mon Oct 18 09:16:57 2010 @@ -140,6 +140,7 @@ under the License. <section> <actions> <set field="title" value="${uiLabelMap.CommonTime}"/> + <set field="parameters.presentation" value="window"/> </actions> <widgets> <decorator-screen name="LookupDecorator" location="component://common/widget/CommonScreens.xml"> 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=1023701&r1=1023700&r2=1023701&view=diff ============================================================================== --- ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js (original) +++ ofbiz/branches/jquery/framework/images/webapp/images/fieldlookup.js Mon Oct 18 09:16:57 2010 @@ -88,13 +88,9 @@ function fieldLookup1(obj_target, args) // validate input parameters if (! obj_target) return lookup_error("Error calling the field lookup: no target control specified"); if (obj_target.value == null) return lookup_error("Error calling the field lookup: parameter specified is not valid target control"); - //this.target = obj_target; targetW = obj_target; - - // register in global collections - //this.id = lookups.length; - //lookups[this.id] = this; } + function fieldLookup2(obj_target, obj_target2, args) { this.args = args; // passing methods @@ -109,10 +105,6 @@ function fieldLookup2(obj_target, obj_ta if (obj_target2.value == null) return lookup_error("Error calling the field lookup: parameter specified is not valid target2 control"); target2 = obj_target2; - - // register in global collections - //this.id = lookups.length; - //lookups[this.id] = this; } function lookup_popup1(view_name, form_name, viewWidth, viewheight) { @@ -236,7 +228,18 @@ function ConstructLookup(requestUrl, inp open: function() { jQuery("#" + lookupId).load(requestUrl, function(data){ modifySubmitButton(lookupId); + // set up the window chaining + // if the ACTIVATED_LOOKUP var is set there have to be more than one lookup, + // before registrating the new lookup we store the id of the old lookup in the + // preLookup variable of the new lookup object. I.e. lookup_1 calls lookup_8, the lookup_8 + // object need a reference to lookup_1, this reference is set here + var prevLookup = null + if (ACTIVATED_LOOKUP) { + prevLookup = GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).lookupId; + } identifyLookup(lookupId); + + GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).prevLookup = prevLookup; }); }, close: function() { @@ -261,7 +264,7 @@ function ConstructLookup(requestUrl, inp if (dialogOptionalTarget != null) { this.target2 = null; } - ((GLOBAL_LOOKUP_REF.countFields() - 1) >= 0) ? this.prevLookup = (GLOBAL_LOOKUP_REF.countFields() - 1) + "_lookupId" : null; + this.prevLookup = null; this.dialogRef = dialogRef; //write external settings in global window manager GLOBAL_LOOKUP_REF.setReference(lookupId, this); @@ -598,6 +601,22 @@ function setSourceColor(src) { src.css({"background-color": bkColor}); } } +// function passing selected value to calling window, using only in the TimeDuration case +function set_duration_value (value) { + if(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP)){ + obj_caller.target = GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP).target; + } + else{ + obj_caller.target = obj_caller.targetW; + } + var target = obj_caller.target; + if (!target) return; + + setSourceColor(target); + target.value = value; + + closeLookup(); +} // function passing selected value to calling window function set_value (value) { if(GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP)){ @@ -635,11 +654,8 @@ function write_value (value, target) { setSourceColor(target); target.val(value); - //target.fire("lookup:changed"); - //if (target.onchange != null) { - // target.onchange(); - //} } + function set_multivalues(value) { obj_caller.target.value = value; obj_caller.target.fire("lookup:changed"); @@ -656,6 +672,7 @@ function set_multivalues(value) { } closeLookup(); } + //close the window after passing the value function closeLookup() { if (window.opener != null && GLOBAL_LOOKUP_REF.getReference(ACTIVATED_LOOKUP) == null) { |
Free forum by Nabble | Edit this page |