<%/******************************************************************************
 * Copyright (c) 2000-2005 e-Deal
 *
 * e-Deal S.A.
 * 55 rue Brillat Savarin
 * 75013 Paris
 * France
 *
 * T: +33 (0)1 53 80 80 30
 * F: +33 (0)1 73 01 69 77
 * http://www.e-deal.com
 * 
 * La diffusion de ce code source sous quelque forme que ce soit sans
 * l'autorisation de E-DEAL est interdite.
 *
 * Vous êtes autorisés à modifier ce code source uniquement pour votre usage
 * propre et sous réserve que les mentions de copyright demeurent intactes.
 *
 * Ce code est fourni en l'état. Aucune garantie d'aucune sorte, explicite ou
 * implicite n'est donnée. En aucun cas E-DEAL ne pourra être tenu pour
 * responsable des dommages pouvant résulter de l'utilisation de ce code
 * source.
 ******************************************************************************/
%>
<%@page session="true"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="com.edeal.frontline.FieldNotInitializedException" %>
<%@ page import="com.edeal.frontline.Utils" %>
<%@ page import="com.edeal.frontline.custom.Photo_Bean"%>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.custom.Photo_Bean" id="Photo_" scope="request"/>
<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/common_css.jsp">

<%
	final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass());
	FlRequest flRequest = new FlRequest(request);
	FlContext context = flRequest.getContext();
	DataDictionary dico = context.getDataDictionary();
	String id = null;
	

	try {
	    id = Photo_.getID();
	} catch (FieldNotInitializedException fnie) {}
	
	String nomPhoto = null;
	try {
		nomPhoto = Photo_.getPo_NomPhoto();
	} catch (FieldNotInitializedException e) {}
	
	String apercuID = null;
	try {
		apercuID = Photo_.getPo_Apercu();
	} catch (FieldNotInitializedException e) {
	}
	
%>
<script language="JavaScript">
<%if (apercuID != null) {%>

var fois = 0;
var apercu;

function afficheImage() {
	if (fois != 0) {
		return;
	}
	
	var apercuWidth = (apercu.width < 500 ? 500 : apercu.width + 50);
	var apercuHeight = ((apercu.height + 100) < 300 ? 300 : (apercu.height + 100));

	var ouvrirImage = window.open('<fl:webapp/>/sales/photo_/showApercu.jsp?id=<%=apercuID%>','photoWindow','toolbar=0,location=0,menuBar=0,scrollbars=0,resizable=1,width=' + apercuWidth + ',height=' + apercuHeight);
	fois=1;
}

function doOnLoad() {
	apercu = new Image();
	apercu.src = '<fl:webapp/>/download?id=<%=apercuID%>';
	
	// Sometimes, for an unknown reason, we have to do it twice 
	if (apercu.width == 0 && apercu.height == 0) {
		apercu = new Image();
		apercu.src = '<fl:webapp/>/download?id=<%=apercuID%>';
	}
}

function doRefresh() {
	window.top.location.reload();	
}
<%}%>

</script>

<fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"FF001\", \"Photo\") %>" listTitle="<%= Utils.getMessage(session, \"FF05D\", \"Liste des photos\") %>" ou="<%= \"read_photo_.fl\" + (id != null ? \"?id=\" + id : \"\")%>" >
    <table class="container" cellpadding="0">
		<tr>					
			<td style="width: 100%" class="titreFiche">
				<%=Utils.formatToWeb(nomPhoto.toString(), false)%>
			</td>
		</tr>
	</table>
    <table class="container" cellpadding="0">
   
		<tr class="ligne_separation"><td></td></tr>
		<tr>
			<td class="column2">
				<table class="container">
					<fl:fieldRead property="Po_LienPhoto" href="<fl:fieldRead property='Po_LienPhoto' />"/>	
					<fl:fieldRead property="Po_LienPhotoExt"/>
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldRead property="Po_DateAjout"/>	
					<tr><td colspan="5" class="ligne_separation"/></tr>
					<fl:fieldRead property="Po_AuteurImage"/>		
					<tr class="fieldline">
						<td id="Tiers_label" class="dataLabel"><fl:label code="FF038" label="Tiers"/></td>
						<td id="Apercu_value" class="dataValue">							
							<fl:getProperty name="Photo_" property="Po_Tiers" bean="true" href="true" disp="<%= flRequest.computeURL(\"/read_enterprise.fl\") %>" alt=""/>
						</td>
					</tr>
				</table>
			</td>
			<td class="separation"><div class="separation"></div></td>
			<td class="column2">
				<table class="data_column" cellpadding="0">
					<tr class="fieldline">
						<td id="Apercu_label" class="dataLabel"><fl:label code="FF099" label="Aperçu"/></td>
						<td id="Apercu_value" class="dataValue">
						<%if(apercuID != null) { %>
							<!-- <img alt="test" src='<fl:webapp/>/download?id=<%=apercuID%>' onclick="javascript:afficheImage()" height="300" width="500"> -->
							<img alt="test" src='<fl:webapp/>/download?id=<%=apercuID%>' height="300" width="500">
							<%} %>
						</td>
					</tr>
					<tr class="fieldline">
						<td id="PhVoie_label" class="dataLabel"><span style="color:#0000;font-weight: bold;">&nbsp;</span></td>
					</tr>
					<fl:fieldRead property="Po_DroitsUtilisation"/>
					<fl:fieldRead property="Po_Qualification"/>		
					<fl:fieldRead property="Po_TagsMV"/>
				</table>
			</td>			
		</tr>
		<tr class="ligne_separation"><td></td></tr>
	</table>
<fl:notes name="PhComments" title="<%= Utils.getMessage(session, \"L64B4\", \"Commentaires\") %>" nbPix="32"><fl:getProperty name="Photo_" alt="" property="Po_Commentaires"/></fl:notes>
</fl:bigTabs>
