<% /****************************************************************************** * 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" %> <%@ page import="com.edeal.frontline.*" %> <%@ page import="java.util.*" %> <%@ page import="java.text.*" %> <%@ page import="java.lang.reflect.*" %> <%@ page import="com.edeal.frontline.navigation.*" %> <%@ page import="java.util.LinkedHashMap" %> <%@ page import="com.edeal.frontline.helper.custom.EventHelper" %> <%@ page import="java.util.Iterator" %> <%@ page import="com.edeal.frontline.helper.EventBaseHelper.StatusType" %> <%@ 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"); String parentTarget = " target=\"_parent\" "; String blankTarget = " target=\"_blank\" "; FlContext context = null; FlRequest flRequest = new FlRequest(request); String id = (String) flRequest.getRequestParameterOrAttribute("id"); logger.debug("xxxxxxxxxxxxxxxxxx"+id); if (contextPath != null) { context = Frontline.getContext(contextPath); } else { context = Frontline.getContext(request.getContextPath()); } DataDictionary dico = context.getDataDictionary(); int idxTab = 1; String formID = flRequest.getRequestParameterOrAttribute("formID"); String perID = (String) flRequest.getRequestParameterOrAttribute("perID"); boolean isPreview = flRequest.getRequestParameterOrAttribute("preview") != null; LinkedHashMap statusParIDAndDisplay = new LinkedHashMap(); if (isPreview) { %><% if (perID == null) { %><fl:getMessage code="L6147" alt="Prévisualiser"/> <% } } %> <% if (isPreview) { %> <% } String[][] queryForm = {{"FrmID = " + Utils.formatToSQL(context, formID)}}; String[] fieldsForm = {"FrmID", "FrmLabel" , "FrmSeqNum" , "FrmBasicQuestion0" , "FrmBasicQuestion1" , "FrmBasicQuestion2" , "FrmEventID", "FrmTabMode", "FrmParStatusRule", "FrmParStatus"}; String formLabel = "???"; String formNumber = "???"; String formEventID = null; String frmParStatusRule = null; String frmParStatus = null; boolean formTabMode = false; Vector listForm = FormBean.listSummary(session , fieldsForm , queryForm); if (listForm != null && listForm.size() > 0) { formEventID = (String) ((Hashtable) listForm.elementAt(0)).get("FrmEventID"); formLabel = (String) ((Hashtable) listForm.elementAt(0)).get("FrmLabel"); Integer formNumberI = (Integer) ((Hashtable) listForm.elementAt(0)).get("FrmSeqNum"); if (formNumberI != null) { DecimalFormat df = FlLocale.getInstance(session).getDecimalFormat("0000"); formNumber = df.format((long) (formNumberI.intValue())); } formTabMode = ((Hashtable)listForm.elementAt(0)).containsKey("FrmTabMode") ? ((Boolean)((Hashtable)listForm.elementAt(0)).get("FrmTabMode")).booleanValue() : false; frmParStatusRule = (String) ((Hashtable) listForm.elementAt(0)).get("FrmParStatusRule"); frmParStatus = (String) ((Hashtable) listForm.elementAt(0)).get("FrmParStatus"); } String[][] queryPer = {{ "PerID = " + Utils.formatToSQL(context, perID)}}; String[] fieldsPer = {"PerID", "PerCivID:Val" , "PerName" , "PerFstName"}; String perCompleteName = ""; Vector listPer = PersonBean.listSummary(session , fieldsPer , queryPer); if (listPer != null && listPer.size() > 0) { String perCiv = (String) ((Hashtable) listPer.elementAt(0)).get("PerCivID:Val"); String perName = (String) ((Hashtable) listPer.elementAt(0)).get("PerName"); String perFstName = (String) ((Hashtable) listPer.elementAt(0)).get("PerFstName"); perCompleteName = (perCiv != null ? perCiv : "") + " " + (perFstName != null ? perFstName : "") + " " + (perName != null ? perName : ""); } //On regarde si on doit poser la question de l'état pour l'evenement boolean askForParStatus = false; String[][] queryPvt = {{"PvtEventID = " + Utils.formatToSQL(context, formEventID) , "PvtPersonID = " + Utils.formatToSQL(context, perID)}}; String[] fieldsPvt = {"PvtID"}; Vector listPvt = PersonEventBean.listSummary(session, fieldsPvt, queryPvt); if (frmParStatusRule == null || "NONE".equals(dico.getRefCode("FrmParStatusRule" , frmParStatusRule)) ) { if (listPvt == null || listPvt.size() == 0) { askForParStatus = true; } } else if ( "MANU".equals(dico.getRefCode("FrmParStatusRule" , frmParStatusRule)) ) { askForParStatus = true; } if (askForParStatus) { statusParIDAndDisplay = EventHelper.getListStatusByEvent(context, StatusType.PARTICIPATION, formEventID); } %> " ou="<%=\"/find_form_pers.fl?selectedTab=1&FrpFormID=\" + formID + \"&FrpPersonID=\" + perID + \"&EventID=\" + formEventID %>"> <% if (perID != null) { %> <% } else { %> <% } %>
"/>" target="_blank"><%= perCompleteName %>
<%= perCompleteName %>
<% if (askForParStatus) { %> <% } else { if ( frmParStatusRule != null && "AUTO".equals(dico.getRefCode("FrmParStatusRule" , frmParStatusRule)) ) { %> <% } } %>
: <% if (statusParIDAndDisplay != null && !statusParIDAndDisplay.isEmpty()) { Iterator iter = statusParIDAndDisplay.keySet().iterator(); while (iter.hasNext()) { String currStatusID = iter.next(); String currStatusDisplay = statusParIDAndDisplay.get(currStatusID); %> ><%= currStatusDisplay %>
<% } } %>
" >
<% String[][] query = {{"LfqFormID = " + Utils.formatToSQL(context, formID)}}; String[] fields = {"LfqID" , "LfqFormQuestionID" , "LfqParagraph", "LfqPosition"}; String[] orderBy = {"LfqPosition"}; Vector lfqList = LinkFormQuestionBean.listSummary(session, fields, query, orderBy); if (lfqList != null && lfqList.size() > 0) { for (int i=0 ; i < lfqList.size() ; i++) { Hashtable line = (Hashtable) lfqList.elementAt(i); String questionID = (String) line.get("LfqFormQuestionID"); String paragraph = (String) line.get("LfqParagraph"); Integer lfqPosI = (Integer) line.get("LfqPosition"); String lfqID = (String) line.get("LfqID"); int lfqPosition = 99; if (lfqPosI != null) { lfqPosition = lfqPosI.intValue(); } String lfqPos = Integer.toString(lfqPosition); if (paragraph != null) { %>
<% if (formTabMode) { if (idxTab == 1) { String[] tabFields = {"LfqID" , "LfqParagraph", "LfqPosition"}; String[][] tabQuery = {{"LfqFormID = " + Utils.formatToSQL(context, formID), "LfqParagraph <> null"}}; String[] tabOrderBy = {"LfqPosition"}; Vector tabList = LinkFormQuestionBean.listSummary(session, tabFields, tabQuery, tabOrderBy); if (tabList != null && !tabList.isEmpty()) { %>
<% String nb = "" + (100 / tabList.size()) + "%"; for(int k = 0; k < tabList.size(); k++) { if (k == 0){ %> <% }%> <% if (k == 0){ %> <% } else if (k + 1 < tabList.size()){ %> <% } else { %> <% } } %> <% for (int k = 0; k
" style="<%= k == 0 ? "display:inline" : "display:none"%> ">
 
<%}%>
" onmouseup="<%="selectSmallTab('parag', " + k + ");"%>" class="<%= k == 0 ? "stabselected" : "stabunselected"%>" width="<%= nb %>" onmouseout="<%="swapSmallTabs('parag', 'out', " + k + ");"%>" onmouseover="<%="swapSmallTabs('parag', 'in', " + k + ");"%>"> "><%= "" + (String)((Hashtable)tabList.elementAt(k)).get("LfqParagraph")%> >>
<% } }//End idx==1 if(idxTab > 1) {%> <%}%> "> <% idxTab++;%> <% } // fin formTabMode else { //Idx tab = 0 --> on met un espace %>
 
<% } } else { FormQuestionBean curQuestion = null; try { curQuestion = new FormQuestionBean(questionID , session); } catch (AccessDeniedException ade) { } catch (FrontlineException fex) { } if (curQuestion != null) { String qLabel = null; try { qLabel = curQuestion.getFqtLabel(); } catch (FieldNotInitializedException fnie) { } %> <% String qType = null; try { qType = curQuestion.getFqtType(); } catch (FieldNotInitializedException fnie) { } boolean isFreeText = qType.equals(dico.getRefIdByCode("FqtType" , "FRE")); if ( qType == null || isFreeText) { int inputSize = 0; try { inputSize = curQuestion.getFqtInputSize(); } catch (FieldNotInitializedException fnie) { } %> <% }else if(qType != null && "INT".equals(dico.getRefCode("FqtType" , qType))){ %> <% } else { //Pas Texte libre, c-a-d REF ou LST boolean isREF = false; boolean isLST = false; if ( qType.equals(dico.getRefIdByCode("FqtType" , "REF")) ) { isREF = true; } if ( qType.equals(dico.getRefIdByCode("FqtType" , "LST")) ) { isLST = true; } boolean isCombo = true; boolean isRadio = false; boolean isCheck = false; String dispType = null; try { dispType = curQuestion.getFqtDispType(); } catch (FieldNotInitializedException fnie) { } if (dispType != null && dispType.equals(dico.getRefIdByCode("FqtDispType", "RADIO"))) { isCombo = false; isRadio = true; } if (dispType != null && dispType.equals(dico.getRefIdByCode("FqtDispType", "CHECK"))) { isCombo = false; isCheck = true; } int complementaryText = 0; try { complementaryText = curQuestion.getFqtAssociatedText(); } catch (FieldNotInitializedException fnie) { } int nbColumn = 1; try { nbColumn = curQuestion.getFqtColumnsNb(); } catch (FieldNotInitializedException fnie) { } int hasOther = 0; try { hasOther = curQuestion.getFqtHasOther(); } catch (FieldNotInitializedException fnie) { } String refTableID = null; try { refTableID = curQuestion.getFqtRefTable(); } catch (FieldNotInitializedException fnie) { } Vector listSelectedRef = null; try{ listSelectedRef = (Vector)curQuestion.getCustomProperty("FqtRefsDisp_"); }catch(FieldNotInitializedException e){} Vector listRef2Init = null; try{ listRef2Init = (Vector)curQuestion.getCustomProperty("FqtRefsInit_"); }catch(FieldNotInitializedException e){} Vector possibleResponses = new Vector(); if ( isLST ) { for (int j=0 ; j < 15 ; j++) { String lstAnswer = null; try { Method getter = Class.forName("com.edeal.frontline.FormQuestionBean").getMethod("getFqtLstAnswer" + j , null); lstAnswer = (String) getter.invoke(curQuestion , null); } catch (Exception e) { } if (lstAnswer != null) { Vector oneResponse = new Vector(); oneResponse.add(Integer.toString(j)); oneResponse.add(lstAnswer); possibleResponses.add(oneResponse); } } } else { try { possibleResponses = dico.getRefList(session, refTableID , "Te1"); if(listSelectedRef != null && listSelectedRef.size() > 0){ int k = 0; for(int h=0; h <% } else { // pas combo , c-a-d checkbox ou radio String tagType = "checkbox"; if (isRadio) { tagType = "radio"; } %> <% } } }//currQuestion != null }//N est pas un paragraph }//End for }//If list != null %>
 
<%=paragraph%>
<%= qLabel == null ? " " : qLabel %> <% // If we have chosen a free text zone, and not set a size, consider it is a textarea. if (isFreeText && (inputSize == 0)) { %> <% } else { %> "> <% } %>
   
<% if (complementaryText > 0) { %> <% } %>
<% int nbResByColumn = possibleResponses.size() / nbColumn; if ( nbColumn * nbResByColumn < possibleResponses.size() ) nbResByColumn++; int cptPossibleResponse = 0; for (int j = 0 ; j < possibleResponses.size() ; j++) { String responseChoice = (String) ((Vector) possibleResponses.elementAt(j)).elementAt(0); String responseLabel = (String) ((Vector) possibleResponses.elementAt(j)).elementAt(1); if (cptPossibleResponse % nbResByColumn == 0) { if (cptPossibleResponse > 0) { %> <% } %>
<% } else { %>
<% } if ( (complementaryText > 0) || (hasOther > 0 && j == possibleResponses.size() - 1) ) { %> <% } cptPossibleResponse++; } %>
<% if(formTabMode) { %>
  <% } %>
<% if (isPreview) { %>
<% } %>