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/templates IncludeTop.vm
Date Thu, 20 Mar 2003 06:37:59 GMT
coliver     2003/03/19 22:37:59

  Modified:    src/scratchpad/webapp/samples/petstore sitemap.xmap
               src/scratchpad/webapp/samples/petstore/flow petstore.js
               src/scratchpad/webapp/samples/petstore/stylesheets
                        site2html.xsl
               src/scratchpad/webapp/samples/petstore/view/templates
                        IncludeTop.vm
  Log:
  weak attempt at making views (Velocity or Xsp right now) dynamically selectable: please
improve this!
  
  Revision  Changes    Path
  1.7       +2 -15     cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- sitemap.xmap	17 Mar 2003 16:05:06 -0000	1.6
  +++ sitemap.xmap	20 Mar 2003 06:37:58 -0000	1.7
  @@ -59,29 +59,16 @@
     </map:pipeline>
   
      <map:pipeline>
  -     <map:match pattern="view/*.html">
  -<!--
  +     <map:match pattern="view/*.xsp">
           <map:generate src="view/xsp/{1}.xsp" type="serverpages"/>
           <map:transform src="stylesheets/site2html.xsl" />
           <map:serialize type="html"/>
  --->
  -      <map:generate src="view/templates/{1}.vm" type="flow_velocity"/>
  -      <map:serialize type="html"/>
        </map:match>
  -   </map:pipeline>
  -
  -   <map:pipeline>
  -     <map:match pattern="view/templates/*.vm">
  +     <map:match pattern="view/*.vm">
         <map:generate src="view/templates/{1}.vm" type="flow_velocity"/>
         <map:serialize type="html"/>
        </map:match>
  -    <map:match pattern="view/xsp/*.xsp">
  -        <map:generate src="view/xsp/{1}.xsp" type="serverpages"/>
  -        <map:transform src="stylesheets/site2html.xsl" />
  -        <map:serialize type="html"/>
  -    </map:match>
      </map:pipeline>
  -            
   
      <map:pipeline>
      <map:match pattern="images/*.gif">
  
  
  
  1.7       +50 -21    cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js
  
  Index: petstore.js
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- petstore.js	20 Mar 2003 00:29:55 -0000	1.6
  +++ petstore.js	20 Mar 2003 06:37:58 -0000	1.7
  @@ -48,6 +48,10 @@
   
   var MAX_RESULTS = 5;
   
  +var VIEW = "Velocity";
  +var EXT = ".vm";
  +
  +
   function Yoshi() {
   }
   
  @@ -88,13 +92,26 @@
       return petStore;
   }
   
  +function setView() {
  +    VIEW = cocoon.request.get("view");
  +    print("setView: VIEW="+VIEW);
  +    if (VIEW == "Velocity") {
  +	EXT = ".vm";
  +    } else if (VIEW == "Xsp") {
  +	EXT = ".xsp";
  +    }
  +    print("EXT="+EXT);
  +}
  +
   // Index page
   
   function index() {
  +    setView();
       getPetStore();
  -    sendPage("/view/index.html", {
  +    sendPage("/view/index" + EXT, {
  +             view: VIEW,
                accountForm: accountForm,
  -             categoryList: categoryList
  +             categoryList: categoryList,
       });
   }
   
  @@ -106,7 +123,8 @@
           var cartItem = cartForm.cart.cartItems[i];
           cartItems.push(cartItem);
       }
  -    sendPage("/view/Cart.html", {
  +    sendPage("/view/Cart" + EXT, {
  +             view: VIEW,
                accountForm: accountForm, 
                cartForm: cartForm, 
                yoshi: yoshi,
  @@ -124,7 +142,8 @@
           var cartItem = cartForm.cart.cartItems[i];
           cartItems.push(cartItem);
       }
  -    sendPage("/view/Cart.html", {
  +    sendPage("/view/Cart" + EXT, {
  +             view: VIEW,
                yoshi: yoshi, 
                accountForm: accountForm, 
                           cartForm: cartForm, cartItems: cartItems
  @@ -140,7 +159,8 @@
           cartItem.updateQuantity(quantity);
           cartItems.push(cartItem);
       }
  -    sendPage("/view/Cart.html", {
  +    sendPage("/view/Cart" + EXT, {
  +             view: VIEW,
                yoshi: yoshi, 
                accountForm: accountForm, 
                cartForm:cartForm,
  @@ -157,7 +177,8 @@
           var cartItem = cartForm.cart.cartItems[i];
           cartItems.push(cartItem);
       }
  -    sendPage("/view/Cart.html", {
  +    sendPage("/view/Cart" + EXT, {
  +             view: VIEW,
                yoshi: yoshi, 
                accountForm: accountForm, 
                cartForm:cartForm, 
  @@ -180,7 +201,7 @@
                                                      maxResults);
           var lastPage = !productList.isLimitedByMaxRows;
           var rowCount = productList.rowCount;
  -        sendPageAndWait("/view/Category.html", {
  +        sendPageAndWait("/view/Category" + EXT, {
                           accountForm: accountForm, 
                           productList: productList.rows, 
                           category: category, 
  @@ -224,7 +245,8 @@
               getPetStore().getItemListByProduct(productId,
                                                  skipResults, 
                                                  maxResults);
  -        sendPageAndWait("/view/Product.html", {
  +        sendPageAndWait("/view/Product" + EXT, {
  +                        view: VIEW,
                           accountForm: accountForm, 
                           yoshi: yoshi,
                           product: product,
  @@ -250,7 +272,8 @@
   function viewItem() {
       var itemId = cocoon.request.getParameter("itemId");
       var item = getPetStore().getItem(itemId);
  -    sendPage("/view/Item.html", {
  +    sendPage("/view/Item" + EXT, {
  +             view: VIEW,
                accountForm: accountForm, 
                cartForm: cartForm, 
                item: item, 
  @@ -275,7 +298,8 @@
       } else {
           var message = "";
           while (true) {
  -            sendPageAndWait("/view/SignonForm.html", {
  +            sendPageAndWait("/view/SignonForm" + EXT, {
  +                            view: VIEW,
                               accountForm: accountForm, 
                               message: message
               });
  @@ -301,7 +325,8 @@
       print("new account");
       var accountForm = new AccountForm();
       var account = new Account();
  -    sendPageAndWait("/view/NewAccountForm.html", {
  +    sendPageAndWait("/view/NewAccountForm" + EXT, {
  +                     view: VIEW,
                        accountForm: accountForm,
                        account: account,
                        categoryList: categoryList
  @@ -312,7 +337,7 @@
       if (accountForm.signOn) {
           newAccountForm();
       } else {
  -        sendPageAndWait("/view/EditAccountForm.html", {
  +        sendPageAndWait("/view/EditAccountForm" + EXT, {
                           accountForm: accountForm,
                           account: accountForm.account,
                           categoryList: categoryList
  @@ -325,7 +350,8 @@
   function searchProducts() {
       var keyword = cocoon.request.get("keyword");
       if (keyword == null || keyword == "") {
  -        sendPage("/view/Error.html", {
  +        sendPage("/view/Error" + EXT, {
  +           view: VIEW,
              message: "Please enter a keyword to search for, then press the search button"
           });
           return;
  @@ -336,7 +362,8 @@
           var result = 
               getPetStore().searchProductList(keyword, skipResults,
                                               maxResults);
  -        sendPageAndWait("/view/SearchProducts.html", {
  +        sendPageAndWait("/view/SearchProducts" + EXT, {
  +                        view: VIEW,
                           searchResultsProductList: result.rows,
                           firstPage: skipResults == 0,
                           lastPage: !result.isLimitedByMaxRows
  @@ -362,7 +389,8 @@
           var cartItem = cartForm.cart.cartItems[i];
           cartItems.push(cartItem);
       }
  -    sendPageAndWait("/view/Checkout.html", {
  +    sendPageAndWait("/view/Checkout" + EXT, {
  +                    view: VIEW,
                       accountForm: accountForm,
                       cartForm: cartForm, 
   		    yoshi: yoshi,
  @@ -376,25 +404,26 @@
       var order = orderForm.order;
       var valid = false;
       while (!valid) {
  -        sendPageAndWait("/view/NewOrderForm.html", { 
  +        sendPageAndWait("/view/NewOrderForm" + EXT, { 
  +                        view: VIEW,
                           yoshi: yoshi,
                           creditCardTypes: ["Visa", "MasterCard", "American Express"],
                           order: order});
           var shippingAddressRequired = cocoon.request.get("shippingAddressRequired");
           if (shippingAddressRequired) {
  -            sendPageAndWait("/view/ShippingForm.html",
  +            sendPageAndWait("/view/ShippingForm" + EXT,
                               {order: order, yoshi: yoshi});
           }
           // fix me !! do real validation
           valid = true;
       }
  -    sendPageAndWait("/view/ConfirmOrder.html",
  -                    {order: order, yoshi: yoshi});
  +    sendPageAndWait("/view/ConfirmOrder" + EXT,
  +                    {view: VIEW, order: order, yoshi: yoshi});
       
       var oldCartForm = cartForm;
       cartForm = new CartForm();
  -    sendPage("/view/ViewOrder.html",
  -             {order: order, itemList: order.lineItems, yoshi: yoshi});
  +    sendPage("/view/ViewOrder" + EXT,
  +             {view: VIEW, order: order, itemList: order.lineItems, yoshi: yoshi});
   }
   
   function listOrders() {
  
  
  
  1.3       +7 -1      cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/site2html.xsl
  
  Index: site2html.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/stylesheets/site2html.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- site2html.xsl	20 Mar 2003 00:29:55 -0000	1.2
  +++ site2html.xsl	20 Mar 2003 06:37:58 -0000	1.3
  @@ -18,7 +18,13 @@
                       <tbody>
                           <tr>
                               <td>
  -                                <a href="index.do"><img border="0" src="images/logo-topbar.gif"
/></a>
  +                               <form method="post" action="index.do">
  +                                 <input type="image" border="0" src="images/logo-topbar.gif"
/>
  +                                   <select name="view" width="14" align="left" value="Xsp">
  +                                      <option value="Xsp">Xsp</option>
  +                                      <option value="Velocity">Velocity</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" hspace="4"
/>
  
  
  
  1.2       +9 -1      cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeTop.vm
  
  Index: IncludeTop.vm
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeTop.vm,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IncludeTop.vm	14 Mar 2003 17:15:27 -0000	1.1
  +++ IncludeTop.vm	20 Mar 2003 06:37:58 -0000	1.2
  @@ -12,7 +12,15 @@
   <table background="images/bkg-topbar.gif" border="0" cellspacing="0" cellpadding="5"
width="100%">
     <tbody>
     <tr>
  -    <td><a href="index.do"><img border="0" src="images/logo-topbar.gif"
/></a></td>
  +    <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="Velocity">
  +          <option value="Velocity">Velocity</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" />
   
  
  
  

Mime
View raw message