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

svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Author: hansbak
Date: Wed Sep 30 09:51:01 2009
New Revision: 820232

URL: http://svn.apache.org/viewvc?rev=820232&view=rev
Log:
 fix for OFBIZ-2414: if a portlet is included more than once the links do not work, this fix will make these links unique. Sponsored By Antwebsystems Co.Ltd: employee Berm

Modified:
    ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Modified: ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=820232&r1=820231&r2=820232&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl (original)
+++ ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl Wed Sep 30 09:51:01 2009
@@ -20,6 +20,7 @@
 <#if portalPage?has_content>
 <table width="100%">
   <tr>
+    <#assign renderSeq = 0/>
     <#list portalPageColumns?if_exists as portalPageColumn>
       <td style="vertical-align: top; <#if portalPageColumn.columnWidthPercentage?has_content> width:${portalPageColumn.columnWidthPercentage}%;</#if>">
       <#assign firstInColumn = true/>
@@ -31,7 +32,9 @@
             ${setRequestAttribute("portalPortletId", portlet.portalPortletId)}
             ${setRequestAttribute("portletSeqId", portlet.portletSeqId)}
             ${screens.render(portlet.screenLocation, portlet.screenName)}
+            ${screens.setRenderFormUniqueSeq(renderSeq)}
             </div>
+            <#assign renderSeq = renderSeq+1/>
           </#if>
           <#assign firstInColumn = false/>
         </#if>

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=820232&r1=820231&r2=820232&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Sep 30 09:51:01 2009
@@ -268,15 +268,19 @@
         ModelForm modelForm = modelFormField.getModelForm();
         Integer itemIndex = (Integer) context.get("itemIndex");
         String iterateId = "";
+        String formUniqueId = "";
         String formName = (String) context.get("formName");
         if (UtilValidate.isEmpty(formName)) {
             formName = modelForm.getName();
         }
         if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
-        	iterateId = (String) context.get("iterateId");
+            iterateId = (String) context.get("iterateId");
+        }
+        if (UtilValidate.isNotEmpty(context.get("formUniqueId"))) {
+            formUniqueId = (String) context.get("formUniqueId");
         }
         if (itemIndex != null) {
-            return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + iterateId + modelForm.getItemIndexSeparator() + modelFormField.getName();
+            return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + iterateId + formUniqueId + modelForm.getItemIndexSeparator() + modelFormField.getName();
         } else {
             return formName + modelForm.getItemIndexSeparator() + modelFormField.getName();
         }

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=820232&r1=820231&r2=820232&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Wed Sep 30 09:51:01 2009
@@ -1423,6 +1423,10 @@
                 ModelFormAction.runSubActions(this.rowActions, localContext);
 
                 localContext.put("itemIndex", Integer.valueOf(itemIndex - lowIndex));
+                if (UtilValidate.isNotEmpty(context.get("renderFormSeqNumber"))) {
+                    localContext.put("formUniqueId", "_"+context.get("renderFormSeqNumber"));
+                }
+                
                 this.resetBshInterpreter(localContext);
 
                 if (Debug.verboseOn()) Debug.logVerbose("In form got another row, context is: " + localContext, module);

Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=820232&r1=820231&r2=820232&view=diff
==============================================================================
--- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java (original)
+++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java Wed Sep 30 09:51:01 2009
@@ -73,6 +73,7 @@
     protected Appendable writer;
     protected MapStack<String> context;
     protected ScreenStringRenderer screenStringRenderer;
+    protected int renderFormSeqNumber = 0;
 
     public ScreenRenderer(Appendable writer, MapStack<String> context, ScreenStringRenderer screenStringRenderer) {
         this.writer = writer;
@@ -129,10 +130,15 @@
                 writer.append(gwo.toString());
             }
         } else {
+            context.put("renderFormSeqNumber", String.valueOf(renderFormSeqNumber));
             modelScreen.renderScreenString(writer, context, screenStringRenderer);
         }
         return "";
     }
+    
+    public void setRenderFormUniqueSeq (int renderFormSeqNumber) {
+        this.renderFormSeqNumber = renderFormSeqNumber;
+    }
 
     public ScreenStringRenderer getScreenStringRenderer() {
         return this.screenStringRenderer;



Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/Sc

Posted by Jacques Le Roux <ja...@les7arts.com>.
Apart from the company name and employee in commit, because we already discussed of all that, I second Anil request. Using Jira 
issues in the midle would allow peer reviews and avoid to revert, etc.
However, for that it needs commiters to be more commited to the review process...

Jacques

From: "Anil Patel" <an...@hotwaxmedia.com>
> Hans,
> Apache (and Ofbiz) has a workflow defined for contributions coming
> from non committers. I am sure you are aware of the process as well. I
> will be much more happy if
> 1) Contributor create a Jira issue.
> 2) In Jira issues Contributor can mention all about company they work
> for etc.
> 3) Contributor uploads patch to Jira issue
> 4) Committer take the patch and applies it.
>
> Once in a while its fine if committer take contribution directly from
> a well established contributor and commits it. I don't think its good
> idea to make it a practice.
>
> I know in community driven projects most of practices is
> recommendation and not many rules. Its good if community members
> assume recommendations are rules to live by else community can become
> difficult place to live in.
>
> I personally don't see reason why you still want to add company name
> in commit log.
>
> Regards
> Anil Patel
>
> Begin forwarded message:
>
>> From: hansbak@apache.org
>> Date: September 30, 2009 5:51:01 AM EDT
>> To: commits@ofbiz.apache.org
>> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/
>> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/
>> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java
>> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>> Reply-To: dev@ofbiz.apache.org
>>
>> Author: hansbak
>> Date: Wed Sep 30 09:51:01 2009
>> New Revision: 820232
>>
>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>> Log:
>> fix for OFBIZ-2414: if a portlet is included more than once the
>> links do not work, this fix will make these links unique. Sponsored
>> By Antwebsystems Co.Ltd: employee Berm
>
> 



Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by Ashish Vijaywargiya <as...@hotwaxmedia.com>.
+1

--
Regards
Ashish Vijaywargiya
HotWax Media Pvt. Ltd.
http://www.hotwaxmedia.com

Helping hand around the World ...
USA | Italy | New Zealand | India


Tim Ruppert wrote:
> Definitely do them for framework - and really think about the fact 
> that all of the other committers are asking you to use the full 
> process in integrating your changes and your employees changes into 
> the project.  We all do it because it's better for the community, so 
> please consider upgrading your support to this best practice as soon 
> as possible, Hans.
>
> Cheers,
> Ruppert
> -- 
> Tim Ruppert
> HotWax Media
> http://www.hotwaxmedia.com
>
> o:801.649.6594
> f:801.649.6595
>
> On Sep 30, 2009, at 10:00 PM, Hans Bakker wrote:
>
>> Good suggestion from Scott,
>>
>> i will create jira issues for for framework changes.
>>
>> Regards,
>> Hans
>>
>>
>> On Wed, 2009-09-30 at 20:44 -0600, David E Jones wrote:
>>> Hans,
>>>
>>> If I remember right Anil was in a similar position a couple of years
>>> ago. At the time I recommended that for Hotwax we have everyone get a
>>> Jira account and submit changes there, and that is what Anil is
>>> recommending to you now.
>>>
>>> There are a few potential benefits to you:
>>>
>>> 1. happier employees: they get a chance to work directly with the
>>> community (as much as they want to and are able, it's not really
>>> required to go this way) and get to know people more and become more
>>> comfortable with interactive with others
>>>
>>> 2. more committers: with your people more involved they may soon
>>> become committers themselves
>>>
>>> 3. more reviewers: other committers and other OFBiz users can take a
>>> look at what they've done; you don't have to take on the entire burden
>>> yourself, or be pushed into a defensive position if there is an issue
>>> with one of their commits
>>>
>>> I remember walking in the streets of a beachside town in Thailand a
>>> few years ago and a wise man said to me something along the lines of
>>> it always being better to let someone else do something, and help them
>>> as needed, than to do it all yourself. I'll admit that hasn't always
>>> worked out for me, but I do still think it's good advice.
>>>
>>> -David
>>>
>>>
>>> On Sep 30, 2009, at 8:07 PM, Hans Bakker wrote:
>>>
>>>> Hi Anil,
>>>>
>>>> This workflow is good for independent contributors.
>>>>
>>>> However I employ people who get tasks assigned by me and are working
>>>> under my responsibility. I try to review the results as good as I can
>>>> and if there are comments from other committers i will accommodate
>>>> these
>>>> as good as I can.
>>>>
>>>> However in this case with a average commit rate of 3 commits per day ,
>>>> creating jira issues would be a big overhead with no benefit.
>>>>
>>>> Regards,
>>>> Hans
>>>>
>>>> On Wed, 2009-09-30 at 06:59 -0400, Anil Patel wrote:
>>>>> Hans,
>>>>> Apache (and Ofbiz) has a workflow defined for contributions coming
>>>>> from non committers. I am sure you are aware of the process as
>>>>> well. I
>>>>> will be much more happy if
>>>>> 1) Contributor create a Jira issue.
>>>>> 2) In Jira issues Contributor can mention all about company they work
>>>>> for etc.
>>>>> 3) Contributor uploads patch to Jira issue
>>>>> 4) Committer take the patch and applies it.
>>>>>
>>>>> Once in a while its fine if committer take contribution directly from
>>>>> a well established contributor and commits it. I don't think its good
>>>>> idea to make it a practice.
>>>>>
>>>>> I know in community driven projects most of practices is
>>>>> recommendation and not many rules. Its good if community members
>>>>> assume recommendations are rules to live by else community can become
>>>>> difficult place to live in.
>>>>>
>>>>> I personally don't see reason why you still want to add company name
>>>>> in commit log.
>>>>>
>>>>> Regards
>>>>> Anil Patel
>>>>>
>>>>> Begin forwarded message:
>>>>>
>>>>>> From: hansbak@apache.org
>>>>>> Date: September 30, 2009 5:51:01 AM EDT
>>>>>> To: commits@ofbiz.apache.org
>>>>>> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/
>>>>>> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/
>>>>>> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java
>>>>>> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>>>>> Reply-To: dev@ofbiz.apache.org
>>>>>>
>>>>>> Author: hansbak
>>>>>> Date: Wed Sep 30 09:51:01 2009
>>>>>> New Revision: 820232
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>>>>>> Log:
>>>>>> fix for OFBIZ-2414: if a portlet is included more than once the
>>>>>> links do not work, this fix will make these links unique. Sponsored
>>>>>> By Antwebsystems Co.Ltd: employee Berm
>>>>>
>>>> -- 
>>>> Antwebsystems.com: Quality OFBiz services for competitive rates
>>>>
>>>
>> -- 
>> Antwebsystems.com: Quality OFBiz services for competitive rates
>>
>

Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/Sc

