Edit C:\galaxie\Back\galaxie\sales\enterprise\similaires.jsp
<% /****************************************************************************** * Copyright (c) 2000-2005 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 session="true" %> <%@ page import="com.edeal.frontline.FlContext" %> <%@ page import="com.edeal.frontline.DataDictionary" %> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@ page import="java.util.Vector" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.Hashtable" %> <%@ page import="com.edeal.frontline.Utils" %> <%@ page import="com.edeal.frontline.controller.actions.Identical" %> <%@ page import="com.edeal.frontline.FieldBean" %> <%@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 objType = (String) flRequest.getAttribute("objType"); String doublon = (String) flRequest.getParameter("doublon"); if (doublon == null) { doublon = "all"; } Vector similarObjs = (Vector)flRequest.getAttribute("vectIdentical"); if (similarObjs == null) { similarObjs = new Vector(); } Vector fields = (Vector)flRequest.getAttribute("fieldList"); if (fields == null) { fields = new Vector(); } int totalNbOfRecs = 0; if (flRequest.getAttribute("totalNbOfRecs") != null) { try { totalNbOfRecs = ((Integer) flRequest.getAttribute("totalNbOfRecs")).intValue(); } catch (Exception ex) { logger.error(ex); } } int totalNbOfPages = 0; if (flRequest.getAttribute("totalNbOfPages") != null) { try { totalNbOfPages = ((Integer) flRequest.getAttribute("totalNbOfPages")).intValue(); } catch (Exception ex) { logger.error(ex); } } int nbOfPage = 0; if (flRequest.getAttribute("numOfPage") != null) { try { nbOfPage = ((Integer) flRequest.getAttribute("numOfPage")).intValue(); if(nbOfPage > totalNbOfPages){ nbOfPage = totalNbOfPages; } } catch (Exception ex) { logger.error(ex); } } int seuilCert = 0; if (flRequest.getAttribute("seuilCert") != null) { try { seuilCert = ((Integer) flRequest.getAttribute("seuilCert")).intValue(); } catch (Exception ex) { logger.error(ex); } } %> <script language="javascript"> var arrMassSelectID = new Array(); function addElement(id, doAdd) { if (doAdd) { arrMassSelectID.push(id); } else { arrMassSelectID.splice(arrMassSelectID.indexOf(id), 1); } } function merge() { if (arrMassSelectID.length == 0) { alert('<fl:getMessage code="M6025" alt="Veuillez selectionner au moins un enregistrement." js="true"/>'); return; } if (!validate()) { alert('<fl:getMessage code="M9037" alt="Veuillez choisir l\\\'entreprise principale pour chaque ligne sélectionnée" js="true"/>'); return; } var arrForJson = new Object(); for (var j = 0; j < arrMassSelectID.length; j++) { arrForJson[arrMassSelectID[j]] = $("input:radio[name='" + arrMassSelectID[j] + "']:checked").attr("id"); } var jsonstr = JSON.stringify(arrForJson); openPopupLayerWaiting(jsonstr, "<fl:webapp/>/merge_object.fl?objType=<%= objType %>", "<fl:getMessage code="M903C" alt="La fusion s\'est déroulé avec succès"/>", waitingPopupMergeStatus); } function mergeAsFuntion(){ if (arrMassSelectID.length == 0) { alert('<fl:getMessage code="M6025" alt="Veuillez selectionner au moins un enregistrement." js="true"/>'); return; } if (!validate()) { alert('<fl:getMessage code="M9037" alt="Veuillez choisir l\\\'entreprise principale pour chaque ligne sélectionnée" js="true"/>'); return; } var arrForJson = new Object(); for (var j = 0; j < arrMassSelectID.length; j++) { arrForJson[arrMassSelectID[j]] = $("input:radio[name='" + arrMassSelectID[j] + "']:checked").attr("id"); } var jsonstr = JSON.stringify(arrForJson); openPopupLayerWaiting(jsonstr, "<fl:webapp/>/merge_object_as_function.fl?objType=<%= objType %>", "<fl:getMessage code="M903C" alt="La fusion s\'est déroulé avec succès"/>", waitingPopupMergeStatus); } function waitingPopupMergeStatus(data, detail) { if (data != null) { if (data.status == "OK") { $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/success.png"); $("#detail_popup").html(detail); } else if (data.status == "KO") { $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/failure.png"); $("#detail_popup").html(decodeURIComponent(data.detail)); } else { $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/failure.png"); } } } function validate() { for (var i = 0; i < arrMassSelectID.length; i++) { var fld = $("input:radio[name='" + arrMassSelectID[i] + "']:checked").attr("id"); if (fld == undefined) { return; } } return true; } function notDoubloon() { if (arrMassSelectID.length == 0) { alert('<fl:getMessage code="M6025" alt="Veuillez selectionner au moins un enregistrement." js="true"/>'); return; } var jsonstr = JSON.stringify(arrMassSelectID); openPopupLayerWaiting(jsonstr, "<fl:webapp/>/operation_doublon.fl?objType=<%= objType %>&oper=notDoublon&numOfPage=<%= nbOfPage + 1 %>&doublon=" + $("#Doublon").val(), "", waitingPopupOperationStatus); } function deleteFrom() { if (arrMassSelectID.length == 0) { alert('<fl:getMessage code="M6025" alt="Veuillez selectionner au moins un enregistrement." js="true"/>'); return; } var jsonstr = JSON.stringify(arrMassSelectID); openPopupLayerWaiting(jsonstr, "<fl:webapp/>/operation_doublon.fl?objType=<%= objType %>&oper=toDelete", "", waitingPopupOperationStatus); } function waitingPopupOperationStatus(data, detail) { if (data != null) { if (data.status == "OK") { $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/success.png"); $("#detail_popup").html(decodeURIComponent(data.detail)); } else if (data.status == "KO") { $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/failure.png"); $("#detail_popup").html(decodeURIComponent(data.detail)); } else { $("#waiting_popup").attr("src", "<fl:webapp/>/js/progressbar/images/failure.png"); } } } function refreshPage() { window.location.href = "<fl:webapp/>/similaires.fl?objType=<%= objType %>&numOfPage=<%= nbOfPage %>&doublon=" + $("#Doublon").val(); <%--'<fl:link url="<%= \"/similaires.fl?objType=\" + objType %>&numOfPage=<%= nbOfPage + 1 %>&doublon=" + $(\"#Doublon\").val() />'; --%> } function doClosePopUp(popName){ $.closePopupLayer(popName); if (popName == "WaitingPopup") { refreshPage(); } } function viewObject(id) { window.open('<fl:webapp/>/read_<%= objType.toLowerCase() %>.fl?id=' + id, '<%= objType %>', 'menubar=no,status=no,toolbar=no,scrollbars=yes,resizable=yes,width=1024,height=768'); } function goNextPage() { window.location.href = "<fl:webapp/>/similaires.fl?objType=<%= objType %>&numOfPage=<%= nbOfPage + 1 %>&doublon=" + $("#Doublon").val(); } function goPreviousPage() { window.location.href = "<fl:webapp/>/similaires.fl?objType=<%= objType %>&numOfPage=<%= nbOfPage - 1 %>&doublon=" + $("#Doublon").val(); } function goLastPage() { window.location.href = "<fl:webapp/>/similaires.fl?objType=<%= objType %>&numOfPage=<%= totalNbOfPages %>&doublon=" + $("#Doublon").val(); } function goFirstPage() { window.location.href = "<fl:webapp/>/similaires.fl?objType=<%= objType %>&numOfPage=<%= 1 %>&doublon=" + $("#Doublon").val(); } function checkAll(toCheck) { $("input[type=checkbox][name='checkbox']").each(function() { this.checked = toCheck; addElement(this.id, this.checked); }); } function reloadPage() { window.location.href = "<fl:webapp/>/similaires.fl?objType=<%= objType %>&numOfPage=<%= 1 %>&doublon=" + $("#Doublon").val(); } </script> <fl:bigTabs objectTitle="<%= Utils.getMessage(session, \"L3021\", false, true, \"Similaires\") %>"> <table cellpadding="0" class="container"> <tr valign="top"> <td> <table cellpadding="0" cellspacing="0" width="30%"> <tr class="fieldline"> <td class="dataLabel" id="Doublon_label"> <div> <fl:label code="L65F5"/> </div> </td> <td class="dataValue" id="Doublon_value"> <div class="input select"> <select class="input select" name="Doublon" id="Doublon"> <option value="all" <%= doublon.equals("all") ? "selected='selected'" : "" %>><fl:getMessage code="L8153" alt="Tout"/></option> <option value="certain" <%= doublon.equals("certain") ? "selected='selected'" : "" %>><fl:getMessage code="L8151" alt="Certitude"/></option> <option value="suspect" <%= doublon.equals("suspect") ? "selected='selected'" : "" %>><fl:getMessage code="L8152" alt="Suspicion"/></option> </select> </div> </td> </tr> </table> </td> <td class="separation"><div class="separation"></div></td> <td valign="top" style="width: 15%;"> <table cellpadding="0" class="container"> <tr> <td> <a href="javascript:reloadPage(); void('')" title="<fl:getMessage code="A2009" alt="Rechercher"/>" class="search-button" id="valid-button"><img src="<fl:webapp/>/icons/ico/valid_green2_long.gif"></a> </td> </tr> </table> </td> </tr> <tr class="ligne_separation"><td colspan="5"></td></tr> <tr class="ligne_separation"><td colspan="5"></td></tr> <tr class="ligne_separation"><td colspan="5"></td></tr> <tr style="padding-right: 20px; padding-left: 20px;" class="ligne_separation_couleur"><td colspan="5"></td></tr> </table> <% if (similarObjs.size() > 0) { %> <center> <span class="grid-action"> <% if (nbOfPage > 1) { %> <a onclick="goFirstPage(); return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheGdouble.gif"/> </a> <a onclick="goPreviousPage(); return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheG.gif"/> </a> <% } %> <%= Utils.getMessage(session, "F608C", "Page") %> <%= nbOfPage + "/" + totalNbOfPages %><%= " - (" + totalNbOfRecs + ")" %> <% if (nbOfPage < totalNbOfPages) { %> <a onclick="goNextPage(); return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheD.gif"/> </a> <a onclick="goLastPage(); return false;" href="#"> <img src="<fl:webapp/>/icons/ico/flecheDdouble.gif"/> </a> <% } %> </span> </center> <% } %> <table cellpadding="0" cellspacing="0" width="100%"> <tr class="ligne_separation"><td colspan="0"></td></tr> <% if (similarObjs.size() == 0) { %> <tr> <td class="dataLabel" colspan="5"><fl:getMessage code="L0001" alt="Aucune entrée disponible"/></td> </tr> <% } else { %> <tr valign="top" style="text-align: center;"> <td class="headerDataGrid borderLineOne" style="text-align: center" width="5px"><input type="checkbox" name="" id="" onclick="checkAll(this.checked)"></td> <td class="headerDataGrid borderLineOne" style="text-align: center" width="5px"></td> <td class="headerDataGrid borderLineOne" style="text-align: center" width="5px"></td> <% for (int i = 0; i < fields.size(); i++) { String codeLbl = null; try { codeLbl = dico.getFieldByName((String)fields.elementAt(i)).getFldDisplayLabel(); } catch (Exception e) { codeLbl = ""; } String altLbl = null; try { altLbl = dico.getFieldByName((String)fields.elementAt(i)).getFldDisplay(); } catch (Exception e) { altLbl = ""; } String fieldLbl = Utils.getMessage(session, codeLbl, altLbl); %> <td class="headerDataGrid borderLineOne" style="text-align: center"><%= fieldLbl %></td> <% } %> </tr> <% boolean doColor = false; for (int i = 0; i < similarObjs.size(); i++) { Identical identical = (Identical)similarObjs.elementAt(i); String id = identical.getId(); Integer poids = identical.getPoids(); String objid1 = identical.getObj1id(); String objid2 = identical.getObj2id(); Hashtable obj1 = identical.getObj1(); Hashtable obj2 = identical.getObj2(); %> <tr class="<%= doColor ? "tabSimpleFdBlanc" : "tabSimpleFdBleu" %>" valign="top"> <td nowrap="nowrap" rowspan="2" style="<%= poids >= seuilCert ? "background-color: #F2D5D9;" : "background-color: #FBFAC8;"%>"><input type="checkbox" name="checkbox" id="<%= id %>" onclick="addElement(this.id, this.checked)"></td> <td nowrap="nowrap"><input type="radio" name="<%= id %>" id="<%= objid1 %>" checked="checked" title="<fl:getMessage code="M60E8" alt="Choisir cette entreprise comme l\'entreprise principale"/>"/></td> <td nowrap="nowrap"><a href="javascript:viewObject('<%= objid1 %>');"><img src="<fl:webapp/>/icons/ico/zoom.gif" title="<fl:getMessage code="A2008" alt="Voir"/>"></a></td> <% for (int j = 0; j < fields.size(); j++) { Object valOfField = (Object) obj1.get(fields.elementAt(j)); %> <td nowrap="nowrap"> <%= valOfField.toString().length() > 50 ? valOfField.toString().substring(0, 50) : valOfField.toString() %> </td> <% } %> </tr> <tr class="<%= doColor ? "tabSimpleFdBlanc" : "tabSimpleFdBleu" %>" valign="top"> <td nowrap="nowrap"><input type="radio" name="<%= id %>" id="<%= objid2 %>" title="<fl:getMessage code="M60E8" alt="Choisir cette entreprise comme l\'entreprise principale"/>"/></td> <td nowrap="nowrap"><a href="javascript:viewObject('<%= objid2 %>');"><img src="<fl:webapp/>/icons/ico/zoom.gif" title="<fl:getMessage code="A2008" alt="Voir"/>"></a></td> <% for (int k = 0; k < fields.size(); k++) { Object valOfField = (Object) obj2.get(fields.elementAt(k)); %> <td nowrap="nowrap"> <%= valOfField.toString().length() > 50 ? valOfField.toString().substring(0, 50) : valOfField.toString() %> </td> <% } doColor = !doColor; %> </tr> <% if (i != similarObjs.size() - 1) {%> <tr class="ligne_separation"><td colspan="<%= fields.size() + 3 %>"></td></tr> <tr style="padding-right: 20px; padding-left: 20px;" class="ligne_separation_couleur"><td colspan="<%= fields.size() + 3 %>"></td></tr> <tr class="ligne_separation"><td colspan="<%= fields.size() + 3 %>"></td></tr> <tr><td colspan="<%= fields.size() + 3 %>" style="border-top: 1px solid #ccc;"></td></tr> <% } %> <% } } %> </table> </fl:bigTabs>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de