|  | /*
 | 
  
    |  |  * Generated by the Jasper component of Apache Tomcat
 | 
  
    |  |  * Version: WildFly Full 14.0.1.Final (WildFly Core 6.0.2.Final) - 2.0.13.Final
 | 
  
    |  |  * Generated at: 2019-01-23 11:17:20 UTC
 | 
  
    |  |  * Note: The last modified time of this file was set to
 | 
  
    |  |  *       the last modified time of the source file after
 | 
  
    |  |  *       generation to assist with modification tracking.
 | 
  
    |  |  */
 | 
  
    |  | package org.apache.jsp.quizz.jsp;
 | 
  
    |  | 
 | 
  
    |  | import javax.servlet.*;
 | 
  
    |  | import javax.servlet.http.*;
 | 
  
    |  | import javax.servlet.jsp.*;
 | 
  
    |  | import org.silverpeas.core.util.StringUtil;
 | 
  
    |  | import org.silverpeas.core.util.WebEncodeHelper;
 | 
  
    |  | import org.silverpeas.core.util.file.FileUploadUtil;
 | 
  
    |  | import org.silverpeas.core.util.URLUtil;
 | 
  
    |  | import org.silverpeas.core.util.MultiSilverpeasBundle;
 | 
  
    |  | import org.silverpeas.core.admin.user.model.UserDetail;
 | 
  
    |  | import org.silverpeas.core.admin.component.model.ComponentInstLight;
 | 
  
    |  | import org.silverpeas.components.quizz.QuizzException;
 | 
  
    |  | import org.silverpeas.components.quizz.QuestionForm;
 | 
  
    |  | import org.silverpeas.components.quizz.QuestionHelper;
 | 
  
    |  | import org.silverpeas.core.util.file.FileServerUtils;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.board.Board;
 | 
  
    |  | import org.silverpeas.core.util.ResourceLocator;
 | 
  
    |  | import org.silverpeas.core.questioncontainer.score.model.ScoreDetail;
 | 
  
    |  | import org.silverpeas.core.questioncontainer.question.model.Question;
 | 
  
    |  | import org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader;
 | 
  
    |  | import org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail;
 | 
  
    |  | import org.silverpeas.core.questioncontainer.result.model.QuestionResult;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.window.Window;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.browsebars.BrowseBar;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.frame.Frame;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.buttons.Button;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.buttonpanes.ButtonPane;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.iconpanes.IconPane;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.icons.Icon;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.Encode;
 | 
  
    |  | import org.silverpeas.core.util.file.FileRepositoryManager;
 | 
  
    |  | import org.silverpeas.core.questioncontainer.answer.model.Answer;
 | 
  
    |  | import org.silverpeas.core.util.SettingBundle;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.tabs.TabbedPane;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayPane;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayColumn;
 | 
  
    |  | import java.util.Collection;
 | 
  
    |  | import java.util.Iterator;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayLine;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellText;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellLink;
 | 
  
    |  | import java.util.Date;
 | 
  
    |  | import java.util.List;
 | 
  
    |  | import java.util.Vector;
 | 
  
    |  | import java.util.Map;
 | 
  
    |  | import java.util.HashMap;
 | 
  
    |  | import java.io.IOException;
 | 
  
    |  | import org.apache.commons.fileupload.FileItem;
 | 
  
    |  | import org.silverpeas.components.quizz.control.QuizzSessionController;
 | 
  
    |  | import org.silverpeas.core.util.DateUtil;
 | 
  
    |  | import org.silverpeas.core.util.LocalizationBundle;
 | 
  
    |  | import java.util.ArrayList;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPane;
 | 
  
    |  | import org.silverpeas.core.persistence.jdbc.DBUtil;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.board.Board;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.buttons.Button;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPane;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.frame.Frame;
 | 
  
    |  | import org.silverpeas.core.web.util.viewgenerator.html.window.Window;
 | 
  
    |  | import org.silverpeas.core.util.WebEncodeHelper;
 | 
  
    |  | 
 | 
  
    |  | public final class quizzQuestionsNew_jsp extends org.apache.jasper.runtime.HttpJspBase
 | 
  
    |  |     implements org.apache.jasper.runtime.JspSourceDependent,
 | 
  
    |  |                  org.apache.jasper.runtime.JspSourceImports {
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | //Display the quizz header
 | 
  
    |  | String displayQuizzHeader(QuizzSessionController quizzScc, QuestionContainerHeader quizzHeader, MultiSilverpeasBundle resources, GraphicElementFactory gef) {
 | 
  
    |  |   String title = quizzHeader.getTitle();
 | 
  
    |  |   String description = quizzHeader.getDescription();
 | 
  
    |  |   String comment = quizzHeader.getComment();
 | 
  
    |  | 
 | 
  
    |  |   Board board = gef.getBoard();
 | 
  
    |  |   String r = "";
 | 
  
    |  |   r += board.printBefore();
 | 
  
    |  |   r += "<table border=\"0\" cellspacing=\"3\" cellpadding=\"0\" width=\"100%\">";
 | 
  
    |  |   r += "<tr><td>";
 | 
  
    |  |   r += "<span class=\"titreFenetre\">"+WebEncodeHelper.javaStringToHtmlString(title)+"</span>";
 | 
  
    |  |   r += "<blockquote>";
 | 
  
    |  |   r += "<span class=\"sousTitreFenetre\">"+WebEncodeHelper.javaStringToHtmlParagraphe(description)+"</span>";
 | 
  
    |  |   if (StringUtil.isDefined(comment)) {
 | 
  
    |  |     r += "<br><br><span class=txttitrecol>"+resources.getString("QuizzNotice")+"</span>  ";
 | 
  
    |  |     r += WebEncodeHelper.javaStringToHtmlParagraphe(comment)+"";
 | 
  
    |  |   }
 | 
  
    |  |   r += "</blockquote>";
 | 
  
    |  |   r += "</td></tr></table>";
 | 
  
    |  |   r += board.printAfter();
 | 
  
    |  |   return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | String displayQuizz(QuestionContainerDetail quizz, GraphicElementFactory gef, String m_context, QuizzSessionController quizzScc, MultiSilverpeasBundle resources, SettingBundle settings, JspWriter out) throws QuizzException {
 | 
  
    |  |   String r = "";
 | 
  
    |  |   Question question = null;
 | 
  
    |  |   Collection<Answer> answers = null;
 | 
  
    |  | 	try{
 | 
  
    |  | 		if (quizz != null) {
 | 
  
    |  | 			QuestionContainerHeader quizzHeader = quizz.getHeader();
 | 
  
    |  | 			Collection<Question> questions = quizz.getQuestions();
 | 
  
    |  | 			//Display the quizz header
 | 
  
    |  | 			r += displayQuizzHeader(quizzScc, quizzHeader, resources, gef);
 | 
  
    |  | 
 | 
  
    |  | 			//Display the questions
 | 
  
    |  | 			r += "<form name=\"quizz\" Action=\"quizzQuestionsNew.jsp\" Method=\"Post\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"Action\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"NbQuestions\" value=\""+questions.size()+"\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"QuizzId\" value=\""+quizzHeader.getPK().getId()+"\">";
 | 
  
    |  | 
 | 
  
    |  | 			Iterator<Question> itQ = questions.iterator();
 | 
  
    |  | 			int i = 1;
 | 
  
    |  | 			while (itQ.hasNext()) {
 | 
  
    |  | 				  question = (Question) itQ.next();
 | 
  
    |  | 				  r += displayQuestion(quizzScc, question, i, m_context, settings, gef, resources);
 | 
  
    |  | 				  i++;
 | 
  
    |  | 
 | 
  
    |  | 			}
 | 
  
    |  | 		} else {
 | 
  
    |  | 			r += "<table><tr><td>"+resources.getString("QuizzUnavailable")+"</td></tr>";
 | 
  
    |  | 		}
 | 
  
    |  | 	} catch (Exception e){
 | 
  
    |  | 		throw new QuizzException ("quizzQuestionNew_JSP.displayQuizz",QuizzException.WARNING,"Quizz.EX_CANNOT_DISPLAY_QUIZZ",e);
 | 
  
    |  | 	}
 | 
  
    |  | 
 | 
  
    |  |   return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | List<String> displayQuestions(QuestionContainerDetail quizz, int roundId,GraphicElementFactory gef, String m_context,QuizzSessionController quizzScc, MultiSilverpeasBundle resources, SettingBundle settings, Frame frame, JspWriter out) throws QuizzException {
 | 
  
    |  |   String r = "";
 | 
  
    |  |   String s = "";
 | 
  
    |  |   Question question = null;
 | 
  
    |  |   List<String> displayQuestions = new ArrayList<String>();
 | 
  
    |  | 	try{
 | 
  
    |  | 		if (quizz != null) {
 | 
  
    |  | 			QuestionContainerHeader quizzHeader = quizz.getHeader();
 | 
  
    |  | 			int nbQuestionsPerPage = quizzHeader.getNbQuestionsPerPage();
 | 
  
    |  | 			int end = nbQuestionsPerPage * roundId;
 | 
  
    |  | 			int begin = end - nbQuestionsPerPage;
 | 
  
    |  | 			Collection<Question> questions = quizz.getQuestions();
 | 
  
    |  | 			int nbQuestions = 0;
 | 
  
    |  | 			if (end <= questions.size()) {
 | 
  
    |  | 				nbQuestions = nbQuestionsPerPage;
 | 
  
    |  | 			} else {
 | 
  
    |  | 				nbQuestions = questions.size() % nbQuestionsPerPage;
 | 
  
    |  |       }
 | 
  
    |  | 			r += displayQuizzHeader(quizzScc, quizzHeader, resources, gef);
 | 
  
    |  | 
 | 
  
    |  | 			//Display the questions
 | 
  
    |  | 			r += "<form name=\"quizz\" Action=\"quizzQuestionsNew.jsp\" Method=\"Post\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"Action\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"RoundId\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"NbQuestions\" value=\""+nbQuestions+"\">";
 | 
  
    |  | 			r += "<input type=\"hidden\" name=\"QuizzId\" value=\""+quizzHeader.getPK().getId()+"\">";
 | 
  
    |  | 			Iterator<Question> itQ = questions.iterator();
 | 
  
    |  | 			int i = 1;
 | 
  
    |  | 			int j = 1;
 | 
  
    |  | 			while (itQ.hasNext()) {
 | 
  
    |  | 				  question = (Question) itQ.next();
 | 
  
    |  | 				  if ((i > begin) && (i <= end)) {
 | 
  
    |  | 					  r += displayQuestion(quizzScc, question, j, m_context, settings, gef, resources);
 | 
  
    |  | 					  j++;
 | 
  
    |  | 				  }
 | 
  
    |  | 				  i++;
 | 
  
    |  | 			}
 | 
  
    |  | 			s += "<table width=\"98%\" border=\"0\" cellspacing=\"2\" cellpadding=\"5\">";
 | 
  
    |  | 			s += "<tr><td nowrap>";
 | 
  
    |  | 			s += "<table border=\"0\" cellspacing=\"3\" cellpadding=\"0\" width=\"100%\">";
 | 
  
    |  | 			s += "<tr><td>";
 | 
  
    |  | 
 | 
  
    |  | 			Button cancelButton = null;
 | 
  
    |  | 			Button voteButton = null;
 | 
  
    |  | 			if ((begin <= 0) && (end < questions.size())) {
 | 
  
    |  | 				  voteButton = (Button) gef.getFormButton(resources.getString("GML.validate"), "javascript:onClick=sendVote('"+(roundId+1)+"')", false);
 | 
  
    |  | 				  s += "<tr><td align=\"center\"><table><tr><td class=intfdcolor51 align=center>"+voteButton.print()+"</td></tr></table></td></tr>";
 | 
  
    |  | 			} else if (end >= questions.size()) {
 | 
  
    |  | 				  voteButton = (Button) gef.getFormButton(resources.getString("GML.validate"), "javascript:onClick=sendVote('end')", false);
 | 
  
    |  | 				  s += "<tr><td align=\"center\"><table><tr><td class=intfdcolor51 align=center>"+voteButton.print()+"</td></tr></table></td></tr>";
 | 
  
    |  | 			} else {
 | 
  
    |  | 				  voteButton = (Button) gef.getFormButton(resources.getString("GML.validate"), "javascript:onClick=sendVote('"+(roundId+1)+"')", false);
 | 
  
    |  | 				  s += "<tr><td align=\"center\"><table><tr><td class=intfdcolor51 align=center>"+voteButton.print()+"</td></tr></table></td></tr>";
 | 
  
    |  | 			}
 | 
  
    |  | 			 s += "</table>";
 | 
  
    |  | 			 s += "</td></tr>";
 | 
  
    |  | 			 s += "</table>";
 | 
  
    |  | 			 s += "</form>";
 | 
  
    |  | 		} else {
 | 
  
    |  | 			r += "<table><tr><td>"+resources.getString("QuizzUnavailable")+"</td></tr></table>";
 | 
  
    |  | 		}
 | 
  
    |  | 		displayQuestions.add(r);
 | 
  
    |  | 		displayQuestions.add(s);
 | 
  
    |  | 	} catch (Exception e){
 | 
  
    |  | 		throw new QuizzException ("quizzQuestionNew_JSP.displayQuestion",QuizzException.WARNING,"Quizz.EX_CANNOT_DISPLAY_QUESTIONS",e);
 | 
  
    |  | 	}
 | 
  
    |  | 
 | 
  
    |  |   return displayQuestions;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | String displayQuestion(QuizzSessionController quizzScc, Question question, int i, String m_context, SettingBundle settings, GraphicElementFactory gef, MultiSilverpeasBundle resources) {
 | 
  
    |  |   Collection<Answer> answers = question.getAnswers();
 | 
  
    |  |   Board board = gef.getBoard();
 | 
  
    |  |   String r = "";
 | 
  
    |  |   r += "<br>";
 | 
  
    |  |   r += board.printBefore();
 | 
  
    |  |   r += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\">";
 | 
  
    |  |   r += "<tr><td nowrap>";
 | 
  
    |  |   r += "<span class=txtlibform> <b>•</b> "+ WebEncodeHelper.javaStringToHtmlString(question.getLabel())+" </span>";
 | 
  
    |  |   r += " - "+question.getNbPointsMax()+" pts</td>";
 | 
  
    |  |   r += "<td nowrap align=\"right\">";
 | 
  
    |  |   r += "<input type=\"hidden\" name=\"cluePenalty_"+i+"\" value=\"0\">";
 | 
  
    |  | 
 | 
  
    |  |   if (question.getClue() != null && !question.getClue().equals(""))
 | 
  
    |  | 	{
 | 
  
    |  | 			r += "<a href=\"#\" onClick=\"view_clue("+i+","+question.getFatherId()+","+question.getPK().getId()+","+question.getCluePenalty()+")\">"+resources.getString("QuizzSeeClue")+"</a>";
 | 
  
    |  | 			r += " (" + resources.getString("QuizzPenalty") + "=" + question.getCluePenalty() + " pts)";
 | 
  
    |  | 	}
 | 
  
    |  | 	else
 | 
  
    |  | 		r += "        ";
 | 
  
    |  |   r += "</table>";
 | 
  
    |  |   r += board.printAfter();
 | 
  
    |  |   r += "<br>";
 | 
  
    |  |   r += board.printBefore();
 | 
  
    |  |   r += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" >";
 | 
  
    |  | 
 | 
  
    |  |   if (question.isOpen()) {
 | 
  
    |  |         Iterator<Answer> itA = answers.iterator();
 | 
  
    |  |         while (itA.hasNext()) {
 | 
  
    |  |             Answer answer = (Answer) itA.next();
 | 
  
    |  |             String inputValue = answer.getPK().getId()+","+question.getPK().getId();
 | 
  
    |  |             r += "<input type=\"hidden\" name=\"answer_"+i+"\" value=\""+inputValue+"\">";
 | 
  
    |  |             r += "<tr><td colspan=\"2\"><textarea name=\"openedAnswer_"+i+"\" cols=\"20\" rows=\"3\"></textarea></td></tr>";
 | 
  
    |  |         }
 | 
  
    |  |   }
 | 
  
    |  |   else
 | 
  
    |  |   {
 | 
  
    |  |   	String style = question.getStyle();
 | 
  
    |  |   	if (style.equals("list"))
 | 
  
    |  |   	{
 | 
  
    |  |   		// liste d�roulante
 | 
  
    |  |        	String selectedStr = "";
 | 
  
    |  | 
 | 
  
    |  |           r += "<tr><td><select id=\"answer_"+i+"\" name=\"answer_"+i+"\" >";
 | 
  
    |  | 
 | 
  
    |  |           Iterator<Answer> itA = answers.iterator();
 | 
  
    |  |         while (itA.hasNext())
 | 
  
    |  |         {
 | 
  
    |  |         	Answer answer = (Answer) itA.next();
 | 
  
    |  |         	String inputValue = answer.getPK().getId()+","+question.getPK().getId();
 | 
  
    |  |               r += "<option value=\""+inputValue+"\" "+selectedStr+">"+ WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"</option>";
 | 
  
    |  |         }
 | 
  
    |  |         r += "</td></tr>";
 | 
  
    |  |   	}
 | 
  
    |  |   	else
 | 
  
    |  |    	{
 | 
  
    |  |         String inputType = "radio";
 | 
  
    |  |         if (style.equals("checkbox"))
 | 
  
    |  |         	inputType = "checkbox";
 | 
  
    |  |           Iterator<Answer> itA = answers.iterator();
 | 
  
    |  |           int isOpened = 0;
 | 
  
    |  |           while (itA.hasNext())
 | 
  
    |  |           {
 | 
  
    |  |               Answer answer = (Answer) itA.next();
 | 
  
    |  |               r += "<tr><td colspan=\"2\"><table width=\"98%\"><tr>";
 | 
  
    |  |               String inputValue = answer.getPK().getId()+","+question.getPK().getId();
 | 
  
    |  | 
 | 
  
    |  |               // traitement de l'affichage des images
 | 
  
    |  |               if (answer.getImage() == null)
 | 
  
    |  | 	      {
 | 
  
    |  |             	    r += "<td align=\"left\"> </td>";
 | 
  
    |  | 	      }
 | 
  
    |  | 	      else
 | 
  
    |  | 	      {
 | 
  
    |  | 		      	String imageUrl = answer.getImage();
 | 
  
    |  | 		        String url = "";
 | 
  
    |  | 		        if (imageUrl.startsWith("/"))
 | 
  
    |  | 		        {
 | 
  
    |  | 		        	url = imageUrl+"&Size=266x150";
 | 
  
    |  | 		        }
 | 
  
    |  | 		        else
 | 
  
    |  | 		        {
 | 
  
    |  | 		        	url = FileServerUtils.getUrl(answer.getPK().getComponentName(), answer.getImage(), answer.getImage(), "image/gif", settings.getString("imagesSubDirectory"));
 | 
  
    |  | 		        }
 | 
  
    |  | 		        r += "<td width=\"50%\"><img src=\""+url+"\" align=\"left\"></td>";
 | 
  
    |  | 	      }
 | 
  
    |  |               if (answer.isOpened()) {
 | 
  
    |  |                   isOpened = 1;
 | 
  
    |  |                   r += "<td align=\"left\" width=\"1%\">";
 | 
  
    |  |                   r += "<input type=\""+inputType+"\" name=\"answer_"+i+"\" value=\""+inputValue+"\"></td>";
 | 
  
    |  |                   r += "<td align=\"left\">"+WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"";
 | 
  
    |  |                   r += "<input type=\"text\" size=\"20\" name=\"openedAnswer_"+i+"\"></td></tr>";
 | 
  
    |  |                   r += "<tr><td colspan=2><br></td></tr></table></td></tr>";
 | 
  
    |  |               } else {
 | 
  
    |  |                   r += "<td align=\"left\" width=\"1%\">";
 | 
  
    |  |                   r += "<input type=\""+inputType+"\" name=\"answer_"+i+"\" value=\""+inputValue+"\"></td>";
 | 
  
    |  |                   r += "<td width=\"100%\">"+WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"</td>";
 | 
  
    |  |               }
 | 
  
    |  |               r += "</tr></table></td></tr>";
 | 
  
    |  |           }
 | 
  
    |  |   	}
 | 
  
    |  |   }
 | 
  
    |  |   r += "</table>";
 | 
  
    |  |   r += board.printAfter();
 | 
  
    |  |   return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | List<String> displayQuestionResult(QuestionContainerDetail quizz, Question question, int i, String m_context, SettingBundle settings, QuizzSessionController quizzScc, boolean solutionAllowed, MultiSilverpeasBundle resources) {
 | 
  
    |  | 
 | 
  
    |  |   Collection<Answer> answers = question.getAnswers();
 | 
  
    |  |   Collection<QuestionResult> questionResults = question.getQuestionResults();
 | 
  
    |  |   List<String> displayQuestionResult = new ArrayList<String>();
 | 
  
    |  |   String r = "";
 | 
  
    |  |   // User answers
 | 
  
    |  |   int questionUserScore = 0;
 | 
  
    |  |   Iterator<QuestionResult> itB = questionResults.iterator();
 | 
  
    |  |   List<String> qrUser = new ArrayList<String>();
 | 
  
    |  |   try {
 | 
  
    |  | 		while (itB.hasNext()) {
 | 
  
    |  | 			QuestionResult questionResult = (QuestionResult) itB.next();
 | 
  
    |  | 			questionUserScore += questionResult.getNbPoints();
 | 
  
    |  | 			if (question.isOpen()) {
 | 
  
    |  | 				qrUser.add(questionResult.getOpenedAnswer());
 | 
  
    |  | 			} else {
 | 
  
    |  | 				qrUser.add(questionResult.getAnswerPK().getId());
 | 
  
    |  | 			}
 | 
  
    |  | 		}
 | 
  
    |  | 		if (question.getNbPointsMax() < questionUserScore) {
 | 
  
    |  | 			questionUserScore = question.getNbPointsMax();
 | 
  
    |  | 		} else if (question.getNbPointsMin() > questionUserScore) {
 | 
  
    |  | 			questionUserScore = question.getNbPointsMin();
 | 
  
    |  | 		}
 | 
  
    |  | 		r = "<br><table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr align=center><td><table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" class=\"contourintfdcolor\" width=\"100%\">";
 | 
  
    |  | 		r += "<tr><td nowrap width=\"41%\"><span class=txtlibform> <b>•</b> "+Encode.javaStringToHtmlString(question.getLabel())+" </span></td>";
 | 
  
    |  | 		r += "<td class=\"quizzscore\" width=25% align=\"center\">"+resources.getString("ScoreLib")+" : "+questionUserScore+"/"+question.getNbPointsMax()+" pts</td>";
 | 
  
    |  | 		r += "<td align=\"center\" nowrap>";
 | 
  
    |  | 		r += "        ";
 | 
  
    |  | 		r += "</td></tr>";
 | 
  
    |  | 		if (question.isOpen()) {
 | 
  
    |  | 			Iterator<Answer> itA = answers.iterator();
 | 
  
    |  | 			while (itA.hasNext()) {
 | 
  
    |  | 				Answer answer = (Answer) itA.next();
 | 
  
    |  | 				String inputValue = answer.getPK().getId()+","+question.getPK().getId();
 | 
  
    |  | 				r += "<input type=\"hidden\" name=\"answer_"+i+"\" value=\""+inputValue+"\">";
 | 
  
    |  | 				if (solutionAllowed) {
 | 
  
    |  | 					r += "<tr><td><textarea disabled name=\"openedAnswer_"+i+"\" cols=\"40\" rows=\"3\">"+qrUser.get(0)+"</textarea></td>";
 | 
  
    |  | 					r += "  <td><textarea disabled name=\"openedAnswer_"+i+"\" cols=\"40\" rows=\"3\">"+answer.getLabel()+"</textarea></td></tr>";
 | 
  
    |  | 				}
 | 
  
    |  | 				else
 | 
  
    |  | 					r += "<tr><td colspan=\"2\"><textarea disabled name=\"openedAnswer_"+i+"\" cols=\"40\" rows=\"3\">"+qrUser.get(0)+"</textarea></td></tr>";
 | 
  
    |  | 			}
 | 
  
    |  | 		} else {
 | 
  
    |  | 			String style = question.getStyle();
 | 
  
    |  | 
 | 
  
    |  | 			// on est dans le cas de l'affichage,
 | 
  
    |  | 			// alors on pr�sente les listes d�roulante sous forme de bouton radio
 | 
  
    |  | 			// pour faire apparaitre le choix de l'utilisateur et les commentaires
 | 
  
    |  | 			String inputType = "radio";
 | 
  
    |  | 			//if (question.isQCM())
 | 
  
    |  | 			if (style.equals("checkbox"))
 | 
  
    |  |                   inputType = "checkbox";
 | 
  
    |  | 			Iterator<Answer> itA = answers.iterator();
 | 
  
    |  | 			int isOpened = 0;
 | 
  
    |  | 			while (itA.hasNext()) {
 | 
  
    |  | 				Answer answer = (Answer) itA.next();
 | 
  
    |  | 				String inputStatus = "";
 | 
  
    |  | 				r += "<tr><td colspan=\"3\"><table><tr>";
 | 
  
    |  | 				String inputValue = answer.getPK().getId()+","+question.getPK().getId();
 | 
  
    |  | 
 | 
  
    |  | 				// traitement de l'affichage des images
 | 
  
    |  |                   if (answer.getImage() == null)
 | 
  
    |  | 			      {
 | 
  
    |  |                 	  r += "<td width=50> </td>";
 | 
  
    |  | 			      }
 | 
  
    |  | 			      else
 | 
  
    |  | 			      {
 | 
  
    |  | 				      	String imageUrl = answer.getImage();
 | 
  
    |  | 				        String url = "";
 | 
  
    |  | 				        if (imageUrl.startsWith("/"))
 | 
  
    |  | 				        {
 | 
  
    |  | 				        	url = imageUrl+"&Size=266x150";
 | 
  
    |  | 				        }
 | 
  
    |  | 				        else
 | 
  
    |  | 				        {
 | 
  
    |  | 				        	url = FileServerUtils.getUrl(answer.getPK().getComponentName(), answer.getImage(), answer.getImage(), "image/gif", settings.getString("imagesSubDirectory"));
 | 
  
    |  | 				        }
 | 
  
    |  | 				        r += "<td><img src=\""+url+"\" align=\"left\"></td>";
 | 
  
    |  | 			      }
 | 
  
    |  | 
 | 
  
    |  | 				if (answer.isOpened()) {
 | 
  
    |  | 					isOpened = 1;
 | 
  
    |  | 					r += "<td width=\"40px\" align=\"center\"><input disabled type=\""+inputType+"\" name=\"answer_"+i+"\" value=\""+inputValue+"\"></td><td align=\"left\">";
 | 
  
    |  | 					if (answer.isSolution() && solutionAllowed)
 | 
  
    |  | 						r += "<b class=textePetitBoldVert>"+WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"</b>";
 | 
  
    |  | 					else
 | 
  
    |  | 						r += WebEncodeHelper.javaStringToHtmlString(answer.getLabel());
 | 
  
    |  | 					r += "<BR><input disabled type=\"text\" size=\"20\" name=\"openedAnswer_"+i+"\"></td></tr>";
 | 
  
    |  | 				} else {
 | 
  
    |  | 					inputStatus = "";
 | 
  
    |  | 					if (qrUser!=null){
 | 
  
    |  | 						for (int cpt=0; cpt<qrUser.size(); cpt++){
 | 
  
    |  | 							if (qrUser.get(cpt).equals(answer.getPK().getId())) {
 | 
  
    |  | 								inputStatus = "checked";
 | 
  
    |  | 							}
 | 
  
    |  | 						}
 | 
  
    |  | 					}
 | 
  
    |  | 					r += "<td width=\"40px\" align=\"center\"><input disabled type=\""+inputType+"\" name=\"answer_"+i+"\" value=\""+inputValue+"\" "+inputStatus+"></td><td align=\"left\">";
 | 
  
    |  | 					if (answer.isSolution() && solutionAllowed)
 | 
  
    |  | 						r += "<b class=textePetitBoldVert>"+WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"</b><BR>";
 | 
  
    |  | 					else
 | 
  
    |  | 						r += WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"<BR>";
 | 
  
    |  | 					r += "</td>";
 | 
  
    |  | 					if (solutionAllowed){
 | 
  
    |  |    						r += "</tr><tr>";
 | 
  
    |  | 						r += "<td align=\"left\" colspan=3>";
 | 
  
    |  | 						r += "<b>"+WebEncodeHelper.javaStringToHtmlParagraphe(answer.getComment())+"</b></td>";
 | 
  
    |  | 					}
 | 
  
    |  | 				}
 | 
  
    |  | 				r += "</tr></table></td></tr>";
 | 
  
    |  | 			}
 | 
  
    |  | 		}
 | 
  
    |  | 		r += "</table></td></tr></table>";
 | 
  
    |  | 	} catch (NumberFormatException e) {
 | 
  
    |  | 	}
 | 
  
    |  | 	displayQuestionResult.add(r);
 | 
  
    |  | 	displayQuestionResult.add(Integer.toString(questionUserScore));
 | 
  
    |  | 	displayQuestionResult.add(Integer.toString(question.getNbPointsMax()));
 | 
  
    |  | 
 | 
  
    |  | 	return displayQuestionResult;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | String displayQuizzHeaderPreview(QuizzSessionController quizzScc, QuestionContainerHeader quizzHeader, MultiSilverpeasBundle resources, GraphicElementFactory gef) {
 | 
  
    |  |   Board board = gef.getBoard();
 | 
  
    |  | 	String title = WebEncodeHelper.javaStringToHtmlString(quizzHeader.getTitle());
 | 
  
    |  |   String description = WebEncodeHelper.javaStringToHtmlParagraphe(quizzHeader.getDescription());
 | 
  
    |  |   String comment = WebEncodeHelper.javaStringToHtmlParagraphe(quizzHeader.getComment());
 | 
  
    |  |   String r = "";
 | 
  
    |  |   r += board.printBefore();
 | 
  
    |  |   r += "<table border=\"0\" cellspacing=\"3\" cellpadding=\"0\" width=\"98%\">";
 | 
  
    |  |   r += "<tr><td>";
 | 
  
    |  |   r += "<span class=\"TitreFenetre\">"+title+"</span>";
 | 
  
    |  |   r += "<blockquote>";
 | 
  
    |  |   r += "<span class=\"sousTitreFenetre\">"+description+"</span>";
 | 
  
    |  |   if (comment != null) {
 | 
  
    |  |     r += "<br><br><span class=txttitrecol>"+comment+"</span>";
 | 
  
    |  |   }
 | 
  
    |  |   r += "</blockquote>";
 | 
  
    |  |   r += "</td></tr></table>";
 | 
  
    |  |   r += board.printAfter();
 | 
  
    |  | 
 | 
  
    |  |   return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | String displayQuizzPreview(QuestionContainerDetail quizz, GraphicElementFactory gef, String m_context,QuizzSessionController quizzScc, MultiSilverpeasBundle resources, SettingBundle settings) throws QuizzException {
 | 
  
    |  |   String r = "";
 | 
  
    |  |   Question question = null;
 | 
  
    |  |   try{
 | 
  
    |  | 		if (quizz != null) {
 | 
  
    |  | 			QuestionContainerHeader quizzHeader = quizz.getHeader();
 | 
  
    |  | 			Collection<Question> questions = quizz.getQuestions();
 | 
  
    |  | 
 | 
  
    |  | 			//Display the quizz header
 | 
  
    |  | 			r += displayQuizzHeaderPreview(quizzScc, quizzHeader,resources, gef);
 | 
  
    |  | 
 | 
  
    |  | 			//Display the questions
 | 
  
    |  | 			r += "<form name=\"quizz\" Action=\"SubmitQuizz\" Method=\"Post\">";
 | 
  
    |  | 			Iterator<Question> itQ = questions.iterator();
 | 
  
    |  | 			int i = 1;
 | 
  
    |  | 			while (itQ.hasNext()) {
 | 
  
    |  | 				  question = (Question) itQ.next();
 | 
  
    |  | 				  r += displayQuestionPreview(question, i, m_context, quizzScc,settings, gef, resources);
 | 
  
    |  | 				  i++;
 | 
  
    |  | 			}
 | 
  
    |  | 			r += "</form>";
 | 
  
    |  | 
 | 
  
    |  | 		} else {
 | 
  
    |  | 			r += "<table><tr><td>"+resources.getString("QuizzUnavailable")+"</td></tr></table>";
 | 
  
    |  | 		}
 | 
  
    |  | 	} catch(Exception e){
 | 
  
    |  | 		throw new QuizzException ("quizzQuestionNew_JSP.displayQuizzPreview",QuizzException.WARNING,"Quizz.EX_CANNOT_DISPLAY_QUIZZPREVIEW",e);
 | 
  
    |  | 	}
 | 
  
    |  | 
 | 
  
    |  | 	return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | String displayQuestionPreview(Question question, int i, String m_context, QuizzSessionController quizzScc,SettingBundle settings, GraphicElementFactory gef, MultiSilverpeasBundle resources) {
 | 
  
    |  |         Collection<Answer> answers = question.getAnswers();
 | 
  
    |  |         Board board = gef.getBoard();
 | 
  
    |  |         String r = "<br>";
 | 
  
    |  |         r += board.printBefore();
 | 
  
    |  |         r += "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\"><tr><td nowrap><span class=\"txtlibform\"> <b>•</b> "+Encode.javaStringToHtmlString(question.getLabel())+" </span>";
 | 
  
    |  |         r += " - "+question.getNbPointsMax()+" pts</td>";
 | 
  
    |  |         r += "<td align=\"right\" nowrap>";
 | 
  
    |  |         if ((question.getClue() != null)&&(!question.getClue().equals("")))
 | 
  
    |  |         {
 | 
  
    |  |           r += "<a href=\"#\" onClick=\"view_cluePreview('"+i+"')\">"+resources.getString("QuizzSeeClue")+"</a>";
 | 
  
    |  |           r += " (" + resources.getString("QuizzPenalty") + "=" + question.getCluePenalty() + " pts)";
 | 
  
    |  |         }
 | 
  
    |  |         else
 | 
  
    |  |           r += "        ";
 | 
  
    |  |         r += "</td></tr></table>";
 | 
  
    |  |         r += "</table><br>";
 | 
  
    |  |         r += board.printBefore();
 | 
  
    |  |         r += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"3\" >";
 | 
  
    |  | 
 | 
  
    |  |         String style = question.getStyle();
 | 
  
    |  |         if (style.equals("list"))
 | 
  
    |  | 		{
 | 
  
    |  |         	r += "<tr><td colspan=\"2\">";
 | 
  
    |  |             r += "<select id=\"answers\" name=\"answers\" >";
 | 
  
    |  | 
 | 
  
    |  |         	Iterator<Answer> itA = answers.iterator();
 | 
  
    |  |         	while (itA.hasNext())
 | 
  
    |  | 	        {
 | 
  
    |  | 	            Answer answer = (Answer) itA.next();
 | 
  
    |  | 	           	r += "<option name=\"answer_"+i+"\" value=\"\">"+WebEncodeHelper.javaStringToHtmlString(answer.getLabel())+"</option>";
 | 
  
    |  | 	        }
 | 
  
    |  | 
 | 
  
    |  |          	r += "</td></tr>";
 | 
  
    |  | 		}
 | 
  
    |  | 		else
 | 
  
    |  | 		{
 | 
  
    |  | 	        String inputType = "radio";
 | 
  
    |  | 	        if (style.equals("checkbox"))
 | 
  
    |  | 	        	inputType = "checkbox";
 | 
  
    |  | 	        Iterator<Answer> itA = answers.iterator();
 | 
  
    |  | 	        while (itA.hasNext())
 | 
  
    |  | 	        {
 | 
  
    |  | 	            Answer answer = (Answer) itA.next();
 | 
  
    |  | 	            r += "<tr><td colspan=\"2\"><table width=\"98%\"><tr>";
 | 
  
    |  | 
 | 
  
    |  | 	            // traitement de l'affichage des images
 | 
  
    |  | 	            if (answer.getImage() == null)
 | 
  
    |  | 			      {
 | 
  
    |  | 	            	r += "<td align=\"left\"> </td>";
 | 
  
    |  | 			      }
 | 
  
    |  | 			      else
 | 
  
    |  | 			      {
 | 
  
    |  | 				      	String imageUrl = answer.getImage();
 | 
  
    |  | 				        String url = "";
 | 
  
    |  | 				        if (imageUrl.startsWith("/"))
 | 
  
    |  | 				        {
 | 
  
    |  | 				        	url = imageUrl+"&Size=266x150";
 | 
  
    |  | 				        }
 | 
  
    |  | 				        else
 | 
  
    |  | 				        {
 | 
  
    |  | 				        	url = FileServerUtils.getUrl(quizzScc.getComponentId(), answer.getImage(), answer.getImage(), "image/gif", settings.getString("imagesSubDirectory"));
 | 
  
    |  | 				        }
 | 
  
    |  | 				        r += "<td width=\"50%\"><img src=\""+url+"\" align=\"left\"></td>";
 | 
  
    |  | 			      }
 | 
  
    |  | 	            r += "<td width=\"40px\" align=\"center\"><input type=\""+inputType+"\" name=\"answer_"+i+"\"></td><td align=\"left\" width=\"100%\">"+Encode.javaStringToHtmlString(answer.getLabel())+"<BR>";
 | 
  
    |  | 	            r += "</tr></table>";
 | 
  
    |  | 	        }
 | 
  
    |  | 		}
 | 
  
    |  |         r += board.printAfter();
 | 
  
    |  |         r += board.printAfter();
 | 
  
    |  |         return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | String displayQuizzResult(QuestionContainerDetail quizz, GraphicElementFactory gef, String m_context,QuizzSessionController quizzScc, MultiSilverpeasBundle resources, SettingBundle settings, int nb_user_votes) throws QuizzException {
 | 
  
    |  |         String r = "";
 | 
  
    |  |         List<String> function = null;
 | 
  
    |  |         int quizzUserScore = 0;
 | 
  
    |  |         int quizzScoreMax = 0;
 | 
  
    |  | 
 | 
  
    |  |         Question question = null;
 | 
  
    |  |         Collection answers = null;
 | 
  
    |  |         try{
 | 
  
    |  | 			if (quizz != null) {
 | 
  
    |  | 				QuestionContainerHeader quizzHeader = quizz.getHeader();
 | 
  
    |  | 				//Display the quizz header
 | 
  
    |  | 				r += displayQuizzHeader(quizzScc, quizzHeader, resources, gef);
 | 
  
    |  | 
 | 
  
    |  | 				boolean solutionAllowed = false;
 | 
  
    |  | 				if (nb_user_votes >= quizzHeader.getNbParticipationsBeforeSolution())
 | 
  
    |  | 				  solutionAllowed = true;
 | 
  
    |  | 
 | 
  
    |  | 				Collection<Question> questions = quizz.getQuestions();
 | 
  
    |  | 				//Display the quizz header
 | 
  
    |  | 				String quizzId = quizzHeader.getPK().getId();
 | 
  
    |  | 				String title = quizzHeader.getTitle();
 | 
  
    |  | 
 | 
  
    |  | 				//Display the questions
 | 
  
    |  | 				r += "<form name=\"quizz\" Action=\"quizzQuestionsNew.jsp\" Method=\"Post\">";
 | 
  
    |  | 				r += "<input type=\"hidden\" name=\"Action\">";
 | 
  
    |  | 				r += "<input type=\"hidden\" name=\"QuizzId\" value=\""+quizzHeader.getPK().getId()+"\">";
 | 
  
    |  | 				Iterator<Question> itQ = questions.iterator();
 | 
  
    |  | 				int i = 1;
 | 
  
    |  | 				while (itQ.hasNext()) {
 | 
  
    |  | 					  question = (Question) itQ.next();
 | 
  
    |  | 					  function = displayQuestionResult(quizz, question, i, m_context, settings, quizzScc, solutionAllowed, resources);
 | 
  
    |  | 					  r += function.get(0);
 | 
  
    |  | 					  quizzUserScore += new Integer((String) function.get(1)).intValue();
 | 
  
    |  | 					  quizzScoreMax += new Integer((String) function.get(2)).intValue();
 | 
  
    |  | 					  i++;
 | 
  
    |  | 				}
 | 
  
    |  | 
 | 
  
    |  | 				//Score total:
 | 
  
    |  | 				float winRate=((new Float(quizzUserScore).floatValue())/(new Float(quizzScoreMax).floatValue()))*100;
 | 
  
    |  | 				String winRateImg="tableProf_4.gif";
 | 
  
    |  | 				String winRate1 = settings.getString("winRate1");
 | 
  
    |  | 				String winRate2 = settings.getString("winRate2");
 | 
  
    |  | 				String winRate3 = settings.getString("winRate3");
 | 
  
    |  | 				String winRate4 = settings.getString("winRate4");
 | 
  
    |  | 				String winRateImg1 = settings.getString("winRateImg1");
 | 
  
    |  | 				String winRateImg2 = settings.getString("winRateImg2");
 | 
  
    |  | 				String winRateImg3 = settings.getString("winRateImg3");
 | 
  
    |  | 				String winRateImg4 = settings.getString("winRateImg4");
 | 
  
    |  | 
 | 
  
    |  | 				if (winRate<=new Integer(winRate1).intValue()) {
 | 
  
    |  | 				  winRateImg=winRateImg1;
 | 
  
    |  | 				} else if (winRate<=new Integer(winRate2).intValue()) {
 | 
  
    |  | 				  winRateImg=winRateImg2;
 | 
  
    |  | 			  } else if (winRate<=new Integer(winRate3).intValue()) {
 | 
  
    |  | 			    winRateImg=winRateImg3;
 | 
  
    |  |         } else if (winRate<=new Integer(winRate4).intValue()) {
 | 
  
    |  |           winRateImg=winRateImg4;
 | 
  
    |  |         }
 | 
  
    |  | 
 | 
  
    |  | 				r += "<table width=100% border=0 cellspacing=0 cellpadding=5><tr><td width=50% align=right valign=top class=\"txtnav\">"+resources.getString("TotalScoreLib")+" :</td>";
 | 
  
    |  | 				r += "<td width=\"50%\"><table border=0 cellspacing=0 cellpadding=0><tr>";
 | 
  
    |  | 				r += "<td rowspan=3><img src=\"icons/tableProf_1.gif\" width=7 height=70></td><td><img src=\"icons/tableProf_2.gif\" width=34 height=6></td>";
 | 
  
    |  | 				r += "<td rowspan=3><img src=\"icons/"+winRateImg+"\" width=79 height=70></td></tr>";
 | 
  
    |  | 				r += "<tr><td height=42 bgcolor=#387B80><span class=\"titreFenetre2\">"+quizzUserScore+"<br><img src=\"icons/1pxBlanc.gif\" width=30 height=1><br>"+quizzScoreMax+"</span></td></tr>";
 | 
  
    |  | 				r += "<tr><td><img src=\"icons/tableProf_3.gif\" width=34 height=22></td></tr></table></td></tr></table><br>";
 | 
  
    |  | 			} else {
 | 
  
    |  | 		        r += "<table><tr><td>"+resources.getString("QuizzUnavailable")+"</td></tr>";
 | 
  
    |  | 			}
 | 
  
    |  | 		}catch( Exception e){
 | 
  
    |  | 			throw new QuizzException ("quizzQuestionNew_JSP.displayQuizzResult",QuizzException.WARNING,"Quizz.EX_CANNOT_DISPLAY_RESULT",e);
 | 
  
    |  | 		}
 | 
  
    |  | 
 | 
  
    |  | 		return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  |   String displayQuizzResultAdmin(QuestionContainerDetail quizz, GraphicElementFactory gef, String m_context,QuizzSessionController quizzScc, MultiSilverpeasBundle resources, SettingBundle settings, int nb_user_votes) throws QuizzException {
 | 
  
    |  |         String r = "";
 | 
  
    |  |         List<String> function = null;
 | 
  
    |  |         int quizzUserScore = 0;
 | 
  
    |  |         int quizzScoreMax = 0;
 | 
  
    |  | 
 | 
  
    |  |         Question question = null;
 | 
  
    |  |         Collection answers = null;
 | 
  
    |  | 		try{
 | 
  
    |  | 			if (quizz != null) {
 | 
  
    |  | 				QuestionContainerHeader quizzHeader = quizz.getHeader();
 | 
  
    |  | 				r += displayQuizzHeader(quizzScc,quizzHeader,resources, gef);
 | 
  
    |  | 				boolean solutionAllowed = true;
 | 
  
    |  | 				Collection<Question> questions = quizz.getQuestions();
 | 
  
    |  | 				String quizzId = quizzHeader.getPK().getId();
 | 
  
    |  | 				String title = quizzHeader.getTitle();
 | 
  
    |  | 				r += "<form name=\"quizz\">";
 | 
  
    |  | 				r += "<input type=\"hidden\" name=\"Action\">";
 | 
  
    |  | 				r += "<input type=\"hidden\" name=\"QuizzId\" value=\""+quizzHeader.getPK().getId()+"\">";
 | 
  
    |  | 				Iterator<Question> itQ = questions.iterator();
 | 
  
    |  | 				int i = 1;
 | 
  
    |  | 				while (itQ.hasNext()) {
 | 
  
    |  | 					  question = (Question) itQ.next();
 | 
  
    |  | 					  function = displayQuestionResult(quizz, question, i, m_context, settings, quizzScc, solutionAllowed, resources);
 | 
  
    |  | 					  r += function.get(0);
 | 
  
    |  | 					  quizzUserScore += new Integer((String) function.get(1)).intValue();
 | 
  
    |  | 					  quizzScoreMax += new Integer((String) function.get(2)).intValue();
 | 
  
    |  | 					  i++;
 | 
  
    |  | 				}
 | 
  
    |  | 					float winRate=((new Float(quizzUserScore).floatValue())/(new Float(quizzScoreMax).floatValue()))*100;
 | 
  
    |  | 				String winRateImg="tableProf_4.gif";
 | 
  
    |  | 				String winRate1 = settings.getString("winRate1");
 | 
  
    |  | 				String winRate2 = settings.getString("winRate2");
 | 
  
    |  | 				String winRate3 = settings.getString("winRate3");
 | 
  
    |  | 				String winRate4 = settings.getString("winRate4");
 | 
  
    |  | 				String winRateImg1 = settings.getString("winRateImg1");
 | 
  
    |  | 				String winRateImg2 = settings.getString("winRateImg2");
 | 
  
    |  | 				String winRateImg3 = settings.getString("winRateImg3");
 | 
  
    |  | 				String winRateImg4 = settings.getString("winRateImg4");
 | 
  
    |  | 
 | 
  
    |  | 				if (winRate<=new Integer(winRate1).intValue())
 | 
  
    |  | 					winRateImg=winRateImg1;
 | 
  
    |  | 				else if (winRate<=new Integer(winRate2).intValue())
 | 
  
    |  | 					winRateImg=winRateImg2;
 | 
  
    |  | 				else if (winRate<=new Integer(winRate3).intValue())
 | 
  
    |  | 					winRateImg=winRateImg3;
 | 
  
    |  | 				else if (winRate<=new Integer(winRate4).intValue())
 | 
  
    |  | 					winRateImg=winRateImg4;
 | 
  
    |  | 
 | 
  
    |  | 				r += "<table width=100% border=0 cellspacing=0 cellpadding=5><tr><td width=50% align=right valign=top class=\"txtnav\">"+resources.getString("TotalScoreLib")+" :</td>";
 | 
  
    |  | 				r += "<td width=\"50%\"><table border=0 cellspacing=0 cellpadding=0><tr>";
 | 
  
    |  | 				r += "<td rowspan=3><img src=\"icons/tableProf_1.gif\" width=7 height=70></td><td><img src=\"icons/tableProf_2.gif\" width=34 height=6></td>";
 | 
  
    |  | 				r += "<td rowspan=3><img src=\"icons/"+winRateImg+"\" width=79 height=70></td></tr>";
 | 
  
    |  | 				r += "<tr><td height=42 bgcolor=#387B80><span class=\"titreFenetre2\">"+quizzUserScore+"<br><img src=\"icons/1pxBlanc.gif\" width=30 height=1><br>"+quizzScoreMax+"</span></td></tr>";
 | 
  
    |  | 				r += "<tr><td><img src=\"icons/tableProf_3.gif\" width=34 height=22></td></tr></table></td></tr></table><br>";
 | 
  
    |  | 			} else {
 | 
  
    |  | 				r += "<table><tr><td>"+resources.getString("QuizzUnavailable")+"</td></tr>";
 | 
  
    |  | 			}
 | 
  
    |  | 		} catch(Exception e){
 | 
  
    |  | 			throw new QuizzException ("quizzQuestionNew_JSP.displayQuizzResultAdmin",QuizzException.WARNING,"Quizz.EX_CANNOT_DISPLAY_RESULT",e);
 | 
  
    |  | 		}
 | 
  
    |  | 
 | 
  
    |  | 		return r;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  |   private static final javax.servlet.jsp.JspFactory _jspxFactory =
 | 
  
    |  |           javax.servlet.jsp.JspFactory.getDefaultFactory();
 | 
  
    |  | 
 | 
  
    |  |   private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;
 | 
  
    |  | 
 | 
  
    |  |   static {
 | 
  
    |  |     _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(1);
 | 
  
    |  |     _jspx_dependants.put("/quizz/jsp/checkQuizz.jsp", Long.valueOf(1548241817000L));
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   private static final java.util.Set<java.lang.String> _jspx_imports_packages;
 | 
  
    |  | 
 | 
  
    |  |   private static final java.util.Set<java.lang.String> _jspx_imports_classes;
 | 
  
    |  | 
 | 
  
    |  |   static {
 | 
  
    |  |     _jspx_imports_packages = new java.util.HashSet<>();
 | 
  
    |  |     _jspx_imports_packages.add("javax.servlet");
 | 
  
    |  |     _jspx_imports_packages.add("javax.servlet.http");
 | 
  
    |  |     _jspx_imports_packages.add("javax.servlet.jsp");
 | 
  
    |  |     _jspx_imports_classes = new java.util.HashSet<>();
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.Encode");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.components.quizz.QuestionForm");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.Date");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.MultiSilverpeasBundle");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.persistence.jdbc.DBUtil");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.StringUtil");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.URLUtil");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.board.Board");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.window.Window");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.admin.user.model.UserDetail");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.Vector");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.tabs.TabbedPane");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.Map");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.components.quizz.QuizzException");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellLink");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.operationpanes.OperationPane");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.Collection");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.GraphicElementFactory");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.questioncontainer.container.model.QuestionContainerHeader");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.admin.component.model.ComponentInstLight");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.List");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.questioncontainer.result.model.QuestionResult");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.DateUtil");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.questioncontainer.answer.model.Answer");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.WebEncodeHelper");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.SettingBundle");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.questioncontainer.question.model.Question");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.HashMap");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.iconpanes.IconPane");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.questioncontainer.score.model.ScoreDetail");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayLine");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.ArrayList");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.buttonpanes.ButtonPane");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayCellText");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.ResourceLocator");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayColumn");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.file.FileServerUtils");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.buttons.Button");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.file.FileUploadUtil");
 | 
  
    |  |     _jspx_imports_classes.add("java.util.Iterator");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.arraypanes.ArrayPane");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.file.FileRepositoryManager");
 | 
  
    |  |     _jspx_imports_classes.add("org.apache.commons.fileupload.FileItem");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.icons.Icon");
 | 
  
    |  |     _jspx_imports_classes.add("java.io.IOException");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.util.LocalizationBundle");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.components.quizz.control.QuizzSessionController");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.frame.Frame");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.components.quizz.QuestionHelper");
 | 
  
    |  |     _jspx_imports_classes.add("org.silverpeas.core.web.util.viewgenerator.html.browsebars.BrowseBar");
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fview_005flooknfeel_0026_005fwithFieldsetStyle_005fwithCheckFormScript_005fnobody;
 | 
  
    |  | 
 | 
  
    |  |   private javax.el.ExpressionFactory _el_expressionfactory;
 | 
  
    |  |   private org.apache.tomcat.InstanceManager _jsp_instancemanager;
 | 
  
    |  | 
 | 
  
    |  |   public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
 | 
  
    |  |     return _jspx_dependants;
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   public java.util.Set<java.lang.String> getPackageImports() {
 | 
  
    |  |     return _jspx_imports_packages;
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   public java.util.Set<java.lang.String> getClassImports() {
 | 
  
    |  |     return _jspx_imports_classes;
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   public void _jspInit() {
 | 
  
    |  |     _005fjspx_005ftagPool_005fview_005flooknfeel_0026_005fwithFieldsetStyle_005fwithCheckFormScript_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
 | 
  
    |  |     _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
 | 
  
    |  |     _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   public void _jspDestroy() {
 | 
  
    |  |     _005fjspx_005ftagPool_005fview_005flooknfeel_0026_005fwithFieldsetStyle_005fwithCheckFormScript_005fnobody.release();
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
 | 
  
    |  |         throws java.io.IOException, javax.servlet.ServletException {
 | 
  
    |  | 
 | 
  
    |  | final java.lang.String _jspx_method = request.getMethod();
 | 
  
    |  | if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
 | 
  
    |  | response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JBWEB004248: JSPs only permit GET POST or HEAD");
 | 
  
    |  | return;
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  |     final javax.servlet.jsp.PageContext pageContext;
 | 
  
    |  |     javax.servlet.http.HttpSession session = null;
 | 
  
    |  |     final javax.servlet.ServletContext application;
 | 
  
    |  |     final javax.servlet.ServletConfig config;
 | 
  
    |  |     javax.servlet.jsp.JspWriter out = null;
 | 
  
    |  |     final java.lang.Object page = this;
 | 
  
    |  |     javax.servlet.jsp.JspWriter _jspx_out = null;
 | 
  
    |  |     javax.servlet.jsp.PageContext _jspx_page_context = null;
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  |     try {
 | 
  
    |  |       response.setContentType("text/html; charset=UTF-8");
 | 
  
    |  |       response.addHeader("X-Powered-By", "JSP/2.3");
 | 
  
    |  |       pageContext = _jspxFactory.getPageContext(this, request, response,
 | 
  
    |  |       			"../../admin/jsp/errorpage.jsp", true, 16384, true);
 | 
  
    |  |       _jspx_page_context = pageContext;
 | 
  
    |  |       application = pageContext.getServletContext();
 | 
  
    |  |       config = pageContext.getServletConfig();
 | 
  
    |  |       session = pageContext.getSession();
 | 
  
    |  |       out = pageContext.getOut();
 | 
  
    |  |       _jspx_out = out;
 | 
  
    |  | 
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  | 
 | 
  
    |  | response.setHeader("Cache-Control","no-store"); //HTTP 1.1
 | 
  
    |  | response.setHeader("Pragma","no-cache"); //HTTP 1.0
 | 
  
    |  | response.setDateHeader ("Expires",-1); //prevents caching at the proxy server
 | 
  
    |  | 
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail quizzUnderConstruction = null;
 | 
  
    |  |       synchronized (session) {
 | 
  
    |  |         quizzUnderConstruction = (org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail) _jspx_page_context.getAttribute("quizzUnderConstruction", javax.servlet.jsp.PageContext.SESSION_SCOPE);
 | 
  
    |  |         if (quizzUnderConstruction == null){
 | 
  
    |  |           quizzUnderConstruction = new org.silverpeas.core.questioncontainer.container.model.QuestionContainerDetail();
 | 
  
    |  |           _jspx_page_context.setAttribute("quizzUnderConstruction", quizzUnderConstruction, javax.servlet.jsp.PageContext.SESSION_SCOPE);
 | 
  
    |  |         }
 | 
  
    |  |       }
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       java.util.ArrayList questionsVector = null;
 | 
  
    |  |       synchronized (session) {
 | 
  
    |  |         questionsVector = (java.util.ArrayList) _jspx_page_context.getAttribute("questionsVector", javax.servlet.jsp.PageContext.SESSION_SCOPE);
 | 
  
    |  |         if (questionsVector == null){
 | 
  
    |  |           questionsVector = new java.util.ArrayList();
 | 
  
    |  |           _jspx_page_context.setAttribute("questionsVector", questionsVector, javax.servlet.jsp.PageContext.SESSION_SCOPE);
 | 
  
    |  |         }
 | 
  
    |  |       }
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       java.util.HashMap questionsResponses = null;
 | 
  
    |  |       synchronized (session) {
 | 
  
    |  |         questionsResponses = (java.util.HashMap) _jspx_page_context.getAttribute("questionsResponses", javax.servlet.jsp.PageContext.SESSION_SCOPE);
 | 
  
    |  |         if (questionsResponses == null){
 | 
  
    |  |           questionsResponses = new java.util.HashMap();
 | 
  
    |  |           _jspx_page_context.setAttribute("questionsResponses", questionsResponses, javax.servlet.jsp.PageContext.SESSION_SCOPE);
 | 
  
    |  |         }
 | 
  
    |  |       }
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  | 
 | 
  
    |  |   GraphicElementFactory gef =
 | 
  
    |  |       (GraphicElementFactory) session.getAttribute("SessionGraphicElementFactory");
 | 
  
    |  |   QuizzSessionController quizzScc = (QuizzSessionController) request.getAttribute("quizz");
 | 
  
    |  |   MultiSilverpeasBundle resources = (MultiSilverpeasBundle) request.getAttribute("resources");
 | 
  
    |  |   if (quizzScc == null) {
 | 
  
    |  |     String sessionTimeout =
 | 
  
    |  |         ResourceLocator.getGeneralSettingBundle().getString("sessionTimeout");
 | 
  
    |  |     getServletConfig().getServletContext().getRequestDispatcher(sessionTimeout).forward(
 | 
  
    |  |         request, response);
 | 
  
    |  |     return;
 | 
  
    |  |   }
 | 
  
    |  |   LocalizationBundle surveyResource = ResourceLocator
 | 
  
    |  |       .getLocalizationBundle("org.silverpeas.survey.multilang.surveyBundle",
 | 
  
    |  |           quizzScc.getLanguage());
 | 
  
    |  | 
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  | 
 | 
  
    |  | String    profile     = (String) request.getAttribute("Profile");
 | 
  
    |  | 
 | 
  
    |  | String m_context = ResourceLocator.getGeneralSettingBundle().getString("ApplicationURL");
 | 
  
    |  | 
 | 
  
    |  | String exportSrc = m_context + "/util/icons/export.gif";
 | 
  
    |  | String copySrc = m_context + "util/icons/copy.gif";
 | 
  
    |  | 
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write('\n');
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | //Retrieve parameter
 | 
  
    |  | String action = request.getParameter("Action");
 | 
  
    |  | String quizzId = request.getParameter("QuizzId");
 | 
  
    |  | String participationIdSTR =  request.getParameter("ParticipationId");
 | 
  
    |  | String userId = request.getParameter("UserId");
 | 
  
    |  | String roundId = request.getParameter("RoundId");
 | 
  
    |  | String origin = request.getParameter("Page");
 | 
  
    |  | if (origin==null) origin="";
 | 
  
    |  | int participationId = 0;
 | 
  
    |  | 
 | 
  
    |  | if (roundId == null) {
 | 
  
    |  |   roundId = "1";
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  | if (participationIdSTR != null) {
 | 
  
    |  |   session.setAttribute("currentParticipationId", participationIdSTR);
 | 
  
    |  | }
 | 
  
    |  | SettingBundle settings = quizzScc.getSettings();
 | 
  
    |  | 
 | 
  
    |  | //Icons
 | 
  
    |  | String topicAddSrc = m_context + "/util/icons/folderAdd.gif";
 | 
  
    |  | String ligne = m_context + "/util/icons/colorPix/1px.gif";
 | 
  
    |  | 
 | 
  
    |  | //Html
 | 
  
    |  | List<String> html_string = null;
 | 
  
    |  | 
 | 
  
    |  | QuestionContainerDetail quizz = null;
 | 
  
    |  | 
 | 
  
    |  | boolean isClosed = false;
 | 
  
    |  | 
 | 
  
    |  | if (action.equals("PreviewQuizz")) {
 | 
  
    |  |       quizz = (QuestionContainerDetail) session.getAttribute("quizzUnderConstruction");
 | 
  
    |  | }
 | 
  
    |  | else {
 | 
  
    |  | 	if (quizzId != null && quizzId.length() != 0) {
 | 
  
    |  | 		quizz = quizzScc.getQuizzDetail(quizzId);
 | 
  
    |  | 		session.setAttribute("currentQuizz", quizz);
 | 
  
    |  | 	}
 | 
  
    |  | 	else
 | 
  
    |  | 	{
 | 
  
    |  |       quizz = (QuestionContainerDetail) session.getAttribute("currentQuizz");
 | 
  
    |  |       if (quizz == null) {
 | 
  
    |  |           quizz = quizzScc.getQuizzDetail(quizzId);
 | 
  
    |  |           session.setAttribute("currentQuizz", quizz);
 | 
  
    |  |           roundId = "1";
 | 
  
    |  |       }
 | 
  
    |  | 	}
 | 
  
    |  | 
 | 
  
    |  |   boolean endDateReached = false;
 | 
  
    |  |   if (quizz.getHeader().getEndDate() != null) {
 | 
  
    |  |           endDateReached = (quizz.getHeader().getEndDate().compareTo(resources.getDBDate(new Date())) < 0);
 | 
  
    |  |   }
 | 
  
    |  |   if (endDateReached || quizz.getHeader().isClosed())
 | 
  
    |  |         isClosed = true;
 | 
  
    |  |   if (action == null) {
 | 
  
    |  |           action = "ViewQuizz";
 | 
  
    |  |   }
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n");
 | 
  
    |  |       out.write("<html xmlns=\"http://www.w3.org/1999/xhtml\">\n");
 | 
  
    |  |       out.write("<head>\n");
 | 
  
    |  |       out.write("  <title></title>\n");
 | 
  
    |  |       if (_jspx_meth_view_005flooknfeel_005f0(_jspx_page_context))
 | 
  
    |  |         return;
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("<style type=\"text/css\">\n");
 | 
  
    |  |       out.write(".thumbnailPreviewAndActions {\n");
 | 
  
    |  |       out.write("  display: none;\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("</style>\n");
 | 
  
    |  |       out.write("<script type=\"text/javascript\">\n");
 | 
  
    |  |       out.write("<!--\n");
 | 
  
    |  |       out.write("function confirmCancel()\n");
 | 
  
    |  |       out.write("{\n");
 | 
  
    |  |       out.write("  jQuery.popup.confirm('");
 | 
  
    |  |       out.print(resources.getString("ConfirmCancel"));
 | 
  
    |  |       out.write("', function() {\n");
 | 
  
    |  |       out.write("    self.location = \"Main.jsp\";\n");
 | 
  
    |  |       out.write("  });\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("function update_suggestion(quizz_id)\n");
 | 
  
    |  |       out.write("{\n");
 | 
  
    |  |       out.write("    errorMsg=\"\";\n");
 | 
  
    |  |       out.write("   document.quizz.Action.value=\"UpdateSuggestion\";\n");
 | 
  
    |  |       out.write("   if (!isWhitespace(document.quizz.txa_suggestion.value)) {\n");
 | 
  
    |  |       out.write("      if (!isValidTextArea(document.quizz.txa_suggestion)) {\n");
 | 
  
    |  |       out.write("            errorMsg = \"");
 | 
  
    |  |       out.print(resources.getString("GML.ThisFormContains"));
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.write('1');
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.print(resources.getString("GML.error"));
 | 
  
    |  |       out.write(" : \\n\";\n");
 | 
  
    |  |       out.write("            errorMsg += \"  - ");
 | 
  
    |  |       out.print(resources.getString("GML.theField"));
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.write('\'');
 | 
  
    |  |       out.print(resources.getString("EducationSuggestion"));
 | 
  
    |  |       out.write('\'');
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.print(resources.getString("MustContainsLessCar"));
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.print(DBUtil.getTextAreaLength());
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.print(resources.getString("Caracters"));
 | 
  
    |  |       out.write("\\n\";\n");
 | 
  
    |  |       out.write("            jQuery.popup.error(errorMsg);\n");
 | 
  
    |  |       out.write("            return;\n");
 | 
  
    |  |       out.write("      }\n");
 | 
  
    |  |       out.write("      else\n");
 | 
  
    |  |       out.write("           document.quizz.submit();\n");
 | 
  
    |  |       out.write("   }\n");
 | 
  
    |  |       out.write("   document.quizz.submit();\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("function view_cluePreview(question_id)\n");
 | 
  
    |  |       out.write("{\n");
 | 
  
    |  |       out.write("  largeur = \"600\";\n");
 | 
  
    |  |       out.write("  hauteur = \"230\";\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("  SP_openWindow('quizzCluePreview.jsp?question_id='+question_id,'indice',largeur,hauteur,'scrollbars=yes,resizable=yes');\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("function view_clue(i, quizz_id, question_id, cluePenalty)\n");
 | 
  
    |  |       out.write("{\n");
 | 
  
    |  |       out.write("  objet = eval(\"document.quizz.cluePenalty_\"+i);\n");
 | 
  
    |  |       out.write("  if (objet.value == 0)\n");
 | 
  
    |  |       out.write("    objet.value = cluePenalty;\n");
 | 
  
    |  |       out.write("  largeur = \"600\";\n");
 | 
  
    |  |       out.write("  hauteur = \"230\";\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write(" SP_openWindow('quizzClue.jsp?quizz_id='+quizz_id+'&question_id='+question_id,'indice',largeur,hauteur,'scrollbars=yes,resizable=yes');\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("// PopUp center\n");
 | 
  
    |  |       out.write("function SP_openWindow(page,nom,largeur,hauteur,options) {\n");
 | 
  
    |  |       out.write("var top=(screen.height-hauteur)/2;\n");
 | 
  
    |  |       out.write("var left=(screen.width-largeur)/2;\n");
 | 
  
    |  |       out.write("\tif (window.fenetre != null){\n");
 | 
  
    |  |       out.write("  \twindow.fenetre.close();}\n");
 | 
  
    |  |       out.write("fenetre=window.open(page,nom,\"top=\"+top+\",left=\"+left+\",width=\"+largeur+\",height=\"+hauteur+\",\"+options);\n");
 | 
  
    |  |       out.write("return fenetre;\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("function MM_openBrWindow(theURL,winName,features) { //v2.0\n");
 | 
  
    |  |       out.write("  window.open(theURL,winName,features);\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("function sendVote(roundId) {\n");
 | 
  
    |  |       out.write("    if (roundId == \"end\") {\n");
 | 
  
    |  |       out.write("          document.quizz.Action.value=\"SendVote\";\n");
 | 
  
    |  |       out.write("          document.quizz.submit();\n");
 | 
  
    |  |       out.write("    } else {\n");
 | 
  
    |  |       out.write("          document.quizz.RoundId.value = roundId;\n");
 | 
  
    |  |       out.write("          document.quizz.Action.value=\"RecordQuestionsResponses\";\n");
 | 
  
    |  |       out.write("          document.quizz.submit();\n");
 | 
  
    |  |       out.write("    }\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("var exportWindow = window;\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("function Export(url)\n");
 | 
  
    |  |       out.write("{\n");
 | 
  
    |  |       out.write("  windowName = \"exportWindow\";\n");
 | 
  
    |  |       out.write("    larg = \"740\";\n");
 | 
  
    |  |       out.write("    haut = \"600\";\n");
 | 
  
    |  |       out.write("    windowParams = \"directories=0,menubar=0,toolbar=0,alwaysRaised\";\n");
 | 
  
    |  |       out.write("    if (!exportWindow.closed && exportWindow.name == \"exportWindow\")\n");
 | 
  
    |  |       out.write("      exportWindow.close();\n");
 | 
  
    |  |       out.write("    exportWindow = SP_openWindow(url, windowName, larg, haut, windowParams);\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("function clipboardCopy(id) {\n");
 | 
  
    |  |       out.write("  top.IdleFrame.location.href = '../..");
 | 
  
    |  |       out.print(quizzScc.getComponentUrl());
 | 
  
    |  |       out.write("copy?Id='+id;\n");
 | 
  
    |  |       out.write("}\n");
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("//-->\n");
 | 
  
    |  |       out.write("</script>\n");
 | 
  
    |  |       out.write("</head>\n");
 | 
  
    |  | 
 | 
  
    |  | 
 | 
  
    |  | if (action.equals("RecordQuestionsResponses")) {
 | 
  
    |  |   int nbQuestions = Integer.parseInt(request.getParameter("NbQuestions"));
 | 
  
    |  |   int cluePenalty  = 0;
 | 
  
    |  |   Map hash = (Map) session.getAttribute("questionsResponses");
 | 
  
    |  |   if (hash == null)
 | 
  
    |  |         hash = new HashMap();
 | 
  
    |  | 
 | 
  
    |  |   for (int i = 1; i <= nbQuestions; i++) {
 | 
  
    |  |       List v = new ArrayList(5);
 | 
  
    |  |       cluePenalty = Integer.parseInt(request.getParameter("cluePenalty_"+i));
 | 
  
    |  |       v.add("PC"+cluePenalty);
 | 
  
    |  |       String[] selectedAnswers = (String[]) request.getParameterValues("answer_"+i);
 | 
  
    |  |       if (selectedAnswers != null) {
 | 
  
    |  |         String questionId = selectedAnswers[0].substring(selectedAnswers[0].indexOf(",")+1, selectedAnswers[0].length());
 | 
  
    |  |         for (int j = 0; j < selectedAnswers.length; j++) {
 | 
  
    |  |               String answerId = selectedAnswers[j].substring(0, selectedAnswers[j].indexOf(","));
 | 
  
    |  |               v.add(answerId);
 | 
  
    |  |         }
 | 
  
    |  |         String openedAnswer = request.getParameter("openedAnswer_"+i);
 | 
  
    |  |         v.add("OA"+openedAnswer);
 | 
  
    |  |         //if (hash.containsKey(questionId))
 | 
  
    |  |         hash.put(questionId, v);
 | 
  
    |  |       }
 | 
  
    |  |   }
 | 
  
    |  |   session.setAttribute("questionsResponses", hash);
 | 
  
    |  |   action = "ViewCurrentQuestions";
 | 
  
    |  | } else if (action.equals("SendVote")) {
 | 
  
    |  |   int nbQuestions = Integer.parseInt(request.getParameter("NbQuestions"));
 | 
  
    |  |   int cluePenalty  = 0;
 | 
  
    |  |   Map hash = (Map) session.getAttribute("questionsResponses");
 | 
  
    |  |   if (hash == null)
 | 
  
    |  |       hash = new HashMap();
 | 
  
    |  | 
 | 
  
    |  |   for (int i = 1; i <= nbQuestions; i++) {
 | 
  
    |  |       List v = new ArrayList(5);
 | 
  
    |  |       cluePenalty = Integer.parseInt(request.getParameter("cluePenalty_"+i));
 | 
  
    |  |       v.add("PC"+cluePenalty);
 | 
  
    |  |       String[] selectedAnswers = (String[]) request.getParameterValues("answer_"+i);
 | 
  
    |  |       if (selectedAnswers != null) {
 | 
  
    |  |         String questionId = selectedAnswers[0].substring(selectedAnswers[0].indexOf(",")+1, selectedAnswers[0].length());
 | 
  
    |  |         for (int j = 0; j < selectedAnswers.length; j++) {
 | 
  
    |  |               String answerId = selectedAnswers[j].substring(0, selectedAnswers[j].indexOf(","));
 | 
  
    |  |               v.add(answerId);
 | 
  
    |  |         }
 | 
  
    |  |         String openedAnswer = request.getParameter("openedAnswer_"+i);
 | 
  
    |  |         v.add("OA"+openedAnswer);
 | 
  
    |  |         hash.put(questionId, v);
 | 
  
    |  |      }
 | 
  
    |  |   }
 | 
  
    |  |   quizzScc.recordReply(quizzId, hash);
 | 
  
    |  |   action = "ViewResult";
 | 
  
    |  | } //End if action = ViewResult
 | 
  
    |  | 
 | 
  
    |  | if (action.equals("PreviewQuizz")) {
 | 
  
    |  |     out.println("<body marginheight=5 marginwidth=5 leftmargin=5 topmargin=5 bgcolor=\"#FFFFFF\">");
 | 
  
    |  | 
 | 
  
    |  |     Window window = gef.getWindow();
 | 
  
    |  |     BrowseBar browseBar = window.getBrowseBar();
 | 
  
    |  |     browseBar.setDomainName(quizzScc.getSpaceLabel());
 | 
  
    |  |     browseBar.setComponentName(quizzScc.getComponentLabel());
 | 
  
    |  |     browseBar.setExtraInformation(resources.getString("quizz.preview"));
 | 
  
    |  | 
 | 
  
    |  |     out.println(window.printBefore());
 | 
  
    |  |     Frame frame = gef.getFrame();
 | 
  
    |  |     out.println(frame.printBefore());
 | 
  
    |  |     String quizzPart = displayQuizzPreview(quizz, gef, m_context, quizzScc, resources, settings);
 | 
  
    |  |     out.println(quizzPart);
 | 
  
    |  |     out.println(frame.printMiddle());
 | 
  
    |  |     out.println("<table width=\"100%\">");
 | 
  
    |  |     Button cancelButton = (Button) gef.getFormButton(resources.getString("GML.cancel"), "javascript:confirmCancel();", false);
 | 
  
    |  |     Button voteButton = (Button) gef.getFormButton(resources.getString("GML.validate"), "javascript:onClick=document.quizz.submit();", false);
 | 
  
    |  |     out.println("<tr><td align=\"center\"><table><tr align=center><td align=center>"+voteButton.print()+"</td><td align=center>"+cancelButton.print()+"</td></tr></table></td></tr>");
 | 
  
    |  |     out.println("</table>");
 | 
  
    |  |     out.println("<br><br>"+frame.printAfter());
 | 
  
    |  |     out.println(window.printAfter());
 | 
  
    |  | }
 | 
  
    |  | if (action.equals("ViewQuizz")) {
 | 
  
    |  |   out.println("<body bgcolor=\"#FFFFFF\">");
 | 
  
    |  |   Window window = gef.getWindow();
 | 
  
    |  |   BrowseBar browseBar = window.getBrowseBar();
 | 
  
    |  |   browseBar.setDomainName(quizzScc.getSpaceLabel());
 | 
  
    |  |   browseBar.setComponentName(quizzScc.getComponentLabel());
 | 
  
    |  |   browseBar.setPath("<a href=\"Main.jsp\">"+resources.getString("QuizzList")+"</a>");
 | 
  
    |  |   browseBar.setExtraInformation(quizz.getHeader().getTitle());
 | 
  
    |  | 
 | 
  
    |  |   //operation pane
 | 
  
    |  |   OperationPane operationPane = window.getOperationPane();
 | 
  
    |  |   operationPane.addOperation(m_context + "/util/icons/quizz_print.gif",resources.getString("GML.print"),"javascript:window.print()");
 | 
  
    |  |   if (quizzScc.getNbVoters(quizz.getHeader().getPK().getId())==0||"admin".equals(quizzScc.getHighestSilverpeasUserRole().getName()))
 | 
  
    |  |   {
 | 
  
    |  |   	operationPane.addLine();
 | 
  
    |  | 	  operationPane.addOperation(m_context + "/util/icons/quizz_to_edit.gif",resources.getString("QuestionUpdate"),"quizzUpdate.jsp?Action=UpdateQuizzHeader&QuizzId="+quizz.getHeader().getPK().getId());
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   if (profile.equals("admin")) {
 | 
  
    |  |     // export csv
 | 
  
    |  |     String url = "ExportCSV?QuizzId=" + quizz.getHeader().getPK().getId();
 | 
  
    |  |     operationPane.addOperation(exportSrc, resources.getString("GML.export"), "javaScript:onClick=Export('"+url+"')");
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   // copier
 | 
  
    |  |   operationPane.addOperation(copySrc, resources.getString("GML.copy"), "javaScript:onClick=clipboardCopy('"+quizz.getHeader().getPK().getId()+"')");
 | 
  
    |  | 
 | 
  
    |  |   out.println(window.printBefore());
 | 
  
    |  |   Frame frame = gef.getFrame();
 | 
  
    |  |   out.println(frame.printBefore());
 | 
  
    |  |   String quizzPart = displayQuizz(quizz,gef, m_context, quizzScc, resources, settings, out);
 | 
  
    |  |   out.println(quizzPart);
 | 
  
    |  | 
 | 
  
    |  |       out.write('\n');
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       out.write(' ');
 | 
  
    |  |       //  view:pdcClassification
 | 
  
    |  |       org.silverpeas.core.web.util.viewgenerator.html.pdc.PdcClassificationTag _jspx_th_view_005fpdcClassification_005f0 = (new org.silverpeas.core.web.util.viewgenerator.html.pdc.PdcClassificationTag());
 | 
  
    |  |       _jsp_instancemanager.newInstance(_jspx_th_view_005fpdcClassification_005f0);
 | 
  
    |  |       _jspx_th_view_005fpdcClassification_005f0.setJspContext(_jspx_page_context);
 | 
  
    |  |       // /quizz/jsp/quizzQuestionsNew.jsp(970,2) name = componentId type = java.lang.String reqTime = true required = true fragment = false deferredValue = false deferredMethod = false expectedTypeName = null methodSignature = null 
 | 
  
    |  |       _jspx_th_view_005fpdcClassification_005f0.setComponentId( quizzScc.getComponentId() );
 | 
  
    |  |       // /quizz/jsp/quizzQuestionsNew.jsp(970,2) name = contentId type = java.lang.String reqTime = true required = true fragment = false deferredValue = false deferredMethod = false expectedTypeName = null methodSignature = null 
 | 
  
    |  |       _jspx_th_view_005fpdcClassification_005f0.setContentId( quizzId );
 | 
  
    |  |       _jspx_th_view_005fpdcClassification_005f0.doTag();
 | 
  
    |  |       _jsp_instancemanager.destroyInstance(_jspx_th_view_005fpdcClassification_005f0);
 | 
  
    |  |       out.write('\n');
 | 
  
    |  | 
 | 
  
    |  |   out.println(frame.printMiddle());
 | 
  
    |  |   out.println(frame.printAfter());
 | 
  
    |  |   out.println(window.printAfter());
 | 
  
    |  | } //End if action = ViewQuizz
 | 
  
    |  | else if (action.equals("ViewCurrentQuestions")) {
 | 
  
    |  |   out.println("<body marginheight=5 marginwidth=5 leftmargin=5 topmargin=5 bgcolor=\"#FFFFFF\">");
 | 
  
    |  | 
 | 
  
    |  |   Window window = gef.getWindow();
 | 
  
    |  |   BrowseBar browseBar = window.getBrowseBar();
 | 
  
    |  |   browseBar.setDomainName(quizzScc.getSpaceLabel());
 | 
  
    |  |   browseBar.setComponentName(quizzScc.getComponentLabel());
 | 
  
    |  |   browseBar.setPath("<a href=\"Main.jsp\">" + resources.getString("QuizzList") + "</a>");
 | 
  
    |  |   browseBar.setExtraInformation(resources.getString("QuizzParticipate") + " " + quizz.getHeader().getTitle());
 | 
  
    |  | 
 | 
  
    |  |   //operation pane
 | 
  
    |  |   OperationPane operationPane = window.getOperationPane();
 | 
  
    |  |   operationPane.addOperation(m_context + "/util/icons/quizz_print.gif",resources.getString("GML.print"),"javascript:window.print()");
 | 
  
    |  | 
 | 
  
    |  |   out.println(window.printBefore());
 | 
  
    |  |   Frame frame = gef.getFrame();
 | 
  
    |  |   out.println(frame.printBefore());
 | 
  
    |  | 
 | 
  
    |  |   html_string = displayQuestions(quizz, Integer.parseInt(roundId), gef, m_context, quizzScc, resources, settings, frame, out);
 | 
  
    |  |   out.println(html_string.get(0));
 | 
  
    |  |   out.println(frame.printMiddle());
 | 
  
    |  |   out.println(html_string.get(1));
 | 
  
    |  |   out.println(frame.printAfter());
 | 
  
    |  |   out.println(window.printAfter());
 | 
  
    |  | }
 | 
  
    |  | else if (action.equals("ViewResult")) {
 | 
  
    |  |   out.println("<body marginheight=5 marginwidth=5 leftmargin=5 topmargin=5 bgcolor=\"#FFFFFF\">");
 | 
  
    |  |   String participation=(String) session.getAttribute("currentParticipationId");
 | 
  
    |  |   int nb_user_votes = 0;
 | 
  
    |  |   Collection<ScoreDetail> userScores = quizzScc.getUserScoresByFatherId(quizzId);
 | 
  
    |  |   if (userScores != null)
 | 
  
    |  |   nb_user_votes = userScores.size();
 | 
  
    |  | 
 | 
  
    |  |   if ((participation!=null)&&(!participation.equals(""))) {
 | 
  
    |  |     participationId = Integer.parseInt((String) session.getAttribute("currentParticipationId"));
 | 
  
    |  |   } else {
 | 
  
    |  | 	  participationId=nb_user_votes;
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   if (userId == null) {
 | 
  
    |  |     participationId += 1;
 | 
  
    |  |     quizz = quizzScc.getQuestionContainerForCurrentUserByParticipationId(quizzId, participationId);
 | 
  
    |  |   }
 | 
  
    |  |   else
 | 
  
    |  |   {
 | 
  
    |  |       quizz = quizzScc.getQuestionContainerByParticipationId(quizzId, userId, participationId);
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   Window window = gef.getWindow();
 | 
  
    |  |   BrowseBar browseBar = window.getBrowseBar();
 | 
  
    |  |   browseBar.setDomainName(quizzScc.getSpaceLabel());
 | 
  
    |  |   browseBar.setComponentName(quizzScc.getComponentLabel());
 | 
  
    |  |   browseBar.setPath("<a href=\"Main.jsp\">"+resources.getString("QuizzList")+"</a>");
 | 
  
    |  |   browseBar.setExtraInformation(resources.getString("QuizzSeeResults"));
 | 
  
    |  | 
 | 
  
    |  |   //operation pane
 | 
  
    |  |   OperationPane operationPane = window.getOperationPane();
 | 
  
    |  |   operationPane.addOperation(m_context + "/util/icons/quizz_print.gif",resources.getString("GML.print"),"javascript:window.print()");
 | 
  
    |  | 
 | 
  
    |  |   out.println(window.printBefore());
 | 
  
    |  |   Frame frame = gef.getFrame();
 | 
  
    |  |   out.println(frame.printBefore());
 | 
  
    |  |   String quizzPart = displayQuizzResult(quizz, gef, m_context, quizzScc, resources, settings, nb_user_votes);
 | 
  
    |  |   ScoreDetail userScoreDetail = null;
 | 
  
    |  |   //Suggestion pedagogique
 | 
  
    |  |   if (userId == null) {
 | 
  
    |  |     userScoreDetail= quizzScc.getCurrentUserScoreByFatherIdAndParticipationId(quizzId, participationId);
 | 
  
    |  |   } else
 | 
  
    |  |     userScoreDetail= quizzScc.getUserScoreByFatherIdAndParticipationId(quizzId, userId, participationId);
 | 
  
    |  | 
 | 
  
    |  |   if ((userScoreDetail.getSuggestion()!=null) && (!userScoreDetail.getSuggestion().equals(""))) {
 | 
  
    |  |     quizzPart += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr align=center><td><table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" class=\"contourintfdcolor\" width=\"100%\"><tr><td valign=\"top\"><img src=\"icons/silverProf_SuggPedago.gif\" align=\"left\"><span class=\"txtnav\">";
 | 
  
    |  |     quizzPart += resources.getString("EducationSuggestion") + " :</span><br>";
 | 
  
    |  |     quizzPart += WebEncodeHelper.javaStringToHtmlString(userScoreDetail.getSuggestion())+"</td></tr></table></td></tr></table>";
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   out.println(quizzPart);
 | 
  
    |  |   out.println(frame.printMiddle());
 | 
  
    |  | 
 | 
  
    |  |   Button cancelButton = gef.getFormButton(resources.getString("GML.back"), "Main.jsp", false);
 | 
  
    |  |   if (origin.equals("1")) {
 | 
  
    |  |     cancelButton = gef.getFormButton(resources.getString("GML.cancel"), "quizzResultUser.jsp", false);
 | 
  
    |  |   } else if (origin.equals("0")) {
 | 
  
    |  |     cancelButton = gef.getFormButton(resources.getString("GML.cancel"), "palmares.jsp?quizz_id="+quizzId, false);
 | 
  
    |  |   }
 | 
  
    |  |   out.println("<table width=100% border=\"0\">");
 | 
  
    |  |   out.println("<tr><td align=\"center\">"+cancelButton.print()+"</td></tr>");
 | 
  
    |  |   out.println("</table>");
 | 
  
    |  |   out.println(frame.printAfter());
 | 
  
    |  |   out.println(window.printAfter());
 | 
  
    |  | }
 | 
  
    |  | else if (action.equals("ViewResultAdmin")) {
 | 
  
    |  |   out.println("<body>");
 | 
  
    |  |   String participation= (String) session.getAttribute("currentParticipationId");
 | 
  
    |  |   if ((participation!=null)&&(!participation.equals("")))
 | 
  
    |  |     participationId = new Integer((String) session.getAttribute("currentParticipationId")).intValue();
 | 
  
    |  |   if (userId == null) {
 | 
  
    |  |     participationId += 1;
 | 
  
    |  |     quizz = quizzScc.getQuestionContainerForCurrentUserByParticipationId(quizzId, participationId);
 | 
  
    |  |   } else{
 | 
  
    |  |        participationId = new Integer((String) session.getAttribute("currentParticipationId")).intValue();
 | 
  
    |  |        quizz = quizzScc.getQuestionContainerByParticipationId(quizzId, userId, participationId);
 | 
  
    |  |   }
 | 
  
    |  |   int nb_user_votes = 0;
 | 
  
    |  |   Collection<ScoreDetail> userScores = quizzScc.getUserScoresByFatherId(quizzId);
 | 
  
    |  |   if (userScores != null) {
 | 
  
    |  |     nb_user_votes = userScores.size();
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   Window window = gef.getWindow();
 | 
  
    |  |   BrowseBar browseBar = window.getBrowseBar();
 | 
  
    |  |   browseBar.setDomainName(quizzScc.getSpaceLabel());
 | 
  
    |  |   browseBar.setComponentName(quizzScc.getComponentLabel());
 | 
  
    |  |   browseBar.setPath("<a href=\"Main.jsp\">"+resources.getString("QuizzList")+"</a>");
 | 
  
    |  |   browseBar.setExtraInformation(resources.getString("QuizzSeeResults"));
 | 
  
    |  | 
 | 
  
    |  |   //operation pane
 | 
  
    |  |   OperationPane operationPane = window.getOperationPane();
 | 
  
    |  |   operationPane.addOperation(m_context + "/util/icons/quizz_print.gif",resources.getString("GML.print"),"javascript:window.print()");
 | 
  
    |  | 
 | 
  
    |  |   out.println(window.printBefore());
 | 
  
    |  |   Frame frame = gef.getFrame();
 | 
  
    |  |   out.println(frame.printBefore());
 | 
  
    |  |   String quizzPart = displayQuizzResultAdmin(quizz, gef, m_context, quizzScc, resources, settings, nb_user_votes);
 | 
  
    |  |   ScoreDetail userScoreDetail = null;
 | 
  
    |  |   //Suggestion pedagogique
 | 
  
    |  |   if (userId == null) {
 | 
  
    |  |     userScoreDetail= quizzScc.getCurrentUserScoreByFatherIdAndParticipationId(quizzId, participationId);
 | 
  
    |  |   } else {
 | 
  
    |  |     userScoreDetail= quizzScc.getUserScoreByFatherIdAndParticipationId(quizzId, userId, participationId);
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   quizzPart += "<table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr align=center><td><table border=\"0\" cellspacing=\"0\" cellpadding=\"5\" class=\"contourintfdcolor\" width=\"100%\"><tr><td valign=\"top\"><img src=\"icons/silverProf_SuggPedago.gif\" align=\"left\"><span class=\"txtnav\">";
 | 
  
    |  |   quizzPart += resources.getString("EducationSuggestion") + " :</span><br>";
 | 
  
    |  |   quizzPart += "<textarea name=\"txa_suggestion\" cols=\"120\" rows=\"4\">";
 | 
  
    |  |   if (userScoreDetail.getSuggestion()!=null) {
 | 
  
    |  |     quizzPart += userScoreDetail.getSuggestion();
 | 
  
    |  |   }
 | 
  
    |  |   quizzPart += "</textarea>";
 | 
  
    |  |   quizzPart += "</td></tr></table></td></tr></table>";
 | 
  
    |  |   quizzPart += "<input type=\"hidden\" name=\"UserId\" value=\""+userId+"\">";
 | 
  
    |  |   quizzPart += "<input type=\"hidden\" name=\"Page\" value=\""+origin+"\">";
 | 
  
    |  | 
 | 
  
    |  |   out.println(quizzPart);
 | 
  
    |  |   out.println(frame.printMiddle());
 | 
  
    |  |   Button cancelButton= gef.getFormButton(resources.getString("GML.back"), "quizzAdmin.jsp", false);
 | 
  
    |  |   if (origin.equals("1")) {
 | 
  
    |  |     cancelButton = gef.getFormButton(resources.getString("GML.cancel"), "quizzResultAdmin.jsp", false);
 | 
  
    |  |   } else if (origin.equals("0")) {
 | 
  
    |  |     cancelButton = gef.getFormButton(resources.getString("GML.cancel"), "palmaresAdmin.jsp?quizz_id="+quizzId, false);
 | 
  
    |  |   }
 | 
  
    |  |   Button voteButton = gef.getFormButton(resources.getString("QuestionUpdate"), "javascript:update_suggestion("+quizz.getHeader().getPK().getId()+")", false);
 | 
  
    |  |   out.println("<table width=100% border=\"0\">");
 | 
  
    |  |   out.println("<tr><td align=\"center\"><table><tr><td align=center>"+voteButton.print()+"</td><td align=center>"+cancelButton.print()+"</td></tr></table></td></tr>");
 | 
  
    |  |   out.println("</table>");
 | 
  
    |  |   out.println(frame.printAfter());
 | 
  
    |  |   out.println(window.printAfter());
 | 
  
    |  | }
 | 
  
    |  | else if (action.equals("UpdateSuggestion")) {
 | 
  
    |  |   String suggestion = request.getParameter("txa_suggestion");
 | 
  
    |  |   participationId = new Integer((String) session.getAttribute("currentParticipationId")).intValue();
 | 
  
    |  |   quizz = quizzScc.getQuestionContainerByParticipationId(quizzId, userId, participationId);
 | 
  
    |  |   ScoreDetail userScoreDetail = null;
 | 
  
    |  |   //Suggestion pedagogique
 | 
  
    |  |   userScoreDetail = quizzScc.getUserScoreByFatherIdAndParticipationId(quizzId, userId, participationId);
 | 
  
    |  |   userScoreDetail.setSuggestion(suggestion);
 | 
  
    |  |   quizzScc.updateScore(userScoreDetail);
 | 
  
    |  | 
 | 
  
    |  |   if (origin.equals("0"))
 | 
  
    |  |   {
 | 
  
    |  | 
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("          <script type=\"text/javascript\">\n");
 | 
  
    |  |       out.write("          <!--\n");
 | 
  
    |  |       out.write("          self.location=\"palmaresAdmin.jsp?quizz_id=");
 | 
  
    |  |       out.print(quizzId);
 | 
  
    |  |       out.write("\";\n");
 | 
  
    |  |       out.write("          //-->\n");
 | 
  
    |  |       out.write("          </script>\n");
 | 
  
    |  | 
 | 
  
    |  |   } else if (origin.equals("1")) {
 | 
  
    |  | 
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("<script type=\"text/javascript\">\n");
 | 
  
    |  |       out.write("<!--\n");
 | 
  
    |  |       out.write("self.location=\"quizzResultAdmin.jsp\";\n");
 | 
  
    |  |       out.write("//-->\n");
 | 
  
    |  |       out.write("</script>\n");
 | 
  
    |  | 
 | 
  
    |  |   }
 | 
  
    |  | }
 | 
  
    |  | 
 | 
  
    |  |       out.write("\n");
 | 
  
    |  |       out.write("</body>\n");
 | 
  
    |  |       out.write("</html>\n");
 | 
  
    |  |     } catch (java.lang.Throwable t) {
 | 
  
    |  |       if (!(t instanceof javax.servlet.jsp.SkipPageException)){
 | 
  
    |  |         out = _jspx_out;
 | 
  
    |  |         if (out != null && out.getBufferSize() != 0)
 | 
  
    |  |           try {
 | 
  
    |  |             if (response.isCommitted()) {
 | 
  
    |  |               out.flush();
 | 
  
    |  |             } else {
 | 
  
    |  |               out.clearBuffer();
 | 
  
    |  |             }
 | 
  
    |  |           } catch (java.io.IOException e) {}
 | 
  
    |  |         if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
 | 
  
    |  |         else throw new ServletException(t);
 | 
  
    |  |       }
 | 
  
    |  |     } finally {
 | 
  
    |  |       _jspxFactory.releasePageContext(_jspx_page_context);
 | 
  
    |  |     }
 | 
  
    |  |   }
 | 
  
    |  | 
 | 
  
    |  |   private boolean _jspx_meth_view_005flooknfeel_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
 | 
  
    |  |           throws java.lang.Throwable {
 | 
  
    |  |     javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
 | 
  
    |  |     javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
 | 
  
    |  |     //  view:looknfeel
 | 
  
    |  |     org.silverpeas.core.web.util.viewgenerator.html.LookAndStyleTag _jspx_th_view_005flooknfeel_005f0 = (org.silverpeas.core.web.util.viewgenerator.html.LookAndStyleTag) _005fjspx_005ftagPool_005fview_005flooknfeel_0026_005fwithFieldsetStyle_005fwithCheckFormScript_005fnobody.get(org.silverpeas.core.web.util.viewgenerator.html.LookAndStyleTag.class);
 | 
  
    |  |     _jspx_th_view_005flooknfeel_005f0.setPageContext(_jspx_page_context);
 | 
  
    |  |     _jspx_th_view_005flooknfeel_005f0.setParent(null);
 | 
  
    |  |     // /quizz/jsp/quizzQuestionsNew.jsp(764,0) name = withFieldsetStyle type = boolean reqTime = false required = false fragment = false deferredValue = false deferredMethod = false expectedTypeName = null methodSignature = null 
 | 
  
    |  |     _jspx_th_view_005flooknfeel_005f0.setWithFieldsetStyle(true);
 | 
  
    |  |     // /quizz/jsp/quizzQuestionsNew.jsp(764,0) name = withCheckFormScript type = boolean reqTime = false required = false fragment = false deferredValue = false deferredMethod = false expectedTypeName = null methodSignature = null 
 | 
  
    |  |     _jspx_th_view_005flooknfeel_005f0.setWithCheckFormScript(true);
 | 
  
    |  |     int _jspx_eval_view_005flooknfeel_005f0 = _jspx_th_view_005flooknfeel_005f0.doStartTag();
 | 
  
    |  |     if (_jspx_th_view_005flooknfeel_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
 | 
  
    |  |       _005fjspx_005ftagPool_005fview_005flooknfeel_0026_005fwithFieldsetStyle_005fwithCheckFormScript_005fnobody.reuse(_jspx_th_view_005flooknfeel_005f0);
 | 
  
    |  |       return true;
 | 
  
    |  |     }
 | 
  
    |  |     _005fjspx_005ftagPool_005fview_005flooknfeel_0026_005fwithFieldsetStyle_005fwithCheckFormScript_005fnobody.reuse(_jspx_th_view_005flooknfeel_005f0);
 | 
  
    |  |     return false;
 | 
  
    |  |   }
 | 
  
    |  | }
 |