Posted by Jacques Le Roux <ja...@les7arts.com>.
+1

Jacques

From: "Tim Ruppert" <ti...@hotwaxmedia.com>
> Definitely do them for framework - and really think about the fact  
> that all of the other committers are asking you to use the full  
> process in integrating your changes and your employees changes into  
> the project.  We all do it because it's better for the community, so  
> please consider upgrading your support to this best practice as soon  
> as possible, Hans.
> 
> Cheers,
> Ruppert
> --
> Tim Ruppert
> HotWax Media
> http://www.hotwaxmedia.com
> 
> o:801.649.6594
> f:801.649.6595
> 
> On Sep 30, 2009, at 10:00 PM, Hans Bakker wrote:
> 
>> Good suggestion from Scott,
>>
>> i will create jira issues for for framework changes.
>>
>> Regards,
>> Hans
>>
>>
>> On Wed, 2009-09-30 at 20:44 -0600, David E Jones wrote:
>>> Hans,
>>>
>>> If I remember right Anil was in a similar position a couple of years
>>> ago. At the time I recommended that for Hotwax we have everyone get a
>>> Jira account and submit changes there, and that is what Anil is
>>> recommending to you now.
>>>
>>> There are a few potential benefits to you:
>>>
>>> 1. happier employees: they get a chance to work directly with the
>>> community (as much as they want to and are able, it's not really
>>> required to go this way) and get to know people more and become more
>>> comfortable with interactive with others
>>>
>>> 2. more committers: with your people more involved they may soon
>>> become committers themselves
>>>
>>> 3. more reviewers: other committers and other OFBiz users can take a
>>> look at what they've done; you don't have to take on the entire  
>>> burden
>>> yourself, or be pushed into a defensive position if there is an issue
>>> with one of their commits
>>>
>>> I remember walking in the streets of a beachside town in Thailand a
>>> few years ago and a wise man said to me something along the lines of
>>> it always being better to let someone else do something, and help  
>>> them
>>> as needed, than to do it all yourself. I'll admit that hasn't always
>>> worked out for me, but I do still think it's good advice.
>>>
>>> -David
>>>
>>>
>>> On Sep 30, 2009, at 8:07 PM, Hans Bakker wrote:
>>>
>>>> Hi Anil,
>>>>
>>>> This workflow is good for independent contributors.
>>>>
>>>> However I employ people who get tasks assigned by me and are working
>>>> under my responsibility. I try to review the results as good as I  
>>>> can
>>>> and if there are comments from other committers i will accommodate
>>>> these
>>>> as good as I can.
>>>>
>>>> However in this case with a average commit rate of 3 commits per  
>>>> day ,
>>>> creating jira issues would be a big overhead with no benefit.
>>>>
>>>> Regards,
>>>> Hans
>>>>
>>>> On Wed, 2009-09-30 at 06:59 -0400, Anil Patel wrote:
>>>>> Hans,
>>>>> Apache (and Ofbiz) has a workflow defined for contributions coming
>>>>> from non committers. I am sure you are aware of the process as
>>>>> well. I
>>>>> will be much more happy if
>>>>> 1) Contributor create a Jira issue.
>>>>> 2) In Jira issues Contributor can mention all about company they  
>>>>> work
>>>>> for etc.
>>>>> 3) Contributor uploads patch to Jira issue
>>>>> 4) Committer take the patch and applies it.
>>>>>
>>>>> Once in a while its fine if committer take contribution directly  
>>>>> from
>>>>> a well established contributor and commits it. I don't think its  
>>>>> good
>>>>> idea to make it a practice.
>>>>>
>>>>> I know in community driven projects most of practices is
>>>>> recommendation and not many rules. Its good if community members
>>>>> assume recommendations are rules to live by else community can  
>>>>> become
>>>>> difficult place to live in.
>>>>>
>>>>> I personally don't see reason why you still want to add company  
>>>>> name
>>>>> in commit log.
>>>>>
>>>>> Regards
>>>>> Anil Patel
>>>>>
>>>>> Begin forwarded message:
>>>>>
>>>>>> From: hansbak@apache.org
>>>>>> Date: September 30, 2009 5:51:01 AM EDT
>>>>>> To: commits@ofbiz.apache.org
>>>>>> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/
>>>>>> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/
>>>>>> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java
>>>>>> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>>>>> Reply-To: dev@ofbiz.apache.org
>>>>>>
>>>>>> Author: hansbak
>>>>>> Date: Wed Sep 30 09:51:01 2009
>>>>>> New Revision: 820232
>>>>>>
>>>>>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>>>>>> Log:
>>>>>> fix for OFBIZ-2414: if a portlet is included more than once the
>>>>>> links do not work, this fix will make these links unique.  
>>>>>> Sponsored
>>>>>> By Antwebsystems Co.Ltd: employee Berm
>>>>>
>>>> -- 
>>>> Antwebsystems.com: Quality OFBiz services for competitive rates
>>>>
>>>
>> -- 
>> Antwebsystems.com: Quality OFBiz services for competitive rates
>>
> 
>


Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by Tim Ruppert <ti...@hotwaxmedia.com>.
Definitely do them for framework - and really think about the fact  
that all of the other committers are asking you to use the full  
process in integrating your changes and your employees changes into  
the project.  We all do it because it's better for the community, so  
please consider upgrading your support to this best practice as soon  
as possible, Hans.

Cheers,
Ruppert
--
Tim Ruppert
HotWax Media
http://www.hotwaxmedia.com

o:801.649.6594
f:801.649.6595

On Sep 30, 2009, at 10:00 PM, Hans Bakker wrote:

