Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== diff -u -r309bbea94bab0e995ea5e46598a0a1c3c4ce5595 -r96f6dc3128419969060b654301ffa0ad632f2863 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 309bbea94bab0e995ea5e46598a0a1c3c4ce5595) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java (.../McAppConstants.java) (revision 96f6dc3128419969060b654301ffa0ad632f2863) @@ -280,6 +280,10 @@ public static final String IS_TOOL_ACTIVITY_OFFLINE ="isToolActivityOffline"; public static final String IS_USERNAME_VISIBLE ="isUsernameVisible"; + public static final String IS_CONTENT_IN_USE ="isContentInUse"; + public static final String IS_RETRIES ="isRetries"; + public static final String IS_SHOW_FEEDBACK ="isShowFeedback"; + public static final String IS_SHOW_LEARNERS_REPORT ="isShowLearnersReport"; public static final String IS_ALL_SESSIONS_COMPLETED ="isAllSessionsCompleted"; public static final String CHECK_ALL_SESSIONS_COMPLETED ="checkAllSessionsCompleted"; public static final String FROM_TOOL_CONTENT_ID ="fromToolContentId"; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java =================================================================== diff -u -rc89f6460b774ec77a036216ff48db6474e0c2d19 -r96f6dc3128419969060b654301ffa0ad632f2863 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision c89f6460b774ec77a036216ff48db6474e0c2d19) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McAction.java (.../McAction.java) (revision 96f6dc3128419969060b654301ffa0ad632f2863) @@ -1833,8 +1833,8 @@ boolean isContentInUse=false; boolean isRetries=false; boolean isShowFeedback=false; + boolean isSln=false; - logger.debug("isQuestionsSequenced: " + mcAuthoringForm.getQuestionsSequenced()); if (mcAuthoringForm.getQuestionsSequenced().equalsIgnoreCase(ON)) isQuestionsSequenced=true; @@ -1851,6 +1851,11 @@ if (mcAuthoringForm.getRetries().equalsIgnoreCase(ON)) isRetries=true; + + logger.debug("isSln" + mcAuthoringForm.getSln()); + if (mcAuthoringForm.getSln().equalsIgnoreCase(ON)) + isSln=true; + logger.debug("passmark: " + mcAuthoringForm.getPassmark()); if ((mcAuthoringForm.getPassmark() != null) && (mcAuthoringForm.getPassmark().length() > 0)) passmark= new Integer(mcAuthoringForm.getPassmark()).intValue(); @@ -1895,6 +1900,13 @@ logger.debug("createContent richTextOnlineInstructions from session: " + richTextOnlineInstructions); if (richTextOnlineInstructions == null) richTextOnlineInstructions=""; + + String richTextReportTitle=(String)request.getSession().getAttribute(RICHTEXT_REPORT_TITLE); + logger.debug("richTextReportTitle: " + richTextReportTitle); + + String richTextEndLearningMessage=(String)request.getSession().getAttribute(RICHTEXT_END_LEARNING_MSG); + logger.debug("richTextEndLearningMessage: " + richTextEndLearningMessage); + creationDate=(String)request.getSession().getAttribute(CREATION_DATE); if (creationDate == null) creationDate=new Date(System.currentTimeMillis()).toString(); @@ -1929,11 +1941,12 @@ mc.setContentInUse(isContentInUse); mc.setEndLearningMessage(endLearningMessage); mc.setRunOffline(isRunOffline); - mc.setReportTitle(reportTitle); + mc.setReportTitle(richTextReportTitle); mc.setMonitoringReportTitle(monitoringReportTitle); - mc.setEndLearningMessage(endLearningMessage); + mc.setEndLearningMessage(richTextEndLearningMessage); mc.setRetries(isRetries); mc.setPassMark(new Integer(passmark)); + mc.setShowReport(isSln); mc.setShowFeedback(isShowFeedback); mc.setMcQueContents(new TreeSet()); mc.setMcSessions(new TreeSet()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java =================================================================== diff -u -r309bbea94bab0e995ea5e46598a0a1c3c4ce5595 -r96f6dc3128419969060b654301ffa0ad632f2863 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java (.../McLearningStarterAction.java) (revision 309bbea94bab0e995ea5e46598a0a1c3c4ce5595) +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java (.../McLearningStarterAction.java) (revision 96f6dc3128419969060b654301ffa0ad632f2863) @@ -22,6 +22,7 @@ import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McComparator; +import org.lamsfoundation.lams.tool.mc.McContent; import org.lamsfoundation.lams.tool.mc.McSession; import org.lamsfoundation.lams.tool.mc.McUtils; import org.lamsfoundation.lams.tool.mc.service.IMcService; @@ -175,7 +176,7 @@ /* *for testing only, remove this line in development */ - Long currentToolContentId= new Long(10); + Long currentToolContentId= new Long(1234); logger.debug("simulating container behaviour: calling createToolSession with toolSessionId : " + new Long(toolSessionId) + " and toolContentId: " + currentToolContentId); try @@ -192,19 +193,117 @@ /* * by now, we made sure that the passed tool session id exists in the db as a new record - * Make sure we can retrieve it and relavent content + * Make sure we can retrieve it and the relavent content */ - McSession mcSession=mcService.retrieveMcSession(new Long(toolSessionId)); logger.debug("retrieving qaSession: " + mcSession); + /* + * find out what content this tool session is referring to + * get the content for this tool session (many to one mapping) + */ + + /* + * Each passed tool session id points to a particular content. Many to one mapping. + */ + McContent mcContent=mcSession.getMcContent(); + logger.debug("using mcContent: " + mcContent); + request.getSession().setAttribute(TOOL_CONTENT_ID, mcContent.getMcContentId()); + logger.debug("using TOOL_CONTENT_ID: " + mcContent.getMcContentId()); + + /* + * The content we retrieved above must have been created before in Authoring time. + * And the passed tool session id already refers to it. + */ + setupAttributes(request, mcContent); + return (mapping.findForward(LOAD_LEARNER)); - } + } /** + * sets up session scope attributes based on content linked to the passed tool session id + * setupAttributes(HttpServletRequest request, McContent mcContent) + * + * @param request + * @param mcContent + */ + protected void setupAttributes(HttpServletRequest request, McContent mcContent) + { + /* returns Integer: can be 0 or greater than 0, 0 is no passmark, otherwise there is a passmark. */ + logger.debug("PASSMARK: " + mcContent.getPassMark()); + if (mcContent.getPassMark() != null) + { + int passMark=mcContent.getPassMark().intValue(); + request.getSession().setAttribute(PASSMARK, mcContent.getPassMark()); + } + else + { + request.getSession().setAttribute(PASSMARK, new Integer(0)); + } + + request.getSession().setAttribute(IS_SHOW_LEARNERS_REPORT, new Boolean(mcContent.isShowReport()).toString()); + logger.debug("IS_SHOW_LEARNERS_REPORT: " + new Boolean(mcContent.isShowReport()).toString()); + + /* same as 1 page per question */ + logger.debug("IS_QUESTIONS_SEQUENCED: " + mcContent.isQuestionsSequenced()); + if (mcContent.isQuestionsSequenced()) + { + request.getSession().setAttribute(QUESTION_LISTING_MODE, QUESTION_LISTING_MODE_SEQUENTIAL); + } + else + { + request.getSession().setAttribute(QUESTION_LISTING_MODE, QUESTION_LISTING_MODE_COMBINED); + } + logger.debug("QUESTION_LISTING_MODE: " + request.getSession().getAttribute(QUESTION_LISTING_MODE)); + + logger.debug("IS_RETRIES: " + new Boolean(mcContent.isRetries()).toString()); + request.getSession().setAttribute(IS_RETRIES, new Boolean(mcContent.isRetries()).toString()); + + logger.debug("REPORT_TITLE_LEARNER: " + mcContent.getReportTitle()); + request.getSession().setAttribute(REPORT_TITLE_LEARNER,mcContent.getReportTitle()); + + request.getSession().setAttribute(END_LEARNING_MESSAGE,mcContent.getEndLearningMessage()); + logger.debug("END_LEARNING_MESSAGE: " + mcContent.getEndLearningMessage()); + + logger.debug("IS_CONTENT_IN_USE: " + mcContent.isContentInUse()); + request.getSession().setAttribute(IS_CONTENT_IN_USE, new Boolean(mcContent.isContentInUse()).toString()); + + /* + * Is the tool activity been checked as Define Later in the property inspector? + */ + logger.debug("IS_DEFINE_LATER: " + mcContent.isDefineLater()); + request.getSession().setAttribute(IS_DEFINE_LATER, new Boolean(mcContent.isDefineLater()).toString()); + + /* + * Is the tool activity been checked as Run Offline in the property inspector? + */ + logger.debug("IS_TOOL_ACTIVITY_OFFLINE: " + mcContent.isRunOffline()); + request.getSession().setAttribute(IS_TOOL_ACTIVITY_OFFLINE, new Boolean(mcContent.isRunOffline()).toString()); + + + /* the following attributes are unused for the moment. + * from here... + */ + logger.debug("ACTIVITY_TITLE: " + mcContent.getTitle()); + request.getSession().setAttribute(ACTIVITY_TITLE,mcContent.getTitle()); + + logger.debug("ACTIVITY_INSTRUCTIONS: " + mcContent.getInstructions()); + request.getSession().setAttribute(ACTIVITY_INSTRUCTIONS,mcContent.getInstructions()); + + logger.debug("IS_USERNAME_VISIBLE: " + mcContent.isUsernameVisible()); + request.getSession().setAttribute(IS_USERNAME_VISIBLE, new Boolean(mcContent.isUsernameVisible()).toString()); + + logger.debug("IS_SHOW_FEEDBACK: " + new Boolean(mcContent.isShowFeedback()).toString()); + request.getSession().setAttribute(IS_SHOW_FEEDBACK, new Boolean(mcContent.isShowFeedback()).toString()); + /* .. till here */ + } + + + + /** * sets up ROOT_PATH and PATH_TO_LAMS attributes for presentation purposes * setupPaths(HttpServletRequest request) * @param request