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; |
Free forum by Nabble | Edit this page |