> Good suggestion from Scott,
>
> i will create jira issues for for framework changes.
>
> Regards,
> Hans
>
>
> On Wed, 2009-09-30 at 20:44 -0600, David E Jones wrote:
>> Hans,
>>
>> If I remember right Anil was in a similar position a couple of years
>> ago. At the time I recommended that for Hotwax we have everyone get a
>> Jira account and submit changes there, and that is what Anil is
>> recommending to you now.
>>
>> There are a few potential benefits to you:
>>
>> 1. happier employees: they get a chance to work directly with the
>> community (as much as they want to and are able, it's not really
>> required to go this way) and get to know people more and become more
>> comfortable with interactive with others
>>
>> 2. more committers: with your people more involved they may soon
>> become committers themselves
>>
>> 3. more reviewers: other committers and other OFBiz users can take a
>> look at what they've done; you don't have to take on the entire  
>> burden
>> yourself, or be pushed into a defensive position if there is an issue
>> with one of their commits
>>
>> I remember walking in the streets of a beachside town in Thailand a
>> few years ago and a wise man said to me something along the lines of
>> it always being better to let someone else do something, and help  
>> them
>> as needed, than to do it all yourself. I'll admit that hasn't always
>> worked out for me, but I do still think it's good advice.
>>
>> -David
>>
>>
>> On Sep 30, 2009, at 8:07 PM, Hans Bakker wrote:
>>
>>> Hi Anil,
>>>
>>> This workflow is good for independent contributors.
>>>
>>> However I employ people who get tasks assigned by me and are working
>>> under my responsibility. I try to review the results as good as I  
>>> can
>>> and if there are comments from other committers i will accommodate
>>> these
>>> as good as I can.
>>>
>>> However in this case with a average commit rate of 3 commits per  
>>> day ,
>>> creating jira issues would be a big overhead with no benefit.
>>>
>>> Regards,
>>> Hans
>>>
>>> On Wed, 2009-09-30 at 06:59 -0400, Anil Patel wrote:
>>>> Hans,
>>>> Apache (and Ofbiz) has a workflow defined for contributions coming
>>>> from non committers. I am sure you are aware of the process as
>>>> well. I
>>>> will be much more happy if
>>>> 1) Contributor create a Jira issue.
>>>> 2) In Jira issues Contributor can mention all about company they  
>>>> work
>>>> for etc.
>>>> 3) Contributor uploads patch to Jira issue
>>>> 4) Committer take the patch and applies it.
>>>>
>>>> Once in a while its fine if committer take contribution directly  
>>>> from
>>>> a well established contributor and commits it. I don't think its  
>>>> good
>>>> idea to make it a practice.
>>>>
>>>> I know in community driven projects most of practices is
>>>> recommendation and not many rules. Its good if community members
>>>> assume recommendations are rules to live by else community can  
>>>> become
>>>> difficult place to live in.
>>>>
>>>> I personally don't see reason why you still want to add company  
>>>> name
>>>> in commit log.
>>>>
>>>> Regards
>>>> Anil Patel
>>>>
>>>> Begin forwarded message:
>>>>
>>>>> From: hansbak@apache.org
>>>>> Date: September 30, 2009 5:51:01 AM EDT
>>>>> To: commits@ofbiz.apache.org
>>>>> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/
>>>>> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/
>>>>> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java
>>>>> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>>>> Reply-To: dev@ofbiz.apache.org
>>>>>
>>>>> Author: hansbak
>>>>> Date: Wed Sep 30 09:51:01 2009
>>>>> New Revision: 820232
>>>>>
>>>>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>>>>> Log:
>>>>> fix for OFBIZ-2414: if a portlet is included more than once the
>>>>> links do not work, this fix will make these links unique.  
>>>>> Sponsored
>>>>> By Antwebsystems Co.Ltd: employee Berm
>>>>
>>> -- 
>>> Antwebsystems.com: Quality OFBiz services for competitive rates
>>>
>>
> -- 
> Antwebsystems.com: Quality OFBiz services for competitive rates
>


Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by Hans Bakker <ma...@antwebsystems.com>.
Good suggestion from Scott,

i will create jira issues for for framework changes.

Regards,
Hans


On Wed, 2009-09-30 at 20:44 -0600, David E Jones wrote:
> Hans,
> 
> If I remember right Anil was in a similar position a couple of years  
> ago. At the time I recommended that for Hotwax we have everyone get a  
> Jira account and submit changes there, and that is what Anil is  
> recommending to you now.
> 
> There are a few potential benefits to you:
> 
> 1. happier employees: they get a chance to work directly with the  
> community (as much as they want to and are able, it's not really  
> required to go this way) and get to know people more and become more  
> comfortable with interactive with others
> 
> 2. more committers: with your people more involved they may soon  
> become committers themselves
> 
> 3. more reviewers: other committers and other OFBiz users can take a  
> look at what they've done; you don't have to take on the entire burden  
> yourself, or be pushed into a defensive position if there is an issue  
> with one of their commits
> 
> I remember walking in the streets of a beachside town in Thailand a  
> few years ago and a wise man said to me something along the lines of  
> it always being better to let someone else do something, and help them  
> as needed, than to do it all yourself. I'll admit that hasn't always  
> worked out for me, but I do still think it's good advice.
> 
> -David
> 
> 
> On Sep 30, 2009, at 8:07 PM, Hans Bakker wrote:
> 
> > Hi Anil,
> >
> > This workflow is good for independent contributors.
> >
> > However I employ people who get tasks assigned by me and are working
> > under my responsibility. I try to review the results as good as I can
> > and if there are comments from other committers i will accommodate  
> > these
> > as good as I can.
> >
> > However in this case with a average commit rate of 3 commits per day ,
> > creating jira issues would be a big overhead with no benefit.
> >
> > Regards,
> > Hans
> >
> > On Wed, 2009-09-30 at 06:59 -0400, Anil Patel wrote:
> >> Hans,
> >> Apache (and Ofbiz) has a workflow defined for contributions coming
> >> from non committers. I am sure you are aware of the process as  
> >> well. I
> >> will be much more happy if
> >> 1) Contributor create a Jira issue.
> >> 2) In Jira issues Contributor can mention all about company they work
> >> for etc.
> >> 3) Contributor uploads patch to Jira issue
> >> 4) Committer take the patch and applies it.
> >>
> >> Once in a while its fine if committer take contribution directly from
> >> a well established contributor and commits it. I don't think its good
> >> idea to make it a practice.
> >>
> >> I know in community driven projects most of practices is
> >> recommendation and not many rules. Its good if community members
> >> assume recommendations are rules to live by else community can become
> >> difficult place to live in.
> >>
> >> I personally don't see reason why you still want to add company name
> >> in commit log.
> >>
> >> Regards
> >> Anil Patel
> >>
> >> Begin forwarded message:
> >>
> >>> From: hansbak@apache.org
> >>> Date: September 30, 2009 5:51:01 AM EDT
> >>> To: commits@ofbiz.apache.org
> >>> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/
> >>> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/
> >>> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java
> >>> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
> >>> Reply-To: dev@ofbiz.apache.org
> >>>
> >>> Author: hansbak
> >>> Date: Wed Sep 30 09:51:01 2009
> >>> New Revision: 820232
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
> >>> Log:
> >>> fix for OFBIZ-2414: if a portlet is included more than once the
> >>> links do not work, this fix will make these links unique. Sponsored
> >>> By Antwebsystems Co.Ltd: employee Berm
> >>
> > -- 
> > Antwebsystems.com: Quality OFBiz services for competitive rates
> >
> 
-- 
Antwebsystems.com: Quality OFBiz services for competitive rates


Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by David E Jones <de...@me.com>.
On Oct 1, 2009, at 1:56 PM, David E Jones wrote:

>
> On Oct 1, 2009, at 8:53 AM, Adrian Crum wrote:
>
>> David E Jones wrote:
>>> I remember walking in the streets of a beachside town in Thailand  
>>> a few years ago and a wise man said to me something along the  
>>> lines of it always being better to let someone else do something,  
>>> and help them as needed, than to do it all yourself. I'll admit  
>>> that hasn't always worked out for me, but I do still think it's  
>>> good advice.
>>
>> "If you give a man a fish, you have fed him for a day. If you teach  
>> a man to fish, you have fed him for a lifetime."
>
> WARNING: what follows is a tongue-in-cheek representation of nearly  
> universal business practices that I personally don't agree with  
> (often to my detriment!):
>
> "If you teach a man to fish, you lose a customer. If you sell a man  
> too many fish, you may lose a customer. If you can get the man to  
> eat more fish, you have a better customer. If you make it illegal  
> for that man to fish, you have a customer for life."
>
> Fortunately the second one doesn't happen much in our democratic  
> societies around the world. Oh wait... sorry... forgot to turn off  
> tongue-in-cheek mode.

Whoops, I meant the last one, not the second one.

-David


Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by David E Jones <de...@me.com>.
On Oct 1, 2009, at 8:53 AM, Adrian Crum wrote:

> David E Jones wrote:
>> I remember walking in the streets of a beachside town in Thailand a  
>> few years ago and a wise man said to me something along the lines  
>> of it always being better to let someone else do something, and  
>> help them as needed, than to do it all yourself. I'll admit that  
>> hasn't always worked out for me, but I do still think it's good  
>> advice.
>
> "If you give a man a fish, you have fed him for a day. If you teach  
> a man to fish, you have fed him for a lifetime."

WARNING: what follows is a tongue-in-cheek representation of nearly  
universal business practices that I personally don't agree with (often  
to my detriment!):

"If you teach a man to fish, you lose a customer. If you sell a man  
too many fish, you may lose a customer. If you can get the man to eat  
more fish, you have a better customer. If you make it illegal for that  
man to fish, you have a customer for life."

