|
<%
if (scriptElement != null) {
String qLabel = null;
try {
qLabel = scriptElement.getSceLabel();
} catch (FieldNotInitializedException fnie) {
}
String qDescription = null;
try {
qDescription = Utils.formatToWeb(scriptElement.getSceDescription(), false);
} catch (FieldNotInitializedException fnie) {
}
// remplacement de $$actor$$ et $$person$$
if (qDescription != null) {
qDescription = Utils.replace(qDescription, "$$person$$", perCompleteName);
qDescription = Utils.replace(qDescription, "$$actor$$", actCompleteName);
}
/*
String qComment = null;
try {
qComment = Utils.formatToWeb((String)scriptElement.getCustomProperty("SceComment_"), false);
} catch (FieldNotInitializedException fnie) {
}
// remplacement de $$actor$$ et $$person$$
if (qComment != null) {
qComment = Utils.replace(qComment, "$$person$$", perCompleteName);
qComment = Utils.replace(qComment, "$$actor$$", actCompleteName);
}
*/
//IMAGE
String picID = null;
try {
picID = scriptElement.getSceImage();
} catch (FieldNotInitializedException ex) {}
%>
<%-- DISPLAY SCRIPT ELEMENT LABEL --%>
<%= qLabel == null ? " " : qLabel %>
|
|
|
<%-- DISPLAY SCRIPT ELEMENT IMAGE IF ANY --%>
<% if (picID != null) { %>
">
|
|
<% } %>
<%-- DISPLAY SCRIPT ELEMENT DESCRIPTION --%>
<%= qDescription == null ? " " : qDescription %>
|
<%-- DISPLAY SCRIPT ELEMENT COMMENT IF ANY --%>
<%--
<% if (qComment != null) { %>
<%= qComment == null ? " " : qComment %>
|
<% } %>
--%>
<%-- DISPLAY SCRIPT ELEMENT ANSWERS --%>
<%
if (scriptElement.getSceHasAnswers() == 1) {
String qType = null;
try {
qType = scriptElement.getSceType();
} catch (FieldNotInitializedException fnie) {
}
//if text libre
if ( qType == null || qType.equals(dico.getRefIdByCode("SceType" , "FRE")) ) {
int inputSize = 0;
try {
inputSize = scriptElement.getSceInputSize();
} catch (FieldNotInitializedException fnie) {
}
String value = "";
if (scriptElementResponses.size() > 0) {
try { value = ((ScriptElementResponseBean)scriptElementResponses.elementAt(0)).getSerText(); }
catch (FieldNotInitializedException e) {}
}
if (inputSize == -1) {
%>
<%----%>
|
<%
} else {
%>
<%----%>
">
|
<%
}
} else { //Pas Texte libre, c-a-d REF ou LST
boolean isREF = false;
boolean isLST = false;
if ( qType.equals(dico.getRefIdByCode("SceType" , "REF")) ) {
isREF = true;
}
if ( qType.equals(dico.getRefIdByCode("SceType" , "LST")) ) {
isLST = true;
}
boolean isCombo = true;
boolean isRadio = false;
boolean isCheck = false;
String dispType = null;
try {
dispType = scriptElement.getSceDispType();
} catch (FieldNotInitializedException fnie) {
}
if (dispType != null && dispType.equals(dico.getRefIdByCode("SceDispType", "RADIO"))) {
isCombo = false;
isRadio = true;
}
if (dispType != null && dispType.equals(dico.getRefIdByCode("SceDispType", "CHECK"))) {
isCombo = false;
isCheck = true;
}
int complementaryText = 0;
try {
complementaryText = scriptElement.getSceAssociatedText();
} catch (FieldNotInitializedException fnie) {
}
int nbColumn = 1;
try {
nbColumn = scriptElement.getSceColumnsNb();
} catch (FieldNotInitializedException fnie) {
}
int hasOther = 0;
try {
hasOther = scriptElement.getSceHasOther();
} catch (FieldNotInitializedException fnie) {
}
String refTableID = null;
try {
refTableID = scriptElement.getSceRefTable();
} catch (FieldNotInitializedException fnie) {
}
Vector possibleResponses = new Vector();
Vector recordedResponses = new Vector(); //in this vector we will store the responses from scriptElementResponses that we have
Hashtable complementaryTexts = new Hashtable(); //in this hashtable we will store the complementary texts that we have
if ( isLST ) {
for (int j=0 ; j < 15 ; j++) {
String lstAnswer = null;
try {
Method getter = Class.forName("com.edeal.frontline.ScriptElementBean").getMethod("getSceLstAnswer" + j , null);
lstAnswer = (String) getter.invoke(scriptElement , null);
} catch (Exception e) {
}
if (lstAnswer != null) {
Vector oneResponse = new Vector();
oneResponse.add(Integer.toString(j));
oneResponse.add(lstAnswer);
possibleResponses.add(oneResponse);
}
}
for (int k = 0 ; k < scriptElementResponses.size() ; k++) {
try {
String choice = new Integer(((ScriptElementResponseBean)scriptElementResponses.elementAt(k)).getSerPosition()).toString();
recordedResponses.addElement(choice);
complementaryTexts.put(choice, ((ScriptElementResponseBean)scriptElementResponses.elementAt(k)).getSerMoreText());
} catch (FieldNotInitializedException e) {}
}
} else {
try {
possibleResponses = dico.getRefList(session, refTableID , "Te1");
} catch (FrontlineException fe) {
logger.error("DBG: dico.getRefList a lancé une exception : " + fe.getMessage());
}
for (int k = 0 ; k < scriptElementResponses.size() ; k++) {
try {
String choice = ((ScriptElementResponseBean)scriptElementResponses.elementAt(k)).getSerRefValID();
recordedResponses.addElement(choice);
complementaryTexts.put(choice, ((ScriptElementResponseBean)scriptElementResponses.elementAt(k)).getSerMoreText());
} catch (FieldNotInitializedException e) {}
}
}
if (isCombo) {
%>
<%
if (complementaryText > 0) {
String compText = (String)complementaryTexts.get(responseChoice);
%>
" size="<%= Integer.toString(complementaryText) %>">
<%
}
%>
|
<%
} else { // pas combo , c-a-d checkbox ou radio
String tagType = "checkbox";
if (isRadio) {
tagType = "radio";
}
%>
|
<%
}
}//end of if (texte libre)
}//end of if (scriptElement.getSceHasAnswers() == 1)
%><%-- END OF DISPLAY SCRIPT ELEMENT ANSWERS --%><%
}//end of if (scriptelement != null)
%>
<%-- IF THIS IS THE LAST ELEMENT, WE MAY WANT TO SHOW THE EVENT STATUS SECTION --%>
<% if (lsePosition == scriptElements.size() - 1) { %>
<%-- EVENT STATUS SECTION --%>