<%-- 
/**
  * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
  *
  * 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
  *
  * Component of: Red Hat Application Server
  * 
  * Initial Developers: Aizaz Ahmed
  *                     Vivek Lakshmanan
  *                     Andrew Overholt
  *                     Matthew Wringe
  *
  */
--%>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%-- This page provides a detailed view for Items. It expects the item
object ItemLocal to be defined as itemToDisplay. This is clumsy ... if necessary
it should be modified so that the item is loaded into the session and the
name of the item is passed to this page --%>

<%@ page contentType="text/html"
         import="olstore.entity.*"
         import="olstore.util.WebUtils"
         import="olstore.session.helper.ItemHelperLocalHome"
	 	 import="olstore.framework.EJBHomeFactory"
%>


<div class="itemDetailedView">
<div class="spacer" ></div>
<%  ItemLocal item = (ItemLocal) request.getAttribute( "itemToDisplay" );
    EJBHomeFactory factory=EJBHomeFactory.getInstance();
    ItemHelperLocalHome itemHelper = (ItemHelperLocalHome)factory.getLocalHome (EJBHomeFactory.ITEM_HELPER);
    pageContext.setAttribute ("itemQS",item, PageContext.REQUEST_SCOPE);
%>  <div class="header"><span class="label" >
			<html:link action="/views/Item.do" paramName="itemQS" paramProperty="itemId" paramId="itemId">

                                <%= item.getName() %>
			</html:link>
                       </span>
                       <span class="formw">[<html:link action="/views/Item.do" paramName="itemQS" paramProperty="itemId" paramId="itemId">Details</html:link>]

			</span>
    <div class="spacer"></div>
    </div>
    <div class="content">

<%
    PictureLocal pic = itemHelper.create().getPicture ( item );
    if ( pic != null ) {
%>
            <html:link action="/views/Item.do" paramName="itemQS" paramProperty="itemId" paramId="itemId">
            <img src="../<%= pic.getLocation() %>"
                 title="<%= pic.getText() %>" />
            </html:link>
<%
    }

%>      
    <p class="price">Price: $<%=WebUtils.costDisplay(item.getPrice())%></p><br />
    <p class="desc" > <%= item.getLongDesc() %> </p>
    <jsp:include page="ItemPurchasedBy.jsp" />
    <div class="spacer" ></div>
    </div>
    <div class="spacer"></div>
</div>