Fortunately the second one doesn't happen much in our democratic  
societies around the world. Oh wait... sorry... forgot to turn off  
tongue-in-cheek mode.

-David



Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by Adrian Crum <ad...@hlmksw.com>.
David E Jones wrote:
> I remember walking in the streets of a beachside town in Thailand a few 
> years ago and a wise man said to me something along the lines of it 
> always being better to let someone else do something, and help them as 
> needed, than to do it all yourself. I'll admit that hasn't always worked 
> out for me, but I do still think it's good advice.

"If you give a man a fish, you have fed him for a day. If you teach a 
man to fish, you have fed him for a lifetime."

-Adrian

Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by David E Jones <de...@me.com>.
Hans,

If I remember right Anil was in a similar position a couple of years  
ago. At the time I recommended that for Hotwax we have everyone get a  
Jira account and submit changes there, and that is what Anil is  
recommending to you now.

There are a few potential benefits to you:

1. happier employees: they get a chance to work directly with the  
community (as much as they want to and are able, it's not really  
required to go this way) and get to know people more and become more  
comfortable with interactive with others

2. more committers: with your people more involved they may soon  
become committers themselves

3. more reviewers: other committers and other OFBiz users can take a  
look at what they've done; you don't have to take on the entire burden  
yourself, or be pushed into a defensive position if there is an issue  
with one of their commits

I remember walking in the streets of a beachside town in Thailand a  
few years ago and a wise man said to me something along the lines of  
it always being better to let someone else do something, and help them  
as needed, than to do it all yourself. I'll admit that hasn't always  
worked out for me, but I do still think it's good advice.

-David


On Sep 30, 2009, at 8:07 PM, Hans Bakker wrote:

> Hi Anil,
>
> This workflow is good for independent contributors.
>
> However I employ people who get tasks assigned by me and are working
> under my responsibility. I try to review the results as good as I can
> and if there are comments from other committers i will accommodate  
> these
> as good as I can.
>
> However in this case with a average commit rate of 3 commits per day ,
> creating jira issues would be a big overhead with no benefit.
>
> Regards,
> Hans
>
> On Wed, 2009-09-30 at 06:59 -0400, Anil Patel wrote:
>> Hans,
>> Apache (and Ofbiz) has a workflow defined for contributions coming
>> from non committers. I am sure you are aware of the process as  
>> well. I
>> will be much more happy if
>> 1) Contributor create a Jira issue.
>> 2) In Jira issues Contributor can mention all about company they work
>> for etc.
>> 3) Contributor uploads patch to Jira issue
>> 4) Committer take the patch and applies it.
>>
>> Once in a while its fine if committer take contribution directly from
>> a well established contributor and commits it. I don't think its good
>> idea to make it a practice.
>>
>> I know in community driven projects most of practices is
>> recommendation and not many rules. Its good if community members
>> assume recommendations are rules to live by else community can become
>> difficult place to live in.
>>
>> I personally don't see reason why you still want to add company name
>> in commit log.
>>
>> Regards
>> Anil Patel
>>
>> Begin forwarded message:
>>
>>> From: hansbak@apache.org
>>> Date: September 30, 2009 5:51:01 AM EDT
>>> To: commits@ofbiz.apache.org
>>> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/
>>> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/
>>> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java
>>> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>>> Reply-To: dev@ofbiz.apache.org
>>>
>>> Author: hansbak
>>> Date: Wed Sep 30 09:51:01 2009
>>> New Revision: 820232
>>>
>>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>>> Log:
>>> fix for OFBIZ-2414: if a portlet is included more than once the
>>> links do not work, this fix will make these links unique. Sponsored
>>> By Antwebsystems Co.Ltd: employee Berm
>>
> -- 
> Antwebsystems.com: Quality OFBiz services for competitive rates
>


Re: Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by Hans Bakker <ma...@antwebsystems.com>.
Hi Anil,

This workflow is good for independent contributors. 

However I employ people who get tasks assigned by me and are working
under my responsibility. I try to review the results as good as I can
and if there are comments from other committers i will accommodate these
as good as I can.

However in this case with a average commit rate of 3 commits per day ,
creating jira issues would be a big overhead with no benefit.

Regards,
Hans

On Wed, 2009-09-30 at 06:59 -0400, Anil Patel wrote:
> Hans,
> Apache (and Ofbiz) has a workflow defined for contributions coming  
> from non committers. I am sure you are aware of the process as well. I  
> will be much more happy if
> 1) Contributor create a Jira issue.
> 2) In Jira issues Contributor can mention all about company they work  
> for etc.
> 3) Contributor uploads patch to Jira issue
> 4) Committer take the patch and applies it.
> 
> Once in a while its fine if committer take contribution directly from  
> a well established contributor and commits it. I don't think its good  
> idea to make it a practice.
> 
> I know in community driven projects most of practices is  
> recommendation and not many rules. Its good if community members  
> assume recommendations are rules to live by else community can become  
> difficult place to live in.
> 
> I personally don't see reason why you still want to add company name  
> in commit log.
> 
> Regards
> Anil Patel
> 
> Begin forwarded message:
> 
> > From: hansbak@apache.org
> > Date: September 30, 2009 5:51:01 AM EDT
> > To: commits@ofbiz.apache.org
> > Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/ 
> > webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/ 
> > WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java  
> > widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
> > Reply-To: dev@ofbiz.apache.org
> >
> > Author: hansbak
> > Date: Wed Sep 30 09:51:01 2009
> > New Revision: 820232
> >
> > URL: http://svn.apache.org/viewvc?rev=820232&view=rev
> > Log:
> > fix for OFBIZ-2414: if a portlet is included more than once the  
> > links do not work, this fix will make these links unique. Sponsored  
> > By Antwebsystems Co.Ltd: employee Berm
> 
-- 
Antwebsystems.com: Quality OFBiz services for competitive rates


Better workflow needed (Fwd: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java)

Posted by Anil Patel <an...@hotwaxmedia.com>.
Hans,
Apache (and Ofbiz) has a workflow defined for contributions coming  
from non committers. I am sure you are aware of the process as well. I  
will be much more happy if
1) Contributor create a Jira issue.
2) In Jira issues Contributor can mention all about company they work  
for etc.
3) Contributor uploads patch to Jira issue
4) Committer take the patch and applies it.

Once in a while its fine if committer take contribution directly from  
a well established contributor and commits it. I don't think its good  
idea to make it a practice.

I know in community driven projects most of practices is  
recommendation and not many rules. Its good if community members  
assume recommendations are rules to live by else community can become  
difficult place to live in.

I personally don't see reason why you still want to add company name  
in commit log.

Regards
Anil Patel

Begin forwarded message:

> From: hansbak@apache.org
> Date: September 30, 2009 5:51:01 AM EDT
> To: commits@ofbiz.apache.org
> Subject: svn commit: r820232 - in /ofbiz/trunk/framework: common/ 
> webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/ 
> WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java  
> widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
> Reply-To: dev@ofbiz.apache.org
>
> Author: hansbak
> Date: Wed Sep 30 09:51:01 2009
> New Revision: 820232
>
> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
> Log:
> fix for OFBIZ-2414: if a portlet is included more than once the  
> links do not work, this fix will make these links unique. Sponsored  
> By Antwebsystems Co.Ltd: employee Berm


Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Hans,

