Author: hansbak
Date: Tue Aug 23 04:26:06 2011 New Revision: 1160539 URL: http://svn.apache.org/viewvc?rev=1160539&view=rev Log: add the viewsize and viewindex parameters to the buttons on a list form to remember the paage and pagesize automatically Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java?rev=1160539&r1=1160538&r2=1160539&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/MacroFormRenderer.java Tue Aug 23 04:26:06 2011 @@ -1350,6 +1350,10 @@ public class MacroFormRenderer implement String containerStyle = modelForm.getContainerStyle(); String autocomplete = ""; String name = modelForm.getCurrentFormName(context); + String viewIndexField = modelForm.getMultiPaginateIndexField(context); + String viewSizeField = modelForm.getMultiPaginateSizeField(context); + int viewIndex = modelForm.getViewIndex(context); + int viewSize = modelForm.getViewSize(context); boolean useRowSubmit = modelForm.getUseRowSubmit(); if (!modelForm.getClientAutocompleteFields()) { autocomplete = "off"; @@ -1370,6 +1374,14 @@ public class MacroFormRenderer implement sr.append(autocomplete); sr.append("\" name=\""); sr.append(name); + sr.append("\" viewIndexField=\""); + sr.append(viewIndexField); + sr.append("\" viewSizeField=\""); + sr.append(viewSizeField); + sr.append("\" viewIndex=\""); + sr.append(Integer.toString(viewIndex)); + sr.append("\" viewSize=\""); + sr.append(Integer.toString(viewSize)); sr.append("\" useRowSubmit="); sr.append(Boolean.toString(useRowSubmit)); sr.append(" />"); @@ -3023,8 +3035,22 @@ public class MacroFormRenderer implement String realLinkType = WidgetWorker.determineAutoLinkType(linkType, target, targetType, request); String encodedDescription = encode(description, modelFormField, context); + // get the parameterized pagination index and size fields + int paginatorNumber = WidgetWorker.getPaginatorNumber(context); + String viewIndexField = modelFormField.modelForm.getMultiPaginateIndexField(context); + String viewSizeField = modelFormField.modelForm.getMultiPaginateSizeField(context); + int viewIndex = modelFormField.modelForm.getViewIndex(context); + int viewSize = modelFormField.modelForm.getViewSize(context); + if (viewIndexField.equals("viewIndex" + "_" + paginatorNumber)) { + viewIndexField = "VIEW_INDEX" + "_" + paginatorNumber; + } + if (viewSizeField.equals("viewSize" + "_" + paginatorNumber)) { + viewSizeField = "VIEW_SIZE" + "_" + paginatorNumber; + } if ("hidden-form".equals(realLinkType)) { + parameterMap.put(viewIndexField, Integer.toString(viewIndex)); + parameterMap.put(viewSizeField, Integer.toString(viewSize)); if (modelFormField != null && "multi".equals(modelFormField.getModelForm().getType())) { WidgetWorker.makeHiddenFormLinkAnchor(writer, linkStyle, encodedDescription, confirmation , modelFormField, request, response, context); Modified: ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl?rev=1160539&r1=1160538&r2=1160539&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl (original) +++ ofbiz/trunk/framework/widget/templates/htmlFormMacroLibrary.ftl Tue Aug 23 04:26:06 2011 @@ -296,11 +296,17 @@ ${item.description}</span> <#macro renderSingleFormFieldTitle></#macro> -<#macro renderFormOpen linkUrl formType targetWindow containerId containerStyle autocomplete name useRowSubmit> +<#macro renderFormOpen linkUrl formType targetWindow containerId containerStyle autocomplete name viewIndexField viewSizeField viewIndex viewSize useRowSubmit> <form method="post" action="${linkUrl}"<#if formType=="upload"> enctype="multipart/form-data"</#if><#if targetWindow?has_content> target="${targetWindow}"</#if><#if containerId?has_content> id="${containerId}"</#if> class=<#if containerStyle?has_content>"${containerStyle}"<#else>"basic-form"</#if> onsubmit="javascript:submitFormDisableSubmits(this)"<#if autocomplete?has_content> autocomplete="${autocomplete}"</#if> name="${name}"><#lt/> <#if useRowSubmit?has_content && useRowSubmit> <input type="hidden" name="_useRowSubmit" value="Y"/> + <#if linkUrl?index_of("VIEW_INDEX") <= 0 && linkUrl?index_of(viewIndexField) <= 0> + <input type="hidden" name="${viewIndexField}" value="${viewIndex}"/> + </#if> + <#if linkUrl?index_of("VIEW_SIZE") <= 0 && linkUrl?index_of(viewSizeField) <= 0> + <input type="hidden" name="${viewSizeField}" value="${viewSize}"/> + </#if> </#if> </#macro> <#macro renderFormClose focusFieldName formName containerId hasRequiredField> |
Free forum by Nabble | Edit this page |