Scott, thanks for the code review. It is fixed now.
BTW I made the mistake by copying it from existing Ofbiz file, which is another indicator that only well written code should go to the project.

Bilgin

Scott Gray wrote:
Hi Bilgin

The parameter separator should be & rather than & to conform to xhtml standards.

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 30/10/2009, at 1:11 PM, [email protected] wrote:

Author: bibryam
Date: Fri Oct 30 00:10:59 2009
New Revision: 831166

URL: http://svn.apache.org/viewvc?rev=831166&view=rev
Log:
Add request parameters to the links created by tree widgets.

Modified:
   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java?rev=831166&r1=831165&r2=831166&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java Fri Oct 30 00:10:59 2009
@@ -20,6 +20,7 @@

import java.io.IOException;
import java.io.StringWriter;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -36,6 +37,7 @@
import org.ofbiz.base.util.StringUtil;
import org.ofbiz.base.util.UtilFormatOut;
import org.ofbiz.base.util.UtilGenerics;
+import org.ofbiz.base.util.UtilHttp;
import org.ofbiz.base.util.UtilMisc;
import org.ofbiz.base.util.UtilValidate;
import org.ofbiz.base.util.UtilXml;
@@ -177,6 +179,21 @@
            else
                expColReq = s1;
        }
+
+        //append also the request parameters
+ Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters"));
+        if (UtilValidate.isNotEmpty(paramMap)) {
+ Map<String, Object> requestParameters = new HashMap<String, Object>(paramMap);
+            requestParameters.remove(this.getTrailName(context));
+ String queryString = UtilHttp.urlEncodeArgs(requestParameters, false);
+            if (expColReq.indexOf("?") < 0) {
+                expColReq += "?";
+            } else {
+                expColReq += "&";
+            }
+            expColReq += queryString;
+        }
+
        return expColReq;
    }





Reply via email to