svn commit: r883280 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/content/ content/servicedef/ product/config/ product/webapp/catalog/WEB-INF/ product/webapp/catalog/product/ product/widget/catalog/

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r883280 - in /ofbiz/trunk/applications: content/script/org/ofbiz/content/content/ content/servicedef/ product/config/ product/webapp/catalog/WEB-INF/ product/webapp/catalog/product/ product/widget/catalog/

jleroux@apache.org
Author: jleroux
Date: Mon Nov 23 08:48:43 2009
New Revision: 883280

URL: http://svn.apache.org/viewvc?rev=883280&view=rev
Log:
A patch from Surya Kusumakar "New feature to upload multiple Additional View Images at Product Content." (https://issues.apache.org/jira/browse/OFBIZ-3244) - OFBIZ-3244
Add a new feature in Product Content to add all four images at a time and one can preview those images in larger view on mouse over of particular image.

Added:
    ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl   (with props)
Modified:
    ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
    ofbiz/trunk/applications/content/servicedef/services_content.xml
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
    ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml

Modified: ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml?rev=883280&r1=883279&r2=883280&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml (original)
+++ ofbiz/trunk/applications/content/script/org/ofbiz/content/content/ContentServices.xml Mon Nov 23 08:48:43 2009
@@ -1220,4 +1220,45 @@
         <field-to-result field="subContentList" result-name="subContentList"/>
         <field-to-result field="contentViewList" result-name="subSubContentList"/>
     </simple-method>
+
+    <simple-method method-name="uploadAdditionalViewImages" short-description="Method to upload multiple Additional View images">
+        <set-service-fields service-name="addAdditionalViewForProduct" map="parameters" to-map="addAdditionalViewForProductMap"/>
+        <if-not-empty field="parameters.additionalImageOne">
+            <set field="addAdditionalViewForProductMap.productId" from-field="parameters.productId"/>
+            <set field="addAdditionalViewForProductMap.uploadedFile" from-field="parameters.additionalImageOne"/>
+            <set field="addAdditionalViewForProductMap.productContentTypeId" value="ADDITIONAL_IMAGE_1"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_fileName" from-field="parameters._additionalImageOne_fileName"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_contentType" from-field="parameters._additionalImageOne_contentType"/>
+            <call-service service-name="addAdditionalViewForProduct" in-map-name="addAdditionalViewForProductMap"/>
+            <clear-field field="addAdditionalViewForProductMap"/>
+        </if-not-empty>
+        <if-not-empty field="parameters.additionalImageTwo">
+            <set field="addAdditionalViewForProductMap.productId" from-field="parameters.productId"/>
+            <set field="addAdditionalViewForProductMap.uploadedFile" from-field="parameters.additionalImageTwo"/>
+            <set field="addAdditionalViewForProductMap.productContentTypeId" value="ADDITIONAL_IMAGE_2"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_fileName" from-field="parameters._additionalImageTwo_fileName"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_contentType" from-field="parameters._additionalImageTwo_contentType"/>
+            <call-service service-name="addAdditionalViewForProduct" in-map-name="addAdditionalViewForProductMap"/>
+            <clear-field field="addAdditionalViewForProductMap"/>
+        </if-not-empty>
+        <if-not-empty field="parameters.additionalImageThree">
+            <set field="addAdditionalViewForProductMap.productId" from-field="parameters.productId"/>
+            <set field="addAdditionalViewForProductMap.uploadedFile" from-field="parameters.additionalImageThree"/>
+            <set field="addAdditionalViewForProductMap.productContentTypeId" value="ADDITIONAL_IMAGE_3"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_fileName" from-field="parameters._additionalImageThree_fileName"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_contentType" from-field="parameters._additionalImageThree_contentType"/>
+            <call-service service-name="addAdditionalViewForProduct" in-map-name="addAdditionalViewForProductMap"/>
+            <clear-field field="addAdditionalViewForProductMap"/>
+        </if-not-empty>
+        <if-not-empty field="parameters.additionalImageFour">
+            <set field="addAdditionalViewForProductMap.productId" from-field="parameters.productId"/>
+            <set field="addAdditionalViewForProductMap.uploadedFile" from-field="parameters.additionalImageFour"/>
+            <set field="addAdditionalViewForProductMap.productContentTypeId" value="ADDITIONAL_IMAGE_4"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_fileName" from-field="parameters._additionalImageFour_fileName"/>
+            <set field="addAdditionalViewForProductMap._uploadedFile_contentType" from-field="parameters._additionalImageFour_contentType"/>
+            <call-service service-name="addAdditionalViewForProduct" in-map-name="addAdditionalViewForProductMap"/>
+            <clear-field field="addAdditionalViewForProductMap"/>
+        </if-not-empty>
+        <field-to-result field="parameters.productId" result-name="productId"/>
+    </simple-method>
 </simple-methods>

Modified: ofbiz/trunk/applications/content/servicedef/services_content.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/servicedef/services_content.xml?rev=883280&r1=883279&r2=883280&view=diff
==============================================================================
--- ofbiz/trunk/applications/content/servicedef/services_content.xml (original)
+++ ofbiz/trunk/applications/content/servicedef/services_content.xml Mon Nov 23 08:48:43 2009
@@ -323,4 +323,22 @@
         <permission-service service-name="genericContentPermission" main-action="UPDATE"/>
         <auto-attributes entity-name="ContentRole" include="pk" mode="IN" optional="false"/>
     </service>
+    <service name="uploadAdditionalViewImages" engine="simple" location="component://content/script/org/ofbiz/content/content/ContentServices.xml"
+            auth="true" invoke="uploadAdditionalViewImages">
+        <description>Upload Additional View Images</description>
+        <permission-service service-name="genericContentPermission" main-action="UPDATE"/>
+        <attribute name="productId" type="String" mode="INOUT" optional="false"/>
+        <attribute name="additionalImageOne" type="java.nio.ByteBuffer" mode="IN" optional="true"/>
+        <attribute name="_additionalImageOne_fileName" type="String" mode="IN" optional="true"/>
+        <attribute name="_additionalImageOne_contentType" type="String" mode="IN" optional="true"/>
+        <attribute name="additionalImageTwo" type="java.nio.ByteBuffer" mode="IN" optional="true"/>
+        <attribute name="_additionalImageTwo_fileName" type="String" mode="IN" optional="true"/>
+        <attribute name="_additionalImageTwo_contentType" type="String" mode="IN" optional="true"/>
+        <attribute name="additionalImageThree" type="java.nio.ByteBuffer" mode="IN" optional="true"/>
+        <attribute name="_additionalImageThree_fileName" type="String" mode="IN" optional="true"/>
+        <attribute name="_additionalImageThree_contentType" type="String" mode="IN" optional="true"/>
+        <attribute name="additionalImageFour" type="java.nio.ByteBuffer" mode="IN" optional="true"/>
+        <attribute name="_additionalImageFour_fileName" type="String" mode="IN" optional="true"/>
+        <attribute name="_additionalImageFour_contentType" type="String" mode="IN" optional="true"/>
+    </service>
 </services>

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=883280&r1=883279&r2=883280&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Mon Nov 23 08:48:43 2009
@@ -6641,6 +6641,9 @@
         <value xml:lang="th">การขนส่งโดยแท้จริง</value>
         <value xml:lang="zh">实际运输</value>
     </property>
+    <property key="ProductAddAdditionalImages">
+        <value xml:lang="en">Add Additional Images</value>
+    </property>
     <property key="ProductAddCatalogProdCat">
         <value xml:lang="de">Kategorie zu diesem Katalog hinzufügen (Kategorie und Typ auswählen, optionales Von Datum angeben)</value>
         <value xml:lang="en">Add a Category to this Catalog (select Category and Type, then enter optional From Date)</value>

Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=883280&r1=883279&r2=883280&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original)
+++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Mon Nov 23 08:48:43 2009
@@ -629,6 +629,12 @@
         <security https="true" auth="true"/>
         <response name="success" type="view" value="EditProductContentContent"/>
     </request-map>