Should we not close OFBIZ-2414 ? (I know it's a pain right now, just asking)

Thanks

Jacques

> Author: hansbak
> Date: Wed Sep 30 09:51:01 2009
> New Revision: 820232
>
> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
> Log:
> fix for OFBIZ-2414: if a portlet is included more than once the links do not work, this fix will make these links unique. 
> Sponsored By Antwebsystems Co.Ltd: employee Berm
>
> Modified:
>    ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
>
> Modified: ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=820232&r1=820231&r2=820232&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl (original)
> +++ ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl Wed Sep 30 09:51:01 2009
> @@ -20,6 +20,7 @@
> <#if portalPage?has_content>
> <table width="100%">
>   <tr>
> +    <#assign renderSeq = 0/>
>     <#list portalPageColumns?if_exists as portalPageColumn>
>       <td style="vertical-align: top; <#if portalPageColumn.columnWidthPercentage?has_content> 
> width:${portalPageColumn.columnWidthPercentage}%;</#if>">
>       <#assign firstInColumn = true/>
> @@ -31,7 +32,9 @@
>             ${setRequestAttribute("portalPortletId", portlet.portalPortletId)}
>             ${setRequestAttribute("portletSeqId", portlet.portletSeqId)}
>             ${screens.render(portlet.screenLocation, portlet.screenName)}
> +            ${screens.setRenderFormUniqueSeq(renderSeq)}
>             </div>
> +            <#assign renderSeq = renderSeq+1/>
>           </#if>
>           <#assign firstInColumn = false/>
>         </#if>
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=820232&r1=820231&r2=820232&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java Wed Sep 30 09:51:01 2009
> @@ -268,15 +268,19 @@
>         ModelForm modelForm = modelFormField.getModelForm();
>         Integer itemIndex = (Integer) context.get("itemIndex");
>         String iterateId = "";
> +        String formUniqueId = "";
>         String formName = (String) context.get("formName");
>         if (UtilValidate.isEmpty(formName)) {
>             formName = modelForm.getName();
>         }
>         if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
> -        iterateId = (String) context.get("iterateId");
> +            iterateId = (String) context.get("iterateId");
> +        }
> +        if (UtilValidate.isNotEmpty(context.get("formUniqueId"))) {
> +            formUniqueId = (String) context.get("formUniqueId");
>         }
>         if (itemIndex != null) {
> -            return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + iterateId + 
> modelForm.getItemIndexSeparator() + modelFormField.getName();
> +            return formName + modelForm.getItemIndexSeparator() + itemIndex.intValue() + iterateId + formUniqueId + 
> modelForm.getItemIndexSeparator() + modelFormField.getName();
>         } else {
>             return formName + modelForm.getItemIndexSeparator() + modelFormField.getName();
>         }
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=820232&r1=820231&r2=820232&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Wed Sep 30 09:51:01 2009
> @@ -1423,6 +1423,10 @@
>                 ModelFormAction.runSubActions(this.rowActions, localContext);
>
>                 localContext.put("itemIndex", Integer.valueOf(itemIndex - lowIndex));
> +                if (UtilValidate.isNotEmpty(context.get("renderFormSeqNumber"))) {
> +                    localContext.put("formUniqueId", "_"+context.get("renderFormSeqNumber"));
> +                }
> +
>                 this.resetBshInterpreter(localContext);
>
>                 if (Debug.verboseOn()) Debug.logVerbose("In form got another row, context is: " + localContext, module);
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java
> URL: 
> http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=820232&r1=820231&r2=820232&view=diff
> ==============================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java Wed Sep 30 09:51:01 2009
> @@ -73,6 +73,7 @@
>     protected Appendable writer;
>     protected MapStack<String> context;
>     protected ScreenStringRenderer screenStringRenderer;
> +    protected int renderFormSeqNumber = 0;
>
>     public ScreenRenderer(Appendable writer, MapStack<String> context, ScreenStringRenderer screenStringRenderer) {
>         this.writer = writer;
> @@ -129,10 +130,15 @@
>                 writer.append(gwo.toString());
>             }
>         } else {
> +            context.put("renderFormSeqNumber", String.valueOf(renderFormSeqNumber));
>             modelScreen.renderScreenString(writer, context, screenStringRenderer);
>         }
>         return "";
>     }
> +
> +    public void setRenderFormUniqueSeq (int renderFormSeqNumber) {
> +        this.renderFormSeqNumber = renderFormSeqNumber;
> +    }
>
>     public ScreenStringRenderer getScreenStringRenderer() {
>         return this.screenStringRenderer;
>
> 



Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Posted by Hans Bakker <ma...@antwebsystems.com>.
Thank you for your comment Scott, 

the update is in New Revision: 820542, i am sure you noticed it
already :-)

Regards,
Hans


On Wed, 2009-09-30 at 23:47 +1300, Scott Gray wrote:
> 1.  You don't need to use a counter in FreeMarker loops, there is a  
> built-in variable provided

-- 
Antwebsystems.com: Quality OFBiz services for competitive rates


Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Posted by Hans Bakker <ma...@antwebsystems.com>.
a fair compromize....

On Thu, 2009-10-01 at 16:34 +1300, Scott Gray wrote:
> Hi Hans,
> ......
> Even if you chose not to create a jira issue and patch for every  
> single contribution I would beg with you to consider doing it for  
> framework contributions and allow the community to have a say about  
> changes to such an important piece of OFBiz.
....


Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Posted by Anil Patel <an...@hotwaxmedia.com>.
Scott,
Thanks for helping with keeping Ofbiz from becoming pile of hacks.

