<%
/******************************************************************************
 * 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" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="com.edeal.frontline.Utils" %>
<%@ page import="com.edeal.frontline.FlLocale" %>
<%@ page import="java.text.DateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.GregorianCalendar" %>
<%@ page import="com.edeal.frontline.FieldNotInitializedException" %>
<%@ page import="java.util.Vector" %>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %>
<jsp:useBean class="com.edeal.frontline.FlOptionBean" id="FlOption" scope="request"/>
<%
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();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/common_css.jsp">
		<link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/master_css.jsp">
		<script type="text/javascript" language="javascript" src="<fl:webapp/>/js/master_js.jsp"></script>
		<script type="text/javascript" language="javascript" src="<fl:webapp/>/js/checkFields.jsp"></script>
		<script type="text/javascript" language="javascript" src="<fl:webapp/>/js/presentField.js"></script>
		<script type="text/javascript" language="javascript" src="<fl:webapp/>/js/utils.js"></script>
		<script type="text/javascript" language="javascript">
		
		function doSubmit() {
			var f = document.forms[0];
			var str	='<scr' + 'ipt language="javascript">window.top.opener.parent.location.reload();window.top.close();</s' + 'cript>';
			f.$$returnedHtmlHead.value = str;
			presentFieldsValue();
			f.submit();
			return true;
		}
		
		function closeWindow() {
			window.top.close();
		}
		
		</script>
	</head>
	<body style="padding-right: 0px;padding-top: 0px;">
		<div id="object_css" style="top: 0px; left: 0px; height: 100%;margin:0px;padding:0px;vertical-align: top;">
			<fl:form action="/save_floption.fl" bean="FlOption">
				<input type="hidden" id="$$returnedHtmlHead" name="$$returnedHtmlHead" value=""/>
				<input type="hidden" id="$$returnedHtmlBody" name="$$returnedHtmlBody" value="Closing..."/>
				<input type="hidden" id="criteria.title" name="criteria.title" value="test"/>
				<br>
				<fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L6456\", \"Assignation d\\'une valeur\") %>" ignoreList="true" showFooter="false">
					<table class="container">
						<tr class="ligne_separation"><td >&nbsp;</td></tr>
						<tr>
							<td class="dataValue" style="vertical-align:top;">
								<table class="data_column" cellpadding="0">
<%
	try {
		String typeID = FlOption.getOptType();
		String codeType = dico.getRefCode("OptType",typeID);
		if ("LIST".equals(codeType)) {
			Vector possibleValues = new Vector();
			try {
				possibleValues = FlOption.getOptValueList();
			} catch (FieldNotInitializedException fnie) {
			}
			String currentValue = null;
			try {
				currentValue = FlOption.getOptValue();
			} catch (FieldNotInitializedException fnie) {
			}
%>									<tr class="fieldline">
										<td class="dataLabel"><label><fl:getMessage code="F6070" alt="Valeur"/></label></td>
										<td class="dataValue">

<%			for (int i = 0; i < possibleValues.size(); i++) {
				String value = (String)possibleValues.elementAt(i);
%>											<%= i > 0 ? "<br/>" : "" %><input type="radio" name="OptValue" id="OptValue_<%= i %>" value="<%= value %>" <%= value.equals(currentValue) ? "checked" : "" %>/><label for="OptValue_<%= i %>"><%= Utils.formatToWeb(value, false) %></label>
<%
			}
%>										</td>
<%		} else {
%>									<fl:fieldEdit property="OptValue"/>
<%		}
	} catch (FieldNotInitializedException fnie) {
	}
%>									<!-- fl:fieldRead property="OptComment"/-->
								</table>
							</td>
						</tr>
					</table>
				</fl:bigTabs>
				&nbsp;
				<div class="validation" style="text-align : center">
						<a href="javascript:doSubmit();"><img src="<fl:link url="/icons/ico/valid_green_long.gif"/>" ></a>&nbsp;&nbsp;&nbsp;
						<a href="#" onclick="closeWindow();return false;"><img src="<fl:link url="/icons/ico/fermer_red_long.gif"/>"></a>
					</div>
			</fl:form>
		</div>
	</body>
</html>
