Edit C:\Windows\install\galaxie_p01_01-10\sales\correspondent\select_multiple.jsp
<%@ page language="java"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.FieldNotInitializedException" %> <%@ page import="com.edeal.frontline.PersonBean" %> <%@ page import="java.util.Vector" %> <%@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 field = flRequest.getParameter("field"); String multivalSeparator = flRequest.getParameter("multivalSeparator"); if (multivalSeparator == null || "".equals(multivalSeparator)) { multivalSeparator = "|"; } String formIndex = flRequest.getParameter("formIndex"); try { Integer.parseInt(formIndex); } catch (NumberFormatException nfe) { formIndex = "0"; } formIndex = formIndex != null && !"".equals(formIndex) ? formIndex : "0"; String entID=""; Vector ids = (Vector)flRequest.getAttribute("ids"); if (ids == null) { ids = new Vector(); } else { // id format --> 000000000000a704:000000000000d15c --> PerID:EntID if(ids.size()==1){ String firstIDs = (String)ids.firstElement(); String[] splittedIDs = firstIDs.split(":"); // If only have PerID try to recover its PerEntID if(splittedIDs.length == 1 && !"".equals(splittedIDs[0])){ PersonBean currentPerson = new PersonBean(splittedIDs[0], context); try{ entID = currentPerson.getPerEntID(); } catch (FieldNotInitializedException e){ // nothing } } else if(splittedIDs.length == 2 && !"".equals(splittedIDs[1])){ // If have EntID entID = splittedIDs[1]; } } } Vector types = (Vector)flRequest.getAttribute("types"); if (types == null) { types = new Vector(); } Vector displays = (Vector)flRequest.getAttribute("displays"); if (displays == null) { displays = new Vector(); } %><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" 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="./js/edeal/tools/utils.js"></script> <title><fl:getMessage code="L82A6" alt="Rechercher des correspondants"/></title> <script type="text/javascript" language="javascript"> var vectID = new FlVector(); var vectDisp = new FlVector(); var vectType = new FlVector(); var selectedID = new FlVector(); var selectedDisplay = new FlVector(); // get a string id1:id2 to id1_id2 // necessary as javascript document.getElementById("xx:yy") doesn't work with the : function transformToJsId(ids) { return ids.replace(":","_"); } // get a id1_id2 to id1:id2 function transformFromJsId(ids) { return ids.replace("_",":"); } function closeWindow() { setTimeout(finalCloseWindow, 10); } function finalCloseWindow() { window.top.close(); } function doAddEntry(pEntID, pPerID, pDisp, pType) { if(!pEntID && !pPerID) return; if(!pEntID) pEntID = ''; if(!pPerID) pPerID = ''; var id = pPerID + ':' + pEntID; if(!vectID.contains(id)) { vectID.addElement(id); vectDisp.addElement(pDisp); vectType.addElement(pType); addRowToResultGrid(id,pDisp); } } function addRowToResultGrid(id, display) { var jsID=transformToJsId(id); var rowStr = '<tr id=\"tableRow_' + jsID + '\" class=\"' + (vectID.size() % 2 == 0 ? 'odd' : 'even') + '\"><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 = vectID.elementAt(vectID.size() - 1); if (lastID == id) { lastID = vectID.elementAt(vectID.size() - 2); } if (lastID) { $('#tableRow_' + transformToJsId(lastID)).after(rowStr); } else { $("#_grid__result_div_").html(""); $("#_grid__result_div_").append("<div id='grid-data' class='data'>"+ "<table>"+ "<thead>"+ "<tr>"+ "<th></th>"+ "<th><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_' + transformToJsId(selectedID.elementAt(idx))); jQueryVar.addClass(doEven ? 'even' : 'odd'); jQueryVar.removeClass(!doEven ? 'even' : 'odd'); doEven = !doEven; } } function unselect(id) { var jsID=transformToJsId(id) var pos = -1; for (var i = 0; i < vectID.size(); i++) { if (vectID.elementAt(i) == id) { pos = i; } } if (pos == -1) { return; } vectID.removeElementAt(pos); vectDisp.removeElementAt(pos); vectType.removeElementAt(pos); // suppression de la ligne numerote pos dans myData_result $('#tableRow_' + jsID).css('display', 'none'); if(vectID.size()==0){ $("#_grid__result_div_").html(""); } refreshRowClasses(); } function removeFrom(tab, pos) { if (!tab) { return; } var tmp = new Array(); var nbElements = tab.length; for (var i = 0; i < nbElements; i++) { if (i < pos) { tmp[i] = tab[i]; } else if (i > pos) { tmp[i - 1] = tab[i]; } } return tmp; } function validate() { var strURL = '<fl:webapp/>/select_correspondent_valid.fl?field=<%= field %>&formIndex=<%= formIndex %>&ids=' + vectID.toString('<%= multivalSeparator %>') + '&types=' + vectType.toString('<%= multivalSeparator %>') + '&multivalSeparator=' + encodeURIComponent('<%= multivalSeparator %>'); doAjax(strURL); } function doSubmit(f) { var params={}; params["type"]=f.type.options[f.type.selectedIndex].value; params["query"]=encodeURIComponent(f.query.value + '%'); params["criteria"]=encodeURIComponent(f.criteria.value); var entity_type=f.type.value; if (entity_type=="person" || entity_type=="journalist") { _grid__select_indiv_js_.callAjaxForHtml(_grid__select_indiv_js_.getAjaxUrl(),params,true); } else { _grid__select_group_js_.callAjaxForHtml(_grid__select_group_js_.getAjaxUrl(),params,true); } } function changeCriteria(form, type) { if (type == 'enterprise') { form.criteria.value = "EntCorpName"; } else if (type == 'support') { form.criteria.value = "SupTitle"; } else if (type == 'person') { form.criteria.value = "PerName"; } else if (type == 'journalist') { form.criteria.value = "JouName"; } } function doSelectIndiv(groupID, type) { var params={}; params["type"]=(type == 'Journalist')?"journalist":"person"; params["query"]=encodeURIComponent(groupID); params["criteria"]=(type == 'Journalist')?"JouSupID":"PerEntID"; _grid__select_indiv_js_.callAjaxForHtml(_grid__select_indiv_js_.getAjaxUrl(),params,true); } function doOnload() { <% String id=""; String label=""; String type=""; for (int i = 0 ; i < ids.size(); i++) { id=(String)ids.elementAt(i); type=(String)types.elementAt(i); label=(String)displays.elementAt(i); %>vectID.addElement('<%= Utils.formatToJavascript(id) %>'); vectType.addElement('<%= Utils.formatToJavascript(type) %>'); vectDisp.addElement('<%= Utils.formatToJavascript(label) %>'); _grid__result_js_.addColumn(new Array(escape('javascript:unselect(\'<%=id%>\')'), escape('<img src=\\\"<fl:link url="/icons/ico/close.gif"/>\\\" class=\\\"unselect_button\\\">'), escape("<%=label%>"), transformToJsId("<%=id%>"))); <% } %> var entID='<%= (entID==null?"":entID) %>'; <%if(!"".equals(entID)){%> params = {"type":"enterprise","query":entID,"criteria":"EntID"}; _grid__select_group_js_.callAjaxForHtml(_grid__select_group_js_.getAjaxUrl(),params,true); params = {"type":"person","query":entID,"criteria":"PerEntID"}; _grid__select_indiv_js_.callAjaxForHtml(_grid__select_indiv_js_.getAjaxUrl(),params,true); <%} %> _grid__result_js_.setAjaxUrl('<fl:webapp/>/select_clientsidelist_ajax.fl'); _grid__result_js_.renderLocal(); document.forms[0].query.focus(); } </script> </head> <body onload="doOnload()"> <form action="javascript:doSubmit(window.document.forms[0])"> <table class="global" cellpadding="0" cellspacing="0"> <tr> <td class="header_top_left"></td> <td class="header_top_middle"></td> <td class="header_top_right"></td> <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" valign="top" nowrap> <div style="display: inline"> <div class="criteria" style="margin-left:10px;"> <input type="hidden" name="criteria" id="criteria" value="EntCorpName"> <span class="criteria_field"> <select id="type" name="type" onchange="changeCriteria(this.form, this.options[this.selectedIndex].value);"> <option value="enterprise"><fl:getMessage code="F002B" alt="Entreprise"/></option> </select> </span> <span class="criteria_field"><input id="query" name="query" 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"> </form> </td> <td class="header_center_right"></td> <td class="header_center_left"></td> <td class="header_center_middle title" valign="top" nowrap> <form action="javascript:doSubmit(window.document.forms[1])"> <div style="display: inline"> <div class="criteria"> <input type="hidden" name="criteria" id="criteria" value="PerName"> <span class="criteria_field"> <select id="type" name="type" onchange="changeCriteria(this.form, this.options[this.selectedIndex].value);"> <option value="person"><fl:getMessage code="F002E" alt="Personne"/></option> </select> </span> <span class="criteria_field"><input id="query" name="query" 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> <td class="header_bottom_left"></td> <td class="header_bottom_middle"></td> <td class="header_bottom_right"></td> </tr> <tr style="height: 300px"> <td class="body_left"></td> <td class="body_middle"><div><fl:grid name="select_group" width="100%" height="300px" hidePage="true" allowUpdate="false" ajaxUrl="/select_correspondent_list.fl"></fl:grid></div></td> <td class="body_right"></td> <td class="body_left"></td> <td class="body_middle"><div><fl:grid name="select_indiv" width="100%" height="300px" hidePage="true" allowUpdate="false" ajaxUrl="/select_correspondent_list.fl"></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> <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> <td class="selection_body_left"></td> <td class="selection_body_middle"> <div class="edealGrid" style="overflow: auto; height: 150px;"> <fl:grid name="result" height="120px" hidePage="true"/> </div> </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> <div class="validation"><a href="javascript:validate()"><img src="<fl:link url="/icons/ico/valid_green_long.gif"/>" class="valid_button_new" style="margin-right: 20px;"></a><a href="javascript:closeWindow();"><img src="<fl:link url="/icons/ico/fermer_red_long.gif"/>" class="cancel_button_new"></a></div> </div> </body> </html>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de