+    <request-map uri="addAdditionalImagesForProduct">
+        <security https="true" auth="true"/>
+        <event type="service" invoke="uploadAdditionalViewImages"/>
+        <response name="success" type="view" value="EditProductContent"/>
+        <response name="error" type="view" value="EditProductContent"/>
+    </request-map>
     <request-map uri="addContentToProduct">
         <security https="true" auth="true"/>
         <event type="service" path="" invoke="createProductContent"/>

Added: ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl?rev=883280&view=auto
==============================================================================
--- ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl (added)
+++ ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl Mon Nov 23 08:48:43 2009
@@ -0,0 +1,38 @@
+<#if product?has_content>
+  <#assign productAdditionalImage1 = (Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(product, "ADDITIONAL_IMAGE_1", locale, dispatcher))?if_exists />
+  <#assign productAdditionalImage2 = (Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(product, "ADDITIONAL_IMAGE_2", locale, dispatcher))?if_exists />
+  <#assign productAdditionalImage3 = (Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(product, "ADDITIONAL_IMAGE_3", locale, dispatcher))?if_exists />
+  <#assign productAdditionalImage4 = (Static["org.ofbiz.product.product.ProductContentWrapper"].getProductContentAsText(product, "ADDITIONAL_IMAGE_4", locale, dispatcher))?if_exists />
+</#if>
+<form id="addAdditionalImagesForm" method="post" action="<@ofbizUrl>addAdditionalImagesForProduct</@ofbizUrl>" enctype="multipart/form-data">
+  <input id="additionalImageProductId" type="hidden" name="productId" value="${productId?if_exists}" />
+  <table>
+    <tbody>
+      <tr>
+        <td><#if productAdditionalImage1?has_content><a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage1}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage1}</@ofbizContentUrl>" height="50" width="50"/></a></#if></td>
+        <td><input id="additionalImageOne" type="file" size="20" name="additionalImageOne" /></td>
+      </tr>
+      </br></br>
+      <tr>
+        <td><#if productAdditionalImage2?has_content><a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage2}</@ofbizContentUrl>" ><img src="<@ofbizContentUrl>${productAdditionalImage2}</@ofbizContentUrl>" height="50" width="50" /></a></#if></td>
+        <td><input type="file" size="20" name="additionalImageTwo" /></td>
+      </tr>
+      <tr>
+        <td><#if productAdditionalImage3?has_content><a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage3}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage3}</@ofbizContentUrl>" height="50" width="50" /></a></#if></td>
+        <td><input type="file" size="20" name="additionalImageThree" /></td>
+      </tr>
+      <tr>
+        <td><#if productAdditionalImage4?has_content><a href="javascript:void(0);" swapDetail="<@ofbizContentUrl>${productAdditionalImage4}</@ofbizContentUrl>"><img src="<@ofbizContentUrl>${productAdditionalImage4}</@ofbizContentUrl>" height="50" width="50" /></a></#if></td>
+        <td><input type="file" size="20" name="additionalImageFour" /></td>
+      </tr>
+      <tr>
+        <td></td>
+        <td><input type="submit" value='${uiLabelMap.CommonUpload}' /></td>
+      </tr>
+    </tbody>
+  </table>
+  <div class="right" style='margin-top:-250px;'>
+    <a href="javascript:void(0);"><img id="detailImage" name="mainImage" vspace="5" hspace="5" width="150" height="150" style='margin-left:50px'/></a>
+    <input type="hidden" id="originalImage" name="originalImage" />
+  </div>
+</form>

