review.jsp
Home
/
sm-shop /
src /
main /
webapp /
pages /
shop /
common /
catalog /
review.jsp
<%
response.setCharacterEncoding("UTF-8");
response.setHeader("Cache-Control","no-cache");
response.setHeader("Pragma","no-cache");
response.setDateHeader ("Expires", -1);
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="sec" %>
<%@ taglib uri="/WEB-INF/shopizer-tags.tld" prefix="sm"%>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<script src="<c:url value="/resources/js/jquery.raty.min.js" />"></script>
<div id="review" class="row-fluid">
<p class="lead"><s:message code="label.product.rate"/></p>
<div id="store.success" class="alert alert-success" style="<c:choose><c:when test="${success!=null}">display:block;</c:when><c:otherwise>display:none;</c:otherwise></c:choose>">
<s:message code="message.productreview.created" text="You have successfully created a product review" />
</div>
<div class="span12 no_margin">
<div class="span6">
<table class="table" style="margin-bottom: 35px">
<tbody>
<tr>
<c:if test="${product.image!=null}">
<td>
<img width="60" src="<c:url value="${product.image.imageUrl}"/>">
</td>
</c:if>
<td>
<table>
<tr>
<td style="border-top: none;"><c:out value="${product.description.name}" /></td>
</tr>
<tr>
<td style="border-top: none;">
<c:set var="HIDEACTION" value="TRUE" scope="request" />
<!-- product rating -->
<jsp:include page="/pages/shop/common/catalog/rating.jsp" />
</td>
</tr>
</table>
</td>
<td>
<c:out value="${product.finalPrice}"/>
</td>
</tr>
</tbody>
</table>
<br/>
<sec:authorize access="hasRole('AUTH_CUSTOMER') and fullyAuthenticated">
<c:choose>
<c:when test="${customerReview!=null}">
<p>
<s:message code="label.product.reviews.evaluated" text="You have evaluated this product"/>
<br/>
<div id="customerRating" style="width: 100px;"></div>
<br/>
<blockquote>
<p><c:out value="${customerReview.description}" escapeXml="false" /></p>
<small><c:out value="${customerReview.customer.firstName}" /> <c:out value="${customerReview.customer.lastName}"/> <c:out value="${customerReview.date}" /></small>
</blockquote>
</p>
<script>
$(function() {
$('#customerRating').raty({
readOnly: true,
half: true,
path : '<c:url value="/resources/img/stars/"/>',
score: <c:out value="${customerReview.rating}" />
});
});
</script>
</p>
</c:when>
<c:otherwise>
<c:url var="submitReview" value="/shop/customer/review/submit.html"/>
<form:form method="POST" commandName="review" action="${submitReview}">
<form:errors path="*" cssClass="alert alert-error" element="div" />
<form:hidden id="rating" path="rating"/>
<form:hidden path="productId"/>
<label><s:message code="label.generic.youropinion" text="Your opinion" /></label>
<form:textarea name="" rows="6" class="span6" path="description"/>
<label> </label>
<span class="help-block"><s:message code="label.product.clickrate" text="Product rating (click on the stars to activate rating)" /></span>
<div id="rateMe" style="width: 100px;"></div>
<script>
$(function() {
$('#rateMe').raty({
readOnly: false,
half: true,
path : '<c:url value="/resources/img/stars/"/>',
score: 5,
click: function(score, evt) {
$('#rating').val(score);
}
});
});
</script>
<br/>
<button type="submit" class="btn"><s:message code="button.label.submit2" text="Submit"/></button>
</form:form>
</c:otherwise>
</c:choose>
</sec:authorize>
</div>
<div class="span6"> </div>
</div>
</div>
<sec:authorize access="!hasRole('AUTH_CUSTOMER') and !fullyAuthenticated">
<p class="muted"><s:message code="label.product.reviews.logon.write" text="You have to be authenticated to write a review" /></p>
</sec:authorize>