Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java,v diff -u -r1.17 -r1.18 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 28 Jan 2006 23:31:10 -0000 1.17 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/LearningUtil.java 29 Jan 2006 13:45:27 -0000 1.18 @@ -820,5 +820,6 @@ request.getSession().removeAttribute(USER_EXCEPTION_TOOLSESSIONID_REQUIRED); request.getSession().removeAttribute(USER_EXCEPTION_NUMBERFORMAT); request.getSession().removeAttribute(LEARNING_MODE); + request.getSession().removeAttribute(PREVIEW_ONLY); } } Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java,v diff -u -r1.7 -r1.8 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 29 Jan 2006 11:05:30 -0000 1.7 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningAction.java 29 Jan 2006 13:45:27 -0000 1.8 @@ -35,6 +35,8 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.exception.DataMissingException; +import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McComparator; @@ -265,19 +267,44 @@ else if (mcLearningForm.getLearnerFinished() != null) { logger.debug("requested learner finished, the learner should be directed to next activity."); + + Long toolSessionId = (Long) request.getSession().getAttribute(TOOL_SESSION_ID); + String userID=(String) request.getSession().getAttribute(USER_ID); + logger.debug("attempting to leave/complete session with toolSessionId:" + toolSessionId + " and userID:"+userID); + + String nextUrl=null; + try + { + nextUrl=mcService.leaveToolSession(toolSessionId, new Long(userID)); + logger.debug("nextUrl: "+ nextUrl); + } + catch (DataMissingException e) + { + throw new ServletException(e); + } + catch (ToolException e) + { + throw new ServletException(e); + } + + logger.debug("success getting nextUrl: "+ nextUrl); mcLearningForm.resetCommands(); LearningUtil.cleanUpLearningSession(request); - //fix this - return (mapping.findForward(LEARNING_STARTER)); + /* pay attention here*/ + logger.debug("redirecting to the nextUrl: "+ nextUrl); + response.sendRedirect(nextUrl); + + //pay attention here as well: whete to go. + return null; } else if (mcLearningForm.getDonePreview() != null) { logger.debug("request is from authoring environment. requested donePreview."); mcLearningForm.resetCommands(); LearningUtil.cleanUpLearningSession(request); AuthoringUtil.cleanupAuthoringSession(request); - return (mapping.findForward(LOAD_STARTER)); + return (mapping.findForward(LEARNING_STARTER)); } mcLearningForm.resetCommands(); return (mapping.findForward(LOAD_LEARNER));