<%
/******************************************************************************
 * Copyright (c) 2000-2009 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 language="java" contentType="text/html; charset=UTF-8"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="com.edeal.frontline.Utils" %>
<%@ page import="com.edeal.frontline.*" %>
<%@ page import="java.util.Hashtable" %>
<%@ page import="java.util.HashMap" %>
<%@ page import="java.util.Vector" %>
<%@ page import="com.edeal.frontline.ListBean" %>
<%@ page import="com.edeal.frontline.ListBean.SearchZone" %>
<%@ page import="com.edeal.frontline.DataDictionary" %>
<%@ page import="com.edeal.frontline.helper.custom.DataDictionaryHelper" %>
<%@ page import="com.edeal.frontline.FlContext" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.lang.reflect.*" %>
<%@ page import="com.edeal.frontline.navigation.WebUtils" %>
<%@ page import="com.edeal.frontline.controller.actions.SelectAction" %>
<%@ page import="com.edeal.frontline.FlDataSource" %>
<%@ page import="java.util.Date" %>
<%@ page import="com.edeal.frontline.helper.custom.ListHelper" %>
<%@ page import="com.edeal.frontline.ListBean.MandatoryGroup" %>
<%@page import="com.edeal.frontline.navigation.EdealBigTabsNavigation"%>
<%@page import="com.edeal.frontline.navigation.EdealBigTabsNavigation.BigTabsParams"%>
<%@ page import="com.edeal.frontline.navigation.FlRequest" %>
<%@ page import="com.edeal.frontline.grid.*" %>
<%@ page import="com.edeal.frontline.*" %>
<%@ page import="com.edeal.frontline.grid.EdealGrid" %>
<%@ page import="java.util.*" %>
<%@ page import="com.edeal.frontline.FrontlineException" %>
<%@ page import="com.edeal.frontline.navigation.EdealBigTabsNavigation" %>
<%@ page import="com.edeal.frontline.navigation.EdealBigTabsNavigation.BigTabsParams" %>
<%@page import="java.util.Enumeration"%>
<%@page import="com.edeal.frontline.helper.ActorBaseHelper"%>
<%@page import="com.edeal.frontline.helper.custom.ActorHelper"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@ page import="com.edeal.frontline.helper.custom.EventHelper" %> 
<%@ page import="com.edeal.frontline.helper.custom.PersonEventHelper" %> 
<%@ page import="com.edeal.frontline.helper.EventBaseHelper.StatusType" %> 
<%@ page import="java.util.Iterator" %>
<%@page import="com.edeal.frontline.display.XmlSelector"%>
<%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl"%>
<jsp:useBean id="List" class="com.edeal.frontline.ListBean" 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();
EdealBigTabsNavigation ebtn = new EdealBigTabsNavigation(request);




// List code
String lc = flRequest.getRequestParameterOrAttribute("lc");
if (lc == null) {
	lc = flRequest.getRequestParameterOrAttribute("code");
}

// Search criteria
String sc = flRequest.getRequestParameterOrAttribute("sc");


Vector pagination = (Vector)flRequest.getAttribute("Pagination");
boolean hasPagination = pagination != null ? pagination.size() > 1 : false;
ListBean.SearchZone searchZone = null;
ListBean.ResultZone resultZone=null;
try {
	searchZone = List.getSearchZone();
	resultZone = List.getResultZone();
} catch (Exception e) {
}
String includedListScript=null;
if (resultZone!=null) {
	includedListScript=ListHelper.processXmlListScriptExtension(context, session, resultZone.getScript());
}
String pJsonFobQuery=flRequest.getRequestParameterOrAttribute("_jsonfobquery");
JSONUtils jsonUtils=new JSONUtils();
Map<String, String> mapFobQuery = jsonUtils.mapFromJson(pJsonFobQuery);
if (mapFobQuery!=null) {
}



String SfwID = flRequest.getRequestParameterOrAttribute("SfwID");

// Is this our first time in here? (ie, we're not navigating back from an object)
boolean isFirstTimeIn = !ebtn.isDoList(); 

Map searchCriteria = new Hashtable();
if (sc != null) {
	searchCriteria = WebUtils.parseQueryString(sc);
}

String gridName=Utils.formatToWeb(lc, true);

EdealBigTabsNavigation bTabNav = new EdealBigTabsNavigation(request);	
bTabNav.setBigTabsParameterValue(BigTabsParams.NameSearchGridJs, "_grid__" + gridName + "_js_");

String pageIndex=flRequest.getSearchCriteria("$$idx",gridName,false);
pageIndex=StringUtils.isEmpty(pageIndex)?"0":pageIndex;

String pagePagination=flRequest.getSearchCriteria("$$nb",gridName,false);
pagePagination=StringUtils.isEmpty(pagePagination)?(String)pagination.firstElement():pagePagination;

String pPreview = flRequest.getSearchCriteria("$$preview",gridName,false);
boolean fDisplayPreview="true".equals(pPreview);
boolean fHasListPreview =  resultZone.hasPreview();
%>

		<div id="criteriaTableRow"> 
		<br/>
			<form  name="<%= gridName%>_search_criteria" id="<%= gridName%>_search_criteria"  method="get" onsubmit="return false;" onkeyup="criteriaKeyPress(event,'<%= gridName%>')">
<%= ebtn.getBigTabsInput(BigTabsParams.CodeLC) %>
<%= ebtn.getBigTabsInput(BigTabsParams.SearchCriteria) %>
<%= ebtn.getBigTabsInput(BigTabsParams.ObjectURI) %>
<%= ebtn.getBigTabsInput(BigTabsParams.ObjectTitle) %>
<%= ebtn.getBigTabsInput(BigTabsParams.CriteriaListTitle) %>
<% if (isFirstTimeIn) { %>
	<%= ebtn.getBigTabsInput(BigTabsParams.DoList, "1") %>
	<%= ebtn.getBigTabsInput(BigTabsParams.CriteriaListURI, "/list_criteria.fl") %>
	<%= ebtn.getBigTabsInput(BigTabsParams.SelectedTab, "1") %>
<% } %>
<% if (SfwID != null) { %>
			<%= ebtn.getBigTabsInput(BigTabsParams.SoftwareModule) %>
<% } %>
			<table class="container" cellpadding="0">
				<tr valign="top">
					<td>
						<div id="criteriaTableDiv" class="criteriaTableDiv">
<%
	if(searchZone != null) {
		int nTabIndex = 1;
		/////////////////////int nbLines = searchZone.getNbLines()>= 2 ? searchZone.getNbLines()-1 : searchZone.getNbLines();
		int nbLines = searchZone.getNbLines()> 4 ? 4 : searchZone.getNbLines();
		for(int i = 0; i < nbLines ; i++) {
%> 			<span id="criteriaTableLine"> 
			<% for(int j = 0; j < searchZone.getNbFields(i); j++) {
				if (j >= 4) {
					// Four is our limit for right now, hard-coded
					break;
				}
				
				ListBean.Field fld = searchZone.getField(i, j);		
				String fldinputname=fld.getInputName();
				fldinputname=fldinputname.replace("$",":"); // in the sc param, the fields are with : where we expect with $ 
				Vector fieldValues = (Vector)searchCriteria.get(fldinputname);				
			
				if(fld.getChoiceType() == ListBean.CHOICE_NONE) {
					String strDisp = null;
					String value = null;
					if (fieldValues != null && fieldValues.size() > 0) {
						value = (String) fieldValues.firstElement();
					} 
					if(fld.isDate() || fld.isTime() || fld.isBoolean() || fld.isDecimal() || fld.isInteger()) {
						strDisp = fld.getDisplay(session);
					} else {
						strDisp = "<" + fld.getDisplay(session) + ">";
					}

					if(fld.getFldFobSql() != null) {
						String lblValue = null;
						String initVal = flRequest.getRequestParameterOrAttribute("init"+fld.getInputName());
				
						if (value != null) {
							Vector lblValues = (Vector)searchCriteria.get("lbl" + fldinputname);
							if (lblValues != null && lblValues.size() > 0) {
								lblValue = (String)lblValues.firstElement();
							}
						} else {
							HashMap<String, String> vectDefaultVals;
							if (initVal != null) {
								FieldBean fldBean = dico.getFieldByName(fld.getName());
								ObjectsBean obj = dico.getTable("id", fldBean.getFldFobID());
								lblValue = obj.toString(session, initVal);
								value=initVal;
							} else if (sc == null && (vectDefaultVals = fld.getStrDefaultValsList(session)) != null) {
								if (vectDefaultVals.size() > 0) {
									FieldBean fldBean = dico.getFieldByName(fld.getName());
									ObjectsBean obj = dico.getTable("id", fldBean.getFldFobID());
									value = vectDefaultVals.get(ListBean.Field.DISPLAY);
									lblValue = obj.toString(session, value);
								}
							}
						}
						
						
						
						boolean doAjax = fld.getObjAjaxSearch() != null;
						String fldNameWeb = Utils.formatToWeb(fld.getInputName(), true);
						String emptyLabelDisplay = lblValue != null ? Utils.formatToWeb(lblValue, true) : Utils.formatToWeb(strDisp, true);
						String emptyLabelDisplayJS = lblValue != null ? Utils.formatToJavascript(lblValue) : Utils.formatToJavascript(strDisp);
						String selectJsonQuery=mapFobQuery.containsKey(fldNameWeb)?mapFobQuery.get(fldNameWeb):null;
						String queryFobUrl=mapFobQuery.containsKey(fldNameWeb)?"&query="+flRequest.urlEncode(Utils.formatToJavascript(mapFobQuery.get(fldNameWeb))):"";
						String webapp =  request.getContextPath();
						String fobSql = fld.getFldFobSql();
						String selectUrl = "javascript:var win = window.open('" + webapp + "/select.fl?type=" + flRequest.urlEncode(fobSql) + "&field=" + flRequest.urlEncode(fld.getInputName()) + queryFobUrl + "', 'Select" + fobSql + "', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + SelectAction.SELECT_WINDOW_WIDTH + ",height=410')";
						
						ObjectsBean fobBean = dico.getTable("sql", fobSql);
						//Determination of which selector will be used (XML or fields)
						try {
							

							String xmlListSelect = fobBean.getObjSelectListID();
							if (!Utils.isEmpty(xmlListSelect)) { 
								XmlSelector selector = new XmlSelector(false, webapp, xmlListSelect,flRequest.urlEncode(fld.getInputName()), "", 0, "", "");
								
								selectUrl = selector.buildSelectUrl();
								
								
							}
						} catch (FieldNotInitializedException e) {
							//No list defined for object selection (=> use SelectFields)
						//	logger.debug("No list defined for object selection",e);
						} catch (FrontlineException fe) {
							//No list defined for object selection (=> use SelectFields)
							logger.error("Error in list defined for object selection",fe);
					    }	
%>
						<script language="javascript"> 
							function do<%=fldNameWeb%>Change(){
								$("#lbl<%=fldNameWeb%>").change();
							}
						</script>
						<input ed:type="fob" ed:fullname="<%= fld.getFullName() %>" id="<%=fldNameWeb%>" name="<%=fldNameWeb%>" type="hidden" value="<%=Utils.formatToWeb(value, true)%>">
						<input ed:type="foblbl" id="lbl<%=fldNameWeb%>" name="lbl<%=fldNameWeb%>" class="criteriaField<%=(j > 0 ? " leftMargin10" : "")%><%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=emptyLabelDisplay%>"<%=doAjax ? " autocomplete=\"off\" onfocus=\"displayOnFocus(this);\"" : " readonly onfocus=\"this.blur();\""%>>
						<a href="<%= selectUrl %>" tabindex="<%=nTabIndex++%>"><img src="<fl:webapp/>/icons/ico/rechercher.gif" class="icon"></a>
						<a href="javascript:var f = window.document.forms[0]; 
								f.<%=fldNameWeb%>.value = ''; 
								f.lbl<%=fldNameWeb%>.value = '<%=Utils.formatToJavascript(strDisp)%>'; 
								<%= doAjax ? "acLastCompleteValues['lbl" + fldNameWeb + "'] = '" + emptyLabelDisplayJS + "'; acLastCompleteValues['" + fldNameWeb + "'] = ''; " : "" %>
								$(f.lbl<%=fldNameWeb%>).change();
								void('')"
							tabindex="<%= nTabIndex++ %>">
							<img src="<fl:webapp/>/icons/ico/supprimer.gif" class="icon">
						</a>
						
<%
	} else if (fld.isFldRef()) {
%>						
									<select ed:type="ref" ed:fullname="<%= fld.getFullName() %>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>" class="criteriaField<%=(j > 0 ? " leftMargin10" : "")%><%=ListHelper.getFldClasses(fld)%>" tabindex="<%=nTabIndex++%>" >
										<option value=""><%=Utils.formatToWeb(strDisp, false)%></option>
<%
				
						Vector vectRef = null;
						String fldName = fld.getName();
						if (fldName.equals(StatusType.getFieldNameStatus(StatusType.INSCRIPTION))) {
							String evtID = flRequest.getParameter("PvtEventID");
							if (!StringUtils.isEmpty(evtID)) {
								vectRef = PersonEventHelper.getVectStatusForEvent(context, session, StatusType.INSCRIPTION, evtID);
							} else {
								DataDictionaryHelper dicoHelper = new DataDictionaryHelper(context);
								vectRef = dicoHelper.getRefDispWithExceptCode(session, fld.getName(), fld.getVectExceptVals());
							}	
						} else if (fldName.equals(StatusType.getFieldNameStatus(StatusType.PARTICIPATION))) {
							String evtID = flRequest.getParameter("PvtEventID");
							if (!StringUtils.isEmpty(evtID)) {
								vectRef = PersonEventHelper.getVectStatusForEvent(context, session, StatusType.PARTICIPATION, evtID);
							} else {
								DataDictionaryHelper dicoHelper = new DataDictionaryHelper(context);
								vectRef = dicoHelper.getRefDispWithExceptCode(session, fld.getName(), fld.getVectExceptVals());
							}	
						} else {
							DataDictionaryHelper dicoHelper = new DataDictionaryHelper(context);
							vectRef = dicoHelper.getRefDispWithExceptCode(session, fld.getName(), fld.getVectExceptVals());
						}
						
						String initVal = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName());

						String idInitVal = null;
						if (value != null) {
							idInitVal = value;
						} else {
							if (initVal != null) {
								try {
									idInitVal = dico.getRefIdByCode(fld.getInputName(), initVal);
									if(idInitVal==null){
										idInitVal = initVal;
									}
								} catch (FrontlineException e) {
									logger.error(e);
								}
							}

							if (sc == null) {
								HashMap<String, String> vectDefaultVals = fld.getStrDefaultValsList(session);
								if (idInitVal == null && vectDefaultVals != null && vectDefaultVals.size() > 0) {
									try {
										 
										String lastFldName=lastFldName=(fldinputname.indexOf(":")>-1)?fldinputname.substring(fldinputname.lastIndexOf(":")+1):fldinputname;
										//idInitVal = dico.getRefIdByCode(lastFldName, vectDefaultVals.get(ListBean.Field.DISPLAY));
										idInitVal = vectDefaultVals.get(ListBean.Field.DISPLAY);
									} catch (Exception e) {
										logger.error("can't get ref for field"+e);
									}
								}
							}
						}

						if (idInitVal == null) {
							idInitVal = "";
						}
						
						for (int r = 0; r < vectRef.size(); r++) {
							Vector vect = (Vector) vectRef.elementAt(r);
							boolean selected = vect.elementAt(0).equals(idInitVal);
%>										<option value="<%=Utils.formatToWeb((String) vect.elementAt(0), true)%>"<%=(selected ? " selected=\"selected\"" : "")%>><%=Utils.formatToWeb(vect.elementAt(1), true)%></option>
<%
	}
%>									</select>
<%
	} else if (fld.isString()) {
						// voir si une valeur par défaut est pré-renseignée dans l'URL
						String initVal = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName());
						if("".equals(initVal))
							initVal = null;
						if (sc == null) {
							HashMap<String, String> vectDefaultVals = fld.getStrDefaultValsList(session);
							if (initVal == null) {
								// voir si une valeur est pré-renseignée dans l'XML
								if (vectDefaultVals != null)
									if (vectDefaultVals.size() > 0)
										initVal = vectDefaultVals.get(ListBean.Field.DISPLAY);
							}
						}
						String fieldValue=Utils.formatToWeb(value != null ? value : (initVal != null ? initVal : strDisp), true);
%>								<input title="<%= strDisp %>" ed:fullname="<%= fld.getFullName() %>" ed:type="string" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>" class="criteriaField<%=(j > 0 ? " leftMargin10" : "")%><%=ListHelper.getFldClasses(fld)%>" type="text" value="<%= fieldValue %>" onfocus="this.select()" onblur="if(this.value == '') this.value = '<%=Utils.formatToJavascript(strDisp)%>';" tabindex="<%=nTabIndex++%>" >
<%
	} else if (fld.isInteger()) {
						String fromValue = null;
						String toValue = null;
						Vector intValues = (Vector) searchCriteria.get(fldinputname + "$From");
						if (intValues != null && intValues.size() > 0) {
							fromValue = (String) intValues.firstElement();
						}
						intValues = (Vector) searchCriteria.get(fldinputname + "$To");
						if (intValues != null && intValues.size() > 0) {
							toValue = (String) intValues.firstElement();
						}

						String initValMin = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Min");
						String initValMax = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Max");
						Vector vectDefaultVals = fld.getDefaultValsList();

						if (initValMin != null) {
							if (fromValue == null)
								fromValue = initValMin;
						}
						if (initValMax != null) {
							if (toValue == null)
								toValue = initValMax;
						}
						if (vectDefaultVals != null) {
							if (vectDefaultVals.size() > 0) {
								if (fromValue == null) {
									if (fld.getDefaultValsList().elementAt(0) != null) {
										fromValue = ((Hashtable) fld.getDefaultValsList().elementAt(0)).get(ListBean.Field.DISPLAY_MIN).toString();
									}
								}
								if (toValue == null) {
									if (fld.getDefaultValsList().elementAt(1) != null)
										toValue = ((Hashtable) fld.getDefaultValsList().elementAt(1)).get(ListBean.Field.DISPLAY_MAX).toString();
								}
							}
						}
%>
								<span class="criteriaLabel"><%=Utils.formatToWeb(strDisp, false)%>&nbsp;<fl:getMessage code="M60CA" alt="entre"/>&nbsp;</span>
								<input ed:type="int" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$From" class="criteriaFieldNumber<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(fromValue, true)%>" onfocus="this.select();" onblur="ctrlNumField(this, 'Integer', '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" >
								<span class="criteriaLabel">&nbsp;<fl:getMessage code="L604B" alt="et"/>&nbsp;</span>		
								<input ed:type="int" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$To" class="criteriaFieldNumber<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(toValue, true)%>" onfocus="this.select();" onblur="ctrlNumField(this, 'Integer', '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" >													
								<input type="hidden" name="$$numericFields" value="<%=Utils.formatToWeb(fld.getInputName(), true)%>">
<%
	} else if (fld.isDecimal()) {
						String fromValue = null;
						String toValue = null;
						Vector decValues = (Vector) searchCriteria.get(fldinputname + "$From");
						if (decValues != null && decValues.size() > 0) {
							fromValue = (String) decValues.firstElement();
						}
						decValues = (Vector) searchCriteria.get(fldinputname + "$To");
						if (decValues != null && decValues.size() > 0) {
							toValue = (String) decValues.firstElement();
						}

						String initValMin = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Min");
						String initValMax = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Max");
						HashMap<String, String> vectDefaultVals = fld.getStrDefaultValsList(session);

						if (initValMin != null) {
							if (fromValue == null)
								fromValue = initValMin;
						}
						if (initValMax != null) {
							if (toValue == null)
								toValue = initValMax;
						}
						if (vectDefaultVals != null) {
							if (vectDefaultVals.size() > 0) {
								if (sc == null && fromValue == null) {
									fromValue = vectDefaultVals.get(ListBean.Field.DISPLAY_MIN);
								}
								if (sc == null && toValue == null) {
									toValue = vectDefaultVals.get(ListBean.Field.DISPLAY_MAX);
								}
							}
						}
%>
								<span class="criteriaLabel"><%=Utils.formatToWeb(strDisp, false)%>&nbsp;<fl:getMessage code="M60CA" alt="entre"/>&nbsp;</span>
								<input ed:type="decimal" ed:fullname="<%= fld.getFullName() %>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$From" class="criteriaFieldNumber<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(fromValue, true)%>" onfocus="this.select();" onblur="ctrlNumField(this, 'float', '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" >
								<span class="criteriaLabel">&nbsp;<fl:getMessage code="L604B" alt="et"/>&nbsp;</span>		
								<input ed:type="decimal" ed:fullname="<%= fld.getFullName() %>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$To" class="criteriaFieldNumber<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(toValue, true)%>" onfocus="this.select();" onblur="ctrlNumField(this, 'float', '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" >					
								<input type="hidden" name="$$numericFields" value="<%=Utils.formatToWeb(fld.getInputName(), true)%>">
<%
	} else if (fld.isDate()) {
						String fromValue = null;
						String toValue = null;
						String fldNameWeb = Utils.formatToWeb(fld.getFullName(), true);
						Vector dateValues = (Vector) searchCriteria.get(fldinputname + "$From");
						if (dateValues != null && dateValues.size() > 0) {
							fromValue = (String) dateValues.firstElement();
						}
						dateValues = (Vector) searchCriteria.get(fldinputname + "$To");
						if (dateValues != null && dateValues.size() > 0) {
							toValue = (String) dateValues.firstElement();
						}
						String initValMin = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Min");
						String initValMax = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Max");
						if (initValMin != null) {
							if (fromValue == null)
								fromValue = initValMin;

						}
						if (initValMax != null) {
							if (toValue == null)
								toValue = initValMax;
						}
						if (sc == null) {
							HashMap<String, String> vectDefaultVals = fld.getStrDefaultValsList(session);
							if (vectDefaultVals != null) {
								if (vectDefaultVals.size() > 0) {
									if (fromValue == null) {
										if (vectDefaultVals.containsKey(ListBean.Field.DISPLAY_MIN))
											fromValue = vectDefaultVals.get(ListBean.Field.DISPLAY_MIN);
									}
									if (toValue == null) {
										if (vectDefaultVals.containsKey(ListBean.Field.DISPLAY_MAX))
											toValue = vectDefaultVals.get(ListBean.Field.DISPLAY_MAX);
									}

								}
							}
						}
		%>						<script language="javascript"> 
									function do<%=fldNameWeb%>$FromChange(){
										$("#<%=fldNameWeb%>From").change();
									}
									function do<%=fldNameWeb%>$ToChange(){
										$("#<%=fldNameWeb%>To").change();
									}
								</script>
								<span class="criteriaLabel<%=(j > 0 ? " leftMargin10" : "")%>"><%=Utils.formatToWeb(strDisp, false)%>&nbsp;<fl:getMessage code="M60CA" alt="entre"/>&nbsp;</span>
								<input ed:type="date" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$From" id="<%=Utils.formatToWeb(fld.getInputName(), true)%>From" class="criteriaFieldDate<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(fromValue, true)%>" onfocus="this.select();" onblur="ctrlDateField(this, '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" size="10" maxlength="10" >
								<a href="javascript:openCalendar(document.forms[0].<%=Utils.formatToWeb(fld.getInputName(), true)%>$From)" onmouseover="window.status = 'Afficher le calendrier';" onmouseout="window.status = '';"><img src="<fl:webapp/>/icons/ico/clock_neutre.gif" class="icon"></a>
								<span class="criteriaLabel">&nbsp;<fl:getMessage code="L604B" alt="et"/>&nbsp;</span>
								<input ed:type="date" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$To" id="<%=Utils.formatToWeb(fld.getInputName(), true)%>To" class="criteriaFieldDate<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(toValue, true)%>" onfocus="this.select();" onblur="ctrlDateField(this, '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" size="10" maxlength="10" >
								<a href="javascript:openCalendar(document.forms[0].<%=Utils.formatToWeb(fld.getInputName(), true)%>$To)" onmouseover="window.status = 'Afficher le calendrier';" onmouseout="window.status = '';"><img src="<fl:webapp/>/icons/ico/clock_neutre.gif" class="icon"></a>
<%
	} else if (fld.isTime()) {
						String fromValue = null;
						String toValue = null;
						Vector dateValues = (Vector) searchCriteria.get(fldinputname + "$From");
						if (dateValues != null && dateValues.size() > 0) {
							fromValue = (String) dateValues.firstElement();
						}
						dateValues = (Vector) searchCriteria.get(fldinputname + "$To");
						if (dateValues != null && dateValues.size() > 0) {
							toValue = (String) dateValues.firstElement();
						}
						String initValMin = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Min");
						String initValMax = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName() + "Max");
						HashMap<String, String> vectDefaultVals = fld.getStrDefaultValsList(session);

						if (initValMin != null) {
							if (fromValue == null)
								fromValue = initValMin;
						}
						if (initValMax != null) {
							if (toValue == null)
								toValue = initValMax;
						}
						if (sc == null && vectDefaultVals != null) {
							if (vectDefaultVals.size() > 0) {
								if (fromValue == null) {
									if (vectDefaultVals.containsKey(ListBean.Field.DISPLAY_MIN))
										fromValue = vectDefaultVals.get(ListBean.Field.DISPLAY_MIN);
								}
								if (toValue == null) {
									if (vectDefaultVals.containsKey(ListBean.Field.DISPLAY_MAX))
										toValue = vectDefaultVals.get(ListBean.Field.DISPLAY_MAX);
								}
							}
						}
%>
								<span class="criteriaLabel<%=(j > 0 ? " leftMargin10" : "")%>"><%=Utils.formatToWeb(strDisp, false)%>&nbsp;</span><fl:getMessage code="M60CA" alt="entre"/>&nbsp;
								<input ed:type="boolean" ed:fullname="<%= fld.getFullName() %>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$From" class="criteriaField<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(fromValue, true)%>" onfocus="this.select();" onblur="ctrlHourField(this, '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" size="5" maxlength="5"><span class="criteriaLabel">&nbsp;<fl:getMessage code="L604B" alt="et"/>&nbsp;</span><input name="<%=Utils.formatToWeb(fld.getInputName(), true)%>$To" class="criteriaField" type="text" value="<%=Utils.formatToWeb(toValue, true)%>" onfocus="this.select();" onblur="ctrlHourField(this, '<fl:getMessage code="M302E" alt="Format incorrect. Veuillez corriger" js="true"/>');" tabindex="<%=nTabIndex++%>" size="5" maxlength="5" >
<%
	} else if (fld.isBoolean()) {
						String initVal = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName());
						if (sc == null) {
							HashMap<String, String> vectDefaultVals = fld.getStrDefaultValsList(session);
							if (initVal == null) {
								// voir si une valeur est pré-renseignée dans l'XML
								if (vectDefaultVals != null)
									if (vectDefaultVals.size() > 0)
										initVal = vectDefaultVals.get(ListBean.Field.DISPLAY);
							}
						}
						boolean isChecked = value!=null ? ("1".equals(value)||"true".equalsIgnoreCase(value)):("1".equals(initVal)||"true".equalsIgnoreCase(initVal));
%>
							<span class="<%=ListHelper.getFldClasses(fld)%>" style="diplay:inligne">
								<input ed:type="boolean" ed:fullname="<%= fld.getFullName() %>" class="<%=(j > 0 ? "leftMargin10 " : " ")%><%=ListHelper.getFldClasses(fld)%>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>" id="<%=Utils.formatToWeb(fld.getInputName(), true)%>" type="checkbox" value="1" tabindex="<%=nTabIndex++%>" <%=isChecked ? "checked" : ""%> >
								<label for="<%=Utils.formatToWeb(fld.getInputName(), true)%>" style="margin-right:5px" class="criteriaLabel<%=ListHelper.getFldClasses(fld)%>"> <%=Utils.formatToWeb(strDisp, false)%> </label>
							</span>
<%
	}
				} else {
					String strDisp = null;

					String strType = null;
					Vector values = (Vector) searchCriteria.get(fld.getFullName());
					if (values == null) {
						values = new Vector();
					}
					Vector vectChoices = fld.getChoiceList();
					switch (fld.getChoiceType()) {
					case ListBean.CHOICE_SELECT :
					case ListBean.CHOICE_SELECT_MULTIPLE :
						strDisp = "<" + fld.getDisplay(session) + ">";
%>
									<select ed:fullname="<%= fld.getFullName() %>" name="<%= Utils.formatToWeb(fld.getFullName(), true) %>" class="criteriaField<%= (j > 0 ? " leftMargin10" : "")  %>"<%= fld.getChoiceType() == ListBean.CHOICE_SELECT ? "" : " multiple" %> tabindex="<%= nTabIndex++ %>">
										<option value=""><%= Utils.formatToWeb(strDisp, false) %></option>
<%
							for(int c = 0; c < vectChoices.size(); c++) {
								boolean isSelected = values.contains(Integer.toString(c));
								Hashtable row = (Hashtable)vectChoices.elementAt(c);

%>										<option value="<%= c %>" <%= isSelected ? "selected" : "" %> ><%= Utils.formatToWeb(row.get("Display"), false) %></option>
<%
							}

%>									</select>
<%
							break;
						case ListBean.CHOICE_RADIO:
							strType = "radio";
						case ListBean.CHOICE_CHECKBOX:
							strDisp = fld.getDisplay(session);
							if(strType == null) strType = "checkbox";
%>
									<%= Utils.formatToWeb(strDisp, false) %> :
<%
							for(int c = 0; c < vectChoices.size(); c++) {
								boolean isSelected = values.contains(Integer.toString(c));
								Hashtable row = (Hashtable)vectChoices.elementAt(c);

%>									<input <%= (j > 0 ? "class=\"leftMargin10\" " : " ")  %>name="<%= Utils.formatToWeb(fld.getFullName(), true) %>" type="<%= strType %>" value="<%= c %>" tabindex="<%= nTabIndex++ %>" <%= isSelected ? "checked" : "" %> >&nbsp;<%= Utils.replace(Utils.formatToWeb(row.get("Display"), false), " ", "&nbsp;") %>
<%
							}
%>
<%
							break;
					}
				}
			}
		} %>
		</div>
		</td>
					<td class="separation"><div class="separation"></div></td>
                    <td valign="top" style="width: 15%;">
	                    <table class="container" cellpadding="0">
							
								<tbody>
	<% if (hasPagination) { %>
				<tr>
				<td colspan="2" style="text-align: left;">
					
					<select name="$$nb" class="criteriaField pagination auto"> <%-- pagination auto"> --%>
						<% for (Iterator iter = pagination.iterator(); iter.hasNext();) {
								String value = (String)iter.next();
								boolean isAll = "all".equalsIgnoreCase(value);
						%>
							<option value="<%= Utils.formatToWeb(value, true) %>"<%= value.equals(pagePagination) ? "selected" : "" %>><%= isAll ? Utils.getMessage(session, "M60CB", false, true, "Tout") : Utils.formatToWeb(value + " / " + Utils.getMessage(session, "M60CC", false, true, "page"), false) %></option>
						<% } 
							%>
					</select><br/>
					</td>
					</tr>
	                <tr class="ligne_separation"><td></td></tr>
							
						<% } 
	 						if (fHasListPreview) { 
								String previewAttribute=fDisplayPreview?"checked=\"true\"":"";
	 					%>
	 						<label><input type="checkbox" name="$$preview" id="$$preview" <%= previewAttribute %>/><fl:getMessage code="L70B6" alt="aperçu"/></label>
						
						<%	}
					String iconRunSearch=StringUtils.isEmpty(searchZone.getIconUrl())?"/icons/ico/valid_green2_long.gif":searchZone.getIconUrl();
						
				%>
				<tr>
				<td>
			<a id="valid-button" class="search-button inactive"  title="<fl:getMessage code="A2009" alt="Rechercher"/>" href="javascript:executeSearch('<%= gridName %>'); void('')"><img src="<fl:webapp/>/<%= iconRunSearch %>"/></a>                 
	           </td></tr></tbody></table>
<%} %>
		</td></tr>
			</table>
			</form>
		</div>
<%


String code = flRequest.getRequestParameterOrAttribute("gridName");
if (code == null) {
	String paramCode = flRequest.getRequestParameterOrAttribute("code");
	String gn=((paramCode==null?"":paramCode) + "_gridname");
	code = flRequest.getRequestParameterOrAttribute(gn);
	if (code == null) {
		code = paramCode;
	}
}
GridData grid = (GridData)flRequest.getAttribute(code);
boolean isEmbedded = flRequest.getAttribute(code + "_Embedded") != null;
boolean isEmbedded2 = grid.isEmbedded();
String type = (String)flRequest.getAttribute("objSql");
if (type==null) {
	type=(String)flRequest.getAttribute(code+"_objSql");
}

boolean fIsListEmbedded=isEmbedded || isEmbedded2;



bTabNav.setBigTabsParameterValue(BigTabsParams.SelectedTab, "1");

String pEditMode=flRequest.getParameter("editmode");
boolean fUpdateMode=("true".equals(pEditMode));
String pAllowUserUpdate=flRequest.getParameter("allowupdate");
boolean fAllowUpdate=("true".equals(pAllowUserUpdate));
// is preview to be displayed ?



String pGridHeight=flRequest.getParameter("gridheight");
EdealGrid edealGrid=new EdealGrid();
edealGrid.setName(code);
edealGrid.buildColumns(session, context, grid);



//boolean fAllowUpdate=true;
//boolean fUpdateMode=false;

int totalNbOfRecs=grid.getTotalNbOfRecords();
boolean fDisplayCounter=(totalNbOfRecs!=0);
int pageNumber=grid.getPageNumber()+1;

fAllowUpdate=fAllowUpdate && grid.isUpdatable();
if (fAllowUpdate) {
	ActorBaseHelper actorHlpr=ActorBaseHelper.factory(ActorBaseHelper.getSessionActor(session));
	fAllowUpdate=fAllowUpdate && actorHlpr.canUseObjectForOperation(type,AccessControlManager.EDIT);
}


String jsGridObject=bTabNav.getBigTabsParameterValue(BigTabsParams.NameSearchGridJs);
String[] updColumnFields=grid.getColumnUpdFld();
boolean canUpdateList=((updColumnFields!=null) && (updColumnFields.length>0));


// can we mass select entries ?
boolean isMassSelect=grid.isMassSelectable();
String previewToken=grid.getPreviewCacheToken();
ListPreviewCache.PreviewCache previewCache=null;
if (previewToken!=null) {
	 previewCache=ListPreviewCache.factory(flRequest.getSession()).getCache(previewToken);
}

if(grid.getNbRows()==0){

%>
<fl:label code="L0001" label="Aucune entrée disponible "/>
<%}else{ 
	int totalNbOfPages=1;
	try {
		if(totalNbOfRecs > grid.getNbLines()){
			if(totalNbOfRecs % grid.getNbLines()>0){
				totalNbOfPages=(totalNbOfRecs/grid.getNbLines())+1;
			}
			else{
				totalNbOfPages=(totalNbOfRecs/grid.getNbLines());
			}	
		}
	} catch (ArithmeticException e) {//avoid / by 
	
	}


%>
<div id="grid-actions">
<table width="100%">
<tr>
<td width="33%"></td>
<td width="33%" style="text-align:center;">
	<%

if(!(grid.isFirstPage() && grid.isLastPage())){%>
<span class="grid-action">
	<%if(!grid.isFirstPage()){%>
	
	<a onclick="<%=jsGridObject%>.loadPage('0',$('input.btMassEdit:checked').length>0);return false;" href="#">
		<img src="<fl:webapp/>/icons/ico/flecheGdouble.gif"/>
	</a>
	<a onclick="<%=jsGridObject%>.loadPage('<%=grid.getPageNumber()-1%>',$('input.btMassEdit:checked').length>0);return false;" href="#">
		<img src="<fl:webapp/>/icons/ico/flecheG.gif"/>
	</a>	
	<%} 
	 if (fDisplayCounter) {%>
	<%=Utils.getMessage(session, "F608C", "Page")%>&nbsp;<%=pageNumber+"/"+totalNbOfPages%><%= " - ("+totalNbOfRecs+")"%> 
	<%} else { %>
	<%=Utils.getMessage(session, "F608C", "Page")%>&nbsp;<%=pageNumber %> 
	<% } %>
	<%if(!grid.isLastPage()){
	%>
	<a onclick="<%=jsGridObject%>.loadPage('<%=grid.getPageNumber()+1%>',$('input.btMassEdit:checked').length>0);return false;" href="#">
		<img src="<fl:webapp/>/icons/ico/flecheD.gif"/>
	</a>
		<%  if (totalNbOfPages>1) { %>
	<a onclick="<%=jsGridObject%>.loadPage('<%=totalNbOfPages-1%>',$('input.btMassEdit:checked').length>0);return false;" href="#">
		<img src="<fl:webapp/>/icons/ico/flecheDdouble.gif"/>
	</a>
		<%}%>
	<%}%>
	
	
</span>
<%}%>
</td>
<td width="33%" style="text-align:right;">
<% if (fAllowUpdate && !fUpdateMode) { %>
	
	<span class="grid-action">
	<a class="action-item" href="javascript:<%= jsGridObject+".reloadForEdition()"%>"><fl:getMessage code="A0008" alt="Modifier"/></a>	
	</span>
	
<% } %>
<% if (fUpdateMode) { %>
<span class="grid-action">
	<a id="grid-save-button" class="action-item" href="javascript:<%=jsGridObject+".save()"%>"><fl:getMessage code="A0003" alt="Enregistrer"/></a>&nbsp;
	<a class="action-item" href="javascript:<%= jsGridObject+".reset()"%>"><fl:getMessage code="A2002" alt="Annuler"/></a>
</span>

<% } %>
</td>
</tr>
</table>
</div>
<div id="grid-data" class="data"<%= (previewToken==null)?"":" ed:previewtoken=\""+previewToken+"\"" %> ed:embedded="<%= fIsListEmbedded %>" style="<%= (pGridHeight!=null)?"height:"+pGridHeight:""%>">

<table cellpadding="0">
	<thead>
		<tr>
			<% if (isMassSelect && !fIsListEmbedded) { %>
				<th><input type="checkbox" onclick="<%=jsGridObject%>.addMassSelectAll(this.checked)"></th>
			<% } %>
		    <%
			int formIndex=1;
			for (EdealGridColumn gridColumn: edealGrid.getColumns()) {
				if (gridColumn.getDataType() != null && !gridColumn.getDataType().equals(EdealGridColumn.DataType.PREVIEW)) { %>
				<%=gridColumn.getHeader(edealGrid.getJsGridName(),edealGrid.getName(),flRequest)%>
			<%}
			}
		%></tr>
	</thead>
	<tbody><%
		ArrayList<String> rowsId = grid.getRowsId();
		//ArrayList<String> previewValue = new ArrayList();
		boolean oddRow = false;
		ActorBean currentActor=ActorHelper.getSessionActor(session);
		BasicBean rowBean = null;
		int nbOfRows=grid.getData().length;
		int tabindex=0;
		int nbOfCols=0;
		for(int rowidx = 0; rowidx < nbOfRows; rowidx++) {
			String id = "";
			oddRow = !oddRow ;
			String objectID="";
			if (rowsId != null && rowsId.size()>0 && rowsId.get(rowidx) != null) {
				objectID=rowsId.get(rowidx);
					
			}%>
			<tr id="<%= objectID %>" class="<%= (oddRow ? "even" : "odd") %> bean" tabindex="<%=++tabindex%>">
			<% if (isMassSelect && !fIsListEmbedded) { %>
				<td><input id="massselectcheck-<%=objectID%>" type="checkbox" onclick="<%=jsGridObject%>.addMassSelect('<%=objectID%>',this.checked)"></td>
			<% }
		 	Object[] row = grid.getData()[rowidx];
		 	nbOfCols=row.length;
				for (int colidx = 0; colidx < row.length; colidx++) {
					EdealGridColumn eGCol = edealGrid.getColumn(colidx);
					boolean allowedToEdit=fUpdateMode  && canUpdateList && updColumnFields[colidx]!=null;
						if (allowedToEdit) {
						  try {
							rowBean= dico.getTable("sql",type).getBasicBean(objectID,session);
							allowedToEdit=rowBean.enforceAccess(AccessControlManager.EDIT,currentActor);
							if (allowedToEdit) { 
								request.setAttribute(type,rowBean); 
							}
						  } catch (FrontlineException e) {
								logger.error("listAjax.jsp: cannot load bean ["+type+"]["+objectID+"]",e);
						  }
						}
						
						if (allowedToEdit) {				
								String fieldsToBeUpdated=updColumnFields[colidx];
								Vector<String> vFieldsToBeUpdated=(Vector<String>)Utils.explodeList(fieldsToBeUpdated,";");
								Enumeration<String> enumFieldsToBeUpdated=vFieldsToBeUpdated.elements();
					%>
						<td><div><table class="data_column" cellpadding="0"><tr class="fieldline">
							<% 
						
								while (enumFieldsToBeUpdated.hasMoreElements()) {
									String fieldName=enumFieldsToBeUpdated.nextElement();
									String eraseJs="eraseField('"+fieldName+"-"+objectID+"')";
									%>
							<td class="">
							    <% 	
							    	
								 if (fieldName.equals(StatusType.getFieldNameStatus(StatusType.INSCRIPTION))) {
								 	PersonEventBean pev = (PersonEventBean)rowBean;
							    	String pvtEventID = null;
							    	try {
							    		pvtEventID = pev.getPvtEventID();
							    	} catch (FrontlineException e) {
							    	} 
								 	String pvtInsStatus = null;
							    	try {
							    		pvtInsStatus = pev.getPvtInsStatus();
							    	} catch (FrontlineException e) {
							    	}
							    	if (pvtEventID != null) {
								 		LinkedHashMap<String, String> statusInsIDAndDisplay = EventHelper.getListStatusByEvent(context, StatusType.INSCRIPTION, pvtEventID);							 
								 		if (statusInsIDAndDisplay != null && !statusInsIDAndDisplay.isEmpty()) { %>
										<select name="<%= fieldName %>" id="<%= fieldName + "-" + objectID %>" class="input select">
											<option value=""></option>
<%											Iterator<String> iter = statusInsIDAndDisplay.keySet().iterator();
											while (iter.hasNext()) {	
												String currStatusID = iter.next();
												String currStatusDisplay = statusInsIDAndDisplay.get(currStatusID);
%>
												<option value="<%= currStatusID %>" <%= currStatusID.equals(pvtInsStatus) ? "selected" : "" %>><%= Utils.formatToWeb(currStatusDisplay, false) %></option>
<%
											}
										%>
										</select>
<%										}
									} else { %>	
									<fl:input property="<%=fieldName%>" id="<%=fieldName+\"-\"+objectID%>"  ondelete="<%=eraseJs%>"  nodiv="true" />
								<% } 
								 } else if (fieldName.equals(StatusType.getFieldNameStatus(StatusType.PARTICIPATION))) { 
								 	PersonEventBean pev = (PersonEventBean)rowBean;
							    	String pvtEventID = null;
							    	try {
							    		pvtEventID = pev.getPvtEventID();
							    	} catch (FrontlineException e) {
							    	} 
								 	String pvtParStatus = null;
							    	try {
							    		pvtParStatus = pev.getPvtParStatus();
							    	} catch (FrontlineException e) {
							    	}	
							    	LinkedHashMap<String, String> statusParIDAndDisplay = EventHelper.getListStatusByEvent(context, StatusType.PARTICIPATION, pvtEventID);		
							    	if (statusParIDAndDisplay != null && !statusParIDAndDisplay.isEmpty()) { %>
										<select name="<%= fieldName %>" id="<%= fieldName + "-" + objectID %>" class="input select">
											<option value=""></option>
<%										Iterator<String> iter2 = statusParIDAndDisplay.keySet().iterator();
										while (iter2.hasNext()) {	
											String currStatusID = iter2.next();
											String currStatusDisplay = statusParIDAndDisplay.get(currStatusID);
%>
											<option value="<%= currStatusID %>" <%= currStatusID.equals(pvtParStatus) ? "selected" : "" %>><%= Utils.formatToWeb(currStatusDisplay, false) %></option>
<%
										}
										%>
										</select>
<%									} else { %>
									<fl:input property="<%=fieldName%>" id="<%=fieldName+\"-\"+objectID%>"  ondelete="<%=eraseJs%>"  alt=" " nodiv="true" />
<%										
									}
								 } else { %>	
									<fl:input property="<%=fieldName%>" id="<%=fieldName+\"-\"+objectID%>"  ondelete="<%=eraseJs%>"  alt=" " nodiv="true" />
								<% } %>
							</td>
							<% 		
								formIndex++;
							} %>
						</tr></table></div></td>
					<% } else { %>
						
						<%= eGCol.advancedFormatWithTD(row[colidx]) %>
					<% } 
					}
			
			%></tr>
			<%
				if (fDisplayPreview) {
					String previewTxt=(previewCache==null)?null:previewCache.getPreviewForID(objectID);
					if (!StringUtils.isEmpty(previewTxt)) {
			%>
			<tr id="<%= objectID %>_preview" class="<%= (oddRow ? "even" : "odd") %> list_preview" tabindex="<%=++tabindex%>">
				<td colspan="<%=nbOfCols%>"> 
					<div class="preview-icon">&nbsp;</div>
					<div class="preview">
						<%= Utils.formatToWeb(previewTxt,false) %>
						
					</div>
				 </td>
			</tr>
			<%  	}
			    }
		}
		if (type!=null && request.getAttribute(type)!=null) {
			request.removeAttribute(type);
		}
	%></tbody>
</table>
</div>
<% 
	//
} %> 



