[pal-cvs 2969] [713] display larger image from details page.

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2007年 11月 20日 (火) 12:39:02 JST


Revision: 713
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=713
Author:   shinsuke
Date:     2007-11-20 12:39:02 +0900 (Tue, 20 Nov 2007)

Log Message:
-----------
display larger image from details page.

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/ProductDetailsAction.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java
    pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java
    pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html


-------------- 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-20 02:41:52 UTC (rev 712)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/PompeiConstants.java	2007-11-20 03:39:02 UTC (rev 713)
@@ -121,6 +121,8 @@
 
     public static final BigDecimal DETAILS_IMAGE_TYPE = new BigDecimal(2);
 
+    public static final BigDecimal LARGE_IMAGE_TYPE = new BigDecimal(3);
+
     public static final String THUMBNAIL_IMAGE_URL = "thumbnailImageUrl";
 
     public static final String DEFAULT_THUMBNAIL_IMAGE_NAME = "noimage.png";

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-20 02:41:52 UTC (rev 712)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsAction.java	2007-11-20 03:39:02 UTC (rev 713)
@@ -130,6 +130,23 @@
                                     .getProductImageUrl(PompeiConstants.DEFAULT_DETAILS_IMAGE_NAME));
         }
 
+        // large image
+        ProductImage largeProductImage = getProductService()
+                .getProductImageByProductIdAndType(
+                        productDetailsPage.getProductId(),
+                        PompeiConstants.LARGE_IMAGE_TYPE);
+        if (largeProductImage != null) {
+            getProductDetailsPage().setLargeImageUrl(
+                    UploadedFileUtil.getProductImageUrl(largeProductImage
+                            .getImageName()));
+        } else {
+            // default image
+            getProductDetailsPage()
+                    .setLargeImageUrl(
+                            UploadedFileUtil
+                                    .getProductImageUrl(PompeiConstants.DEFAULT_DETAILS_IMAGE_NAME));
+        }
+
         // set title
         SystemUtil.setWindowTitle(getProductDetailsPage().getLabelHelper()
                 .getLabelValue("windowTitle"));

Modified: pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-11-20 02:41:52 UTC (rev 712)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductDetailsPage.java	2007-11-20 03:39:02 UTC (rev 713)
@@ -41,6 +41,8 @@
 
     private String detailsImageUrl;
 
+    private String largeImageUrl;
+
     private boolean user;
 
     private boolean login;
@@ -224,6 +226,10 @@
         return getDetailsImageUrl();
     }
 
+    public String getDetailsImageAlt() {
+        return getTitle();
+    }
+
     /**
      * @return detailsImageUrl
      */
@@ -286,4 +292,26 @@
     public void setLabelHelper(LabelHelper labelHelper) {
         this.labelHelper = labelHelper;
     }
+
+    /**
+     * @return the largeImageUrl
+     */
+    public String getLargeImageUrl() {
+        return largeImageUrl;
+    }
+
+    /**
+     * @param largeImageUrl the largeImageUrl to set
+     */
+    public void setLargeImageUrl(String largeImageUrl) {
+        this.largeImageUrl = largeImageUrl;
+    }
+
+    public String getLargeImageHref() {
+        return getLargeImageUrl();
+    }
+
+    public String getLargeImageTitle() {
+        return getName();
+    }
 }

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-20 02:41:52 UTC (rev 712)
+++ pompei/portlets/pompei-core/trunk/src/main/java/jp/sf/pal/pompei/web/user/product/ProductListAction.java	2007-11-20 03:39:02 UTC (rev 713)
@@ -110,15 +110,13 @@
                     PompeiConstants.CURRENT_CATEGORY_ID, currentCategoryId);
         }
 
+        boolean isChangeCategory = false;
         // check previous category
         BigDecimal previousCategoryId = (BigDecimal) SessionUtil
                 .getFromLocalScope(PompeiConstants.CURRENT_CATEGORY_ID);
         if (previousCategoryId != null
                 && !previousCategoryId.equals(currentCategoryId)) {
-            // change category
-            getProductListPage().setPageNumber(
-                    PompeiConstants.DEFAULT_CURRENT_PAGE_NUMBER);
-            getProductListPage().setPageSize(PompeiConstants.DEFAULT_PAGE_SIZE);
+            isChangeCategory = true;
         }
 
         // store category id to local session
@@ -126,14 +124,22 @@
                 currentCategoryId != null ? new BigDecimal(currentCategoryId
                         .longValue()) : null);
 
-        if (isProductDetails()) {
-            return ProductDetailsPage.class;
-        }
+        if (isChangeCategory) {
+            // change category
+            getProductListPage().setPageNumber(
+                    PompeiConstants.DEFAULT_CURRENT_PAGE_NUMBER);
+            getProductListPage().setPageSize(PompeiConstants.DEFAULT_PAGE_SIZE);
 
-        // set page number and size
-        if (getProductListPage().getPageNumber() != 0
-                && getProductListPage().getPageSize() != 0) {
-            getPagerDxo().convert(getProductListPage(), getProductPager());
+        } else {
+            if (isProductDetails()) {
+                return ProductDetailsPage.class;
+            }
+
+            // set page number and size
+            if (getProductListPage().getPageNumber() != 0
+                    && getProductListPage().getPageSize() != 0) {
+                getPagerDxo().convert(getProductListPage(), getProductPager());
+            }
         }
 
         // set display mode

Modified: pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html
===================================================================
--- pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html	2007-11-20 02:41:52 UTC (rev 712)
+++ pompei/portlets/pompei-core/trunk/src/main/webapp/view/user/product/productDetails.html	2007-11-20 03:39:02 UTC (rev 713)
@@ -13,7 +13,7 @@
 <input id="productId" type="hidden" />
 <table style="width: 95%;">
   <tr>
-    <td width="300"><img id="detailsImage" src="" alt="画像" /></td>
+    <td width="300"><a id="largeImage" href="" title="" target="_blank"><img id="detailsImage" src="" alt="画像" border="0"/></a></td>
     <td align="left">
       <div><span id="title">タイトル</span></div>
       <hr style="border-top: 1px dashed #999999;height: 1px;color: #ffffff;" size="1" noshade="noshade"/>


pal-cvs メーリングリストの案内
Back to archive index