<% /****************************************************************************** * Copyright (c) 2000-2004 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="com.edeal.frontline.*,java.util.*,java.text.*,java.lang.reflect.*, com.edeal.frontline.navigation.*"%> <%@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()); String contextPath = (String) session.getAttribute("contextPath"); FlRequest flRequest = new FlRequest(request); FlContext context = flRequest.getContext(); DataDictionary dico = context.getDataDictionary(); String id = flRequest.getParameter("scriptID"); String isVrp = Utils.getRequestParameter(context, request, "vrp"); boolean isReportInclude = Utils.getRequestParameter(context, request, "report") != null; ScriptResponseBean srp = new ScriptResponseBean(id, session); if (isReportInclude) { if (ScriptResponse.getSession() == null) { ScriptResponse.setSession(session); } try { ScriptResponse.populateFromID(id); } catch (FrontlineException fe) { } catch (AccessDeniedException ade) { } } String perID= flRequest.getParameter("perID"); if (perID == null){ try { perID = srp.getSrpPersonID(); } catch (FieldNotInitializedException fnie) { } } String scriptID = null; try { scriptID = srp.getSrpScriptID(); } catch (FieldNotInitializedException fnie) { } String[][] queryScript = {{"ScrID = " + Utils.formatToSQL(context, scriptID)}}; String[] fieldsScript = {"ScrLabel" , "ScrSeqNum" , "ScrEventID"}; String scriptLabel = "???"; String scriptNumber = "???"; String scriptEventID = null; Vector listScript = ScriptBean.listSummary(session , fieldsScript , queryScript); if (listScript != null && listScript.size() > 0) { scriptEventID = (String) ((Hashtable) listScript.elementAt(0)).get("ScrEventID"); scriptLabel = (String) ((Hashtable) listScript.elementAt(0)).get("ScrLabel"); Integer scriptNumberI = (Integer) ((Hashtable) listScript.elementAt(0)).get("ScrSeqNum"); if (scriptNumberI != null) { DecimalFormat df = FlLocale.getInstance(session).getDecimalFormat("0000"); scriptNumber = df.format((long) (scriptNumberI.intValue())); } } EventBean evtObj = null; try { evtObj = new EventBean(scriptEventID, session); } catch (AccessDeniedException ade) { } catch (FrontlineException fe) { } String evtLabel = ""; try { evtLabel = Utils.formatToWeb(evtObj.getEvtLabel(), false); } catch (FieldNotInitializedException fnie) {} %> <% if (!isReportInclude) {} %>
"> <% String[] fieldsPer = {"PerCivID:Val", "PerName", "PerFstName", "PerPhone", "PerFax", "PerMail", "PerTitle", "PerEntID", "PerEntID:EntCorpName", "PerEntID:EntAd1", "PerEntID:EntAd2", "PerEntID:EntAd3", "PerEntID:EntZip", "PerEntID:EntCity", "PerEntID:EntPhone", "PerEntID:EntFax", "PerLocID", "PerLocID:LocAd1", "PerLocID:LocAd2", "PerLocID:LocAd3", "PerLocID:LocZip", "PerLocID:LocCity", "PerLocID:LocPhone", "PerLocID:LocFax" }; String[][] queryPer = {{"PerID = " + Utils.formatToSQL(context, perID)}}; String perCompleteName = "???"; Vector listPer = PersonBean.listSummary(session , fieldsPer , queryPer); if (listPer != null && listPer.size() > 0) { Hashtable row = (Hashtable) listPer.elementAt(0); String perCiv = (String)row.get("PerCivID:Val"); String perName = (String)row.get("PerName"); String perFstName = (String)row.get("PerFstName"); String perTitle = (String)row.get("PerTitle"); String perMail = (String)row.get("PerMail"); String perFax = (String)row.get("PerFax"); String perPhone = (String)row.get("PerPhone"); perCompleteName = (perCiv != null ? perCiv : "") + " " + (perFstName != null ? perFstName : "") + " " + (perName != null ? perName : ""); String entID = (String)row.get("PerEntID"); String entCorpName = (String)row.get("PerEntID:EntCorpName"); String entAd1 = (String)row.get("PerEntID:EntAd1"); String entAd2 = (String)row.get("PerEntID:EntAd2"); String entAd3 = (String)row.get("PerEntID:EntAd3"); String EntZip = (String)row.get("PerEntID:EntZip"); String entCity = (String)row.get("PerEntID:EntCity"); String entFax = (String)row.get("PerEntID:EntFax"); String entPhone = (String)row.get("PerEntID:EntPhone"); String locID = (String)row.get("PerLocID"); String locAd1 = (String)row.get("PerLocID:LocAd1"); String locAd2 = (String)row.get("PerLocID:LocAd2"); String locAd3 = (String)row.get("PerLocID:LocAd3"); String locZip = (String)row.get("PerLocID:LocZip"); String locCity = (String)row.get("PerLocID:LocCity"); String locFax = (String)row.get("PerLocID:LocFax"); String locPhone = (String)row.get("PerLocID:LocPhone"); StringBuffer address = new StringBuffer(); if (locID != null) { if (locAd1 != null) { address.append(locAd1); address.append("\n"); } if (locAd2 != null) { address.append(locAd2); address.append("\n"); } if (locAd3 != null) { address.append(locAd3); address.append("\n"); } if (locZip != null) { address.append(locZip); address.append(" "); } if (locCity != null) { address.append(locCity); } } if (address.length() == 0) { if (entID != null) { if (entAd1 != null) { address.append(entAd1); address.append("\n"); } if (entAd2 != null) { address.append(entAd2); address.append("\n"); } if (entAd3 != null) { address.append(entAd3); address.append("\n"); } if (EntZip != null) { address.append(EntZip); address.append(" "); } if (entCity != null) { address.append(entCity); } } } String[] fieldsPvt = {"PvtParStatus:Val"}; String[][] queryPvt = {{"PvtEventID = " + Utils.formatToSQL(context, scriptEventID), "PvtPersonID = " + Utils.formatToSQL(context, perID)}}; Vector pvts = PersonEventBean.listSummary(context, fieldsPvt, queryPvt); String pvtParStatus = ""; if (!pvts.isEmpty()) { Hashtable h = (Hashtable)pvts.elementAt(0); pvtParStatus = (String)h.get("PvtParStatus:Val"); } %>
<% if (entID != null) { %> <%= Utils.formatToWeb(entCorpName, false) %> <% } else { %>   <% } %>
<%= address.length() == 0 ? " " : Utils.formatToWeb(address.toString(), false) %>
<%= Utils.formatToWeb(entPhone, false) %>
<%= Utils.formatToWeb(entFax, false) %>
<%= Utils.formatToWeb(perCompleteName, false) %>
<%= Utils.formatToWeb(perTitle, false) %>
<%= Utils.formatToWeb(perPhone, false) %>
<%= Utils.formatToWeb(perFax, false) %>
<%= Utils.formatToWeb(perMail, false) %>
<%= pvtParStatus %>
<%= Utils.formatToWebDate(session, srp.getCrDt(), false) %>
<% } %> <% String[][] query = {{"LseScriptID = " + Utils.formatToSQL(context, scriptID)}}; String[] fields = {"LseID" , "LseScriptElementID" , "LsePosition", "LsePageID", "LsePageID:ScpCode", "LsePageID:ScpTitre", "LsePageID:ScpPosition"}; String[] orderBy = {"LsePageID:ScpPosition", "LsePosition"}; String oldPageID = ""; Vector lseList = LinkScriptElementBean.listSummary(session, fields, query, orderBy); if (lseList != null && lseList.size() > 0) { %> <% for (int i=0 ; i < lseList.size() ; i++) { Hashtable line = (Hashtable) lseList.elementAt(i); String scriptElementID = (String) line.get("LseScriptElementID"); Integer lsePosI = (Integer) line.get("LsePosition"); String lseID = (String) line.get("LseID"); String pageID = (String)line.get("LsePageID"); String pageTitle = (String)line.get("LsePageID:ScpTitre"); String pageCode = (String)line.get("LsePageID:ScpCode"); int lsePosition = 99; if (lsePosI != null) { lsePosition = lsePosI.intValue(); } String lsePos = Integer.toString(lsePosition); ScriptElementBean curScriptElement = null; try { curScriptElement = new ScriptElementBean(scriptElementID , session); } catch (AccessDeniedException ade) { } catch (FrontlineException fex) { } if (curScriptElement != null) { if (curScriptElement.getSceHasAnswers() != 1) { String qLabel = null; try { qLabel = curScriptElement.getSceLabel(); } catch (FieldNotInitializedException fnie) { } boolean isTitle = false; if (qLabel != null) { int spaceIdx = qLabel.indexOf(" "); if (spaceIdx > -1) { String numberStr = qLabel.substring(0, spaceIdx); boolean probs = false; for (int j = 0; j < numberStr.length() && !probs; j++) { if (!Character.isDigit(numberStr.charAt(j)) && numberStr.charAt(j) != '.') { probs = true; } } isTitle = !probs; } } if (isTitle) { %> <% } } else { String qLabel = null; try { qLabel = curScriptElement.getSceLabel(); } catch (FieldNotInitializedException fnie) { } String qTypeID = null; try { qTypeID = curScriptElement.getSceType(); } catch (FieldNotInitializedException fnie) { } String qRefTableID = null; String qType = "FRE"; if ( qTypeID != null && qTypeID.equals(dico.getRefIdByCode("SceType" , "REF")) ) { qType = "REF"; try { qRefTableID = curScriptElement.getSceRefTable(); } catch (FieldNotInitializedException fnie) { } } if ( qTypeID != null && qTypeID.equals(dico.getRefIdByCode("SceType" , "LST")) ) { qType = "LST"; } String[][] querySer = {{"SerSrpID = " + Utils.formatToSQL(context, id), "SerLseID = " + Utils.formatToSQL(context, lseID)}}; String[] orderBySer = {"SerInstance"}; Vector listSer = ScriptElementResponseBean.list(session , querySer, orderBySer); if (listSer == null || listSer.size() == 0) { continue; } String replyDisplay = ""; if (listSer != null && listSer.size() > 0) { for (int j=0 ; j < listSer.size() ; j++) { ScriptElementResponseBean curSer = (ScriptElementResponseBean) listSer.elementAt(j); if ("FRE".equals(qType)) { //- debut cas FRE String serText = null; try { serText = curSer.getSerText(); } catch (FieldNotInitializedException fnie) { } replyDisplay += (serText != null ? Utils.formatToWeb(serText, false) : "") + (j < listSer.size() - 1 ? "
" : ""); } //- fin cas FRE if ("LST".equals(qType)) { //- debut cas LST int serPosition = -1; try { serPosition = curSer.getSerPosition(); } catch (FieldNotInitializedException fnie) { } String lstAnswer = null; try { Method getter = Class.forName("com.edeal.frontline.ScriptElementBean").getMethod("getSceLstAnswer" + serPosition , null); lstAnswer = (String) getter.invoke(curScriptElement , null); } catch (Exception e) { logger.warn("DBG: " + e.getClass().getName() + " : " + e.getMessage()); } String serMoreText = null; try { serMoreText = curSer.getSerMoreText(); } catch (FieldNotInitializedException fnie) { } if (lstAnswer != null) { replyDisplay += lstAnswer + (serMoreText != null ? " (" + serMoreText + ")" : "") + (j < listSer.size() - 1 ? "
" : ""); } } //- fin cas LST if ("REF".equals(qType)) { //- debut cas REF String serRefValID = null; try { serRefValID = curSer.getSerRefValID(); } catch (FieldNotInitializedException fnie) { } String serMoreText = null; try { serMoreText = curSer.getSerMoreText(); } catch (FieldNotInitializedException fnie) { } String refAnswer = null; try { refAnswer = (String) dico.getRefDisp(session, qRefTableID , "Te1" , serRefValID); } catch (FrontlineException fe) { } if (refAnswer != null) { replyDisplay += refAnswer + (serMoreText != null ? " (" + serMoreText + ")" : "") + (j < listSer.size() - 1 ? "
" : ""); } } //- fin cas REF }//fin du for }//fin du if // detection de la coupure boolean coupure = false; if (i == 0) { coupure = true; } else if ("".equals(oldPageID)) { coupure = pageID != null; } else if (pageID == null) { coupure = !"".equals(oldPageID); } else { coupure = !oldPageID.equals(pageID); } if (coupure && pageID != null) { %> <% oldPageID = pageID != null ? pageID : ""; } if (!"".equals(replyDisplay)) { %> <% }//if (!"".equals(replyDisplay)) }//fin du if (curScriptElement.getSceHasAnswers() != 1) else }//fin du if (curScriptElement != null) }//fin du for chaque lse }// fin du if il y a des lse String srpNotes = null; try { srpNotes = srp.getSrpNotes(); } catch (FieldNotInitializedException e) {} if (srpNotes != null) { %> <% } %>
<%= Utils.formatToWeb(pageCode, false) %><%= pageCode != null && pageTitle != null ? " - " : "" %><%= Utils.formatToWeb(pageTitle, false) %>
<%= qLabel == null ? " " : qLabel %> <%= replyDisplay %>
 



<% if (!isReportInclude) { %>


<% } %>