You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by bi...@apache.org on 2009/10/30 01:11:00 UTC

svn commit: r831166 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java

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;
     }
 



Re: svn commit: r831166 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java

Posted by Anil Patel <an...@hotwaxmedia.com>.
Well said Bilgin,

"which is another indicator that only well written code should go to  
the project."

Thanks and Regards
Anil Patel
HotWax Media Inc
http://www.hotwaxmedia.com
http://us.apachecon.com/c/acus2009/sponsors/sponsors

On Oct 29, 2009, at 7:32 PM, Bilgin Ibryam wrote:

> 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 &amp; rather than & to conform to  
>> xhtml standards.
>>
>> Regards
>> Scott
>>
>> HotWax Media
>> http://www.hotwaxmedia.com
>>
>> On 30/10/2009, at 1:11 PM, bibryam@apache.org 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;
>>>    }
>>>
>>>
>>>
>>
>


Re: svn commit: r831166 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java

Posted by Bilgin Ibryam <bi...@gmail.com>.
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 &amp; rather than & to conform to 
> xhtml standards.
>
> Regards
> Scott
>
> HotWax Media
> http://www.hotwaxmedia.com
>
> On 30/10/2009, at 1:11 PM, bibryam@apache.org 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;
>>     }
>>
>>
>>
>


Re: svn commit: r831166 - /ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/ModelTree.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
Hi Bilgin

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

Regards
Scott

HotWax Media
http://www.hotwaxmedia.com

On 30/10/2009, at 1:11 PM, bibryam@apache.org 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;
>     }
>
>
>