<% /****************************************************************************** * 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.Utils" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="java.util.Date" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.Hashtable" %> <%@ page import="com.edeal.frontline.TablesBean" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="java.lang.reflect.Method" %> <%@ page import="com.edeal.frontline.RefValuesBean" %> <%@ page import="java.lang.reflect.InvocationTargetException" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %> <% 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 = RefValues.getID(); } catch (FieldNotInitializedException fnie) { } String tabID = flRequest.getRequestParameterOrAttribute("tabID"); boolean isCreate = id == null; String[] fields = {"TabT1", "TabT2", "TabT3", "TabN1", "TabN2", "TabN3", "TabD1", "TabD2", "TabD3"}; String[] refFields = {"RefTe1", "RefTe2", "RefTe3", "RefNu1", "RefNu2", "RefNu3", "RefDa1", "RefDa2", "RefDa3"}; String[] refLocaleFields = {"RelTe1", "RelTe2", "RelTe3"}; Hashtable cols = TablesBean.getColumnLabels(context, tabID); Vector vLanguages = dico.getRefList(session, "Lna", "Te1"); Vector vLngID = new Vector(); Vector vLngDisplay = new Vector(); if (vLanguages != null) { for (int i = 0; i < vLanguages.size(); i++) { Vector row = (Vector)vLanguages.elementAt(i); vLngID.addElement(row.elementAt(0)); vLngDisplay.addElement(row.elementAt(1)); } } try { Hashtable translations = RefValues.getTranslations(); %>
" ou="<%= \"/edit_refvalue.fl\" + (id != null ? \"?id=\" + id : \"\") %>">
<% if (isCreate) { %> <% } else { %> <% } %>
<% int nbCols = 0; for (int i = 0; i < fields.length; i++) { if (cols.get(fields[i]) != null) { nbCols++; } } boolean hasTooManyCols = (nbCols > 5); String width = (100/(nbCols + 4)) + "%"; %> <% for (int i = 0; i < fields.length; i++) { if (cols.get(fields[i]) != null) { %> <% } } %> <% for (int i = 0; i < fields.length; i++) { if (cols.get(fields[i]) != null) { try { String methodStr = "get" + refFields[i]; Method meth; Object value; String dispValue = ""; meth = RefValuesBean.class.getMethod(methodStr, null); try { if (refFields[i].indexOf("Nu") > 0) { value = (Number) meth.invoke(RefValues, null); dispValue = Utils.formatToWeb(value,false); } else if (refFields[i].indexOf("Da") > 0) { value = (Date) meth.invoke(RefValues, null); dispValue = Utils.formatToWebDate((Date) value,false); } else { value = (String) meth.invoke(RefValues, null); dispValue = Utils.formatToWeb(value,false); } } catch (InvocationTargetException e) { if (e.getTargetException() instanceof FieldNotInitializedException) { value = ""; } else { throw e.getTargetException(); } } %> <% } catch (Exception e) { logger.error("[edit_refvalues.jsp] - Error getting field: " + refFields[i] + " - " + e.toString()); } } } %> <% if (vLngID != null) { for (int i = 0; i < vLngID.size(); i++) { String lngID = (String)vLngID.elementAt(i); String lngDisplay = (String)vLngDisplay.elementAt(i); Hashtable row = (Hashtable)translations.get(lngID); if (row == null) { row = new Hashtable(); } %> bean"> <% for (int j = 0; j < fields.length; j++) { if (cols.get(fields[j]) != null) { if (j < refLocaleFields.length) { String currRel = (String)row.get(refLocaleFields[j]); %> <% } else { %> <% } } } %> <% } } %>
  <%= Utils.formatToWeb((String)cols.get(fields[i]), false) %>
;">
0)? \"date\" : \"\" %>" nodiv="true"/>
<%= Utils.formatToWeb(lngDisplay, false) %> ">   <% if(!hasTooManyCols) { %>
<% } %> <% if(!hasTooManyCols) { %>
<% } %>
    
">"> <% if (isCreate) { %>    ">"> <% } %>    ">" class="cancel_button">
<% } catch (Exception e) { logger.error("Exception: " + e.toString()); } %>