You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2012/03/25 16:02:59 UTC

svn commit: r1305038 - in /ofbiz/trunk: applications/product/config/ specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/ specialpurpose/ecommerce/webapp/ecommerce/customer/ specialpurpose/ecommerce/widget/

Author: jleroux
Date: Sun Mar 25 14:02:59 2012
New Revision: 1305038

URL: http://svn.apache.org/viewvc?rev=1305038&view=rev
Log:
A patch from Markus M. May "Add Product Reviews to the profile Screen" https://issues.apache.org/jira/browse/OFBIZ-4736

Currently there is no way for a customer to view her/his reviews created in the ecommerce application. This functionality is added with the attached patch.

Added:
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy   (with props)
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl   (with props)
Modified:
    ofbiz/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewprofile.ftl
    ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml

Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=1305038&r1=1305037&r2=1305038&view=diff
==============================================================================
--- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Sun Mar 25 14:02:59 2012
@@ -22110,6 +22110,11 @@
         <value xml:lang="zh">评价</value>
         <value xml:lang="zh_TW">評論</value>
     </property>
+    <property key="NoProductReviewsAvailable">
+        <value xml:lang="de">Keine Produtkbewertungen vorhanden</value>
+        <value xml:lang="en">No Reviews available</value>
+        <value xml:lang="fr">Aucun avis de client</value>
+    </property>
     <property key="ProductReviewsNoPendingApproval">
         <value xml:lang="de">Keine Bewertungen zur Genehmigung vorhanden</value>
         <value xml:lang="en">No Reviews Pending Approval</value>

Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy?rev=1305038&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy Sun Mar 25 14:02:59 2012
@@ -0,0 +1,29 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+
+import org.ofbiz.entity.condition.EntityOperator
+import org.ofbiz.entity.condition.EntityCondition
+
+// get the product review(s) for the given user
+if (userLogin) {
+  condition = EntityCondition.makeCondition("userLoginId", EntityOperator.EQUALS, userLogin.userLoginId);
+  reviews = delegator.findList("ProductReview", condition, null, null, null, true);
+
+  context.reviews = reviews;
+}

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewprofile.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewprofile.ftl?rev=1305038&r1=1305037&r2=1305038&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewprofile.ftl (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewprofile.ftl Sun Mar 25 14:02:59 2012
@@ -601,6 +601,9 @@ ${screens.render('component://ecommerce/
 <#-- Subscription Summary -->
 ${screens.render('component://ecommerce/widget/CustomerScreens.xml#SubscriptionSummary')}
 
+<#-- Reviews -->
+${screens.render('component://ecommerce/widget/CustomerScreens.xml#showProductReviews')}
+
 <#else>
     <h3>${uiLabelMap.PartyNoPartyForCurrentUserName}: ${userLogin.userLoginId}</h3>
 </#if>

Added: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl?rev=1305038&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl (added)
+++ ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl Sun Mar 25 14:02:59 2012
@@ -0,0 +1,46 @@
+<#--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+
+<#if reviews?has_content>
+<div class="screenlet">
+  <h3>${uiLabelMap.ProductReviews}</h3>
+  <div class="screenlet-body">
+    <table width="100%" border="0" cellpadding="1">
+      <tr>
+        <th>${uiLabelMap.EcommerceSentDate}</th>
+        <th>${uiLabelMap.ProductProductId}</th>
+        <th>${uiLabelMap.ProductReviews}</th>
+        <th>${uiLabelMap.ProductRating}</th>
+        <th>${uiLabelMap.CommonIsAnonymous}</th>
+        <th>${uiLabelMap.CommonStatus}</th>
+      </tr>
+      <#list reviews as review>
+        <tr>
+          <td>${review.postedDateTime}</td>
+          <td><a href="<@ofbizCatalogAltUrl productId=review.productId/>">${review.productId}</a></td>
+          <td>${review.productReview!}</td>
+          <td>${review.productRating}</td>
+          <td>${review.postedAnonymous}</td>
+          <td>${review.getRelatedOne("StatusItem").get("description", locale)}</td>
+        </tr>
+      </#list>
+    </table>
+  </div>
+</div>
+</#if>

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/ecommerce/webapp/ecommerce/customer/viewreviews.ftl
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml?rev=1305038&r1=1305037&r2=1305038&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml (original)
+++ ofbiz/trunk/specialpurpose/ecommerce/widget/CustomerScreens.xml Sun Mar 25 14:02:59 2012
@@ -620,4 +620,28 @@ under the License.
             </widgets>
         </section>
     </screen>
+
+    <screen name="showProductReviews">
+        <section>
+            <actions>
+                <property-map resource="ProductUiLabels" map-name="uiLabelMap" global="true"/>
+
+                <script location="component://ecommerce/webapp/ecommerce/WEB-INF/actions/customer/CustomerReviews.groovy"/>
+            </actions>
+            <widgets>
+                <section>
+                    <condition>
+                      <not>
+                        <if-empty field="reviews"/>
+                      </not>
+                    </condition>
+                    <widgets>
+                        <platform-specific><html><html-template location="component://ecommerce/webapp/ecommerce/customer/viewreviews.ftl"/></html></platform-specific>
+                    </widgets>
+              </section>
+            </widgets>
+        </section>
+    </screen>
+
+
 </screens>