cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From coli...@apache.org
Subject cvs commit: cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxpath IncludeBottom.xml IncludeMyList.xml IncludeQuickHeader.xml IncludeTop.xml Cart.xml
Date Mon, 14 Apr 2003 15:54:41 GMT
coliver     2003/04/14 08:54:41

  Modified:    src/scratchpad/webapp/samples/petstore/view/jxpath Cart.xml
  Added:       src/scratchpad/webapp/samples/petstore/view/jxpath
                        IncludeBottom.xml IncludeMyList.xml
                        IncludeQuickHeader.xml IncludeTop.xml
  Log:
  Modified Cart page to show the use of <import>
  
  Revision  Changes    Path
  1.3       +79 -24    cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxpath/Cart.xml
  
  Index: Cart.xml
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxpath/Cart.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Cart.xml	13 Apr 2003 21:52:31 -0000	1.2
  +++ Cart.xml	14 Apr 2003 15:54:40 -0000	1.3
  @@ -1,29 +1,84 @@
  -<?xml version="1.0"?>
  +<!-- Example of <import> -->
  +<html xmlns:t="http://cocoon.apache.org/transformation/jxpath/1.0">
  +<body>
  +<t:import uri="view/jxpath/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">&lt;&lt; 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>
   
  -<page xmlns:jxpath="http://cocoon.apache.org/transformation/jxpath/1.0">
  -    <site signOn="{accountForm/signOn}" view="jxpath">
  -        <cart name="Shopping Cart" >
  -            <backpointer name="Main Menu" do="index.do" />
  -            <jxpath:for-each select="{cartItems}" >
  -                <item productId="{item/productId}" id="{item/itemid}"> 
  -                    <desc>
  -                        <jxpath:value-of select="{item/attr1}"/> 
  -                        <jxpath:value-of select="{item/attr2}"/> 
  -                        <jxpath:value-of select="{item/attr3}"/> 
  -                        <jxpath:value-of select="{item/attr4}"/> 
  -                        <jxpath:value-of select="{item/attr5}"/> 
  -                        <jxpath:value-of select="{item/product/name}"/> 
  -                    </desc>
  -                    <price><jxpath:value-of select="{item/listPrice}"/></price>
  -                    <quantity><jxpath:value-of select="{quantity}"/></quantity>
  -                </item>
  -            </jxpath:for-each>
  -            <total><jxpath:value-of select="{cartForm/cart/subTotal}"/></total>
  -            <nextpointer do="checkout.do" img="images/button_checkout.gif" />
  -        </cart>
  -    </site>
  +<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:for-each select="{cartItems}">
  +  <tr bgcolor="#FFFF88">
  +  <td><b>
  + {item/itemId}
  + <a href="viewItem.do?cartItem={item/itemId}">
  +</a></b></td>
  +  <td>{item/productId}</td>
  +  <td>
  +     {item/attr1}
  +     {item/attr2}
  +     {item/attr3}
  +     {item/attr4}
  +     {item/attr5}
  +     {item/product/name}
  +   </td>
  +  <td align="center">
  +  <input type="text" size="3" name="{item/itemId}" value="{quantity}" />
  +  </td>
  +  <td align="right">{ format-number(item/listPrice, '$#,##0.00') }"/></td>
  +  <td><a href="removeItemFromCart.do?workingItemId={item/itemId}">
  +  <img border="0" src="images/button_remove.gif" /></a></td>
  +  </tr>
  +</t:for-each>
  +<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/jxpath/IncludeMyList.xml"/>
  +    </t:if>
  +  </t:if>
  + </t:if>
  +</t:if>
  +</td>
  +
  +</tr>
  +</table>
  +<t:import uri="view/jxpath/IncludeBottom.xml"/>
  +</body>
  +</html>
   
  -</page>
   
   
   
  
  
  
  1.1                  cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxpath/IncludeBottom.xml
  
  Index: IncludeBottom.xml
  ===================================================================
  <c:template xmlns:c="http://cocoon.apache.org/transformation/jxpath/1.0">
  <br />
  <c:if test="{accountForm/account}">
    <c:if test="{accountForm/account/username}">
      <c:if test="{accountForm/account/bannerOption}">
        <table align="center" background="images/bkg-topbar.gif" cellpadding="5" width="100%">
        <tr><td>
  <c:if test="{accountForm/account/bannerName}"> 
        <center>
            <image>
            <c:value-of select="{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/jxpath/IncludeMyList.xml
  
  Index: IncludeMyList.xml
  ===================================================================
  <t:template xmlns:t="http://cocoon.apache.org/transformation/jxpath/1.0">
  <t:if test="{myList}">
  <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:for-each select="{myList}"> 
      <a href="viewProduct.do?productId={product/productId}">
          {product/name}</a>
      <br />
      <font size="2">{product/productId}</font>
      <br />
  </t:for-each>
    </td>
    </tr>
    <tr>
    <td>
  <t:if test="{not(accountForm/myListPage/firstPage)}">
      <a href="?page=previous"><font color="white"><B>&lt;&lt; Prev</B></font></a>
  </t:if>
  <t:if test="{not(accountForm/myListPage/lastPage)}">
      <a href="?page=next"><font color="white"><B>Next &gt;&gt;</B></font></a>
  </t:if>
    </td>
    </tr>
  
  </table>
  </t:if>
  </t:template>
  
  
  
  
  
  
  
  1.1                  cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/jxpath/IncludeQuickHeader.xml
  
  Index: IncludeQuickHeader.xml
  ===================================================================
  <t:template xmlns:t="http://cocoon.apache.org/transformation/jxpath/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/jxpath/IncludeTop.xml
  
  Index: IncludeTop.xml
  ===================================================================
  <t:template xmlns:t="http://cocoon.apache.org/transformation/jxpath/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="JXPath" onChange="document.forms[0].submit()">
            <option value="JXPath">JXPath</option>
            <option value="Velocity">Velocity</option>
            <option value="Jexl">Jexl</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/jxpath/IncludeQuickHeader.xml"/>
  
  <!-- Support for non-traditional but simpler use of errors... -->
  <t:if test="{errors}">
    <t:for-each select="{errors}">
      <B><FONT color="RED">
        <BR>{.}</BR>
      </FONT></B>
    </t:for-each>
  </t:if>
  </t:template>
  
  

Mime
View raw message