<%

/**
 * JaDOrT: JASMINe Deployment Orchestration Tool
 * Copyright (C) 2008 Bull S.A.S.
 * Copyright (C) 2008 France Telecom R&D
 * Contact: jasmine@ow2.org
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id: store.jsp 3030 2009-01-27 14:43:49Z alitokmen $
 * --------------------------------------------------------------------------
 */

%>
<%@page import="java.util.*"%>
<%

Map products = (Map) request.getAttribute("products");
Map cartItems = (Map) request.getAttribute("cartItems");
Integer cartValue = (Integer) request.getAttribute("cartValue");

Iterator i;

%>
<html>
<head>
<title>MyStore</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
BODY {
	background:#FEFEFE;
	font-family:tahoma,arial,helvetica;
	font-size:13;
	color:#000000;
	cursor:default;
}

input {
	font-family:tahoma,arial,helvetica;
	font-size:13;
	color:#000000;
}

select {
	font-family:tahoma,arial,helvetica;
	font-size:13;
	color:#000000;
}

TD {
	font-size:13
}

H1 {
	font-size:20
}

A {
	text-decoration:none;
	color:#2B5796
}

A:hover {
	color:#FF6262;
	text-decoration:underline
}
</style>
</head>
<body>
<h1>Welcome to MyStore !</h1>
Your cart has <b><%= cartValue %> &euro;</b> of products<br/><br/>
<b>Here are the products in our store :</b>
<ul>
<%

i = products.entrySet().iterator();
while (i.hasNext()) {
	Map.Entry product = (Map.Entry) i.next();
	out.println("<li><b>" + product.getKey() + "</b>: " + product.getValue() + " &euro; &nbsp; <a href=\"./?buyItem=" + product.getKey() + "\">Add one to your cart</a></li>");
}

%>
</ul>
<b>Here are the contents of your cart :</b>
<ul>
<%

i = cartItems.entrySet().iterator();
while (i.hasNext()) {
	Map.Entry cartItem = (Map.Entry) i.next();
	out.println("<li><b>" + cartItem.getKey() + "</b>: you bought " + cartItem.getValue() + " &nbsp; <a href=\"./?removeItem=" + cartItem.getKey() + "\">Remove one from your cart</a></li>");
}

%>
</ul>
</body>
</html>