<%
/******************************************************************************
 * 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" import="com.edeal.frontline.*"%><%@page import="java.util.*" %>
<%@ page import="com.edeal.frontline.grid.GridData" %>
<%@ page import="java.util.Vector" %>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.SupportBean" id="Support" scope="request"/>
<%
    FlRequest flRequest = new FlRequest(request);
    FlContext context = flRequest.getContext();
    DataDictionary dico = context.getDataDictionary();
    String id = "";
    
    try{
    	id = Support.getID();
    }catch(Exception e){}
    
    
	String tailleTable="";
	String planID="";
	String planFileName="";
	String colSpan = "3";
	
	boolean hasLogo = false;
	try {
		if (Support.getSupLogoID()!=null){
			tailleTable="33%";
			hasLogo = true;	
			colSpan = "5";
		}
		else{
		tailleTable="50%";
		colSpan = "3";
		}	
	} catch (FieldNotInitializedException fnie) {
	}
	tailleTable="50%";
	
	String dayStr = "&nbsp;" + Utils.getMessage(session, "L609F", "jour(s)");
	boolean hasAttachment = false;
	try{
	
		if (Support.getSupAttID()!=null && Support.getSupAttID().size()>0) {
			hasAttachment = true;
		}
	}catch(Exception e){}
	
	try{
		planID = Support.getSupPlanID();
		planFileName= Support.getSupPlanFileName();
	}catch(Exception e){
	}
	String supZip = null;
	try{
		supZip = Support.getSupZip();
	}catch(FieldNotInitializedException e){}
	String supCity = null;
	try{
		supCity = Support.getSupCity();
	}catch(FieldNotInitializedException e){}
%>
<script language="javascript">
function view(idJou){
	window.location = '<fl:link url="/read_journalist.fl"/>'+'&id='+idJou;
}

function doRefresh(){
	//doAjax('<fl:link url="/list_sup_jouajax.fl"/>'+'&id='+'<%=id%>');
	
		_grid__supjou_js_.render('id','<%=id%>');
	
}

function doRefreshPlanEmb() {
	_grid__PLAN_EMB_js_.render();
}

function doRefreshInter(){
	doAjax('<fl:link url="/list_sup_inter.fl"/>'+'&id='+'<%=id%>' + '&type=support');
}



function doReturn(){
	if (eDealXmlhttp.readyState == 4){
		var str = eDealXmlhttp.responseText;
		alert(str);
	}
	
	try{
		eval(str);
	}catch(error){
		alert(error);
	}
	
}
</script>
<fl:bigTabs objectTitle="<%=Utils.getMessage(session, \"L638B\", \"Fiche Support\")%>" ou="<%= \"/read_support.fl\" + (id != null ? \"?id=\"+id : \"\")%>">
		<table class="container" cellpadding="0">
		
		<tr>
			<td colspan="<%= colSpan%>" class="titreFiche">				
				<fl:getProperty name="Support" property="SupTitle" alt="&nbsp;"/>
			</td>
		</tr>
		<tr class="ligne_separation">
			<td colspan="<%= colSpan%>"></td>
		</tr>
		<tr>
			<td class="dataValue" style="vertical-align:top; width: <%=tailleTable%>">
				<table class="data_column" cellpadding="0">
					<tr class="fieldline">
						<td class="dataLabel"><fl:getMessage code="F2010" alt="Groupe"/></td>
						<td class="dataValue"><fl:getProperty name="Support" property="SupEdiID" bean="true" alt="&nbsp;" href="true" disp="<%=flRequest.computeURL(\"/read_editor.fl\")%>" /></td>
					</tr>
					
					<tr valign="top">
						<td class="dataLabel"><fl:getMessage code="F2012" alt="Adresse"/></td>
						<td class="dataValue">
							<fl:getProperty name="Support" property="SupAd1" alt="" postText="<br>"/>
							<fl:getProperty name="Support" property="SupAd2" alt="" postText="<br>"/>
							<fl:getProperty name="Support" property="SupAd3" alt="" postText="<br>"/>
							<fl:getProperty name="Support" property="SupZip" alt="" postText="&nbsp;"/><fl:getProperty name="Support" property="SupCity" alt="" postText=""/><% try { Support.getSupZip(); Support.getSupCity();%><br><% } catch (FieldNotInitializedException fnie) {try { Support.getSupCity();%><br><%} catch (FieldNotInitializedException e) {}} %>
							<fl:getProperty name="Support" property="SupCtrID" alt="&nbsp;" preText="<%= (supZip!= null && supCity == null) ? \"<br>\" : \"\"%>"/>
						</td>
					</tr>
				</table>
			</td>
			
			<!-- Liste des <br> ajoutées pour voir la barre de separation sous IE -->
			<td class="separation"><div class="separation"></div></td>
			
			<td class="dataValue" style="vertical-align:top; width: <%=tailleTable%>">
				<table class="data_column" cellpading="0">
				<tr valign="top">
					<td class="dataLabel" style="text-align: left"><fl:getMessage code="F0049" alt="Tél."/></td>
					<td class="dataValue"><fl:getProperty name="Support" property="SupPhone" alt="&nbsp;" format="phone"/></td>
				</tr>
				<tr valign="top">
					<td class="dataLabel" style="text-align: left"><fl:getMessage code="F2013" alt="Fax"/></td>
					<td class="dataValue"><fl:getProperty name="Support" property="SupFax" alt="&nbsp;"/></td>
				</tr>
				<tr valign="top">
					<td class="dataLabel" style="text-align: left"><fl:getMessage code="F200B" alt="Web"/></td>
					<td class="dataValue"><a href="<fl:getProperty name="Support" property="SupWeb" alt=""/>" target="_blank"><fl:getProperty name="Support" property="SupWeb" alt="&nbsp;"/></a></td>
				</tr>				
				<tr valign="top">
					<td class="dataLabel" style="text-align: left"><fl:getMessage code="F205A" alt="Plan média"/></td>
					<td class="dataValue"><fl:attach name="Support" colID="SupPlanID" edit="false" /></td>
				</tr>				
				</table>
			</td>					
			<%
				if (hasLogo){%>
				<td class="separation"><div class="separation"></div></td>
				<td class="dataValue" style="vertical-align:top; width: 1%" colspan="2">
					<table class="data_column">
						<tr valign="top">
						
							<td width="1%" nowrap style="text-align: right"><img src="<fl:webapp/>/download?id=<fl:getProperty name="Support" property="SupLogoID" alt=""/>" border="0" width="200" height="60" align="top"></td>
						
							<!--<td style="text-align: right"> <img src="<fl:webapp/>/download?id=<fl:getProperty name="Support" property="SupLogoID" alt=""/>" border="0" style="width:expression(this.scrollWidth > 200 ? '200px' : 'auto');max-width: 200px;" align="top"></td>-->
						</tr>
					</table>
				</td><%
				}
			%>
			
		</tr>
		
		
		<tr class="ligne_separation">
			<td colspan="<%= colSpan%>"></td>
		</tr>
		</table>
		
<link href="<fl:webapp/>/css/smalltabs_css.jsp" rel="stylesheet" type="text/css">
<fl:smallTabs name="SupRead">
	<fl:sTab id="PROFILE" title="<%= Utils.getMessage(session, \"L2038\", \"Profil\") %>">
	<fl:autodisplay name="Support" zone="SupportProfil"/>
	</fl:sTab>
	
	<fl:sTab id="SUPPRICES" title="<%= Utils.getMessage(session, \"F2056\", \"Tarifs\") %>">
		<div class="dataValue"><fl:getProperty name="Support" property="SupPrices" alt=""/></div>
	</fl:sTab>
	
	<fl:sTab id="SUPNEGOPRICES" title="<%= Utils.getMessage(session, \"F2057\", \"Tarifs Négociés\") %>">
		<div class="dataValue"><fl:getProperty name="Support" property="SupNegoPrices" alt="&nbsp;"/></div>
	</fl:sTab>
	
	<fl:sTab id="SUPJOUS" title="<%=Utils.getMessage(session, \"F201B\", false, true, \"Journalistes\")%>" onselect="doRefresh()">
		<div>
			<fl:grid height="100" name="supjou"  ajaxUrl="<%= \"/list_sup_jouajax.fl?id=\" + Support.getID() %>"/>
		</div>
	</fl:sTab>	
	
	<fl:sTab id="SUPEDTPLAN" title="<%= Utils.getMessage(session, \"L206A\", \"Plannings rédactionnels\")%>" onselect="doRefreshPlanEmb();">
		<div>
			<fl:grid height="100" name="PLAN_EMB" ajaxUrl="<%= \"/embedded_list_ajax.fl?EdpSupID=\" + Support.getID() %>">
				<fl:gridColumn pos="0" width="75px" />
				<fl:gridColumn pos="1" width="635px" />
			</fl:grid>
		</div>
	</fl:sTab>	

	<fl:sTab id="ATTACHMENT" title="<%= Utils.getMessage(session, \"L201C\", \"Documents joints\") %>">
		<fl:attach name="Support" colID="SupAttID" edit="false" listFobs="true"/>
	</fl:sTab>
</fl:smallTabs>
</fl:bigTabs>
