Edit C:\Windows\install\galaxie_p02_26-09\common\select\select_multiple.jsp
<%@ page language="java"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="java.util.Hashtable" %> <%@ page import="java.util.Vector" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.navigation.WebUtils" %> <%@taglib uri="http://www.e-deal.com/taglib/fl" prefix="fl" %><% final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog(getClass()); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String type = flRequest.getParameter("type"); String field = flRequest.getParameter("field"); String query = flRequest.getParameter("query"); String formIndex = flRequest.getParameter("formIndex"); Vector vectFld = (Vector)flRequest.getAttribute("vectFld"); vectFld = vectFld == null ? new Vector() : vectFld; Vector vectRefs = (Vector)flRequest.getAttribute("vectRefs"); vectRefs = vectRefs == null ? new Vector() : vectRefs; try { Integer.parseInt(formIndex); } catch (NumberFormatException nfe) { formIndex = "0"; } formIndex = formIndex != null && !"".equals(formIndex) ? formIndex : "0"; %><html> <head> <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"/>"> <link rel="stylesheet" type="text/css" href="<fl:webapp/>/css/common_css.jsp" type="text/css"> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/utils.js"></script> <script type="text/javascript" src="<fl:link url="/js/edeal/libraries/jquery/jquery.js"/>"></script> <script type="text/javascript" src="<fl:link url="/js/ajax/ajax.js"/>"></script> <script type="text/javascript" src="<fl:link url="/js/utils.js"/>"></script> <script type="text/javascript" language="javascript" src="<fl:webapp/>/js/ac/fobAC_js.jsp"></script> <script type="text/javascript" language="javascript"> 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) { view.model.reset(); for(i = 0; i < selectedID.size(); i++) { view.model.add({value: selectedID.elementAt(i), label: formatToJavascript(selectedDisplay.elementAt(i))}); } view.render(); view.$el.focus(); mustContinue = false; } } if (mustContinue) { 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, display) { for (var i = 0; i < selectedID.size(); i++) { if (selectedID.elementAt(i) == id) { return; } } 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>"+ "<thead>"+ "<tr>"+ "<th width='15px'></th>"+ "<th width='410px'><fl:getMessage code='L638A' alt='S�lection'/></th>"+ "</tr>"+ "</thead>"+ "<tbody>"+ rowStr+ "</tbody>"+ "</table>"+ "</div>"); } } 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; } } 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 = win.document.forms[<%= formIndex %>]; var mvlSeparator = f.elements['$$multivalSeparator'] ? f.elements['$$multivalSeparator'].value : '|'; var strIds = f.<%= field %>.value; var idsArray = strIds.split(mvlSeparator); if (strIds != '') { selectedID = new FlVector(idsArray); var lblField = f.lbl<%= field %>; for (var i = 0; i < lblField.options.length; i++) { selectedDisplay.addElement(lblField.options[i].text); _grid__result_js_.addColumn(new Array(escape('javascript:unselect(\'' + idsArray[i] + '\')'), escape('<img src=\\\"<fl:link url="/icons/ico/close.gif"/>\\\" class=\\\"unselect_button\\\">'), escape(lblField.options[i].text), idsArray[i])); } } _grid__result_js_.setAjaxUrl('<fl:webapp/>/select_clientsidelist_ajax.fl'); _grid__result_js_.renderLocal(); document.forms[0].query1.focus();*/ if (view) { view.model.each(function(modelItem) { doSelect(modelItem.get("value"),modelItem.get("label")); }); } else { var f = window.top.opener.document.forms[<%= formIndex %>]; var mvlSeparator = f.elements['$$multivalSeparator'] ? f.elements['$$multivalSeparator'].value : '|'; 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, display); } } } $(document).ready(doOnload); </script> </head> <body> <form action="javascript:doSubmit()"> <table class="global" cellpadding="0"> <tr> <td class="header_top_left"></td> <td class="header_top_middle"></td> <td class="header_top_right"></td> </tr> <tr> <td class="header_center_left"></td> <td class="header_center_middle title"> <div style="display: inline"><% for(int i = 0; i < vectFld.size(); i++) { Hashtable row = (Hashtable)vectFld.elementAt(i); String strDisplay = (String)row.get("disp"); Vector vectField = (Vector)row.get("fld"); String currField = null; if (vectField != null && vectField.size() > 0) { currField = (String)vectField.elementAt(0); } %> <div class="criteria"<%= ((i > 0) && (i % 2 == 1)) ? "style=\" margin-left: 10px;\"": "" %>> <span class="criteria_label"><%= Utils.formatToWeb(strDisplay, false) %></span><% if (currField != null && vectRefs.contains(currField)) { %> <span class="criteria_field"> <select id="query<%= (i + 1) %>" name="query<%= (i + 1) %>"> <option value=""></option><% String fldSql = currField; int idx = currField.lastIndexOf(":"); if (idx != -1) { fldSql = currField.substring(idx + 1); } Vector dispRef = dico.getRefList(session, fldSql); if (dispRef != null && dispRef.size() > 0) { for (int j = 0; j < dispRef.size(); j++) { Vector line = (Vector)dispRef.elementAt(j); String refID = (String)line.elementAt(0); Object refDisp = line.elementAt(1); %> <option value="<%= Utils.formatToWeb(refID, true) %>"><%= Utils.formatToWeb(refDisp, true) %></option><% } } %> </select> </span><% } else { %> <span class="criteria_field"><input id="query<%= (i + 1) %>" name="query<%= (i + 1) %>" type="text" size="20" value=""></span><% } %> </div><% } %> </div> <input type="image" src="<fl:link url="/icons/ico/valid_green2_long.gif"/>" class="search_button_new"> </td> <td class="header_center_right"></td> </tr> <tr> <td class="header_bottom_left"></td> <td class="header_bottom_middle"></td> <td class="header_bottom_right"></td> </tr> <tr> <td class="body_left"></td> <td class="body_middle"> <div style="overflow: auto; min-height:240px"> <fl:grid name="select" width="100%" hidePage="true" ajaxUrl="<%= \"/select_list.fl?type=\"+WebUtils.urlEncode(context, type)+(query == null ? \"\" : \"&query=\" + WebUtils.urlEncode(context, query)) %>"></fl:grid> </div> </td> <td class="body_right"></td> </tr> <tr> <td class="body_bottom_left"></td> <td class="body_bottom_middle"><img src="<fl:link url="/icons/popup/pop14.gif"/>" width="9" height="18"></td> <td class="body_bottom_right"></td> </tr> </table> </form> <table class="global"> <tr> <td class="separation" colspan="3"></td> </tr> <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> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de