<% /****************************************************************************** * Copyright (c) 2007-2008 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" import="java.util.*"%> <%@ page import="com.edeal.frontline.navigation.FlRequest" %> <%@page session="true" import="com.edeal.frontline.*"%> <%@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); int numEntries; try { numEntries = Integer.parseInt(flRequest.getParameter("$$nb")); } catch (Exception e) { numEntries = -1; // Show all the entries } String targetDiv = flRequest.getParameter("targetDiv"); if (targetDiv == null) { targetDiv = "PopulationEntryList"; } Integer noPopAddNbr = (Integer)flRequest.getAttribute("noPopAddNbr"); Vector results = (Vector)flRequest.getAttribute("results"); Vector toString = (Vector)flRequest.getAttribute("toString"); Vector colonnes = (Vector)flRequest.getAttribute("colonnes"); Vector objIDFields = (Vector)flRequest.getAttribute("objIDFields"); Vector objNames = (Vector)flRequest.getAttribute("objNames"); String manAddedStr = Utils.getMessage(session, "A3068", "Ajouté manuellement"); String plusUrl = flRequest.computeURL("/icons/ico/plus.gif"); boolean hasAddedEntries = (noPopAddNbr != null && noPopAddNbr > 0); boolean isError = false; if (results == null || toString == null || colonnes == null) { logger.error("No data returned from Population2EntryListAction. Cannot continue"); isError = true; } try { if (toString.size() != colonnes.size()) { logger.error("colonnes/toString data size mismatch. Cannot continue"); isError = true; } } catch (NullPointerException e) { } String ppeRemoved = flRequest.getParameter("PpeRemoved"); String ppeAdded = flRequest.getParameter("PpeAdded"); if (ppeRemoved == null) { ppeRemoved = "0"; } if (ppeAdded == null) { ppeAdded = "0"; } //je dois ecrire les toString int nbObject = (toString == null ? 1 : toString.size()); String widthCol = nbObject == 1 ? "50%" : (100 / nbObject) + "%"; StringBuilder tableBuf = new StringBuilder(); boolean isBlue = true; if (toString.size() > 0 && results.size() > 0 && !isError) { tableBuf.append(""); tableBuf.append(""); tableBuf.append(""); if (hasAddedEntries) { tableBuf.append(""); } Iterator colIter = colonnes.iterator(); while (colIter.hasNext()) { tableBuf.append(""); } tableBuf.append(""); boolean isRemoved = "1".equals(ppeRemoved); boolean isAdded = "1".equals(ppeAdded); String linkString = isRemoved ? " resultsIter = results.iterator(); while (resultsIter.hasNext()) { Hashtable row = resultsIter.next(); String ppeID=(String)row.get("PpeID"); /* Make sure the IDs of the popentry will be really IDs within the HTML * page : they must be unique within the HTML page, that's why we have * chosen to suffix them. */ if (isRemoved) { tableBuf.append(""); if (hasAddedEntries) { if (ppeAddedBool != null && ppeAddedBool) { tableBuf.append(""); } else { tableBuf.append(""); } } Iterator toStringIter = toString.iterator(); Iterator objIDIter = objIDFields.iterator(); Iterator objNamesIter = objNames.iterator(); while (toStringIter.hasNext()) { String toStringPattern = toStringIter.next(); SyntaxNode synNode = SyntaxNode.parse(toStringPattern); Object synNodeObj = synNode.eval(session, row); String synNodeVal = ""; if (synNodeObj == null) { synNodeVal=""; } else { synNodeVal=synNodeObj.toString(); if ("".equals(synNodeVal)) { try { synNodeVal=(String)row.get(toStringPattern); } catch (Exception e) {} } } String objID = objIDIter.next(); String objName = objNamesIter.next(); tableBuf.append(""); } isBlue = !isBlue; } tableBuf.append(""); tableBuf.append("
  " + colIter.next() + "
"); } else if (isAdded) { tableBuf.append("
"); } else { tableBuf.append("
"); } tableBuf.append(linkString); // tableBuf.append(ppeID); // tableBuf.append("\\\'"); Boolean ppeAddedBool = (Boolean)row.get("PpeAdded"); tableBuf.append(");\">\"");"); tableBuf.append(""); tableBuf.append("\"");"); tableBuf.append(""); tableBuf.append(" "); tableBuf.append(""); if (synNodeVal == null || synNodeVal.equals("")) { tableBuf.append(" "); } else { String valToDisp = Utils.formatToJavascript(Utils.formatToWeb(synNodeVal.trim(), false)); tableBuf.append("
" + valToDisp + "
"); } tableBuf.append("
"); if (numEntries != -1 && results.size() >= numEntries) { tableBuf.append("
"); tableBuf.append("
"); tableBuf.append("
" + Utils.getMessage(session, "M6115", true, "Voir tous les entrées") + "
"); tableBuf.append("
"); } } else { tableBuf.append("

"+ Utils.getMessage(session, "L0001", "Aucune entrée disponible") +"

"); } %>var f = document.getElementById('<%= targetDiv %>'); try { f.innerHTML = '<%= tableBuf.toString() %>'; } catch (err) { }