Edit C:\Windows\install\galaxie_p02_26-09\common\select\xml_select_multiple_list.jsp
<%@page import="com.edeal.frontline.helper.custom.DataDictionaryHelper"%> <% /****************************************************************************** * 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. ******************************************************************************/ %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ page language="java" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="java.util.Iterator" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.navigation.WebUtils" %> <%@ 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.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="org.apache.commons.lang.StringUtils"%> <%@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"/> <%@ include file="/common/list/list_variables.jsp" %> <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"> <link rel="stylesheet" type="text/css" href="<fl:link url="/common/select/select_css.jsp"/>"> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/utils.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/edit_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/master_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/jsOnload.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ajax/ajax.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/edeal/libraries/jquery/jquery.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/master_js.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ac/fobAC_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/calendar.jsp"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/grid/EdealGridCriteria.js"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/infobar/infobar_js.jsp"></script> <% FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); EdealBigTabsNavigation ebtn = new EdealBigTabsNavigation(request); ebtn.setBigTabsParameterValue(BigTabsParams.SelectedTab, "2"); String type = flRequest.getParameter("type"); String formIndex = flRequest.getParameter("formIndex"); String field = flRequest.getParameter("field"); String fieldid= flRequest.getParameter("fieldid"); String query = flRequest.getParameter("query"); query = WebUtils.urlEncode(context, query); String au = "list_ajax_select.fl"; 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()); } Vector vectFld = (Vector)flRequest.getAttribute("vectFld"); vectFld = vectFld == null ? new Vector() : vectFld; Vector vectRefs = (Vector)flRequest.getAttribute("vectRefs"); vectRefs = vectRefs == null ? new Vector() : vectRefs; 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"); boolean fHasPreview="true".equals(pPreview); // add a flag to check if the list is designed to have preview boolean fHasListPreview = resultZone.hasPreview(); //mandatory groups HashMap<String, ListBean.MandatoryGroup> mdGps = null; boolean fHasMandatoryGroups = false; if (searchZone != null) { mdGps = searchZone.getMandatoryGroups(); } fHasMandatoryGroups = ((mdGps != null) && (mdGps.size() > 0)); try { Integer.parseInt(formIndex); } catch (NumberFormatException nfe) { formIndex = "0"; } formIndex = formIndex != null && !"".equals(formIndex) ? formIndex : "0"; // deal with return mode : if fieldid then just do a getElementById else usual, through the form String fieldName=(fieldid==null)?field:fieldid; boolean fReturnWithID=(fieldid!=null); %> <title><%= bTabNav.getBigTabsParameterValue(BigTabsParams.CriteriaListTitle) %></title> </head> <body> <!-- Le Javascript ci-dessous doit etre inclus en page, car le JSP a besoin du request --> <script type="text/javascript" language="javascript"> <%= (includedListScript==null)?"":includedListScript %> <%@include file="/common/list/list_criteria_js.jsp"%> var mandatoryGroups = <%= (searchZone != null) ? searchZone.getMandatoryGroupsAsJson() : "\"\"" %>; //additional parameters provide to search var additionalParams = new Array(); additionalParams['query'] = '<%= query %>'; var selectedID = new FlVector(); var selectedDisplay = new FlVector(); function validate() { var i; var win = window.top.opener; var f = window.top.opener.document.forms[<%= formIndex %>]; var view; var edMan = window.top.opener.edManager; var mustContinue = true; if (edMan) { view = edMan.getViewByID("<%= field %>"); if (view) { var viewValidateHandler = view["<%= flRequest.getParameter("validatehandler") %>"]; if (viewValidateHandler) { viewValidateHandler.call(view, selectedID); } else { view.model.reset(); for(i = 0; i < selectedID.size(); i++) { view.model.add({value: selectedID.elementAt(i), label: formatToJavascript(selectedDisplay.elementAt(i))}, {silent:true}); } view.render(); view.$el.focus(); } mustContinue = false; } } if (mustContinue) { var fieldEl = $("#<%= field %>", f); var mvlSeparator = f.elements['$$multivalSeparator'] ? f.elements['$$multivalSeparator'].value : '|'; if(f.<%= field %>) f.<%= field %>.value = selectedID.toString(mvlSeparator); if(f.eval<%= field %> && f.lbl<%= field %>) { var strEval = 'var o = document.forms[<%= formIndex %>].lbl<%= field %>.options; while(o.length > 0) o[o.length - 1] = null;'; for(i = 0; i < selectedID.size(); i++) { strEval += 'o[o.length] = new Option(\'' + formatToJavascript(selectedDisplay.elementAt(i)) + '\', \'' + selectedID.elementAt(i) + '\');'; } f.eval<%= field %>.value = strEval; f.lbl<%= field %>.focus(); } if(win.do<%= field %>Change) { win.do<%= field %>Change(); } } window.top.close(); } function doSelect(id) { for (var i = 0; i < selectedID.size(); i++) { if (selectedID.elementAt(i) == id) { return; } } doAjax("<fl:webapp/>/obj_tostring_ajax.fl?objectsBeanId=" + "<%= List.getLstObjID() %>" + "&beanId=" + id, doSelectCallBack); } function doSelectCallBack(index) { if (eDealXmlhttpArr[index].readyState == 4){ resultArray = JSON.parse(eDealXmlhttpArr[index].responseText); id = resultArray['beanId']; display = resultArray['toStringValue']; if(display == ''){ if(id == ''){ alert('<fl:getMessage code="M903E" alt="Echec de la sélection: impossible de récupérer l\\\'identifiant de la selection." js="true"/>'); } else { selectedID.addElement(id); selectedDisplay.addElement(id); addRowToResultGrid(id, id); } } selectedID.addElement(id); selectedDisplay.addElement(display); addRowToResultGrid(id, display); } } function addRowToResultGrid(id, display) { var rowStr = '<tr id=\"tableRow_' + id + '\" class=\"' + (selectedID.size() % 2 == 0 ? 'odd bean' : 'even bean') + '\"><td>'; rowStr += '<a href=\"javascript:unselect(\'' + id + '\')\"><img src=\"<fl:link url="/icons/ico/close.gif"/>\" class=\"unselect_button\"></a>'; rowStr += '</td><td style=\"width:99%;\">' + display + '</td></tr>'; var lastID = selectedID.elementAt(selectedID.size() - 1); if (lastID == id) { lastID = selectedID.elementAt(selectedID.size() - 2); } if (lastID) { $('#tableRow_' + lastID).after(rowStr); } else { $("#_grid__result_div_").html(""); $("#_grid__result_div_").append("<div id='grid-data' class='data'>"+ "<table>"+ "<tbody>"+ rowStr+ "</tbody>"+ "</table>"+ "</div>"); } } //TODO separated file function refreshRowClasses() { var doEven = true; for (var idx = 0; idx < selectedID.size(); idx++) { var jQueryVar = $('#tableRow_' + selectedID.elementAt(idx)); jQueryVar.addClass(doEven ? 'even' : 'odd'); jQueryVar.removeClass(!doEven ? 'even' : 'odd'); doEven = !doEven; } } //TODO separated file function unselect(id) { var pos = -1; for (var i = 0; i < selectedID.size(); i++) { if (selectedID.elementAt(i) == id) { pos = i; } } if (pos == -1) { return; } selectedID.removeElementAt(pos); selectedDisplay.removeElementAt(pos); $('#tableRow_' + id).css('display', 'none'); if(selectedID.size()==0){ $("#_grid__result_div_").html(""); } refreshRowClasses(); } function removeFrom(tab, pos) { alert('removeFrom - Remove me!'); } function doSubmit() { var e = document.forms[0].elements; //var strURL = '<fl:webapp/>/select_list.fl?type=<%= WebUtils.urlEncode(context, type) %><%= query == null ? "" : "&query=" + WebUtils.urlEncode(context, query) %>'; var strURL = _grid__select_js_.getAjaxUrl(); // Better to get it from the object, as it automatically has more parameters such as pagination <% for(int i = 0; i < vectFld.size(); i++) { Hashtable row = (Hashtable)vectFld.elementAt(i); Vector vect = (Vector)row.get("fld"); for(int j = 0; j < vect.size(); j++) { String currField = (String)vect.elementAt(j); if (!vectRefs.contains(currField)) { %> strURL += '&<%= WebUtils.urlEncode(context, currField) %>=' + encodeURIComponent(e['query<%= (i + 1) %>'].value).split('+').join('%2b'); <% } else { %> strURL += '&<%= WebUtils.urlEncode(context, currField) %>=' + encodeURIComponent(e['query<%= (i + 1) %>'].options[e['query<%= (i + 1) %>'].selectedIndex].value).split('+').join('%2b'); <% } } } %> //_grid__select_js_.callAjaxForHtml(strURL); var params=new Object(); params["$$idx"]=0; _grid__select_js_.callAjaxForHtml(strURL,params,true,false,null,true); } function doOnload() { var view; var edMan = window.top.opener.edManager; var mustContinue = true; if (edMan) { view = edMan.getViewByID("<%= field %>"); } var win = window.top.opener; var f = window.top.opener.document.forms[<%= formIndex %>]; var mvlSeparator = f.elements['$$multivalSeparator'] ? f.elements['$$multivalSeparator'].value : '|'; if (view) { view.model.each(function(modelItem) { doSelect(modelItem.get("value")); }); } else { var selectM = f.lbl<%= field %>; for(var i = 0; i < selectM.length; i++) { var id = selectM.options[i].value; var display = selectM.options[i].text; doSelect(id); } } } $(document).ready(doOnload); </script> <script type="text/javascript" src="<fl:link url="/js/focusFirstElement.js"/>"></script> <div id="object_css" style="top:0px;"> <fl:bigTabs ignoreList="true" objectTitle="<%= bTabNav.getBigTabsParameterValue(BigTabsParams.CriteriaListTitle) %>"> <div class="BTBody BTBodyL"> <div class="BTBody BTBodyR"> <div id="criteriaTableRow"> <form method="get" onsubmit="return false;"> <%= 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, "/xml_select_multiple.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; 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<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 fobSql = fld.getFldFobSql(); ObjectsBean fobBean = dico.getTable("sql", fobSql); String webapp = request.getContextPath(); String querySelect = StringUtils.isEmpty(fld.getQuery(session)) ? "" : Utils.formatToJavascript("&query=" + fld.getQuery(session)); String selectUrl = "javascript:var win = window.open('" + webapp + "/select_multiple.fl?type=" + flRequest.urlEncode(fobSql) + "&field=" + flRequest.urlEncode(fld.getInputName()) + querySelect + "', 'Select" + fobSql + "', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=" + SelectAction.SELECT_WINDOW_WIDTH + ",height=500')" ; //Determination of which selector will be used (XML or fields) try { String xmlListSelect = fobBean.getObjSelectListID(); if (!Utils.isEmpty(xmlListSelect)) { XmlSelector selector = new XmlSelector(true, webapp, xmlListSelect,flRequest.urlEncode(fld.getInputName()), "", 0, querySelect, ""); 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(){ var f = window.document.forms[0]; $(f.lbl<%=fldNameWeb%>).change(); } </script> <input id="<%=fldNameWeb%>" name="<%=fldNameWeb%>" type="hidden" value="<%=Utils.formatToWeb(value, true)%>" > <input title="<%= strDisp %>" 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="javascript:var win = window.open('<%= selectUrl%>', 'Select<%=fld.getFldFobSql()%>', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=<%=SelectAction.SELECT_WINDOW_WIDTH%>,height=500')" 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> <% if (doAjax) { %> <script language="javascript">$(document).ready(function () { runOnTime('installFobAC(document.forms[0].lbl<%= fldNameWeb %>);', 1000);}) </script> <% } %> <% } else if (fld.isFldRef()) { %> <select title="<%= strDisp %>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>" class="criteriaField<%=(j > 0 ? " leftMargin10" : "")%><%=ListHelper.getFldClasses(fld)%>" tabindex="<%=nTabIndex++%>"> <option value=""><%=Utils.formatToWeb(strDisp, false)%></option> <% DataDictionaryHelper dicoHelper = new DataDictionaryHelper(context); Vector 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); } }%> <input title="<%= strDisp %>" name="<%=Utils.formatToWeb(fld.getInputName(), true)%>" class="criteriaField<%=(j > 0 ? " leftMargin10" : "")%><%=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(); } } }%> <span class="criteriaLabel"><%=Utils.formatToWeb(strDisp, false)%> <fl:getMessage code="M60CA" alt="entre"/> </span> <input 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"> <fl:getMessage code="L604B" alt="et"/> </span> <input 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)%> <fl:getMessage code="M60CA" alt="entre"/> </span> <input 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"> <fl:getMessage code="L604B" alt="et"/> </span> <input 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)%> <fl:getMessage code="M60CA" alt="entre"/> </span> <input 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"> <fl:getMessage code="L604B" alt="et"/> </span> <input 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)%> </span><fl:getMessage code="M60CA" alt="entre"/> <input title="<%= strDisp %>" 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"> <fl:getMessage code="L604B" alt="et"/> </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 = "1".equals(initVal) || "true".equalsIgnoreCase(initVal);%> <span class="<%=ListHelper.getFldClasses(fld)%>" style="diplay:inligne"> <input 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 title="<%= strDisp %>" 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" : "" %> > <%= Utils.replace(Utils.formatToWeb(row.get("Display"), false), " ", " ") %> <% }%> <% break; } } } %> <%= (i < (searchZone.getNbLines() - 1) ? "<br><br>" : "") %> <% } %> </div> </td> <td class="separation"><div class="separation"></div></td> <td valign="top" style="width: 15%;"> <table class="container" cellpadding="0"> <% if (hasPagination) { %> <tr> <td colspan="2" style="text-align: left;"> <select name="$$nb" class="criteriaField 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(nb) ? "selected" : "" %>><%= isAll ? Utils.getMessage(session, "M60CB", false, true, "Tout") : Utils.formatToWeb(value + " / " + Utils.getMessage(session, "M60CC", false, true, "page"), false) %></option> <% } %> </select> <br/> <% if (fHasListPreview) { String previewAttribute=fHasPreview?"checked=\"true\"":""; %> <label><input type="checkbox" name="$$preview" id="$$preview" <%= previewAttribute %>/><fl:getMessage code="L70B6" alt="aperçu"/></label> <% } %> </td> </tr> <tr class="ligne_separation"><td></td></tr> <% } String iconRunSearch=StringUtils.isEmpty(searchZone.getIconUrl())?"/icons/ico/valid_green2_long.gif":searchZone.getIconUrl(); String iconRunSearchWithPreview="/icons/ico/valid2_long.gif"; %> <tr> <td> <a id="valid-button" class="search-button inactive" title="<fl:getMessage code="A2009" alt="Rechercher"/>" href="javascript:executeSearchWithParam(additionalParams); void('')"><img src="<fl:webapp/>/<%= iconRunSearch %>"/></a> </td> </tr> </table> <div id="zone-mandatory-message"> <% if (fHasMandatoryGroups) { %> <a href="javascript:gGridCriteria.displayHelp('<%= gridName %>')"><img src="<fl:link url="/icons/ico/aide.gif" menu="false" list="false"/>"/></a> <% } %> </div> </td> </tr> <% } %> </table> </form> </div> <div id="infoTab" class="helpMsg upTab" style="display:none;"> <div class="body"> </div> </div> <div id="searchResult" > <h2 <%= (isFirstTimeIn ? "" : "style=\"margin-top: 0px;\"") %>> <span><fl:getMessage code="L200C" alt="Résultat"/> <a id="bShowHideCriteria" href="#" onclick="gGridCriteria.show(this)" class="bHideCriteria" title="<fl:getMessage code="M808D" alt="Cacher/Montrer les critères de recherche"/>"> </a></span> </h2> <fl:grid name="<%= lc %>" ajaxUrl="<%=au %>"/> </div> <!-- ------------ Selected items summary and validation buttons -------------- --> <br /> <br /> <div class = "selectSummary" > <table style="width: 100%;"> <tr> <td class="selection_title_left"></td> <td class="selection_title_middle title"><fl:getMessage code="L63DF" alt="Votre sélection"/></td> <td class="selection_title_right"></td> </tr> <tr style="min-height: 110px;"> <td class="selection_body_left"></td> <td class="selection_body_middle"><fl:grid name="result"/></td> <td class="selection_body_right"></td> </tr> <tr> <td class="selection_bottom_left"></td> <td class="selection_bottom_middle"></td> <td class="selection_bottom_right"></td> </tr> </table> <br> <div class="validation"><a href="javascript:validate()"><img src="<fl:link url="/icons/ico/valid_green_long.gif"/>" class="valid_button_new"></a> <a href="javascript:window.top.close();"><img src="<fl:link url="/icons/ico/fermer_red_long.gif"/>" class="cancel_button_new"></a></div> <hr /> </div> </div> <br /> </div> </fl:bigTabs> </div> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de