svnno****@sourc*****
svnno****@sourc*****
2007年 11月 13日 (火) 16:40:43 JST
Revision: 705 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=705 Author: shinsuke Date: 2007-11-13 16:40:43 +0900 (Tue, 13 Nov 2007) Log Message: ----------- fixed page navigation. Modified Paths: -------------- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java -------------- next part -------------- Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java 2007-11-12 08:04:26 UTC (rev 704) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java 2007-11-13 07:40:43 UTC (rev 705) @@ -277,4 +277,8 @@ + "NumOfTopProducts"; public static final int DEFAULT_NUM_OF_TOP_PRODUCTS = 8; + + public static final String IS_FROM_DETAILS_PAGE = PREFIX + + "IsFromDetailsPage"; + } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java 2007-11-12 08:04:26 UTC (rev 704) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/CategoryListAction.java 2007-11-13 07:40:43 UTC (rev 705) @@ -43,8 +43,12 @@ } catch (NumberFormatException e) { } } - return (BigDecimal) SessionUtil + BigDecimal id = (BigDecimal) SessionUtil .getFromApplicationScope(PompeiConstants.CURRENT_CATEGORY_ID); + if (id != null) { + id = new BigDecimal(id.longValue()); + } + return id; } public Class<?> prerender() { Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java 2007-11-12 08:04:26 UTC (rev 704) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java 2007-11-13 07:40:43 UTC (rev 705) @@ -90,12 +90,16 @@ || !ccid .equals(SessionUtil .getFromLocalScope(PompeiConstants.CURRENT_CATEGORY_ID))) { + SessionUtil.putToLocalScope(PompeiConstants.IS_FROM_DETAILS_PAGE, + Boolean.TRUE); return ProductListPage.class; } // check product if (!isProductDetails()) { if (getProductDetailsPage().getProductId() == null) { + SessionUtil.putToLocalScope( + PompeiConstants.IS_FROM_DETAILS_PAGE, Boolean.TRUE); return ProductListPage.class; } } Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java =================================================================== --- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java 2007-11-12 08:04:26 UTC (rev 704) +++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java 2007-11-13 07:40:43 UTC (rev 705) @@ -70,8 +70,12 @@ } catch (NumberFormatException e) { } } - return (BigDecimal) SessionUtil + BigDecimal id = (BigDecimal) SessionUtil .getFromApplicationScope(PompeiConstants.CURRENT_CATEGORY_ID); + if (id != null) { + id = new BigDecimal(id.longValue()); + } + return id; } private boolean isProductDetails() { @@ -79,6 +83,12 @@ .getExternalContext().getRequestParameterMap().get( PompeiConstants.PRODUCT_ID); if (productId != null) { + if (SessionUtil + .getFromLocalScope(PompeiConstants.IS_FROM_DETAILS_PAGE) != null) { + SessionUtil + .removeFromLocalScope(PompeiConstants.IS_FROM_DETAILS_PAGE); + return false; + } try { long id = Long.parseLong(productId); getProductListPage().setProductId(BigDecimal.valueOf(id)); @@ -86,19 +96,17 @@ } catch (NumberFormatException e) { } } + SessionUtil.removeFromLocalScope(PompeiConstants.IS_FROM_DETAILS_PAGE); return false; } public Class<?> prerender() { - if (isProductDetails()) { - return ProductDetailsPage.class; - } - BigDecimal currentCategoryId = getCurrentCategoryId(); if (currentCategoryId == null) { currentCategoryId = PompeiConstants.ROOT_CATEGORY_ID; - //TODO should put it to session? + SessionUtil.putToApplicationScope( + PompeiConstants.CURRENT_CATEGORY_ID, currentCategoryId); } // check previous category @@ -114,8 +122,13 @@ // store category id to local session SessionUtil.putToLocalScope(PompeiConstants.CURRENT_CATEGORY_ID, - currentCategoryId); + currentCategoryId != null ? new BigDecimal(currentCategoryId + .longValue()) : null); + if (isProductDetails()) { + return ProductDetailsPage.class; + } + // set page number and size if (getProductListPage().getPageNumber() != 0 && getProductListPage().getPageSize() != 0) {