coliver 2003/03/14 09:15:28
Added: src/scratchpad/webapp/samples/petstore sitemap.xmap
src/scratchpad/webapp/samples/petstore/flow PetStoreImpl.js
petstore.js
src/scratchpad/webapp/samples/petstore/images
banner_birds.gif banner_cats.gif banner_dogs.gif
banner_fish.gif banner_reptiles.gif bird1.gif
bird1.jpg bird2.gif bird2.jpg bird3.gif bird4.gif
bird5.gif bird6.gif birds_icon.gif bkg-sidebar.gif
bkg-topbar.gif button_add_to_cart.gif
button_checkout.gif button_continue.gif
button_next.gif button_prev.gif button_previous.gif
button_proceed.gif button_register_now.gif
button_remove.gif button_submit.gif
button_update_cart.gif cart.gif cartHL.gif cat1.gif
cat1.jpg cat2.gif cat2.jpg cat3.gif cat4.gif
cats_icon.gif cocoon.gif dog1.gif dog1.jpg dog2.gif
dog2.jpg dog3.gif dog3.jpg dog4.gif dog4.jpg
dog5.gif dog5.jpg dog6.gif dog6.jpg dogs.gif
dogs_icon.gif fish.gif fish1.gif fish1.jpg
fish2.gif fish2.jpg fish3.gif fish3.jpg fish4.gif
fish4.jpg fish_icon.gif help.gif helpHL.gif
lizard1.gif lizard1.jpg lizard2.gif lizard3.gif
logo-topbar.gif my_account.gif my_accountHL.gif
poweredby.gif reptiles_icon.gif search.gif
separator.gif sign-in.gif sign-inHL.gif
sign-out.gif sign-outHL.gif sm_birds.gif
sm_cats.gif sm_dogs.gif sm_fish.gif sm_reptiles.gif
snake1.gif snake1.jpg splash.gif
src/scratchpad/webapp/samples/petstore/view/templates
Cart.vm Category.vm Checkout.vm ConfirmOrder.vm
EditAccountForm.vm Error.vm IncludeAccountFields.vm
IncludeBottom.vm IncludeMyList.vm
IncludeQuickHeader.vm IncludeTop.vm Item.vm
NewAccountForm.vm NewOrderForm.vm Product.vm
SearchProducts.vm ShippingForm.vm SignonForm.vm
ViewOrder.vm index.vm
Log:
Java PetStore example app using Cocoon flow layer
Revision Changes Path
1.1 cocoon-2.1/src/scratchpad/webapp/samples/petstore/sitemap.xmap
Index: sitemap.xmap
===================================================================
<?xml version="1.0"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
<!-- =========================== Components ================================ -->
<map:components>
<map:generators default="file">
<map:generator label="content,data" logger="sitemap.generator.flow_velocity"
name="flow_velocity" src="org.apache.cocoon.generation.FlowVelocityGenerator"/>
</map:generators>
<map:flow-interpreters default="JavaScript"/>
<map:serializers default="html"/>
<map:matchers default="wildcard"/>
</map:components>
<!-- =========================== Views =================================== -->
<!--
The debug view can be used to output an intermediate
snapshot of the pipeline.
Pass cocoon-view=debug as a URL parameter to see
the pipeline output produced by the transofrmer
labeled "debug". You can move the label to different
transformers to understand each processing
stage better.
-->
<map:views>
<map:view name="debug" from-label="debug">
<map:serialize type="xml"/>
</map:view>
<map:view name="xml" from-label="xml">
<map:serialize type="xml"/>
</map:view>
</map:views>
<!-- =========================== Resources ================================= -->
<map:resources>
</map:resources>
<!-- =========================== Pipelines ================================= -->
<map:flow language="JavaScript">
<map:script src="flow/PetStoreImpl.js"/>
<map:script src="flow/petstore.js"/>
</map:flow>
<map:pipelines>
<map:pipeline>
<map:match pattern="*.kont">
<map:call continuation="{1}"/>
</map:match>
<map:match pattern="*.do">
<map:call function="{1}"/>
</map:match>
<map:match pattern="">
<map:call function="index"/>
</map:match>
</map:pipeline>
<map:pipeline>
<map:match pattern="view/templates/*.vm">
<map:generate src="view/templates/{1}.vm" type="flow_velocity"/>
<map:serialize type="html"/>
</map:match>
</map:pipeline>
<map:pipeline>
<map:match pattern="images/*.gif">
<map:read mime-type="images/gif" src="images/{1}.gif"/>
</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>
<!-- end of file -->
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/PetStoreImpl.js
Index: PetStoreImpl.js
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function OrderForm() {
this.order = new Order();
this.shippingAddressRequired = false;
this.confirmed = false;
}
OrderForm.prototype.initOrder = function(accountForm, cartForm) {
var acct = accountForm.account;
this.order.username = accountForm.username;
this.order.orderDate = new java.util.Date();
this.order.shipAddress = acct.addr1;
this.order.shipAddress2 = acct.addr2;
this.order.shipCity = acct.city;
this.order.shipState = acct.state;
this.order.shipZip = acct.zip;
this.order.shipCountry = acct.country;
this.order.billAddress = acct.addr1;
this.order.billAddress2 = acct.addr2;
this.order.billCity = acct.city;
this.order.billState = acct.state;
this.order.billZip = acct.zip;
this.order.billCountry = acct.country;
this.order.totalPrice = cartForm.cart.subTotal;
this.order.billToFirstName= acct.firstName;
this.order.billToLastName= acct.lastName;
this.order.shipToFirstName= acct.firstName;
this.order.shipToLastName= acct.lastName;
this.order.shipDate = new java.util.Date();
for (var i in cartForm.cart.cartItems) {
var cartItem = cartForm.cart.cartItems[i];
this.order.lineItems.push(cartItem);
}
}
function Order() {
this.orderId = 0;
this.username= "";
this.orderDate =null;
this.shipAddress1= "";
this.shipAddress2= "";
this.shipCity= "";
this.shipState= "";
this.shipZip= "";
this.shipCountry= "";
this.billAddress1= "";
this.billAddress2= "";
this.billCity= "";
this.billState= "";
this.billZip= "";
this.billCountry= "";
this.courier= "";
this.totalPrice= 0;
this.billToFirstName= "";
this.billToLastName= "";
this.shipToFirstName= "";
this.shipToLastName= "";
this.creditCard= "";
this.expiryDate= "";
this.cardType= "";
this.locale= "";
this.status= "";
this.lineItems = [];
}
function Account() {
this.username ="";
this.password = "";
this.email = "";
this.firstName = "";
this.lastName = "";
this.status = "";
this.address1 = "";
this.address2= "";
this.city= "";
this.state= "";
this.zip= "";
this.country= "";
this.phone= "";
this.favouriteCategoryId= "";
this.languagePreference= "";
this.listOption= false;
this.bannerOption= false;
this.bannerName= "";
}
function AccountForm(username, password) {
this.username = username;
this.password = password;
this.signOn = true;
}
function Cart() {
this.cartItems = {};
this.numberOfItems = 0;
this.subTotal = 0;
}
function CartItem(cart, item) {
this.cart = cart;
this.item = item;
this.quantity = 1
this.listPrice = Number(item.listPrice);
cart.subTotal += this.listPrice;
}
CartItem.prototype.updateQuantity = function(newQuantity) {
var delta = newQuantity - this.quantity;
this.cart.subTotal += (this.item.listPrice * delta);
this.quantity = newQuantity;
}
Cart.prototype.addItem = function(item) {
if (!(item.itemId in this.cartItems)) {
this.cartItems[item.itemId] = new CartItem(this, item);
this.numberOfItems++;
} else {
var cartItem;
cartItem = this.cartItems[item.itemId];
cartItem.updateQuantity(cartItem.quantity + 1);
}
}
Cart.prototype.removeItem = function(item) {
if (item.itemId in this.cartItems) {
this.numberOfItems--;
var cartItem = this.cartItems[item.itemId];
delete this.cartItems[item.itemId];
this.subTotal -= (cartItem.quantity * cartItem.listPrice);
}
}
function CartForm() {
this.cart = new Cart();
}
var DROP_SCRIPT =
"drop index productCat;" +
"drop index productName;" +
"drop index itemProd;" +
"" +
"drop table lineitem;" +
"drop table orderstatus;" +
"drop table orders;" +
"drop table bannerdata;" +
"drop table profile;" +
"drop table signon;" +
"drop table inventory;" +
"drop table item;" +
"drop table product;" +
"drop table account;" +
"drop table category;" +
"drop table supplier;" +
"drop table sequence;";
var CREATE_SCRIPT =
"" +
"create table supplier (" +
" suppid int not null," +
" name varchar(80) null," +
" status varchar(2) not null," +
" addr1 varchar(80) null," +
" addr2 varchar(80) null," +
" city varchar(80) null," +
" state varchar(80) null," +
" zip varchar(5) null," +
" phone varchar(80) null," +
" constraint pk_supplier primary key (suppid)" +
");" +
"" +
"create table signon (" +
" username varchar(25) not null," +
" password varchar(25) not null," +
" constraint pk_signon primary key (username)" +
");" +
"" +
"create table account (" +
" userid varchar(80) not null," +
" email varchar(80) not null," +
" firstname varchar(80) not null," +
" lastname varchar(80) not null," +
" status varchar(2) null," +
" addr1 varchar(80) not null," +
" addr2 varchar(40) null," +
" city varchar(80) not null," +
" state varchar(80) not null," +
" zip varchar(20) not null," +
" country varchar(20) not null," +
" phone varchar(80) not null," +
" constraint pk_account primary key (userid)" +
");" +
"" +
"create table profile (" +
" userid varchar(80) not null," +
" langpref varchar(80) not null," +
" favcategory varchar(30)," +
" mylistopt bit," +
" banneropt bit" +
//", constraint pk_profile primary key (userid)" +
");" +
"" +
"create table bannerdata (" +
" favcategory varchar(80) not null," +
" bannername varchar(255) null" +
//" ,constraint pk_bannerdata primary key (favcategory)" +
");" +
"" +
"create table orders (" +
" orderid int not null," +
" userid varchar(80) not null," +
" orderdate date not null," +
" shipaddr1 varchar(80) not null," +
" shipaddr2 varchar(80) null," +
" shipcity varchar(80) not null," +
" shipstate varchar(80) not null," +
" shipzip varchar(20) not null," +
" shipcountry varchar(20) not null," +
" billaddr1 varchar(80) not null," +
" billaddr2 varchar(80) null," +
" billcity varchar(80) not null," +
" billstate varchar(80) not null," +
" billzip varchar(20) not null," +
" billcountry varchar(20) not null," +
" courier varchar(80) not null," +
" totalprice decimal(10,2) not null," +
" billtofirstname varchar(80) not null," +
" billtolastname varchar(80) not null," +
" shiptofirstname varchar(80) not null," +
" shiptolastname varchar(80) not null," +
" creditcard varchar(80) not null," +
" exprdate varchar(7) not null," +
" cardtype varchar(80) not null," +
" locale varchar(80) not null" +
//" ,constraint pk_orders primary key (orderid)" +
");" +
"" +
"create table orderstatus (" +
" orderid int not null," +
" linenum int not null," +
" timestamp date not null, " +
" status varchar(2) not null" +
//" ,constraint pk_orderstatus primary key (orderid, linenum)" +
");" +
"" +
"create table lineitem (" +
" orderid int not null," +
" linenum int not null," +
" itemid varchar(10) not null," +
" quantity int not null," +
" unitprice decimal(10,2) not null" +
//" ,constraint pk_lineitem primary key (orderid, linenum)" +
");" +
"" +
"create table category (" +
" catid varchar(10) not null," +
" name varchar(80) null," +
" descn varchar(255) null" +
//", constraint pk_category primary key (catid)" +
");" +
"" +
"create table product (" +
" productid varchar(10) not null," +
" category varchar(10) not null," +
" name varchar(80) null," +
" descn varchar(255) null" +
//", constraint pk_product primary key (productid)," +
//" constraint fk_product_1 foreign key (category)" +
//" references category (catid)" +
");" +
"" +
"create index productCat on product (category);" +
"create index productName on product (name);" +
"" +
"create table item (" +
" itemid varchar(10) not null," +
" productid varchar(10) not null," +
" listprice decimal(10,2) null," +
" unitcost decimal(10,2) null," +
" supplier int null," +
" status varchar(2) null," +
" attr1 varchar(80) null," +
" attr2 varchar(80) null," +
" attr3 varchar(80) null," +
" attr4 varchar(80) null," +
" attr5 varchar(80) null" +
//", constraint pk_item primary key (itemid)," +
//" constraint fk_item_1 foreign key (productid)" +
//" references product (productid)," +
//" constraint fk_item_2 foreign key (supplier)" +
//" references supplier (suppid)" +
");" +
"" +
"create index itemProd on item (productid);" +
"" +
"create table inventory (" +
" itemid varchar(10) not null," +
" qty int not null" +
//", constraint pk_inventory primary key (itemid)" +
");" +
"" +
"CREATE TABLE sequence" +
"(" +
" name varchar(30) not null," +
" nextid int not null" +
//" ,constraint pk_sequence primary key (name)" +
");" +
"";
function PetStore(poolId) {
this.poolId = poolId;
this.hsql = null;
this.populate();
}
PetStore.prototype.getConnection = function(id) {
if (true) {
// temporary hack to avoid requiring datasource config in cocoon.xconf
java.lang.Class.forName("org.hsqldb.jdbcDriver");
var jdbc = java.sql.DriverManager.getConnection("jdbc:hsqldb:.", "sa", "")
var conn = new Database(jdbc);
if (this.hsql == null) {
// keep hsql in-memory database alive
this.hsql = java.sql.DriverManager.getConnection("jdbc:hsqldb:.", "sa",
"");
}
return conn;
} else {
// lookup datasource in cocoon.xconf
return Database.getConnection(id);
}
}
PetStore.prototype.populate = function() {
var conn = this.getConnection(this.poolId);
try {
conn.update(CREATE_SCRIPT);
} catch (ignored) {
ignored.printStackTrace();
conn.close();
return;
}
//conn.update("INSERT INTO sequence VALUES('Order', 1);");
conn.update("INSERT INTO signon VALUES('j2ee','j2ee');");
conn.update("INSERT INTO signon VALUES('ACID','ACID');");
conn.update("INSERT INTO account VALUES('j2ee','[EMAIL PROTECTED]','ABC', 'XYX',
'OK', '901 San Antonio Road', 'MS UCUP02-206', 'Palo Alto', 'CA', '94303', 'USA',
'555-555-5555');");
conn.update("INSERT INTO account VALUES('ACID','[EMAIL PROTECTED]','ABC', 'XYX',
'OK', '901 San Antonio Road', 'MS UCUP02-206', 'Palo Alto', 'CA', '94303', 'USA',
'555-555-5555');");
conn.update("INSERT INTO profile VALUES('j2ee','english','DOGS',true,true);");
conn.update("INSERT INTO profile VALUES('ACID','english','CATS',true,true);");
conn.update("INSERT INTO bannerdata VALUES ('FISH','<image
src=\"images/banner_fish.gif\">');");
conn.update("INSERT INTO bannerdata VALUES ('CATS','<image
src=\"images/banner_cats.gif\">');");
conn.update("INSERT INTO bannerdata VALUES ('DOGS','<image
src=\"images/banner_dogs.gif\">');");
conn.update("INSERT INTO bannerdata VALUES ('REPTILES','<image
src=\"images/banner_reptiles.gif\">');");
conn.update("INSERT INTO bannerdata VALUES ('BIRDS','<image
src=\"images/banner_birds.gif\">');");
conn.update("INSERT INTO category VALUES ('FISH','Fish','<image
src=\"images/fish_icon.gif\"><font size=\"5\" color=\"blue\"> Fish</font>');");
conn.update("INSERT INTO category VALUES ('DOGS','Dogs','<image
src=\"images/dogs_icon.gif\"><font size=\"5\" color=\"blue\"> Dogs</font>');");
conn.update("INSERT INTO category VALUES ('REPTILES','Reptiles','<image
src=\"images/reptiles_icon.gif\"><font size=\"5\" color=\"blue\"> Reptiles</font>');");
conn.update("INSERT INTO category VALUES ('CATS','Cats','<image
src=\"images/cats_icon.gif\"><font size=\"5\" color=\"blue\"> Cats</font>');");
conn.update("INSERT INTO category VALUES ('BIRDS','Birds','<image
src=\"images/birds_icon.gif\"><font size=\"5\" color=\"blue\"> Birds</font>');");
conn.update("INSERT INTO product VALUES ('FI-SW-01','FISH','Angelfish','<image
src=\"images/fish1.jpg\">Salt Water fish from Australia');");
conn.update("INSERT INTO product VALUES ('FI-SW-02','FISH','Tiger Shark','<image
src=\"images/fish4.gif\">Salt Water fish from Australia');");
conn.update("INSERT INTO product VALUES ('FI-FW-01','FISH', 'Koi','<image
src=\"images/fish3.gif\">Fresh Water fish from Japan');");
conn.update("INSERT INTO product VALUES ('FI-FW-02','FISH', 'Goldfish','<image
src=\"images/fish2.gif\">Fresh Water fish from China');");
conn.update("INSERT INTO product VALUES ('K9-BD-01','DOGS','Bulldog','<image
src=\"images/dog2.gif\">Friendly dog from England');");
conn.update("INSERT INTO product VALUES ('K9-PO-02','DOGS','Poodle','<image
src=\"images/dog6.gif\">Cute dog from France');");
conn.update("INSERT INTO product VALUES ('K9-DL-01','DOGS', 'Dalmation','<image
src=\"images/dog5.gif\">Great dog for a Fire Station');");
conn.update("INSERT INTO product VALUES ('K9-RT-01','DOGS', 'Golden
Retriever','<image src=\"images/dog1.gif\">Great family dog');");
conn.update("INSERT INTO product VALUES ('K9-RT-02','DOGS', 'Labrador
Retriever','<image src=\"images/dog5.gif\">Great hunting dog');");
conn.update("INSERT INTO product VALUES ('K9-CW-01','DOGS', 'Chihuahua','<image
src=\"images/dog4.gif\">Great companion dog');");
conn.update("INSERT INTO product VALUES
('RP-SN-01','REPTILES','Rattlesnake','<image src=\"images/lizard3.gif\">Doubles as a
watch dog');");
conn.update("INSERT INTO product VALUES ('RP-LI-02','REPTILES','Iguana','<image
src=\"images/lizard2.gif\">Friendly green friend');");
conn.update("INSERT INTO product VALUES ('FL-DSH-01','CATS','Manx','<image
src=\"images/cat3.gif\">Great for reducing mouse populations');");
conn.update("INSERT INTO product VALUES ('FL-DLH-02','CATS','Persian','<image
src=\"images/cat1.gif\">Friendly house cat, doubles as a princess');");
conn.update("INSERT INTO product VALUES ('AV-CB-01','BIRDS','Amazon
Parrot','<image src=\"images/bird4.gif\">Great companion for up to 75 years');");
conn.update("INSERT INTO product VALUES ('AV-SB-02','BIRDS','Finch','<image
src=\"images/bird1.gif\">Great stress reliever');");
conn.update("INSERT INTO supplier VALUES (1,'XYZ Pets','AC','600 Avon
Way','','Los Angeles','CA','94024','212-947-0797');");
conn.update("INSERT INTO supplier VALUES (2,'ABC Pets','AC','700 Abalone
Way','','San Francisco ','CA','94024','415-947-0797');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-1','FI-SW-01',16.50,10.00,1,'P','Large');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-2','FI-SW-01',16.50,10.00,1,'P','Small');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-3','FI-SW-02',18.50,12.00,1,'P','Toothless');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-4','FI-FW-01',18.50,12.00,1,'P','Spotted');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-5','FI-FW-01',18.50,12.00,1,'P','Spotless');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-6','K9-BD-01',18.50,12.00,1,'P','Male Adult');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-7','K9-BD-01',18.50,12.00,1,'P','Female
Puppy');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-8','K9-PO-02',18.50,12.00,1,'P','Male Puppy');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-9','K9-DL-01',18.50,12.00,1,'P','Spotless Male
Puppy');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-10','K9-DL-01',18.50,12.00,1,'P','Spotted Adult
Female');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-11','RP-SN-01',18.50,12.00,1,'P','Venomless');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-12','RP-SN-01',18.50,12.00,1,'P','Rattleless');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-13','RP-LI-02',18.50,12.00,1,'P','Green
Adult');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-14','FL-DSH-01',58.50,12.00,1,'P','Tailless');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-15','FL-DSH-01',23.50,12.00,1,'P','With tail');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-16','FL-DLH-02',93.50,12.00,1,'P','Adult
Female');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-17','FL-DLH-02',93.50,12.00,1,'P','Adult
Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-18','AV-CB-01',193.50,92.00,1,'P','Adult
Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-19','AV-SB-02',15.50, 2.00,1,'P','Adult Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-20','FI-FW-02',5.50, 2.00,1,'P','Adult Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-21','FI-FW-02',5.29, 1.00,1,'P','Adult
Female');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-22','K9-RT-02',135.50, 100.00,1,'P','Adult
Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-23','K9-RT-02',145.49, 100.00,1,'P','Adult
Female');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-24','K9-RT-02',255.50, 92.00,1,'P','Adult
Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-25','K9-RT-02',325.29, 90.00,1,'P','Adult
Female');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-26','K9-CW-01',125.50, 92.00,1,'P','Adult
Male');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-27','K9-CW-01',155.29, 90.00,1,'P','Adult
Female');");
conn.update("INSERT INTO item (itemid, productid, listprice, unitcost,
supplier, status, attr1) VALUES('EST-28','K9-RT-01',155.29, 90.00,1,'P','Adult
Female');");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-1',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-2',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-3',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-4',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-5',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-6',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-7',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-8',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-9',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-10',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-11',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-12',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-13',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-14',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-15',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-16',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-17',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-18',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-19',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-20',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-21',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-22',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-23',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-24',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-25',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-26',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-27',10000);");
conn.update("INSERT INTO inventory (itemid, qty ) VALUES ('EST-28',10000);");
conn.close();
}
PetStore.prototype.getCategory = function(catId) {
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from CATEGORY where CATID = '"+catId + "'");
conn.close();
return result.rows[0];
}
PetStore.prototype.getCategoryList = function() {
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from CATEGORY");
conn.close();
return result.rows;
}
PetStore.prototype.getItemListByProduct = function(prodId) {
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from ITEM where PRODUCTID = '"+prodId + "'");
conn.close();
return result;
}
PetStore.prototype.getItem = function(itemId) {
print("getItem: " + itemId);
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from ITEM item, INVENTORY inv where
item.ITEMID = inv.ITEMID and item.ITEMID = '" + itemId + "'");
conn.close();
result.rows[0].product = this.getProduct(result.rows[0].productId);
return result.rows[0];
}
PetStore.prototype.getAccount = function(username, password) {
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from ACCOUNT, PROFILE, SIGNON, BANNERDATA
where ACCOUNT.USERID = '"+username+"' and SIGNON.USERNAME = ACCOUNT.USERID and
PROFILE.USERID = ACCOUNT.USERID and PROFILE.FAVCATEGORY = BANNERDATA.FAVCATEGORY");
var record = result.rows[0];
conn.close();
return record;
}
PetStore.prototype.getProduct = function(key, skipResults, maxResults) {
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from PRODUCT where PRODUCTID = '" + key + "'",
skipResults, maxResults);
conn.close();
return result.rows[0];
}
PetStore.prototype.getProductListByCategory = function(key, skipResults, maxResults)
{
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from PRODUCT where CATEGORY = '" + key + "'",
skipResults, maxResults);
conn.close();
return result;
}
PetStore.prototype.getProductRowCountByCategory = function(key) {
var conn = this.getConnection(this.poolId);
var rs = conn.query("select count(*) as ROWCOUNT from PRODUCT where CATEGORY =
'" + key + "'");
var result = rs.rows[0].ROWCOUNT;
conn.close();
return result;
}
PetStore.prototype.searchProductList = function(key, skipResults, maxResults) {
var conn = this.getConnection(this.poolId);
var result = conn.query("select * from PRODUCT where lower(name) like '%" + key
+ "%' or lower(category) like '%" + key + "%' or lower(descn) like '%" + key + "%'",
skipResults, maxResults);
conn.close();
return result;
}
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/flow/petstore.js
Index: petstore.js
===================================================================
/*
============================================================================
The Apache Software License, Version 1.1
============================================================================
Copyright (C) 1999-2003 The Apache Software Foundation. All rights reserved.
Redistribution and use in source and binary forms, with or without modifica-
tion, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. The end-user documentation included with the redistribution, if any, must
include the following acknowledgment: "This product includes software
developed by the Apache Software Foundation (http://www.apache.org/)."
Alternately, this acknowledgment may appear in the software itself, if
and wherever such third-party acknowledgments normally appear.
4. The names "Apache Cocoon" and "Apache Software Foundation" must not be
used to endorse or promote products derived from this software without
prior written permission. For written permission, please contact
[EMAIL PROTECTED]
5. Products derived from this software may not be called "Apache", nor may
"Apache" appear in their name, without prior written permission of the
Apache Software Foundation.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
// Page Flow for PetStore Application
var MAX_RESULTS = 5;
function Yoshi() {
}
Yoshi.prototype.formatNumber = function(num, format) {
return new java.text.DecimalFormat(format).format(num);
}
Yoshi.prototype.formatDate = function(date, format) {
return new java.text.SimpleDateFormat(format).format(date);
}
var yoshi = new Yoshi();
var petStore = null;
var accountForm = null;
var cartForm = null;
var categoryList = null;
function getPetStore() {
if (petStore == null) {
petStore = new PetStore("hsql");
}
return petStore;
}
// Index page
function index() {
if (petStore == null) {
cocoon.createSession();
cartForm = new CartForm();
accountForm = new AccountForm();
}
this.categoryList = getPetStore().getCategoryList();
sendPage("view/templates/index.vm", {
accountForm: accountForm,
categoryList: categoryList
});
}
// Cart page
function viewCart() {
sendPage("view/templates/Cart.vm", {
accountForm: accountForm,
cartForm: cartForm,
yoshi: yoshi
});
}
function removeItemFromCart() {
var itemId = cocoon.request.getParameter("workingItemId");
var item = getPetStore().getItem(itemId);
cartForm.cart.removeItem(item);
sendPage("view/templates/Cart.vm", {
yoshi: yoshi,
accountForm: accountForm,
cartForm: cartForm
});
}
function updateCartQuantities() {
for (var i in cartForm.cart.cartItems) {
var cartItem = cartForm.cart.cartItems[i];
var itemId = cartItem.item.itemId;
var quantity = new java.lang.Double(cocoon.request.get(itemId)).intValue();
cartItem.updateQuantity(quantity);
}
sendPage("view/templates/Cart.vm", {
yoshi: yoshi,
accountForm: accountForm,
cartForm:cartForm
});
}
function addItemToCart() {
var itemId = cocoon.request.getParameter("itemId");
var item = getPetStore().getItem(itemId);
cartForm.cart.addItem(item);
sendPage("view/templates/Cart.vm", {
yoshi: yoshi,
accountForm: accountForm,
cartForm:cartForm
});
}
// Category page
function viewCategory() {
var categoryId = cocoon.request.get("categoryId");
var category = getPetStore().getCategory(categoryId);
var skipResults = 0;
var maxResults = MAX_RESULTS;
while (true) {
var productList = getPetStore().getProductListByCategory(categoryId,
skipResults,
maxResults);
sendPageAndWait("view/templates/Category.vm", {
accountForm: accountForm,
productList: productList.rows,
category: category,
firstPage: skipResults == 0,
lastPage: !productList.isLimitedByMaxRows
});
var page = cocoon.request.get("page");
if (page == "previous") {
skipResults -= maxResults;
} else if (page == "next") {
skipResults += productList.rowCount;
}
}
}
// Product page
function viewProduct() {
var productId = cocoon.request.get("productId");
var product = getPetStore().getProduct(productId);
var skipResults = 0;
var maxResults = MAX_RESULTS;
while (true) {
var itemList = getPetStore().getItemListByProduct(productId,
skipResults,
maxResults);
sendPageAndWait("view/templates/Product.vm", {
accountForm: accountForm,
yoshi: yoshi,
product: product,
firstPage: skipResults == 0,
lastPage: !itemList.isLimitedByMaxRows,
itemList: itemList.rows
});
var page = cocoon.request.get("page");
if (page == "previous") {
skipResults -= maxResults;
} else if (page == "next") {
skipResults += itemList.rowCount;
}
}
}
// Item page
function viewItem() {
var itemId = cocoon.request.getParameter("itemId");
var item = getPetStore().getItem(itemId);
sendPageAndWait("view/templates/Item.vm", {
accountForm: accountForm,
cartForm: cartForm,
item: item,
product: item.product,
yoshi: yoshi
});
}
// Sign-on page
function signonForm() {
signOn();
index();
}
function signOn() {
if (cocoon.request.get("signoff") != null) {
accountForm = new AccountForm();
cartForm = new CartForm();
} else {
var message = "";
while (true) {
sendPageAndWait("view/templates/SignonForm.vm", {
accountForm: accountForm,
message: message
});
var username = cocoon.request.get("username");
var password = cocoon.request.get("password");
print("getting account: " + username);
account = getPetStore().getAccount(username, password);
if (account == null) {
message = "Invalid username or password";
} else {
accountForm = new AccountForm(username, password);
accountForm.account = account;
accountForm.signOn = false;
break;
}
}
}
}
// Account Form
function newAccountForm() {
print("new account");
var accountForm = new AccountForm();
var account = new Account();
sendPageAndWait("view/templates/NewAccountForm.vm", {
accountForm: accountForm,
account: account,
categoryList: categoryList
});
}
function editAccountForm() {
if (accountForm.signOn) {
newAccountForm();
} else {
sendPageAndWait("view/templates/EditAccountForm.vm", {
accountForm: accountForm,
account: accountForm.account,
categoryList: categoryList
});
}
}
// Search
function searchProducts() {
var keyword = cocoon.request.get("keyword");
if (keyword == null || keyword == "") {
sendPage("view/templates/Error.vm", {
message: "Please enter a keyword to search for, then press the search
button"
});
return;
}
var skipResults = 0;
var maxResults = 3;
while (true) {
var result = getPetStore().searchProductList(keyword, skipResults,
maxResults);
sendPageAndWait("view/templates/SearchProducts.vm", {
searchResultsProductList: result.rows,
firstPage: skipResults == 0,
lastPage: !result.isLimitedByMaxRows
});
var page = cocoon.request.get("page");
if (page == "previous") {
skipResults -= maxResults;
} else if (page == "next") {
skipResults += result.rowCount;
}
}
}
// Checkout
function checkout() {
sendPageAndWait("view/templates/Checkout.vm", {
accountForm: accountForm,
cartForm: cartForm,
yoshi: yoshi
});
if (accountForm.signOn) {
signOn();
}
var orderForm = new OrderForm();
orderForm.initOrder(accountForm, cartForm);
var order = orderForm.order;
var valid = false;
while (!valid) {
sendPageAndWait("view/templates/NewOrderForm.vm", {
yoshi: yoshi,
creditCardTypes: ["Visa", "MasterCard", "American Express"],
order: order});
var shippingAddressRequired = cocoon.request.get("shippingAddressRequired");
if (shippingAddressRequired) {
sendPageAndWait("view/templates/ShippingForm.vm",
{order: order, yoshi: yoshi});
}
// fix me !! do real validation
valid = true;
}
sendPageAndWait("view/templates/ConfirmOrder.vm",
{order: order, yoshi: yoshi});
var oldCartForm = cartForm;
cartForm = new CartForm();
sendPage("view/templates/ViewOrder.vm",
{order: order, itemList: order.lineItems, yoshi: yoshi});
}
function listOrders() {
}
function viewOrder() {
var webservice = cocoon.request.get("webservice");
if (webservice) {
}
}
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/banner_birds.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/banner_cats.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/banner_dogs.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/banner_fish.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/banner_reptiles.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird1.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird2.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird3.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird4.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird5.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bird6.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/birds_icon.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bkg-sidebar.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/bkg-topbar.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_add_to_cart.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_checkout.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_continue.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_next.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_prev.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_previous.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_proceed.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_register_now.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_remove.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_submit.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/button_update_cart.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cart.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cartHL.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cat1.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cat1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cat2.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cat2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cat3.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cat4.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cats_icon.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/cocoon.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog1.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog2.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog3.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog3.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog4.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog4.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog5.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog5.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog6.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dog6.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dogs.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/dogs_icon.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish1.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish2.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish2.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish3.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish3.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish4.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish4.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/fish_icon.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/help.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/helpHL.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/lizard1.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/lizard1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/lizard2.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/lizard3.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/logo-topbar.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/my_account.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/my_accountHL.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/poweredby.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/reptiles_icon.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/search.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/separator.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sign-in.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sign-inHL.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sign-out.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sign-outHL.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sm_birds.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sm_cats.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sm_dogs.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sm_fish.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/sm_reptiles.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/snake1.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/snake1.jpg
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/images/splash.gif
<<Binary file>>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/Cart.vm
Index: Cart.vm
===================================================================
#parse("view/templates/IncludeTop.vm")
<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>
#if ($cartForm.cart.numberOfItems.intValue() == 0)
<tr bgcolor="#FFFF88"><td colspan="6"><b>Your cart is empty.</b></td></tr>
#end
#foreach ($cartItem in $cartForm.cart.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.intValue()" />
</td>
<td align="right">$yoshi.formatNumber($cartItem.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>
#end
<tr bgcolor="#FFFF88">
<td colspan="5" align="right">
<b>Sub Total: $yoshi.formatNumber($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>
#if ($cartForm.cart.numberOfItems.intValue() > 0)
<br /><center><a href="checkout.do"><img border="0" src="images/button_checkout.gif"
/></a></center>
#end
</td>
<td valign="top" width="20%" align="right">
#if ($accountForm)
#if ($accountForm.account)
#if ($accountForm.account.username)
#if ($accountForm.account.listOption)
#parse("view/templates/IncludeMyList.vm")
#end
#end
#end
#end
</td>
</tr>
</table>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/Category.vm
Index: Category.vm
===================================================================
#parse("view/templates/IncludeTop.vm");
<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>
<p>
<center>
<h2>$category.name</h2>
</center>
<table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="3">
<tr bgcolor="#CCCCCC"> <td><b>Product ID</b></td> <td><b>Name</b></td> </tr>
#foreach ($product in $productList)
<tr bgcolor="#FFFF88">
<td><b><a href="viewProduct.do?productId=$product.productId"><font
color="BLACK">$product.productId</font></a></b></td>
<td>$product.name</td>
</tr>
#end
<tr><td>
#if (!$firstPage)
<a href="${continuation.id}.kont?page=previous"><font color="white"><B><<
Prev</B></font></a>
#end
#if (!$lastPage)
<a href="${continuation.id}.kont?page=next"><font color="white"><B>Next
>></B></font></a>
#end
</td></tr>
</table>
</p>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/Checkout.vm
Index: Checkout.vm
===================================================================
#parse("view/templates/IncludeTop.vm")
<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="viewCart.do"><b><font color="BLACK" size="2"><< Shopping
Cart</font></b></a>
</td></tr>
</table>
</td>
<td valign="top" align="center">
<h2 align="center">Checkout Summary</h2>
<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>
</tr>
#foreach ($cartItem in $cartForm.cart.cartItems)
<tr bgcolor="#FFFF88">
<td><b>
<a href="viewItem.do?itemId=$cartItem.item.itemId">
$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">
$cartItem.quantity.intValue()
</td>
<td align="right">$yoshi.formatNumber($cartItem.item.listPrice, '$#,##0.00')</td>
</tr>
#end
<tr bgcolor="#FFFF88">
<td colspan="5" align="right">
cart=$cartForm.cart.numberOfItems
<b>Sub Total: $yoshi.formatNumber($cartForm.cart.subTotal, '$#,##0.00')</b><br />
</td>
</tr>
</table>
<br />
<center><a href="${continuation.id}.kont"><img border="0"
src="images/button_continue.gif" /></a></center>
</td>
<td valign="top" width="20%" align="right">
</td>
</tr>
</table>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/ConfirmOrder.vm
Index: ConfirmOrder.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<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>
<p>
<center>
<b>Please confirm the information below and then press continue...</b>
</center>
<p>
<table width="60%" align="center" border="0" cellpadding="3" cellspacing="1"
bgcolor="#FFFF88">
<tr bgcolor="#FFFF88"><td align="center" colspan="2">
<font size="4"><b>Order #$order.orderId</b></font>
<br /><font size="3"><b>$yoshi.formatDate($order.orderDate, 'yyyy/MM/dd
hh:mm:ss')</b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b>Payment Details</b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
Card Type:</td><td>
$order.cardType
</td></tr>
<tr bgcolor="#FFFF88"><td>
Card Number:</td><td>$order.creditCard <font color="red" size="2">* Fake
number!</font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
Expiry Date (MM/YYYY):</td><td>$order.expiryDate
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b>Billing Address</b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
First name:</td><td>$order.billToFirstName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Last name:</td><td>$order.billToLastName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 1:</td><td>$order.billAddress1
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 2:</td><td>$order.billAddress2
</td></tr>
<tr bgcolor="#FFFF88"><td>
City: </td><td>$order.billCity
</td></tr>
<tr bgcolor="#FFFF88"><td>
State:</td><td>$order.billState
</td></tr>
<tr bgcolor="#FFFF88"><td>
Zip:</td><td>$order.billZip
</td></tr>
<tr bgcolor="#FFFF88"><td>
Country: </td><td>$order.billCountry
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b>Shipping Address</b></font>
</td></tr><tr bgcolor="#FFFF88"><td>
First name:</td><td>$order.shipToFirstName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Last name:</td><td>$order.shipToLastName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 1:</td><td>$order.shipAddress1
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 2:</td><td>$order.shipAddress2
</td></tr>
<tr bgcolor="#FFFF88"><td>
City: </td><td>$order.shipCity
</td></tr>
<tr bgcolor="#FFFF88"><td>
State:</td><td>$order.shipState
</td></tr>
<tr bgcolor="#FFFF88"><td>
Zip:</td><td>$order.shipZip
</td></tr>
<tr bgcolor="#FFFF88"><td>
Country: </td><td>$order.shipCountry
</td></tr>
</table>
<p>
<center><a href="${continuation.id}.kont?confirmed=true"><img border="0"
src="images/button_continue.gif" /></a></center>
</p></p></p>
#parse ("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/EditAccountForm.vm
Index: EditAccountForm.vm
===================================================================
#parse("view/templates/IncludeTop.vm")
<form styleId="workingAccountForm" method="post" action="${continuation.id}.kont">
<hidden name="workingAccountForm" property="validate" value="editAccount" />
<hidden name="workingAccountForm" property="account.username" />
<table cellpadding="10" cellspacing="0" align="center" border="1"
bgcolor="#dddddd"><tr><td>
<font color="darkgreen"><h3>User Information</h3></font>
<table border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFF88">
<tr bgcolor="#FFFF88"><td>
User ID:</td><td><input name="workingAccountForm.account.username"
value="$account.username"/>
</td></tr><tr bgcolor="#FFFF88"><td>
New password:</td><td><input type="password"
name="workingAccountForm.account.password" />
</td></tr><tr bgcolor="#FFFF88"><td>
Repeat password:</td><td> <input type="password"
name="workingAccountForm.repeatedPassword" />
</td></tr>
</table>
#parse("view/templates/IncludeAccountFields.vm")
</td></tr></table>
<br /><center>
<input border="0" type="image" src="images/button_submit.gif" name="submit"
value="Save Account Information" />
</center>
</form>
<p>
<center><b><a href="listOrders.do">My Orders</a></b></center>
</p>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/Error.vm
Index: Error.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<H3>Error!</H3>
#if ($message)
<B>$message</B>
#else
<B>No further information was provided.</B>
#end
#parse ("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeAccountFields.vm
Index: IncludeAccountFields.vm
===================================================================
<FONT color="darkgreen"><H3>Account Information</H3></FONT>
<TABLE bgcolor="#008800" border="0" cellpadding="3" cellspacing="1" >
<TR bgcolor="FFFF88"><TD>
First name:</TD><TD><input type="text" value="$!account.firstName"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Last name:</TD><TD><input type="text" value="$!account.lastName"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Email:</TD><TD><input type="text" size="40" name="workingAccountForm.email"
value="$!account.email" />
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Phone:</TD><TD><input type="text" name="workingAccountForm.phone"
value="$!account.phone" />
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Address 1:</TD><TD><input type="text" size="40" name="workingAccountForm.address1"
value="$!account.address1" />
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Address 2:</TD><TD><input type="text" size="40" name="workingAccountForm.address2"
value="$!account.address2" />
</TD></TR>
<TR bgcolor="FFFF88"><TD>
City: </TD><TD><input type="text" name="workingAccountForm.city"
value="$!account.city"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
State:</TD><TD><input type="text" name="workingAccountForm.state"
value="$!account.state"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Zip:</TD><TD><input type="text" name="workingAccountForm.zip" value="$!account.zip"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Country: </TD><TD><input type="text" size="15" name="workingAccountForm.country"
value="$!account.country" />
</TD></TR>
</TABLE>
<FONT color="darkgreen"><H3>Profile Information</H3></FONT>
<TABLE bgcolor="#008800" border="0" cellpadding="3" cellspacing="1" >
<TR bgcolor="FFFF88"><TD>
Language Preference:</TD><TD>
<select name="workingAccountForm.languagePreference">
<option value="English">English</option>
<option value="Japanese">Japanese</option>
</select>
</TD></TR><TR bgcolor="FFFF88"><TD>
Favourite Category:</TD><TD>
<select name="workingAccountForm.account.favouriteCategoryId">
#foreach ($cat in $categoryList)
<option value="$cat.name">$cat.name</option>
#end
</select>
</TD></TR><TR bgcolor="FFFF88"><TD colspan="2">
<input type="checkbox" name="workingAccountForm.account.listOption"/> Enable MyList
</TD></TR><TR bgcolor="FFFF88"><TD colspan="2">
<input type="checkbox" name="workingAccountForm.account.bannerOption"/> Enable
MyBanner
</TD></TR>
</TABLE>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeBottom.vm
Index: IncludeBottom.vm
===================================================================
<br />
#if ($accountForm.account)
#if ($accountForm.account.username)
#if ($accountForm.account.bannerOption)
<table align="center" background="images/bkg-topbar.gif" cellpadding="5"
width="100%">
<tr><td>
#if ($accountForm.account.bannerName.length() > 0)
<center>
$accountForm.account.bannerName
</image>
</center>
#end
</td></tr>
</table>
#end
#end
#end
<p align="center">
<a href="http://cocoon.apache.org"><img border="0" align="center"
src="images/cocoon.gif" /></a>
</p>
</body>
</html>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeMyList.vm
Index: IncludeMyList.vm
===================================================================
#if ($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>
#foreach ($product in $myList)
<a href="viewProduct.do?productId=$product.productId">
$product.name</a>
<br />
<font size="2">($product.productId")</font>
<br />
#end
</td>
</tr>
<tr>
<td>
#if (!$accountForm.myListPage.firstPage)
<a href="?page=previous"><font color="white"><B><< Prev</B></font></a>
#end
#if (!$accountForm.myListPage.lastPage) {
<a href="?page=next"><font color="white"><B>Next >></B></font></a>
#end
</td>
</tr>
</table>
#end
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeQuickHeader.vm
Index: IncludeQuickHeader.vm
===================================================================
<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>
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/IncludeTop.vm
Index: IncludeTop.vm
===================================================================
<html><head>
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" />
<META HTTP-EQUIV="Cache-Control" CONTENT="max-age=0"/>
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"/>
<meta http-equiv="expires" content="0"/>
<META HTTP-EQUIV="Expires" CONTENT="Tue, 01 Jan 1980 1:00:00 GMT"/>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
</head>
<body bgcolor="white">
<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 align="right"><a href="viewCart.do"><img border="0" name="img_cart"
src="images/cart.gif" /></a>
<img border="0" src="images/separator.gif" />
#if ($accountForm.signOn)
<a href="signonForm.do">
<img border="0" name="img_signin" src="images/sign-in.gif" /></a>
#else
<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="editAccountForm.do">
<img border="0" name="img_myaccount" src="images/my_account.gif" /></a>
#end
<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>
#parse( "view/templates/IncludeQuickHeader.vm" )
<!-- Support for non-traditional but simpler use of errors... -->
#if ($errors)
#foreach ($error in $errors)
<B><FONT color=RED>
<BR>$error
</FONT></B>
#end
#end
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/Item.vm
Index: Item.vm
===================================================================
#parse("view/templates/IncludeTop.vm")
<table align="left" bgcolor="#008800" border="0" cellspacing="2" cellpadding="2">
<tr><td bgcolor="#FFFF88">
<a href="viewProduct.do?productId=$product.productId"><b><font color="BLACK"
size="2"><< $product.name</font></b></a>
</td></tr>
</table>
<p>
<table align="center" bgcolor="#008800" cellspacing="2" cellpadding="3" border="0"
width="60%">
<tr bgcolor="#FFFF88">
<td bgcolor="#FFFFFF">
$product.descn</image>
</td>
</tr>
<tr bgcolor="#FFFF88">
<td width="100%" bgcolor="#cccccc">
<b>$item.itemId</b>
</td>
</tr><tr bgcolor="#FFFF88">
<td>
<b><font size="4">
$item.attr1
$!item.attr2
$!item.attr3
$!item.attr4
$!item.attr5
$!item.product.name
</font></b>
</td></tr>
<tr bgcolor="#FFFF88"><td>
<font size="3"><i>$product.name</i></font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
#if ($item.quantity.intValue() <= 0)
<font color="RED" size="2"><i>Back ordered.</i></font>
#end
#if ($item.quantity.intValue() >= 1)
<font size="2">$item.quantity in stock.</font>
#end
</td></tr>
<tr bgcolor="#FFFF88"><td>
$yoshi.formatNumber($item.listPrice, '$#,##0.00')
</td></tr>
<tr bgcolor="#FFFF88"><td>
<a href="addItemToCart.do?itemId=$item.itemId" >
<img border="0" src="images/button_add_to_cart.gif" /></a>
</td></tr>
</table>
</p>
#parse ("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/NewAccountForm.vm
Index: NewAccountForm.vm
===================================================================
#parse("view/templates/IncludeTop.vm")
<form action="${continuation.id}.kont" styleId="workingAccountForm" method="post" >
<hidden name="workingAccountForm" property="validate" value="newAccount"/>
<TABLE cellpadding="10" cellspacing="0" align="center" border="1"
bgcolor="#dddddd"><TR><TD>
<FONT color="darkgreen"><H3>User Information</H3></FONT>
<TABLE border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFF88">
<TR bgcolor="#FFFF88"><TD>
User ID:</TD><TD><input name="workingAccountForm.account.username"
value="$!account.username"/>
</TD></TR><TR bgcolor="#FFFF88"><TD>
Password:</TD><TD><input type="password" name="workingAccountForm.account.password"
/>
</TD></TR><TR bgcolor="#FFFF88"><TD>
Repeat password:</TD><TD> <input type="password"
name="workingAccountForm.repeatedPassword"/>
</TD></TR>
</TABLE>
#parse("view/templates/IncludeAccountFields.vm");
</TD></TR></TABLE>
<BR /><CENTER>
<input border="0" type="image" src="images/button_submit.gif" />
</CENTER>
</form>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/NewOrderForm.vm
Index: NewOrderForm.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<form action="${continuation.id}.kont" styleId="workingOrderForm" method="post" >
<TABLE border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFF88">
<TR bgcolor="#FFFF88"><TD colspan="2">
<FONT color="GREEN" size="4"><B>Payment Details</B></FONT>
</TD></TR><TR bgcolor="#FFFF88"><TD>
Card Type:</TD><TD>
<select name="order.cardType">
#foreach ($cardType in $creditCardTypes)
<option value="$cardType">$cardType</option>
#end
</select>
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
Card Number:</TD><TD><input type="text" name="creditCard"/> <font color="red"
size="2">* Use a fake number!</font>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Expiry Date (MM/YYYY):</TD><TD><input type="text" name="expiryDate" />
</TD></TR>
<TR bgcolor="FFFF88"><TD colspan="2">
<FONT color="GREEN" size="4"><B>Billing Address</B></FONT>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
First name:</TD><TD><input type="text" name="billToFirstName"
value="$order.billToFirstName"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Last name:</TD><TD><input type="text" name="billToLastName"
value="$order.billToLastName" />
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Address 1:</TD><TD><input type="text" size="40" name="billAddress1"
value="$order.billAddress" />
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Address 2:</TD><TD><input type="text" size="40" name="billAddress2"
value="$order.billAddress2"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
City: </TD><TD><input type="text" name="billCity" value="$order.billCity"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
State:</TD><TD><input type="text" size="4" name="billState"
value="$order.billState"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Zip:</TD><TD><input type="text" size="10" name="billZip" value="$order.billZip"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD>
Country: </TD><TD><input type="text" size="15" name="billCountry"
value="$order.billCountry"/>
</TD></TR>
<TR bgcolor="FFFF88"><TD colspan="2">
<input type="checkbox" name="shippingAddressRequired" /> Ship to different address...
</TD></TR>
</TABLE>
<P>
<input type="image" src="images/button_submit.gif"/>
</P>
</form>
#parse ("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/Product.vm
Index: Product.vm
===================================================================
#parse("view/templates/IncludeTop.vm")
<table align="left" bgcolor="#008800" border="0" cellspacing="2" cellpadding="2">
<tr><td bgcolor="#FFFF88">
<a href="viewCategory.do?categoryId=$product.category"> <b><font color="BLACK"
size="2"><< $product.category</font></b></a>
</td></tr>
</table>
<p>
<center>
<b><font size="4">$product.name</font></b>
</center>
<table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="3">
<tr bgcolor="#CCCCCC"> <td><b>Item ID</b></td> <td><b>Product ID</b></td>
<td><b>Description</b></td> <td><b>List Price</b></td> <td> </td> </tr>
#foreach ($item in $itemList)
<tr bgcolor="#FFFF88">
<td><b>
<a href="viewItem.do?itemId=$item.itemId">
$item.itemId</a></b></td>
<td>$item.productId</td>
<td>
$item.attr1
$!item.attr2
$!item.attr3
$!item.attr4
$!item.attr5
$product.name
</td>
<td>$yoshi.formatNumber($item.listPrice, '$#,##0.00')</td>
<td><a href="addItemToCart.do?itemId=$item.itemId">
<img border="0" src="images/button_add_to_cart.gif" /></a></td>
</tr>
#end
<tr><td>
#if (!$firstPage)
<a href="${continuation.id}.kont?page=previous"><font color="white"><B><<
Prev</B></font></a>
#end
#if (!$lastPage)
<a href="${continuation.id}.kont?page=next"><font color="white"><B>Next
>></B></font></a>
#end
</td></tr>
</table>
</p>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/SearchProducts.vm
Index: SearchProducts.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<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>
<table align="center" bgcolor="#008800" border="0" cellspacing="2" cellpadding="3">
<tr bgcolor="#CCCCCC"> <td> </td> <td><b>Product ID</b></td>
<td><b>Name</b></td> </tr>
#foreach ($product in $searchResultsProductList)
<tr bgcolor="#FFFF88">
<td><a href="viewProduct.do?productId=$product.productId">
$product.descn</image></a></td>
<td><b><a href="viewProduct.do?productId=$product.productId"><font
color="BLACK">$product.productId</font></a></b></td>
<td>$product.name</td>
</tr>
#end
<tr>
<td>
#if (!$firstPage)
<a href="${continuation.id}.kont?page=previous"><font color="white"><B><<
Prev</B></font></a>
#end
#if (!$lastPage)
<a href="${continuation.id}.kont?page=next"><font color="white"><B>Next
>></B></font></a>
#end
</td>
</tr>
</table>
#parse ("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/ShippingForm.vm
Index: ShippingForm.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<form action="${continuation.id}.kont" styleId="workingOrderForm" method="post" >
<TABLE border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFF88">
<TR bgcolor="#FFFF88"><TD colspan="2">
<FONT color="GREEN" size="4"><B>Shipping Address</B></FONT>
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
First name:</TD><TD><input type="text" name="shipToFirstName" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
Last name:</TD><TD><input type="text" name="shipToLastName" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
Address 1:</TD><TD><input type="text" size="40" name="shipAddress1" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
Address 2:</TD><TD><input type="text" size="40" name="shipAddress2" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
City: </TD><TD><input type="text" name="shipCity" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
State:</TD><TD><input type="text" size="4" name="shipState" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
Zip:</TD><TD><input type="text" size="10" name="shipZip" />
</TD></TR>
<TR bgcolor="#FFFF88"><TD>
Country: </TD><TD><input type="text" size="15" name="shipCountry" />
</TD></TR>
</TABLE>
<P>
<input type="image" src="images/button_submit.gif"/>
</P>
</form>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/SignonForm.vm
Index: SignonForm.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<b><font color="RED">$message </font></b>
<form action="${continuation.id}.kont" method="POST">
<table align="center" border="0">
<tr>
<td colspan="2">Please enter your username and password.
<br /> </td>
</tr>
<tr>
<td>Username:</td>
<td><input type="text" name="username" value="j2ee" /></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="password" value="j2ee" /></td>
</tr>
<tr>
<td> </td>
<td><input type="image" border="0" src="images/button_submit.gif" name="update"
/></td>
</tr>
</table>
</form>
<center>
<a href="newAccountForm.do">
<img border="0" src="images/button_register_now.gif" />
</a>
</center>
#parse("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/ViewOrder.vm
Index: ViewOrder.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<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>
<tr><td bgcolor="#FFFF88">
<a href="viewOrder.do?webservice=true&orderId=$order.orderId">
<font color="BLACK" size="2"><B>
View with Web Service
</B></font>
</a>
</td></tr>
</table>
#if ($message)
<center><b>$message</b></center>
#end
<p>
<table width="60%" align="center" border="0" cellpadding="3" cellspacing="1"
bgcolor="#FFFF88">
<tr bgcolor="#FFFF88"><td align="center" colspan="2">
<font size="4"><b>Order #$order.orderId</b></font>
<br /><font size="3"><b>$yoshi.formatDate($order.orderDate, 'yyyy/MM/dd
hh:mm:ss')</b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b>Payment Details</b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
Card Type:</td><td>
$order.cardType
</td></tr>
<tr bgcolor="#FFFF88"><td>
Card Number:</td><td>$order.creditCard<font color="red" size="2">* Fake
number!</font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
Expiry Date (MM/YYYY):</td><td>$order.expiryDate
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b>Billing Address</b></font>
</td></tr>
<tr bgcolor="#FFFF88"><td>
First name:</td><td>$order.billToFirstName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Last name:</td><td>$order.billToLastName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 1:</td><td>$order.billAddress1
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 2:</td><td>$order.billAddress2
</td></tr>
<tr bgcolor="#FFFF88"><td>
City: </td><td>$order.billCity
</td></tr>
<tr bgcolor="#FFFF88"><td>
State:</td><td>$order.billState
</td></tr>
<tr bgcolor="#FFFF88"><td>
Zip:</td><td>$order.billZip
</td></tr>
<tr bgcolor="#FFFF88"><td>
Country: </td><td>$order.billCountry
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<font color="GREEN" size="4"><b>Shipping Address</b></font>
</td></tr><tr bgcolor="#FFFF88"><td>
First name:</td><td>$order.shipToFirstName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Last name:</td><td>$order.shipToLastName
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 1:</td><td>$order.shipAddress1
</td></tr>
<tr bgcolor="#FFFF88"><td>
Address 2:</td><td>$order.shipAddress2
</td></tr>
<tr bgcolor="#FFFF88"><td>
City: </td><td>$order.shipCity
</td></tr>
<tr bgcolor="#FFFF88"><td>
State:</td><td>$order.shipState
</td></tr>
<tr bgcolor="#FFFF88"><td>
Zip:</td><td>$order.shipZip
</td></tr>
<tr bgcolor="#FFFF88"><td>
Country: </td><td>$order.shipCountry
</td></tr>
<tr bgcolor="#FFFF88"><td>
Courier: </td><td>$order.courier
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<b><font color="GREEN" size="4">Status:</font> $order.status</b>
</td></tr>
<tr bgcolor="#FFFF88"><td colspan="2">
<table width="100%" align="center" bgcolor="#008800" border="0" cellspacing="2"
cellpadding="3">
<tr bgcolor="#CCCCCC">
<td><b>Item ID</b></td>
<td><b>Description</b></td>
<td><b>Quantity</b></td>
<td><b>Price</b></td>
</tr>
#foreach ($cartItem in $itemList)
<tr bgcolor="#FFFF88">
<td><b><a href="viewItem.do?itemId=$cartItem.item.itemId"><font
color="BLACK">$cartItem.item.itemId</font></a></b></td>
<td>
#if ($cartItem.item)
$!cartItem.item.attr1
$!cartItem.item.attr2
$!cartItem.item.attr3
$!cartItem.item.attr4
$!cartItem.item.attr5
$!cartItem.item.product.name
#else
<i>{description unavailable}</i>
#end
</td>
<td>$cartItem.quantity</td>
<td align="right">$cartItem.item.listPrice</td>
</tr>
#end
<tr bgcolor="#FFFF88">
<td colspan="4" align="right"><b>Total: $order.totalPrice</b></td>
</tr>
</table>
</td></tr>
</table>
</p>
#parse ("view/templates/IncludeBottom.vm")
1.1
cocoon-2.1/src/scratchpad/webapp/samples/petstore/view/templates/index.vm
Index: index.vm
===================================================================
#parse ("view/templates/IncludeTop.vm")
<table border="0" cellspacing="0" width="100%">
<tbody>
<tr>
<td valign="top" width="100%">
<table align="left" border="0" cellspacing="0" width="80%">
<tbody>
<tr>
<td valign="top">
<!-- SIDEBAR -->
<table bgcolor="#FFFF88" border="0" cellspacing="0" cellpadding="5"
width="200">
<tbody>
<tr>
<td>
#if (!$accountForm.signOn)
<b><i><font size="2" color="BLACK">Welcome
$accountForm.account.firstName!</font></i></b>
#end
</td>
</tr>
#foreach ($category in $categoryList)
<tr>
<td>
<a href="viewCategory.do?categoryId=$category.catId">
<i><h2>$category.name</h2></i></a>
</td>
</tr>
#end
</tbody>
</table>
</td>
<td align="center" bgcolor="white" height="300" width="100%">
<!-- MAIN IMAGE -->
<map name="estoremap"><area alt="Birds" coords="72,2,280,250"
href="viewCategory.do?categoryId=BIRDS" shape="RECT" /><area alt="Fish"
coords="2,180,72,250" href="viewCategory.do?categoryId=FISH" shape="RECT" /><area
alt="Dogs" coords="60,250,130,320" href="viewCategory.do?categoryId=DOGS" shape="RECT"
/><area alt="Reptiles" coords="140,270,210,340"
href="viewCategory.do?categoryId=REPTILES" shape="RECT" /><area alt="Cats"
coords="225,240,295,310" href="viewCategory.do?categoryId=CATS" shape="RECT" /><area
alt="Birds" coords="280,180,350,250" href="viewCategory.do?categoryId=BIRDS"
shape="RECT" /></map><img border="0" height="355" src="images/splash.gif"
align="center" usemap="#estoremap" width="350" /> </td></tr></tbody></table></td></tr>
</tbody>
</table>
#parse("view/templates/IncludeBottom.vm")