Propchange: ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl
------------------------------------------------------------------------------
    svn:keywords = "Date Rev Author URL Id"

Propchange: ofbiz/trunk/applications/product/webapp/catalog/product/AddAdditionalImages.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=883280&r1=883279&r2=883280&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml (original)
+++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Mon Nov 23 08:48:43 2009
@@ -827,6 +827,7 @@
 
                 <set field="productId" from-field="parameters.productId"/>
                 <entity-one entity-name="Product" value-field="product"/>
+                <set field="layoutSettings.javaScripts[]" value="/ecommerce/images/productAdditionalView.js" global="true"/>
                 <script location="component://product/webapp/catalog/WEB-INF/actions/product/EditProductContent.groovy"/>
             </actions>
             <widgets>
@@ -846,6 +847,11 @@
                                 <html><html-template location="component://product/webapp/catalog/product/EditProductContent.ftl"/></html>
                             </platform-specific>
                         </screenlet>
+                        <screenlet title="${uiLabelMap.ProductAddAdditionalImages}">
+                            <platform-specific>
+                                <html><html-template location="component://product/webapp/catalog/product/AddAdditionalImages.ftl"/></html>
+                            </platform-specific>
+                        </screenlet>
                     </decorator-section>
                 </decorator-screen>
             </widgets>