Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/McGeneralLearnerFlowDTO.java =================================================================== diff -u --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/McGeneralLearnerFlowDTO.java (revision 0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/McGeneralLearnerFlowDTO.java (revision 44120a6df157dd073c610ffd29566919c89cce22) @@ -0,0 +1,208 @@ +/*************************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * ***********************************************************************/ +/* $$Id$$ */ +package org.lamsfoundation.lams.tool.qa; + +import java.util.Map; + +import org.apache.commons.lang.builder.ToStringBuilder; + + + + +/** + *
DTO that holds learner flow decision properties and some other view-only properties + *
+ * + * @author Ozgur Demirtas + */ +public class McGeneralLearnerFlowDTO implements Comparable +{ + protected String activityOffline; + + protected Integer totalQuestionCount; + + protected String activityInstructions; + + protected String activityTitle; + + protected String countSessionComplete; + + protected String toolSessionId; + + protected Integer currentQuestionIndex; + + protected String questionListingMode; + + protected String currentAnswer; + + /** + * @return Returns the currentAnswer. + */ + public String getCurrentAnswer() { + return currentAnswer; + } + /** + * @param currentAnswer The currentAnswer to set. + */ + public void setCurrentAnswer(String currentAnswer) { + this.currentAnswer = currentAnswer; + } + protected String userFeedback; + + protected Map mapQuestionContentLearner; + + /** + * @return Returns the mapQuestionContentLearner. + */ + public Map getMapQuestionContentLearner() { + return mapQuestionContentLearner; + } + /** + * @param mapQuestionContentLearner The mapQuestionContentLearner to set. + */ + public void setMapQuestionContentLearner(Map mapQuestionContentLearner) { + this.mapQuestionContentLearner = mapQuestionContentLearner; + } + /** + * @return Returns the userFeedback. + */ + public String getUserFeedback() { + return userFeedback; + } + /** + * @param userFeedback The userFeedback to set. + */ + public void setUserFeedback(String userFeedback) { + this.userFeedback = userFeedback; + } + /** + * @return Returns the activityInstructions. + */ + public String getActivityInstructions() { + return activityInstructions; + } + /** + * @param activityInstructions The activityInstructions to set. + */ + public void setActivityInstructions(String activityInstructions) { + this.activityInstructions = activityInstructions; + } + /** + * @return Returns the activityOffline. + */ + public String getActivityOffline() { + return activityOffline; + } + /** + * @param activityOffline The activityOffline to set. + */ + public void setActivityOffline(String activityOffline) { + this.activityOffline = activityOffline; + } + /** + * @return Returns the activityTitle. + */ + public String getActivityTitle() { + return activityTitle; + } + /** + * @param activityTitle The activityTitle to set. + */ + public void setActivityTitle(String activityTitle) { + this.activityTitle = activityTitle; + } + /** + * @return Returns the countSessionComplete. + */ + public String getCountSessionComplete() { + return countSessionComplete; + } + /** + * @param countSessionComplete The countSessionComplete to set. + */ + public void setCountSessionComplete(String countSessionComplete) { + this.countSessionComplete = countSessionComplete; + } + + /** + * @return Returns the questionListingMode. + */ + public String getQuestionListingMode() { + return questionListingMode; + } + /** + * @param questionListingMode The questionListingMode to set. + */ + public void setQuestionListingMode(String questionListingMode) { + this.questionListingMode = questionListingMode; + } + /** + * @return Returns the toolSessionId. + */ + public String getToolSessionId() { + return toolSessionId; + } + /** + * @param toolSessionId The toolSessionId to set. + */ + public void setToolSessionId(String toolSessionId) { + this.toolSessionId = toolSessionId; + } + + public int compareTo(Object o) + { + McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO = (McGeneralLearnerFlowDTO) o; + + if (mcGeneralLearnerFlowDTO == null) + return 1; + else + return 0; + } + + public String toString() { + return new ToStringBuilder(this) + .append("activityOffline: ", activityOffline) + .append("totalQuestionCount : ", totalQuestionCount) + .append("activityInstructions: ", activityInstructions) + .append("activityTitle: ", activityTitle) + .append("countSessionComplete: ", countSessionComplete) + .append("toolSessionId: ", toolSessionId) + .append("currentQuestionIndex: ", currentQuestionIndex) + .append("questionListingMode: ", questionListingMode) + .toString(); + } + + + /** + * @param currentQuestionIndex The currentQuestionIndex to set. + */ + public void setCurrentQuestionIndex(Integer currentQuestionIndex) { + this.currentQuestionIndex = currentQuestionIndex; + } + /** + * @param totalQuestionCount The totalQuestionCount to set. + */ + public void setTotalQuestionCount(Integer totalQuestionCount) { + this.totalQuestionCount = totalQuestionCount; + } +} Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java =================================================================== diff -u -rcc57114dde638ab1b37c0ac5556c1a2822e79bf3 -r44120a6df157dd073c610ffd29566919c89cce22 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java (.../QaLearningForm.java) (revision cc57114dde638ab1b37c0ac5556c1a2822e79bf3) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java (.../QaLearningForm.java) (revision 44120a6df157dd073c610ffd29566919c89cce22) @@ -41,6 +41,21 @@ protected String getPreviousQuestion; protected String endLearning; + protected String toolSessionID; + protected String mode; + + /** + * @return Returns the mode. + */ + public String getMode() { + return mode; + } + /** + * @param mode The mode to set. + */ + public void setMode(String mode) { + this.mode = mode; + } protected String viewAllResults; protected String responseId; @@ -167,5 +182,18 @@ */ public void setViewAllResults(String viewAllResults) { this.viewAllResults = viewAllResults; - } + } + + /** + * @return Returns the toolSessionID. + */ + public String getToolSessionID() { + return toolSessionID; + } + /** + * @param toolSessionID The toolSessionID to set. + */ + public void setToolSessionID(String toolSessionID) { + this.toolSessionID = toolSessionID; + } } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java =================================================================== diff -u -r0409f98dc17dfd380badf33ae103a47d0fffc4e5 -r44120a6df157dd073c610ffd29566919c89cce22 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 0409f98dc17dfd380badf33ae103a47d0fffc4e5) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 44120a6df157dd073c610ffd29566919c89cce22) @@ -41,6 +41,7 @@ import org.apache.struts.action.ActionMessages; import org.lamsfoundation.lams.tool.qa.QaAppConstants; import org.lamsfoundation.lams.tool.qa.QaApplicationException; +import org.lamsfoundation.lams.tool.qa.McGeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.qa.QaComparator; import org.lamsfoundation.lams.tool.qa.QaContent; import org.lamsfoundation.lams.tool.qa.QaQueContent; @@ -167,28 +168,34 @@ /*holds the answers */ Map mapAnswers= new TreeMap(new QaComparator()); - QaLearningForm qaQaLearningForm = (QaLearningForm) form; + QaLearningForm qaLearningForm = (QaLearningForm) form; - request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1"); - request.getSession().setAttribute(CURRENT_ANSWER, ""); + McGeneralLearnerFlowDTO mcGeneralLearnerFlowDTO= new McGeneralLearnerFlowDTO(); + mcGeneralLearnerFlowDTO.setCurrentQuestionIndex(new Integer(1)); + //request.getSession().setAttribute(CURRENT_QUESTION_INDEX, "1"); + + //request.getSession().setAttribute(CURRENT_ANSWER, ""); + mcGeneralLearnerFlowDTO.setCurrentAnswer(""); + /*initialize available question display modes in the session */ - request.getSession().setAttribute(QUESTION_LISTING_MODE_SEQUENTIAL,QUESTION_LISTING_MODE_SEQUENTIAL); - request.getSession().setAttribute(QUESTION_LISTING_MODE_COMBINED, QUESTION_LISTING_MODE_COMBINED); - request.getSession().setAttribute(QUESTION_LISTING_MODE_PREVIEW, QUESTION_LISTING_MODE_PREVIEW); + //request.getSession().setAttribute(QUESTION_LISTING_MODE_SEQUENTIAL,QUESTION_LISTING_MODE_SEQUENTIAL); + //request.getSession().setAttribute(QUESTION_LISTING_MODE_COMBINED, QUESTION_LISTING_MODE_COMBINED); + //request.getSession().setAttribute(QUESTION_LISTING_MODE_PREVIEW, QUESTION_LISTING_MODE_PREVIEW); + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); logger.debug("retrieving qaService: " + qaService); - request.getSession().setAttribute(TOOL_SERVICE, qaService); + //request.getSession().setAttribute(TOOL_SERVICE, qaService); /*mark the http session as a learning activity */ - request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_LEARNING); + //request.getSession().setAttribute(TARGET_MODE,TARGET_MODE_LEARNING); - QaUtils.persistTimeZone(request); + //QaUtils.persistTimeZone(request); /*validate learning mode parameters*/ - ActionForward validateParameters=validateParameters(request, mapping); + ActionForward validateParameters=validateParameters(request, mapping, qaLearningForm); logger.debug("validateParamaters: " + validateParameters); if (validateParameters != null) { @@ -472,13 +479,11 @@ * @param mapping * @return ActionForward */ - protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping) + protected ActionForward validateParameters(HttpServletRequest request, ActionMapping mapping, QaLearningForm qaLearningForm) { /* * obtain and setup the current user's data */ - - String userID = ""; HttpSession ss = SessionManager.getSession(); logger.debug("ss: " + ss); @@ -490,7 +495,7 @@ { userID = user.getUserID().toString(); logger.debug("retrieved userId: " + userID); - request.getSession().setAttribute(USER_ID, userID); + //request.getSession().setAttribute(USER_ID, userID); } } @@ -503,7 +508,7 @@ if ((strToolSessionId == null) || (strToolSessionId.length() == 0)) { QaUtils.cleanUpSessionAbsolute(request); - request.getSession().setAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED, new Boolean(true).toString()); + //request.getSession().setAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED, new Boolean(true).toString()); persistError(request, "error.toolSessionId.required"); return (mapping.findForward(ERROR_LIST_LEARNER)); } @@ -513,12 +518,13 @@ { toolSessionId=new Long(strToolSessionId).longValue(); logger.debug("passed TOOL_SESSION_ID : " + new Long(toolSessionId)); - request.getSession().setAttribute(TOOL_SESSION_ID,new Long(toolSessionId)); + //request.getSession().setAttribute(TOOL_SESSION_ID,new Long(toolSessionId)); + qaLearningForm.setToolSessionID(new Long(toolSessionId).toString()); } catch(NumberFormatException e) { QaUtils.cleanUpSessionAbsolute(request); - request.getSession().setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true).toString()); + //request.getSession().setAttribute(USER_EXCEPTION_NUMBERFORMAT, new Boolean(true).toString()); persistError(request, "error.sessionId.numberFormatException"); logger.debug("add error.sessionId.numberFormatException to ActionMessages."); return (mapping.findForward(ERROR_LIST_LEARNER)); @@ -532,21 +538,21 @@ if ((mode == null) || (mode.length() == 0)) { QaUtils.cleanUpSessionAbsolute(request); - request.getSession().setAttribute(USER_EXCEPTION_MODE_REQUIRED, new Boolean(true).toString()); + //request.getSession().setAttribute(USER_EXCEPTION_MODE_REQUIRED, new Boolean(true).toString()); persistError(request, "error.mode.required"); return (mapping.findForward(ERROR_LIST_LEARNER)); } if ((!mode.equals("learner")) && (!mode.equals("teacher")) && (!mode.equals("author"))) { QaUtils.cleanUpSessionAbsolute(request); - request.getSession().setAttribute(USER_EXCEPTION_MODE_INVALID, new Boolean(true).toString()); + //request.getSession().setAttribute(USER_EXCEPTION_MODE_INVALID, new Boolean(true).toString()); persistError(request, "error.mode.invalid"); return (mapping.findForward(ERROR_LIST_LEARNER)); } logger.debug("session LEARNING_MODE set to:" + mode); - request.getSession().setAttribute(LEARNING_MODE, mode); - + //request.getSession().setAttribute(LEARNING_MODE, mode); + qaLearningForm.setMode(mode); return null; } Index: lams_tool_laqa/web/learning/AnswersContent.jsp =================================================================== diff -u -r9393c098e5dfd603e2d37347cd1e531a25aa424a -r44120a6df157dd073c610ffd29566919c89cce22 --- lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 9393c098e5dfd603e2d37347cd1e531a25aa424a) +++ lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 44120a6df157dd073c610ffd29566919c89cce22) @@ -56,7 +56,7 @@ | |||||||
|