Begging is right word, nothing else seems to work. :(

Regards
Anil Patel

On Sep 30, 2009, at 11:34 PM, Scott Gray wrote:

> Hi Hans,
>
> That all well and good but what I have a problem with is short term  
> solutions to long term problems, especially in the framework where  
> things can be difficult to change further down the track.  The  
> widget code especially can be very difficult to navigate if things  
> are allowed to get messy.
>
> My personal preference would be that things remain broken until a  
> solid solution is put into place but I haven't got the time to  
> propose or create one so I guess we just have to put up with these  
> hackish solutions until someone has the time to do it properly.
>
> Even if you chose not to create a jira issue and patch for every  
> single contribution I would beg with you to consider doing it for  
> framework contributions and allow the community to have a say about  
> changes to such an important piece of OFBiz.
>
> Regards
> Scott
>
> On 1/10/2009, at 3:24 PM, Hans Bakker wrote:
>
>> Hi Scott,
>>
>> The tip for the loop counter of freemarker is taken and we will  
>> change
>> it.
>>
>> If you have a proposal to fix this error a better way sure we have no
>> problem accepting it. As it is now, it fixes a real problem because  
>> it
>> happens very frequently that portlets are called pretty often in the
>> same screen. By the way, that is good so we reuse code.
>>
>> We are thinking about making text portlets for blocks of text where  
>> we
>> can build normal websites from. This error however always prevented  
>> this
>> development.
>>
>> Regards,
>> Hans
>>
>>
>> On Wed, 2009-09-30 at 23:47 +1300, Scott Gray wrote:
>>> 1.  You don't need to use a counter in FreeMarker loops, there is a
>>> built-in variable provided
>>> 2.  Having to know in advance that you are going to render a form  
>>> more
>>> than once is far from an ideal solution, what is two different  
>>> screens
>>> use the same form on the same page?  Quick fixes do not belong in  
>>> the
>>> framework.
>>> 3.  What about screens that use the screen cache?
>>> 4.  The ScreenRenderer class now has a field called
>>> renderFormSeqNumber even though the ScreenRenderer knows nothing  
>>> about
>>> the form widget.
>>>
>>> In general I think this solution is messy and not well thought  
>>> out, it
>>> concerns me because we already have the iterateId solution you
>>> provided the other day and I'm worried that we are going to end up
>>> with a whole stack of strange variables that make no sense to look  
>>> at
>>> in the code.
>>>
>>> I would prefer to see a solution where the widgets or the screens or
>>> the context keeps track of what widgets have previously been  
>>> rendered
>>> and have then automatically take care of uniquely identifying the  
>>> form
>>> elements themselves.
>>>
>>> Regards
>>> Scott
>>>
>>> On 30/09/2009, at 10:51 PM, hansbak@apache.org wrote:
>>>
>>>> Author: hansbak
>>>> Date: Wed Sep 30 09:51:01 2009
>>>> New Revision: 820232
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>>>> Log:
>>>> fix for OFBIZ-2414: if a portlet is included more than once the
>>>> links do not work, this fix will make these links unique. Sponsored
>>>> By Antwebsystems Co.Ltd: employee Berm
>>>>
>>>> Modified:
>>>>  ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>>>>  ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
>>>> WidgetWorker.java
>>>>  ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>>> ModelForm.java
>>>>  ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>>> ScreenRenderer.java
>>>>
>>>> Modified: ofbiz/trunk/framework/common/webcommon/portal/
>>>> showPortalPage.ftl
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=820232&r1=820231&r2=820232&view=diff
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> = 
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/common/webcommon/portal/ 
>>>> showPortalPage.ftl
>>>> (original)
>>>> +++ ofbiz/trunk/framework/common/webcommon/portal/ 
>>>> showPortalPage.ftl
>>>> Wed Sep 30 09:51:01 2009
>>>> @@ -20,6 +20,7 @@
>>>> <#if portalPage?has_content>
>>>> <table width="100%">
>>>> <tr>
>>>> +    <#assign renderSeq = 0/>
>>>>   <#list portalPageColumns?if_exists as portalPageColumn>
>>>>     <td style="vertical-align: top; <#if
>>>> portalPageColumn.columnWidthPercentage?has_content> width:$
>>>> {portalPageColumn.columnWidthPercentage}%;</#if>">
>>>>     <#assign firstInColumn = true/>
>>>> @@ -31,7 +32,9 @@
>>>>           ${setRequestAttribute("portalPortletId",
>>>> portlet.portalPortletId)}
>>>>           ${setRequestAttribute("portletSeqId",
>>>> portlet.portletSeqId)}
>>>>           ${screens.render(portlet.screenLocation,
>>>> portlet.screenName)}
>>>> +            ${screens.setRenderFormUniqueSeq(renderSeq)}
>>>>           </div>
>>>> +            <#assign renderSeq = renderSeq+1/>
>>>>         </#if>
>>>>         <#assign firstInColumn = false/>
>>>>       </#if>
>>>>
>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/
>>>> WidgetWorker.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=820232&r1=820231&r2=820232&view=diff
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> = 
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/
>>>> WidgetWorker.java (original)
>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/
>>>> WidgetWorker.java Wed Sep 30 09:51:01 2009
>>>> @@ -268,15 +268,19 @@
>>>>       ModelForm modelForm = modelFormField.getModelForm();
>>>>       Integer itemIndex = (Integer) context.get("itemIndex");
>>>>       String iterateId = "";
>>>> +        String formUniqueId = "";
>>>>       String formName = (String) context.get("formName");
>>>>       if (UtilValidate.isEmpty(formName)) {
>>>>           formName = modelForm.getName();
>>>>       }
>>>>       if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
>>>> -        	iterateId = (String) context.get("iterateId");
>>>> +            iterateId = (String) context.get("iterateId");
>>>> +        }
>>>> +        if (UtilValidate.isNotEmpty(context.get 
>>>> ("formUniqueId"))) {
>>>> +            formUniqueId = (String) context.get("formUniqueId");
>>>>       }
>>>>       if (itemIndex != null) {
>>>> -            return formName + modelForm.getItemIndexSeparator() +
>>>> itemIndex.intValue() + iterateId + modelForm.getItemIndexSeparator 
>>>> ()
>>>> + modelFormField.getName();
>>>> +            return formName + modelForm.getItemIndexSeparator() +
>>>> itemIndex.intValue() + iterateId + formUniqueId +
>>>> modelForm.getItemIndexSeparator() + modelFormField.getName();
>>>>       } else {
>>>>           return formName + modelForm.getItemIndexSeparator() +
>>>> modelFormField.getName();
>>>>       }
>>>>
>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>>> ModelForm.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=820232&r1=820231&r2=820232&view=diff
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> = 
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>>> ModelForm.java (original)
>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>>> ModelForm.java Wed Sep 30 09:51:01 2009
>>>> @@ -1423,6 +1423,10 @@
>>>>               ModelFormAction.runSubActions(this.rowActions,
>>>> localContext);
>>>>
>>>>               localContext.put("itemIndex",
>>>> Integer.valueOf(itemIndex - lowIndex));
>>>> +                if
>>>> (UtilValidate.isNotEmpty(context.get("renderFormSeqNumber"))) {
>>>> +                    localContext.put("formUniqueId",
>>>> "_"+context.get("renderFormSeqNumber"));
>>>> +                }
>>>> +
>>>>               this.resetBshInterpreter(localContext);
>>>>
>>>>               if (Debug.verboseOn()) Debug.logVerbose("In form got
>>>> another row, context is: " + localContext, module);
>>>>
>>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>>> ScreenRenderer.java
>>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=820232&r1=820231&r2=820232&view=diff
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> =
>>>> = 
>>>> = 
>>>> = 
>>>> ===================================================================
>>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>>> ScreenRenderer.java (original)
>>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>>> ScreenRenderer.java Wed Sep 30 09:51:01 2009
>>>> @@ -73,6 +73,7 @@
>>>>   protected Appendable writer;
>>>>   protected MapStack<String> context;
>>>>   protected ScreenStringRenderer screenStringRenderer;
>>>> +    protected int renderFormSeqNumber = 0;
>>>>
>>>>   public ScreenRenderer(Appendable writer, MapStack<String>
>>>> context, ScreenStringRenderer screenStringRenderer) {
>>>>       this.writer = writer;
>>>> @@ -129,10 +130,15 @@
>>>>               writer.append(gwo.toString());
>>>>           }
>>>>       } else {
>>>> +            context.put("renderFormSeqNumber",
>>>> String.valueOf(renderFormSeqNumber));
>>>>           modelScreen.renderScreenString(writer, context,
>>>> screenStringRenderer);
>>>>       }
>>>>       return "";
>>>>   }
>>>> +
>>>> +    public void setRenderFormUniqueSeq (int renderFormSeqNumber) {
>>>> +        this.renderFormSeqNumber = renderFormSeqNumber;
>>>> +    }
>>>>
>>>>   public ScreenStringRenderer getScreenStringRenderer() {
>>>>       return this.screenStringRenderer;
>>>>
>>>>
>>>
>> -- 
>> Antwebsystems.com: Quality OFBiz services for competitive rates
>>
>


Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

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

That all well and good but what I have a problem with is short term  
solutions to long term problems, especially in the framework where  
things can be difficult to change further down the track.  The widget  
code especially can be very difficult to navigate if things are  
allowed to get messy.

My personal preference would be that things remain broken until a  
solid solution is put into place but I haven't got the time to propose  
or create one so I guess we just have to put up with these hackish  
solutions until someone has the time to do it properly.

Even if you chose not to create a jira issue and patch for every  
single contribution I would beg with you to consider doing it for  
framework contributions and allow the community to have a say about  
changes to such an important piece of OFBiz.

Regards
Scott

On 1/10/2009, at 3:24 PM, Hans Bakker wrote:

> Hi Scott,
>
> The tip for the loop counter of freemarker is taken and we will change
> it.
>
> If you have a proposal to fix this error a better way sure we have no
> problem accepting it. As it is now, it fixes a real problem because it
> happens very frequently that portlets are called pretty often in the
> same screen. By the way, that is good so we reuse code.
>
> We are thinking about making text portlets for blocks of text where we
> can build normal websites from. This error however always prevented  
> this
> development.
>
> Regards,
> Hans
>
>
> On Wed, 2009-09-30 at 23:47 +1300, Scott Gray wrote:
>> 1.  You don't need to use a counter in FreeMarker loops, there is a
>> built-in variable provided
>> 2.  Having to know in advance that you are going to render a form  
>> more
>> than once is far from an ideal solution, what is two different  
>> screens
>> use the same form on the same page?  Quick fixes do not belong in the
>> framework.
>> 3.  What about screens that use the screen cache?
>> 4.  The ScreenRenderer class now has a field called
>> renderFormSeqNumber even though the ScreenRenderer knows nothing  
>> about
>> the form widget.
>>
>> In general I think this solution is messy and not well thought out,  
>> it
>> concerns me because we already have the iterateId solution you
>> provided the other day and I'm worried that we are going to end up
>> with a whole stack of strange variables that make no sense to look at
>> in the code.
>>
>> I would prefer to see a solution where the widgets or the screens or
>> the context keeps track of what widgets have previously been rendered
>> and have then automatically take care of uniquely identifying the  
>> form
>> elements themselves.
>>
>> Regards
>> Scott
>>
>> On 30/09/2009, at 10:51 PM, hansbak@apache.org wrote:
>>
>>> Author: hansbak
>>> Date: Wed Sep 30 09:51:01 2009
>>> New Revision: 820232
>>>
>>> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
>>> Log:
>>> fix for OFBIZ-2414: if a portlet is included more than once the
>>> links do not work, this fix will make these links unique. Sponsored
>>> By Antwebsystems Co.Ltd: employee Berm
>>>
>>> Modified:
>>>   ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>>>   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
>>> WidgetWorker.java
>>>   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>> ModelForm.java
>>>   ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>> ScreenRenderer.java
>>>
>>> Modified: ofbiz/trunk/framework/common/webcommon/portal/
>>> showPortalPage.ftl
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=820232&r1=820231&r2=820232&view=diff
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>>> (original)
>>> +++ ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>>> Wed Sep 30 09:51:01 2009
>>> @@ -20,6 +20,7 @@
>>> <#if portalPage?has_content>
>>> <table width="100%">
>>>  <tr>
>>> +    <#assign renderSeq = 0/>
>>>    <#list portalPageColumns?if_exists as portalPageColumn>
>>>      <td style="vertical-align: top; <#if
>>> portalPageColumn.columnWidthPercentage?has_content> width:$
>>> {portalPageColumn.columnWidthPercentage}%;</#if>">
>>>      <#assign firstInColumn = true/>
>>> @@ -31,7 +32,9 @@
>>>            ${setRequestAttribute("portalPortletId",
>>> portlet.portalPortletId)}
>>>            ${setRequestAttribute("portletSeqId",
>>> portlet.portletSeqId)}
>>>            ${screens.render(portlet.screenLocation,
>>> portlet.screenName)}
>>> +            ${screens.setRenderFormUniqueSeq(renderSeq)}
>>>            </div>
>>> +            <#assign renderSeq = renderSeq+1/>
>>>          </#if>
>>>          <#assign firstInColumn = false/>
>>>        </#if>
>>>
>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/
>>> WidgetWorker.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=820232&r1=820231&r2=820232&view=diff
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/
>>> WidgetWorker.java (original)
>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/
>>> WidgetWorker.java Wed Sep 30 09:51:01 2009
>>> @@ -268,15 +268,19 @@
>>>        ModelForm modelForm = modelFormField.getModelForm();
>>>        Integer itemIndex = (Integer) context.get("itemIndex");
>>>        String iterateId = "";
>>> +        String formUniqueId = "";
>>>        String formName = (String) context.get("formName");
>>>        if (UtilValidate.isEmpty(formName)) {
>>>            formName = modelForm.getName();
>>>        }
>>>        if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
>>> -        	iterateId = (String) context.get("iterateId");
>>> +            iterateId = (String) context.get("iterateId");
>>> +        }
>>> +        if (UtilValidate.isNotEmpty(context.get("formUniqueId"))) {
>>> +            formUniqueId = (String) context.get("formUniqueId");
>>>        }
>>>        if (itemIndex != null) {
>>> -            return formName + modelForm.getItemIndexSeparator() +
>>> itemIndex.intValue() + iterateId + modelForm.getItemIndexSeparator()
>>> + modelFormField.getName();
>>> +            return formName + modelForm.getItemIndexSeparator() +
>>> itemIndex.intValue() + iterateId + formUniqueId +
>>> modelForm.getItemIndexSeparator() + modelFormField.getName();
>>>        } else {
>>>            return formName + modelForm.getItemIndexSeparator() +
>>> modelFormField.getName();
>>>        }
>>>
>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>> ModelForm.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=820232&r1=820231&r2=820232&view=diff
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>> ModelForm.java (original)
>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/
>>> ModelForm.java Wed Sep 30 09:51:01 2009
>>> @@ -1423,6 +1423,10 @@
>>>                ModelFormAction.runSubActions(this.rowActions,
>>> localContext);
>>>
>>>                localContext.put("itemIndex",
>>> Integer.valueOf(itemIndex - lowIndex));
>>> +                if
>>> (UtilValidate.isNotEmpty(context.get("renderFormSeqNumber"))) {
>>> +                    localContext.put("formUniqueId",
>>> "_"+context.get("renderFormSeqNumber"));
>>> +                }
>>> +
>>>                this.resetBshInterpreter(localContext);
>>>
>>>                if (Debug.verboseOn()) Debug.logVerbose("In form got
>>> another row, context is: " + localContext, module);
>>>
>>> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>> ScreenRenderer.java
>>> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=820232&r1=820231&r2=820232&view=diff
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> =
>>> = 
>>> = 
>>> ====================================================================
>>> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>> ScreenRenderer.java (original)
>>> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/
>>> ScreenRenderer.java Wed Sep 30 09:51:01 2009
>>> @@ -73,6 +73,7 @@
>>>    protected Appendable writer;
>>>    protected MapStack<String> context;
>>>    protected ScreenStringRenderer screenStringRenderer;
>>> +    protected int renderFormSeqNumber = 0;
>>>
>>>    public ScreenRenderer(Appendable writer, MapStack<String>
>>> context, ScreenStringRenderer screenStringRenderer) {
>>>        this.writer = writer;
>>> @@ -129,10 +130,15 @@
>>>                writer.append(gwo.toString());
>>>            }
>>>        } else {
>>> +            context.put("renderFormSeqNumber",
>>> String.valueOf(renderFormSeqNumber));
>>>            modelScreen.renderScreenString(writer, context,
>>> screenStringRenderer);
>>>        }
>>>        return "";
>>>    }
>>> +
>>> +    public void setRenderFormUniqueSeq (int renderFormSeqNumber) {
>>> +        this.renderFormSeqNumber = renderFormSeqNumber;
>>> +    }
>>>
>>>    public ScreenStringRenderer getScreenStringRenderer() {
>>>        return this.screenStringRenderer;
>>>
>>>
>>
> -- 
> Antwebsystems.com: Quality OFBiz services for competitive rates
>


Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Posted by Hans Bakker <ma...@antwebsystems.com>.
Hi Scott,

The tip for the loop counter of freemarker is taken and we will change
it.

If you have a proposal to fix this error a better way sure we have no
problem accepting it. As it is now, it fixes a real problem because it
happens very frequently that portlets are called pretty often in the
same screen. By the way, that is good so we reuse code.

We are thinking about making text portlets for blocks of text where we
can build normal websites from. This error however always prevented this
development.

Regards,
Hans


On Wed, 2009-09-30 at 23:47 +1300, Scott Gray wrote:
> 1.  You don't need to use a counter in FreeMarker loops, there is a  
> built-in variable provided
> 2.  Having to know in advance that you are going to render a form more  
> than once is far from an ideal solution, what is two different screens  
> use the same form on the same page?  Quick fixes do not belong in the  
> framework.
> 3.  What about screens that use the screen cache?
> 4.  The ScreenRenderer class now has a field called  
> renderFormSeqNumber even though the ScreenRenderer knows nothing about  
> the form widget.
> 
> In general I think this solution is messy and not well thought out, it  
> concerns me because we already have the iterateId solution you  
> provided the other day and I'm worried that we are going to end up  
> with a whole stack of strange variables that make no sense to look at  
> in the code.
> 
> I would prefer to see a solution where the widgets or the screens or  
> the context keeps track of what widgets have previously been rendered  
> and have then automatically take care of uniquely identifying the form  
> elements themselves.
> 
> Regards
> Scott
> 
> On 30/09/2009, at 10:51 PM, hansbak@apache.org wrote:
> 
> > Author: hansbak
> > Date: Wed Sep 30 09:51:01 2009
> > New Revision: 820232
> >
> > URL: http://svn.apache.org/viewvc?rev=820232&view=rev
> > Log:
> > fix for OFBIZ-2414: if a portlet is included more than once the  
> > links do not work, this fix will make these links unique. Sponsored  
> > By Antwebsystems Co.Ltd: employee Berm
> >
> > Modified:
> >    ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
> >    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
> >    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> > ModelForm.java
> >    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> > ScreenRenderer.java
> >
> > Modified: ofbiz/trunk/framework/common/webcommon/portal/ 
> > showPortalPage.ftl
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=820232&r1=820231&r2=820232&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl  
> > (original)
> > +++ ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl  
> > Wed Sep 30 09:51:01 2009
> > @@ -20,6 +20,7 @@
> > <#if portalPage?has_content>
> > <table width="100%">
> >   <tr>
> > +    <#assign renderSeq = 0/>
> >     <#list portalPageColumns?if_exists as portalPageColumn>
> >       <td style="vertical-align: top; <#if  
> > portalPageColumn.columnWidthPercentage?has_content> width:$ 
> > {portalPageColumn.columnWidthPercentage}%;</#if>">
> >       <#assign firstInColumn = true/>
> > @@ -31,7 +32,9 @@
> >             ${setRequestAttribute("portalPortletId",  
> > portlet.portalPortletId)}
> >             ${setRequestAttribute("portletSeqId",  
> > portlet.portletSeqId)}
> >             ${screens.render(portlet.screenLocation,  
> > portlet.screenName)}
> > +            ${screens.setRenderFormUniqueSeq(renderSeq)}
> >             </div>
> > +            <#assign renderSeq = renderSeq+1/>
> >           </#if>
> >           <#assign firstInColumn = false/>
> >         </#if>
> >
> > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
> > WidgetWorker.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=820232&r1=820231&r2=820232&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
> > WidgetWorker.java (original)
> > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
> > WidgetWorker.java Wed Sep 30 09:51:01 2009
> > @@ -268,15 +268,19 @@
> >         ModelForm modelForm = modelFormField.getModelForm();
> >         Integer itemIndex = (Integer) context.get("itemIndex");
> >         String iterateId = "";
> > +        String formUniqueId = "";
> >         String formName = (String) context.get("formName");
> >         if (UtilValidate.isEmpty(formName)) {
> >             formName = modelForm.getName();
> >         }
> >         if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
> > -        	iterateId = (String) context.get("iterateId");
> > +            iterateId = (String) context.get("iterateId");
> > +        }
> > +        if (UtilValidate.isNotEmpty(context.get("formUniqueId"))) {
> > +            formUniqueId = (String) context.get("formUniqueId");
> >         }
> >         if (itemIndex != null) {
> > -            return formName + modelForm.getItemIndexSeparator() +  
> > itemIndex.intValue() + iterateId + modelForm.getItemIndexSeparator()  
> > + modelFormField.getName();
> > +            return formName + modelForm.getItemIndexSeparator() +  
> > itemIndex.intValue() + iterateId + formUniqueId +  
> > modelForm.getItemIndexSeparator() + modelFormField.getName();
> >         } else {
> >             return formName + modelForm.getItemIndexSeparator() +  
> > modelFormField.getName();
> >         }
> >
> > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> > ModelForm.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=820232&r1=820231&r2=820232&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> > ModelForm.java (original)
> > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> > ModelForm.java Wed Sep 30 09:51:01 2009
> > @@ -1423,6 +1423,10 @@
> >                 ModelFormAction.runSubActions(this.rowActions,  
> > localContext);
> >
> >                 localContext.put("itemIndex",  
> > Integer.valueOf(itemIndex - lowIndex));
> > +                if  
> > (UtilValidate.isNotEmpty(context.get("renderFormSeqNumber"))) {
> > +                    localContext.put("formUniqueId",  
> > "_"+context.get("renderFormSeqNumber"));
> > +                }
> > +
> >                 this.resetBshInterpreter(localContext);
> >
> >                 if (Debug.verboseOn()) Debug.logVerbose("In form got  
> > another row, context is: " + localContext, module);
> >
> > Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> > ScreenRenderer.java
> > URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=820232&r1=820231&r2=820232&view=diff
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > = 
> > ======================================================================
> > --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> > ScreenRenderer.java (original)
> > +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> > ScreenRenderer.java Wed Sep 30 09:51:01 2009
> > @@ -73,6 +73,7 @@
> >     protected Appendable writer;
> >     protected MapStack<String> context;
> >     protected ScreenStringRenderer screenStringRenderer;
> > +    protected int renderFormSeqNumber = 0;
> >
> >     public ScreenRenderer(Appendable writer, MapStack<String>  
> > context, ScreenStringRenderer screenStringRenderer) {
> >         this.writer = writer;
> > @@ -129,10 +130,15 @@
> >                 writer.append(gwo.toString());
> >             }
> >         } else {
> > +            context.put("renderFormSeqNumber",  
> > String.valueOf(renderFormSeqNumber));
> >             modelScreen.renderScreenString(writer, context,  
> > screenStringRenderer);
> >         }
> >         return "";
> >     }
> > +
> > +    public void setRenderFormUniqueSeq (int renderFormSeqNumber) {
> > +        this.renderFormSeqNumber = renderFormSeqNumber;
> > +    }
> >
> >     public ScreenStringRenderer getScreenStringRenderer() {
> >         return this.screenStringRenderer;
> >
> >
> 
-- 
Antwebsystems.com: Quality OFBiz services for competitive rates


Re: svn commit: r820232 - in /ofbiz/trunk/framework: common/webcommon/portal/showPortalPage.ftl widget/src/org/ofbiz/widget/WidgetWorker.java widget/src/org/ofbiz/widget/form/ModelForm.java widget/src/org/ofbiz/widget/screen/ScreenRenderer.java

Posted by Scott Gray <sc...@hotwaxmedia.com>.
1.  You don't need to use a counter in FreeMarker loops, there is a  
built-in variable provided
2.  Having to know in advance that you are going to render a form more  
than once is far from an ideal solution, what is two different screens  
use the same form on the same page?  Quick fixes do not belong in the  
framework.
3.  What about screens that use the screen cache?
4.  The ScreenRenderer class now has a field called  
renderFormSeqNumber even though the ScreenRenderer knows nothing about  
the form widget.

In general I think this solution is messy and not well thought out, it  
concerns me because we already have the iterateId solution you  
provided the other day and I'm worried that we are going to end up  
with a whole stack of strange variables that make no sense to look at  
in the code.

I would prefer to see a solution where the widgets or the screens or  
the context keeps track of what widgets have previously been rendered  
and have then automatically take care of uniquely identifying the form  
elements themselves.

Regards
Scott

On 30/09/2009, at 10:51 PM, hansbak@apache.org wrote:

> Author: hansbak
> Date: Wed Sep 30 09:51:01 2009
> New Revision: 820232
>
> URL: http://svn.apache.org/viewvc?rev=820232&view=rev
> Log:
> fix for OFBIZ-2414: if a portlet is included more than once the  
> links do not work, this fix will make these links unique. Sponsored  
> By Antwebsystems Co.Ltd: employee Berm
>
> Modified:
>    ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> ModelForm.java
>    ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> ScreenRenderer.java
>
> Modified: ofbiz/trunk/framework/common/webcommon/portal/ 
> showPortalPage.ftl
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl?rev=820232&r1=820231&r2=820232&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl  
> (original)
> +++ ofbiz/trunk/framework/common/webcommon/portal/showPortalPage.ftl  
> Wed Sep 30 09:51:01 2009
> @@ -20,6 +20,7 @@
> <#if portalPage?has_content>
> <table width="100%">
>   <tr>
> +    <#assign renderSeq = 0/>
>     <#list portalPageColumns?if_exists as portalPageColumn>
>       <td style="vertical-align: top; <#if  
> portalPageColumn.columnWidthPercentage?has_content> width:$ 
> {portalPageColumn.columnWidthPercentage}%;</#if>">
>       <#assign firstInColumn = true/>
> @@ -31,7 +32,9 @@
>             ${setRequestAttribute("portalPortletId",  
> portlet.portalPortletId)}
>             ${setRequestAttribute("portletSeqId",  
> portlet.portletSeqId)}
>             ${screens.render(portlet.screenLocation,  
> portlet.screenName)}
> +            ${screens.setRenderFormUniqueSeq(renderSeq)}
>             </div>
> +            <#assign renderSeq = renderSeq+1/>
>           </#if>
>           <#assign firstInColumn = false/>
>         </#if>
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
> WidgetWorker.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/WidgetWorker.java?rev=820232&r1=820231&r2=820232&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
> WidgetWorker.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ 
> WidgetWorker.java Wed Sep 30 09:51:01 2009
> @@ -268,15 +268,19 @@
>         ModelForm modelForm = modelFormField.getModelForm();
>         Integer itemIndex = (Integer) context.get("itemIndex");
>         String iterateId = "";
> +        String formUniqueId = "";
>         String formName = (String) context.get("formName");
>         if (UtilValidate.isEmpty(formName)) {
>             formName = modelForm.getName();
>         }
>         if (UtilValidate.isNotEmpty(context.get("iterateId"))) {
> -        	iterateId = (String) context.get("iterateId");
> +            iterateId = (String) context.get("iterateId");
> +        }
> +        if (UtilValidate.isNotEmpty(context.get("formUniqueId"))) {
> +            formUniqueId = (String) context.get("formUniqueId");
>         }
>         if (itemIndex != null) {
> -            return formName + modelForm.getItemIndexSeparator() +  
> itemIndex.intValue() + iterateId + modelForm.getItemIndexSeparator()  
> + modelFormField.getName();
> +            return formName + modelForm.getItemIndexSeparator() +  
> itemIndex.intValue() + iterateId + formUniqueId +  
> modelForm.getItemIndexSeparator() + modelFormField.getName();
>         } else {
>             return formName + modelForm.getItemIndexSeparator() +  
> modelFormField.getName();
>         }
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> ModelForm.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=820232&r1=820231&r2=820232&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> ModelForm.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ 
> ModelForm.java Wed Sep 30 09:51:01 2009
> @@ -1423,6 +1423,10 @@
>                 ModelFormAction.runSubActions(this.rowActions,  
> localContext);
>
>                 localContext.put("itemIndex",  
> Integer.valueOf(itemIndex - lowIndex));
> +                if  
> (UtilValidate.isNotEmpty(context.get("renderFormSeqNumber"))) {
> +                    localContext.put("formUniqueId",  
> "_"+context.get("renderFormSeqNumber"));
> +                }
> +
>                 this.resetBshInterpreter(localContext);
>
>                 if (Debug.verboseOn()) Debug.logVerbose("In form got  
> another row, context is: " + localContext, module);
>
> Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> ScreenRenderer.java
> URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenRenderer.java?rev=820232&r1=820231&r2=820232&view=diff
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> ScreenRenderer.java (original)
> +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ 
> ScreenRenderer.java Wed Sep 30 09:51:01 2009
> @@ -73,6 +73,7 @@
>     protected Appendable writer;
>     protected MapStack<String> context;
>     protected ScreenStringRenderer screenStringRenderer;
> +    protected int renderFormSeqNumber = 0;
>
>     public ScreenRenderer(Appendable writer, MapStack<String>  
> context, ScreenStringRenderer screenStringRenderer) {
>         this.writer = writer;
> @@ -129,10 +130,15 @@
>                 writer.append(gwo.toString());
>             }
>         } else {
> +            context.put("renderFormSeqNumber",  
> String.valueOf(renderFormSeqNumber));
>             modelScreen.renderScreenString(writer, context,  
> screenStringRenderer);
>         }
>         return "";
>     }
> +
> +    public void setRenderFormUniqueSeq (int renderFormSeqNumber) {
> +        this.renderFormSeqNumber = renderFormSeqNumber;
> +    }
>
>     public ScreenStringRenderer getScreenStringRenderer() {
>         return this.screenStringRenderer;
>
>