Author: jleroux
Date: Sat Dec 1 09:33:21 2007 New Revision: 600171 URL: http://svn.apache.org/viewvc?rev=600171&view=rev Log: A patch from Marco Risaliti "Pagination in the product search" (https://issues.apache.org/jira/browse/OFBIZ-1131) - OFBIZ-1131 Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/advancedsearch.ftl ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/keywordsearch.bsh ofbiz/trunk/applications/product/webapp/catalog/find/advancedsearch.ftl ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearch.ftl ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearchbox.ftl Modified: ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/advancedsearch.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/advancedsearch.ftl?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/advancedsearch.ftl (original) +++ ofbiz/trunk/applications/ecommerce/webapp/ecommerce/catalog/advancedsearch.ftl Sat Dec 1 09:33:21 2007 @@ -22,6 +22,7 @@ <br/> <form name="advtokeywordsearchform" method="post" action="<@ofbizUrl>keywordsearch</@ofbizUrl>" style="margin: 0;"> <input type="hidden" name="VIEW_SIZE" value="10"/> + <input type="hidden" name="PAGING" value="Y"/> <table border="0" wdith="100%"> <input type="hidden" name="SEARCH_CATALOG_ID" value="${currentCatalogId}"> <#if searchCategory?has_content> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/keywordsearch.bsh Sat Dec 1 09:33:21 2007 @@ -40,6 +40,8 @@ context.put("listSize", result.get("listSize")); context.put("lowIndex", result.get("lowIndex")); context.put("highIndex", result.get("highIndex")); +context.put("paging", result.get("paging")); +context.put("previousViewSize", result.get("previousViewSize")); context.put("searchCategory", result.get("searchCategory")); context.put("searchConstraintStrings", result.get("searchConstraintStrings")); context.put("searchSortOrderString", result.get("searchSortOrderString")); Modified: ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/entry/catalog/keywordsearchbox.ftl Sat Dec 1 09:33:21 2007 @@ -24,6 +24,7 @@ <div class="screenlet-body" style="text-align: center;"> <form name="keywordsearchform" method="post" action="<@ofbizUrl>keywordsearch</@ofbizUrl>"> <input type="hidden" name="VIEW_SIZE" value="10"/> + <input type="hidden" name="PAGING" value="Y"/> <div class="tabletext"> <input type="text" class="inputBox" name="SEARCH_STRING" size="14" maxlength="50" value="${requestParameters.SEARCH_STRING?if_exists}"/> </div> Modified: ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java (original) +++ ofbiz/trunk/applications/product/src/org/ofbiz/product/product/ProductSearchSession.java Sat Dec 1 09:33:21 2007 @@ -80,6 +80,8 @@ protected Integer viewIndex = null; protected Integer viewSize = null; protected boolean changed = false; + protected String paging = "Y"; + protected Integer previousViewSize = null; public ProductSearchOptions() { } @@ -92,6 +94,8 @@ this.viewIndex = productSearchOptions.viewIndex; this.viewSize = productSearchOptions.viewSize; this.changed = productSearchOptions.changed; + this.paging = productSearchOptions.paging; + this.previousViewSize = productSearchOptions.previousViewSize; } public List getConstraintList() { @@ -138,6 +142,8 @@ public void clearViewInfo() { this.viewIndex = null; this.viewSize = null; + this.paging = "Y"; + this.previousViewSize = null; } /** @@ -175,12 +181,15 @@ public Integer getViewSize() { return viewSize; } + /** * @param viewSize The viewSize to set. */ public void setViewSize(Integer viewSize) { + setPreviousViewSize(getViewSize()); this.viewSize = viewSize; } + /** * @param viewSize The viewSize to set. */ @@ -197,7 +206,41 @@ } } } - + + /** + * @return Returns the paging. + */ + public String getPaging() { + return paging; + } + + /** + * @param paging The paging to set. + */ + public void setPaging(String paging) { + if (paging == null) { + paging = "Y"; + } + this.paging = paging; + } + + /** + * @return Returns the previousViewSize. + */ + public Integer getPreviousViewSize() { + return previousViewSize; + } + /** + * @param previousViewSize The previousViewSize to set. + */ + public void setPreviousViewSize(Integer previousViewSize) { + if (previousViewSize == null) { + this.previousViewSize = new Integer(20); + } else { + this.previousViewSize = previousViewSize; + } + } + public String getTopProductCategoryId() { return topProductCategoryId; } @@ -466,7 +509,7 @@ ProductSearchOptions productSearchOptions = getProductSearchOptions(request.getSession()); productSearchOptions.setViewIndex((String) parameters.get("VIEW_INDEX")); productSearchOptions.setViewSize((String) parameters.get("VIEW_SIZE")); - + productSearchOptions.setPaging((String) parameters.get("PAGING")); return; } else { request.setAttribute("processSearchParametersAlreadyRun", Boolean.TRUE); @@ -768,6 +811,7 @@ productSearchOptions.setViewIndex((String) parameters.get("VIEW_INDEX")); productSearchOptions.setViewSize((String) parameters.get("VIEW_SIZE")); + productSearchOptions.setPaging((String) parameters.get("PAGING")); } public static Map getProductSearchResult(HttpServletRequest request, GenericDelegator delegator, String prodCatalogId) { @@ -778,16 +822,34 @@ int highIndex = 0; int lowIndex = 0; int listSize = 0; + String paging = "Y"; + int previousViewSize = 20; HttpSession session = request.getSession(); ProductSearchOptions productSearchOptions = getProductSearchOptions(session); String addOnTopProdCategoryId = productSearchOptions.getTopProductCategoryId(); + Integer viewIndexInteger = productSearchOptions.getViewIndex(); - if (viewIndexInteger != null) viewIndex = viewIndexInteger.intValue(); + if (viewIndexInteger != null) { + viewIndex = viewIndexInteger.intValue(); + } + Integer viewSizeInteger = productSearchOptions.getViewSize(); - if (viewSizeInteger != null) viewSize = viewSizeInteger.intValue(); - + if (viewSizeInteger != null) { + viewSize = viewSizeInteger.intValue(); + } + + Integer previousViewSizeInteger = productSearchOptions.getPreviousViewSize(); + if (previousViewSizeInteger != null) { + previousViewSize = previousViewSizeInteger.intValue(); + } + + String pag = productSearchOptions.getPaging(); + if (paging != null) { + paging = pag; + } + lowIndex = viewIndex * viewSize; highIndex = (viewIndex + 1) * viewSize; @@ -882,6 +944,8 @@ result.put("listSize", new Integer(listSize)); result.put("lowIndex", new Integer(lowIndex)); result.put("highIndex", new Integer(highIndex)); + result.put("paging", paging); + result.put("previousViewSize", previousViewSize); result.put("searchConstraintStrings", searchConstraintStrings); result.put("searchSortOrderString", searchSortOrderString); Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/keywordsearch.bsh URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/keywordsearch.bsh?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/keywordsearch.bsh (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/find/keywordsearch.bsh Sat Dec 1 09:33:21 2007 @@ -48,6 +48,8 @@ context.put("listSize", result.get("listSize")); context.put("lowIndex", result.get("lowIndex")); context.put("highIndex", result.get("highIndex")); +context.put("paging", result.get("paging")); +context.put("previousViewSize", result.get("previousViewSize")); context.put("searchCategory", result.get("searchCategory")); context.put("searchConstraintStrings", result.get("searchConstraintStrings")); context.put("searchSortOrderString", result.get("searchSortOrderString")); Modified: ofbiz/trunk/applications/product/webapp/catalog/find/advancedsearch.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/find/advancedsearch.ftl?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/find/advancedsearch.ftl (original) +++ ofbiz/trunk/applications/product/webapp/catalog/find/advancedsearch.ftl Sat Dec 1 09:33:21 2007 @@ -20,6 +20,7 @@ <br/> <form name="advtokeywordsearchform" method="post" action="<@ofbizUrl>keywordsearch</@ofbizUrl>" style="margin: 0;"> <input type="hidden" name="VIEW_SIZE" value="25"/> + <input type="hidden" name="PAGING" value="Y"/> <table border="0" wdith="100%"> <#if searchCategory?has_content> <input type="hidden" name="SEARCH_CATEGORY_ID" value="${searchCategoryId?if_exists}"/> Modified: ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearch.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearch.ftl?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearch.ftl (original) +++ ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearch.ftl Sat Dec 1 09:33:21 2007 @@ -75,13 +75,18 @@ <td align="right"> <b> <#if 0 < viewIndex?int> - <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex-1}/~VIEW_SIZE=${viewSize}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> | + <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex-1}/~VIEW_SIZE=${viewSize}/~clearSearch=N/~PAGING=${paging}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> | </#if> <#if 0 < listSize?int> <span class="tabletext">${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span> </#if> <#if highIndex?int < listSize?int> - | <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex+1}/~VIEW_SIZE=${viewSize}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a> + | <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex+1}/~VIEW_SIZE=${viewSize}/~clearSearch=N/~PAGING=${paging}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a> + </#if> + <#if paging == "Y"> + <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=0/~VIEW_SIZE=99999/~clearSearch=N/~PAGING=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a> + <#else> + <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=0/~VIEW_SIZE=${previousViewSize}/~clearSearch=N/~PAGING=Y</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a> </#if> </b> </td> @@ -109,13 +114,18 @@ <td align="right"> <b> <#if 0 < viewIndex?int> - <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex-1}/~VIEW_SIZE=${viewSize}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> | + <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex-1}/~VIEW_SIZE=${viewSize}/~clearSearch=N/~PAGING=${paging}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPrevious}</a> | </#if> <#if 0 < listSize?int> <span class="tabletext">${lowIndex+1} - ${highIndex} ${uiLabelMap.CommonOf} ${listSize}</span> </#if> <#if highIndex?int < listSize?int> - | <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex+1}/~VIEW_SIZE=${viewSize}/~clearSearch=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a> + | <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=${viewIndex+1}/~VIEW_SIZE=${viewSize}/~clearSearch=N/~PAGING=${paging}</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonNext}</a> + </#if> + <#if paging == "Y"> + <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=0/~VIEW_SIZE=99999/~clearSearch=N/~PAGING=N</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOff}</a> + <#else> + <a href="<@ofbizUrl>keywordsearch/~VIEW_INDEX=0/~VIEW_SIZE=${previousViewSize}/~clearSearch=N/~PAGING=Y</@ofbizUrl>" class="buttontext">${uiLabelMap.CommonPagingOn}</a> </#if> </b> </td> Modified: ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearchbox.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearchbox.ftl?rev=600171&r1=600170&r2=600171&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearchbox.ftl (original) +++ ofbiz/trunk/applications/product/webapp/catalog/find/keywordsearchbox.ftl Sat Dec 1 09:33:21 2007 @@ -45,7 +45,7 @@ <#if isOpen> <div class="screenlet-body"> <div> - <form name="keywordsearchform" method="post" action="<@ofbizUrl>keywordsearch?VIEW_SIZE=25</@ofbizUrl>" style="margin: 0;"> + <form name="keywordsearchform" method="post" action="<@ofbizUrl>keywordsearch?VIEW_SIZE=25&PAGING=Y</@ofbizUrl>" style="margin: 0;"> <div class="tabletext">${uiLabelMap.ProductKeywords}: <input type="text" class="inputBox" name="SEARCH_STRING" size="20" maxlength="50" value="${requestParameters.SEARCH_STRING?if_exists}"/></div> <div class="tabletext"> ${uiLabelMap.ProductCategoryId}: |
Free forum by Nabble | Edit this page |