You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by co...@apache.org on 2003/04/15 22:24:45 UTC
cvs commit: cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl IncludeBottom.xml IncludeMyList.xml IncludeQuickHeader.xml IncludeTop.xml Cart.xml
coliver 2003/04/15 13:24:44
Modified: src/scratchpad/webapp/samples/petstore/view/jexl Cart.xml
Added: src/scratchpad/webapp/samples/petstore/view/jexl
IncludeBottom.xml IncludeMyList.xml
IncludeQuickHeader.xml IncludeTop.xml
Log:
refactored Cart page for testing import and define
Revision Changes Path
1.2 +89 -24 cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl/Cart.xml
Index: Cart.xml
===================================================================
RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl/Cart.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Cart.xml 27 Mar 2003 18:59:23 -0000 1.1
+++ Cart.xml 15 Apr 2003 20:24:44 -0000 1.2
@@ -1,25 +1,90 @@
-<?xml version="1.0"?>
+<!--
+ Examples of <import>
+ You can use embedded expressions in the import "uri" and you can
+ [optionally] select a context object for the imported template
+-->
+
+<html xmlns:t="http://cocoon.apache.org/transformation/jexl/1.0">
+<body>
+<t:import uri="view/jexl/IncludeTop.xml"/>
+<table border="0" width="100%" cellspacing="0" cellpadding="0">
+<tr><td valign="top" width="20%" align="left">
+<table align="left" bgcolor="#008800" border="0" cellspacing="2" cellpadding="2">
+<tr><td bgcolor="#FFFF88">
+<a href="index.do"><b><font color="BLACK" size="2"><< Main Menu</font></b></a>
+</td></tr>
+</table>
+</td><td valign="top" align="center">
+<h2 align="center">Shopping Cart</h2>
+<form action="updateCartQuantities.do" method="post" >
+<table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="5">
+ <tr bgcolor="#cccccc">
+ <td><b>Item ID</b></td> <td><b>Product ID</b></td> <td><b>Description</b></td> <td><b>Quantity</b></td> <td><b>List Price</b></td> <td> </td>
+ </tr>
+
+<t:if test="#{number(cartForm/cart/numberOfItems) = 0}">
+<tr bgcolor="#FFFF88"><td colspan="6"><b>Your cart is empty.</b></td></tr>
+</t:if>
+<t:forEach var="cartItem" items="${cartItems}">
+ <tr bgcolor="#FFFF88">
+ <td><b>
+ ${cartItem.item.itemId}
+ <a href="viewItem.do?cartItem=${cartItem.item.itemId}">
+</a></b></td>
+ <td>${cartItem.item.productId}</td>
+ <td>
+ ${cartItem.item.attr1}
+ ${cartItem.item.attr2}
+ ${cartItem.item.attr3}
+ ${cartItem.item.attr4}
+ ${cartItem.item.attr5}
+ ${cartItem.item.product.name}
+ </td>
+ <td align="center">
+ <input type="text" size="3" name="${cartItem.item.ItemId}" value="${cartItem.quantity}" />
+ </td>
+ <td align="right">#{format-number(item/listPrice, '$#,##0.00')}</td>
+ <td><a href="removeItemFromCart.do?workingItemId=${cartItem.item.itemId}">
+ <img border="0" src="images/button_remove.gif" /></a></td>
+ </tr>
+</t:forEach>
+<tr bgcolor="#FFFF88">
+<td colspan="5" align="right">
+
+<b>Sub Total: #{ format-number(cartForm/cart/subTotal, '$#,##0.00') }</b><br />
+<input type="image" border="0" src="images/button_update_cart.gif" name="update" />
+
+</td><td> </td>
+</tr>
+</table>
+</form>
+
+<t:if test="#{number(cartForm/cart/numberOfItems) > 0}">
+<br /><center><a href="checkout.do"><img border="0" src="images/button_checkout.gif" /></a></center>
+</t:if>
+
+</td>
+
+
+<td valign="top" width="20%" align="right">
+<t:if test="#{accountForm}">
+ <t:if test="#{accountForm/account}">
+ <t:if test="#{accountForm/account/username}">
+ <t:if test="#{accountForm/account/listOption}">
+ <t:import uri="view/jexl/IncludeMyList.xml"/>
+ </t:if>
+ </t:if>
+ </t:if>
+</t:if>
+</td>
+
+</tr>
+</table>
+<t:import uri="view/jexl/IncludeBottom.xml"/>
+</body>
+</html>
+
+
+
+
-<page xmlns:jexl="http://cocoon.apache.org/transformation/jexl/1.0">
- <site signOn="${accountForm.signOn}" view="jexl">
- <cart name="Shopping Cart" >
- <backpointer name="Main Menu" do="index.do" />
- <jexl:forEach var="cartItem" items="${cartItems}" >
- <item productId="${cartItem.item.productId}" id="${cartItem.item.itemId}">
- <desc>
- <jexl:out value="${cartItem.item.attr1}"/>
- <jexl:out value="${cartItem.item.attr2}"/>
- <jexl:out value="${cartItem.item.attr3}"/>
- <jexl:out value="${cartItem.item.attr4}"/>
- <jexl:out value="${cartItem.item.attr5}"/>
- <jexl:out value="${cartItem.item.product.name}"/>
- </desc>
- <price><jexl:out value="${cartItem.item.listPrice}"/></price>
- <quantity><jexl:out value="${cartItem.quantity}"/></quantity>
- </item>
- </jexl:forEach>
- <total><jexl:out value="${cartForm.cart.subTotal}"/></total>
- <nextpointer do="checkout.do" img="images/button_checkout.gif" />
- </cart>
- </site>
-</page>
1.1 cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl/IncludeBottom.xml
Index: IncludeBottom.xml
===================================================================
<c:template xmlns:c="http://cocoon.apache.org/transformation/jexl/1.0">
<br />
<c:if test="${accountForm.account != null}">
<c:if test="${accountForm.account.username != null}">
<c:if test="${accountForm.account.bannerOption != null}">
<table align="center" background="images/bkg-topbar.gif" cellpadding="5" width="100%">
<tr><td>
<c:if test="${accountForm.account.bannerName != null}">
<center>
<image>
<c:out value="${accountForm.account.bannerName}"/>
</image>
</center>
</c:if>
</td></tr>
</table>
</c:if>
</c:if>
</c:if>
<p align="center">
<a href="http://cocoon.apache.org"><img border="0" align="center" src="images/cocoon.gif" /></a>
</p>
</c:template>
1.1 cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl/IncludeMyList.xml
Index: IncludeMyList.xml
===================================================================
<t:template xmlns:t="http://cocoon.apache.org/transformation/jexl/1.0">
<t:if test="${myList != null}">
<p> </p>
<table align="right" bgcolor="#008800" border="0" cellspacing="2" cellpadding="3">
<tr bgcolor="#CCCCCC"><td>
<font size="4"><b>Pet Favorites</b></font>
<font size="2"><i><br />Shop for more of your <br />favorite pets here.</i></font>
</td></tr>
<tr bgcolor="#FFFF88">
<td>
<t:forEach var="item" items="${myList}">
<a href="viewProduct.do?productId=${item.product.productId}">
${item.product.name}</a>
<br />
<font size="2">${item.product.productId}</font>
<br />
</t:forEach>
</td>
</tr>
<tr>
<td>
<t:if test="${!accountForm.myListPage.firstPage}}">
<a href="?page=previous"><font color="white"><B><< Prev</B></font></a>
</t:if>
<t:if test="${!accountForm.myListPage.lastPage}">
<a href="?page=next"><font color="white"><B>Next >></B></font></a>
</t:if>
</td>
</tr>
</table>
</t:if>
</t:template>
1.1 cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl/IncludeQuickHeader.xml
Index: IncludeQuickHeader.xml
===================================================================
<t:template xmlns:t="http://cocoon.apache.org/transformation/jexl/1.0">
<center>
<a href="viewCategory.do?categoryId=FISH">
<img border="0" src="images/sm_fish.gif" /></a>
<img border="0" src="images/separator.gif" />
<a href="viewCategory.do?categoryId=DOGS">
<img border="0" src="images/sm_dogs.gif" /></a>
<img border="0" src="images/separator.gif" />
<a href="viewCategory.do?categoryId=REPTILES">
<img border="0" src="images/sm_reptiles.gif" /></a>
<img border="0" src="images/separator.gif" />
<a href="viewCategory.do?categoryId=CATS">
<img border="0" src="images/sm_cats.gif" /></a>
<img border="0" src="images/separator.gif" />
<a href="viewCategory.do?categoryId=BIRDS">
<img border="0" src="images/sm_birds.gif" /></a>
</center>
</t:template>
1.1 cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jexl/IncludeTop.xml
Index: IncludeTop.xml
===================================================================
<t:template xmlns:t="http://cocoon.apache.org/transformation/jexl/1.0">
<table background="images/bkg-topbar.gif" border="0" cellspacing="0" cellpadding="5" width="100%">
<tbody>
<tr>
<td>
<form method="post" action="index.do">
<input type="image" border="0" src="images/logo-topbar.gif"/>
<select name="view" width="14" align="left" value="Jexl" onChange="document.forms[0].submit()">
<option value="Jexl">Jexl</option>
<option value="Velocity">Velocity</option>
<option value="JXPath">JXPath</option>
<option value="Xsp">Xsp</option>
</select>
</form>
</td>
<td align="right"><a href="viewCart.do"><img border="0" name="img_cart" src="images/cart.gif" /></a>
<img border="0" src="images/separator.gif" />
<t:choose>
<t:when test="${accountForm.signOn}">
<a href="signonForm.do">
<img border="0" name="img_signin" src="images/sign-in.gif" /></a>
</t:when>
<t:otherwise>
<a href="signonForm.do?signoff=true">
<img border="0" name="img_signout" src="images/sign-out.gif" /></a>
<img border="0" src="images/separator.gif" />
<a href="editAccount.form">
<img border="0" name="img_myaccount" src="images/my_account.gif" /></a>
</t:otherwise>
</t:choose>
<img border="0" src="images/separator.gif" /><a href="../help.html"><img border="0" name="img_help" src="images/help.gif" /></a>
</td>
<td align="left" valign="bottom">
<form method="post" action="searchProducts.do">
<input name="keyword" size="14" /> <input border="0" src="images/search.gif" type="image" />
</form>
</td>
</tr>
</tbody>
</table>
<t:import uri="view/jexl/IncludeQuickHeader.xml"/>
<!-- Support for non-traditional but simpler use of errors... -->
<t:if test="${errors != null}">
<t:forEach select="${errors}">
<B><FONT color="RED">
<BR>{.}</BR>
</FONT></B>
</t:forEach>
</t:if>
</t:template>