%@page import="com.edeal.frontline.AccessControlManager"%><%
/******************************************************************************
* 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="java.util.Vector" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.text.DecimalFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.GregorianCalendar" %>
<%@ page import="com.edeal.frontline.*" %>
<%@ page import="com.edeal.frontline.helper.custom.*" %>
<%@ 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();
Vector columnNames = new Vector();
Vector columnSQLNames = new Vector();
columnSQLNames.addElement("RefID");
columnNames.addElement(Utils.getMessage(session, "F2000", "Code"));
columnSQLNames.addElement("RefVal");
try {
String colName = Tables.getTabT1();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefTe1");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabT2();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefTe2");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabT3();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefTe3");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabN1();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefNu1");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabN2();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefNu2");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabN3();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefNu3");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabD1();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefDa1");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabD2();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefDa2");
}
} catch (FieldNotInitializedException fnie) {
}
try {
String colName = Tables.getTabD3();
if (colName != null) {
columnNames.addElement(colName);
columnSQLNames.addElement("RefDa3");
}
} catch (FieldNotInitializedException fnie) {
}
columnNames.addElement(Utils.getMessage(session, "L601A", "Numéro d\'ordre"));
columnSQLNames.addElement("RefPos");
columnNames.addElement(Utils.getMessage(session, "L601B", "Désactivée"));
columnSQLNames.addElement("RefEnd");
Vector values = Tables.getRefValuesData();
DecimalFormat floatFormat = FlLocale.getInstance(session).getDecimalFormat("#,##0.00;- #,##0.00");
RefValuesBean rvb = new RefValuesBean(context);
rvb.setSession(session);
%>
|
<%
Date exTemps = new Date(0);
GregorianCalendar initCal = FlLocale.getInstance(session).getCalendar();
initCal.setTime(exTemps);
for(int i = 0; i < columnNames.size(); i++) {
%> <%= (String)columnNames.elementAt(i) %> |
<%
}
%>
<%
boolean colorBlue = true;
boolean canDel = false;
boolean canEdit = false;
ActorBean actor=ActorHelper.getSessionActor(session);
for(int i = 0; i < values.size(); i++) {
Hashtable row = (Hashtable)values.elementAt(i);
String refID = (String)row.get("RefID");
colorBlue = !colorBlue;
//if (canDel == null) {
canDel = rvb.enforceAccess(AccessControlManager.DELETE, refID,actor);
//}
//if (canEdit == null) {
canEdit = rvb.enforceAccess(AccessControlManager.EDIT, refID, actor);
//}
%> ">
|
<%
int width = 100 / columnSQLNames.size();
for(int j = 1; j < columnSQLNames.size() - 1; j++) {
String colName = (String)columnSQLNames.elementAt(j);
Object col = row.get(colName);
boolean isNumeric = (col != null) && ("RefNu1".equals(colName) ||"RefNu2".equals(colName) ||"RefNu3".equals(colName) || "RefPos".equals(colName));
boolean isDate = (col != null) && ("RefDa1".equals(colName) ||"RefDa2".equals(colName) ||"RefDa3".equals(colName));
boolean isRefPos = (col != null) && ("RefPos".equals(colName));
%> <%= (isRefPos) ? "width:1%;" : "" %>">
<%
if (col != null && ("RefNu1".equals(colName) ||"RefNu2".equals(colName) ||"RefNu3".equals(colName))) {
%> <%= floatFormat.format((Number)row.get((String)columnSQLNames.elementAt(j))) %>
<%
} else if (col != null &&("RefDa1".equals(colName) ||"RefDa2".equals(colName) ||"RefDa3".equals(colName))) {
//voir si le resultat est une date ou une heure, se baser sur la date
Date currDate = (Date) col;
GregorianCalendar currCal = FlLocale.getInstance(session).getCalendar();
currCal.setTime(currDate);
boolean isJanuaryFirstOf1970 = false;
if (currCal.get(GregorianCalendar.YEAR) == initCal.get(GregorianCalendar.YEAR)) {
if (currCal.get(GregorianCalendar.MONTH) == initCal.get(GregorianCalendar.MONTH)) {
if (currCal.get(GregorianCalendar.DAY_OF_YEAR) == initCal.get(GregorianCalendar.DAY_OF_YEAR)) {
isJanuaryFirstOf1970 = true;
}
}
}
if (currDate != null && isJanuaryFirstOf1970) {
%> <%= Utils.formatToWebTime(session, (Date) col, false) %>
<%
} else {
%> <%= Utils.formatToWebDate(session, (Date) col, false) %>
<%
}
} else {
%> <%= Utils.formatToWeb(col, false) %>
<%
}
%>
|
<%
}
Object isActivated = row.get("RefEnd");
%>
<%
if (isActivated != null && ((Boolean)isActivated).booleanValue()) {
%> " title="">
<%
} else {
%>
<%
}
%> |
<%
}
%>