<%
if(searchZone != null) {
int nTabIndex = 1;
for(int i = 0; i < searchZone.getNbLines(); i++) {
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 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(fldinputname, true);
String emptyLabelDisplay = lblValue != null ? Utils.formatToWeb(lblValue, true) : Utils.formatToWeb(strDisp, true);
String emptyLabelDisplayJS = lblValue != null ? Utils.formatToJavascript(lblValue) : Utils.formatToJavascript(strDisp);
%>
<%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=emptyLabelDisplay%>"<%=doAjax ? " autocomplete=\"off\" onfocus=\"displayOnFocus(this);\"" : " readonly onfocus=\"this.blur();\""%>>
<%if (!fldNameWeb.equals("TrlTrpID")) { %>
$(f.lbl<%=fldNameWeb%>).change();
void('')"
tabindex="<%= nTabIndex++ %>">
<%} if (doAjax) { %>
<% } %>
<%
} else if (fld.isFldRef()) {
%>
<%
} 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 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);
}
}
%> <%=ListHelper.getFldClasses(fld)%>" type="text" value="<%=Utils.formatToWeb(value != null ? value : (initVal != null ? initVal : strDisp), true)%>" 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();
}
}
}
%>
<%=Utils.formatToWeb(strDisp, false)%>
');" tabindex="<%=nTabIndex++%>">
');" tabindex="<%=nTabIndex++%>">
<%
} 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 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);
}
}
}
%>
<%=Utils.formatToWeb(strDisp, false)%>
');" tabindex="<%=nTabIndex++%>">
');" tabindex="<%=nTabIndex++%>">
<%
} 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 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);
}
}
}
}
%>
"><%=Utils.formatToWeb(strDisp, false)%>
');" tabindex="<%=nTabIndex++%>" size="10" maxlength="10">
');" tabindex="<%=nTabIndex++%>" size="10" maxlength="10">
<%
} 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 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);
}
}
}
%>
"><%=Utils.formatToWeb(strDisp, false)%>
');" tabindex="<%=nTabIndex++%>" size="5" maxlength="5"> ');" tabindex="<%=nTabIndex++%>" size="5" maxlength="5">
<%
} else if (fld.isBoolean()) {
String initVal = flRequest.getRequestParameterOrAttribute("init" + fld.getInputName());
if (sc == null) {
HashMap 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 = "1".equals(initVal) || "true".equalsIgnoreCase(initVal);
%>
<%=ListHelper.getFldClasses(fld)%>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>" id="<%=Utils.formatToWeb(fld.getInputName(), true)%>" type="checkbox" value="1" tabindex="<%=nTabIndex++%>" <%=isChecked ? "checked" : ""%> >
<%
}
} 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) + ">";
%>
<%
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);
%> 0 ? "class=\"leftMargin10\" " : " ") %>name="<%= Utils.formatToWeb(fld.getFullName(), true) %>" type="<%= strType %>" value="<%= c %>" tabindex="<%= nTabIndex++ %>" <%= isSelected ? "checked" : "" %> > <%= Utils.replace(Utils.formatToWeb(row.get("Display"), false), " ", " ") %>
<%
}
%>
<%
break;
}
}
}
%><%= (i < (searchZone.getNbLines() - 1) ? "
" : "") %><%
}
%>
|
|
<%
if (fHasMandatoryGroups) { %>
"/>
<% } %>
|
<%
}
%>