Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java =================================================================== diff -u -r408afbaee696ef9a560b950f9509bed0c7b92d12 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaAppConstants.java (.../QaAppConstants.java) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -47,6 +47,7 @@ public static final String TARGET_MODE_MONITORING ="Monitoring"; public static final String TARGET_MODE_EXPORT_PORTFOLIO ="ExportPortfolio"; + public static final String TOOL_SERVICE ="toolService"; public static final String AUTHORING_STARTER ="starter"; public static final String TITLE ="title"; public static final String INSTRUCTIONS ="instructions"; @@ -58,6 +59,7 @@ public static final String INDIVIDUAL_LEARNER_RESULTS ="individualLearnerResults"; public static final String MAP_ALL_RESULTS_KEY ="mapAllResultsKey"; public static final String LOAD_MONITORING ="refreshMonitoring"; + public static final String SOURCE_QA_STARTER ="sourceQaStarter"; public static final String LOAD_VIEW_ONLY ="loadViewOnly"; public static final String EDIT_RESPONSE ="editResponse"; public static final String EDITABLE_RESPONSE_ID ="editableResponseId"; Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== diff -u -r0e84a4a3deefd2678f28e3e466179827de10ea01 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 0e84a4a3deefd2678f28e3e466179827de10ea01) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -180,7 +180,7 @@ qaAuthoringForm.setToolContentID(strToolContentID); - if (defaultContentIdStr != null) + if ((defaultContentIdStr != null) && (defaultContentIdStr.length() > 0)) qaAuthoringForm.setDefaultContentIdStr(new Long(defaultContentIdStr).toString()); qaAuthoringForm.setActiveModule(activeModule); Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java =================================================================== diff -u -r78513b1e0029cd7b09fc979852b95b465475e6c9 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -87,18 +87,8 @@ String questionIndex =qaAuthoringForm.getQuestionIndex(); logger.debug("pre-delete map content: " + mapQuestionContent); logger.debug("questionIndex: " + questionIndex); - - // watch here and remove request.getSession().getAttribute(REMOVABLE_QUESTION_INDEX); - String removableQuestionIndex=null; - if (activeModule.equals(MONITORING)) - { - removableQuestionIndex=(String)request.getSession().getAttribute(REMOVABLE_QUESTION_INDEX); - logger.debug("removableQuestionIndex: " + removableQuestionIndex); - questionIndex=removableQuestionIndex; - } logger.debug("final removableQuestionIndex: " + questionIndex); - long longQuestionIndex= new Long(questionIndex).longValue(); logger.debug("pre-delete count: " + mapQuestionContent.size()); @@ -222,20 +212,18 @@ boolean synchInMonitorBoolean=false; boolean usernameVisibleBoolean=false; boolean reflectBoolean=false; - //if (setCommonContent) - //{ - if ((questionsSequenced != null) && (questionsSequenced.equalsIgnoreCase("1"))) - questionsSequencedBoolean=true; - - if ((synchInMonitor != null) && (synchInMonitor.equalsIgnoreCase("1"))) - synchInMonitorBoolean=true; - - if ((usernameVisible != null) && (usernameVisible.equalsIgnoreCase("1"))) - usernameVisibleBoolean=true; - if ((reflect != null) && (reflect.equalsIgnoreCase("1"))) - reflectBoolean=true; - //} + if ((questionsSequenced != null) && (questionsSequenced.equalsIgnoreCase("1"))) + questionsSequencedBoolean=true; + + if ((synchInMonitor != null) && (synchInMonitor.equalsIgnoreCase("1"))) + synchInMonitorBoolean=true; + + if ((usernameVisible != null) && (usernameVisible.equalsIgnoreCase("1"))) + usernameVisibleBoolean=true; + + if ((reflect != null) && (reflect.equalsIgnoreCase("1"))) + reflectBoolean=true; logger.debug("questionsSequencedBoolean: " + questionsSequencedBoolean); @@ -285,7 +273,8 @@ logger.debug("end of setting common content values..."); - //if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent)) + + logger.debug("activeModule:" + activeModule); if (activeModule.equals(AUTHORING)) { logger.debug("setting other content values..."); @@ -385,6 +374,7 @@ logger.debug("removeableQaQueContent" + removeableQaQueContent); if (removeableQaQueContent != null) { + //qaContent.getQaQueContents().remove(removeableQaQueContent); qaService.removeQaQueContent(removeableQaQueContent); logger.debug("removed removeableQaQueContent from the db: " + removeableQaQueContent); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java =================================================================== diff -u -r78513b1e0029cd7b09fc979852b95b465475e6c9 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -103,6 +103,7 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.authoring.web.AuthoringConstants; import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.ToolException; @@ -124,6 +125,7 @@ import org.lamsfoundation.lams.tool.qa.util.QAConstants; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.util.AttributeNames; +import org.lamsfoundation.lams.web.util.SessionMap; public class QaMonitoringAction extends LamsDispatchAction implements QaAppConstants @@ -605,78 +607,378 @@ preparEditActivityScreenData(request, qaContent); + + if (qaService.studentActivityOccurredGlobal(qaContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + generalMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); + request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + + + QaGeneralAuthoringDTO qaGeneralAuthoringDTO = (QaGeneralAuthoringDTO)request.getAttribute(QA_GENERAL_AUTHORING_DTO); + qaGeneralAuthoringDTO.setActiveModule(MONITORING); + request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); + + return (mapping.findForward(LOAD_MONITORING)); } public ActionForward addNewQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - logger.debug("dispatching proxy editActivityQuestions..."); + logger.debug("dispatching proxy addNewQuestion..."); + QaAuthoringForm qaAuthoringForm = (QaMonitoringForm) form; - IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext()); logger.debug("qaService: " + qaService); + + String httpSessionID=qaAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); - QaAction qaAction= new QaAction(); - + String activeModule=MONITORING; + logger.debug("activeModule: " + activeModule); + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); logger.debug("strToolContentID: " + strToolContentID); - - QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue()); - logger.debug("existing qaContent:" + qaContent); - preparEditActivityScreenData(request, qaContent); - - return qaAction.addNewQuestion(mapping, form, request, response); + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue()); + logger.debug("qaContent: " + qaContent); + + if (qaContent == null) + { + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue()); + } + logger.debug("final qaContent: " + qaContent); + + QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm); + logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + + qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(0).toString()); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY); + logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapQuestionContent size: " + mapQuestionContent.size()); + + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + qaGeneralAuthoringDTO.setActivityTitle(richTextTitle); + qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + String defaultQuestionContent=request.getParameter("questionContent0"); + logger.debug("defaultQuestionContent: " + defaultQuestionContent); + qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent); + + qaGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + + authoringUtil.reconstructQuestionContentMapForAdd(mapQuestionContent, qaGeneralAuthoringDTO, request); + + sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent); + request.getSession().setAttribute(httpSessionID, sessionMap); + + qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + + QaUtils.setFormProperties(request, qaService, qaContent, + qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + qaGeneralAuthoringDTO.setToolContentID(strToolContentID); + qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + qaGeneralAuthoringDTO.setActiveModule(MONITORING); + qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + + qaAuthoringForm.setToolContentID(strToolContentID); + qaAuthoringForm.setHttpSessionID(httpSessionID); + qaAuthoringForm.setActiveModule(MONITORING); + qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + qaAuthoringForm.setCurrentTab("3"); + + + logger.debug("qaGeneralAuthoringDTO now: " + qaGeneralAuthoringDTO); + request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); + + GeneralMonitoringDTO qaGeneralMonitoringDTO=new GeneralMonitoringDTO(); + qaGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (qaService.studentActivityOccurredGlobal(qaContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + qaGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + qaGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + logger.debug("final generalMonitoringDTO: " + qaGeneralMonitoringDTO ); + request.setAttribute(QA_GENERAL_MONITORING_DTO, qaGeneralMonitoringDTO); + + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); } public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { logger.debug("dispatching proxy removeQuestion..."); + QaAuthoringForm qaAuthoringForm = (QaMonitoringForm) form; - IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext()); logger.debug("qaService: " + qaService); - QaMonitoringForm qaMonitoringForm = (QaMonitoringForm) form; - logger.debug("qaMonitoringForm: " + qaMonitoringForm); - String questionIndex=qaMonitoringForm.getQuestionIndex(); - logger.debug("questionIndex: " + questionIndex); - + String httpSessionID=qaAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String activeModule=MONITORING; + logger.debug("activeModule: " + activeModule); + + String richTextTitle = request.getParameter(TITLE); + logger.debug("richTextTitle: " + richTextTitle); + + String richTextInstructions = request.getParameter(INSTRUCTIONS); + logger.debug("richTextInstructions: " + richTextInstructions); + + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); logger.debug("strToolContentID: " + strToolContentID); - - QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue()); - logger.debug("existing qaContent:" + qaContent); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); + + QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue()); + logger.debug("qaContent: " + qaContent); + + if (qaContent == null) + { + logger.debug("using defaultContentIdStr: " + defaultContentIdStr); + qaContent=qaService.loadQa(new Long(defaultContentIdStr).longValue()); + } + logger.debug("final qaContent: " + qaContent); - preparEditActivityScreenData(request, qaContent); + QaGeneralAuthoringDTO qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm); + logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); - QaAction qaAction= new QaAction(); - return qaAction.removeQuestion(mapping, form, request, response); + String defaultQuestionContent=request.getParameter("questionContent0"); + logger.debug("defaultQuestionContent: " + defaultQuestionContent); + qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent); + + qaGeneralAuthoringDTO.setActivityTitle(richTextTitle); + qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + + Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY); + logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapQuestionContent size: " + mapQuestionContent.size()); + + qaGeneralAuthoringDTO.setEditActivityEditMode(new Boolean(true).toString()); + mapQuestionContent=authoringUtil.reconstructQuestionContentMapForRemove(mapQuestionContent, request, qaAuthoringForm, activeModule); + logger.debug("final mapQuestionContent: " + mapQuestionContent); + + sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent); + request.getSession().setAttribute(httpSessionID, sessionMap); + qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + + QaUtils.setFormProperties(request, qaService, qaContent, + qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + qaGeneralAuthoringDTO.setToolContentID(strToolContentID); + qaGeneralAuthoringDTO.setHttpSessionID(httpSessionID); + qaGeneralAuthoringDTO.setActiveModule(MONITORING); + qaGeneralAuthoringDTO.setDefaultContentIdStr(defaultContentIdStr); + qaAuthoringForm.setToolContentID(strToolContentID); + qaAuthoringForm.setHttpSessionID(httpSessionID); + qaAuthoringForm.setActiveModule(MONITORING); + qaAuthoringForm.setDefaultContentIdStr(defaultContentIdStr); + qaAuthoringForm.setCurrentTab("3"); + + + logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); + + GeneralMonitoringDTO qaGeneralMonitoringDTO=new GeneralMonitoringDTO(); + qaGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(true).toString()); + + if (qaService.studentActivityOccurredGlobal(qaContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + qaGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + qaGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + logger.debug("final generalMonitoringDTO: " + qaGeneralMonitoringDTO ); + request.setAttribute(QA_GENERAL_MONITORING_DTO, qaGeneralMonitoringDTO); + + logger.debug("fwd ing to LOAD_MONITORING: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); } + public ActionForward submitAllContent(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { logger.debug("dispatching proxy submitAllContent..."); - - IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); - logger.debug("qaService: " + qaService); - GeneralMonitoringDTO generalMonitoringDTO = new GeneralMonitoringDTO(); - generalMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + QaAuthoringForm qaAuthoringForm = (QaMonitoringForm) form; + + IQaService qaService =QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("qaService: " + qaService); - logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); - request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + String httpSessionID=qaAuthoringForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + qaAuthoringForm.setHttpSessionID(httpSessionID); + SessionMap sessionMap=(SessionMap)request.getSession().getAttribute(httpSessionID); + logger.debug("sessionMap: " + sessionMap); + + String activeModule=MONITORING; + qaAuthoringForm.setActiveModule(activeModule); + String strToolContentID=request.getParameter(AttributeNames.PARAM_TOOL_CONTENT_ID); logger.debug("strToolContentID: " + strToolContentID); - - QaContent qaContent=qaService.loadQa(new Long(strToolContentID).longValue()); - logger.debug("existing qaContent:" + qaContent); + qaAuthoringForm.setToolContentID(strToolContentID); + + String defaultContentIdStr=request.getParameter(DEFAULT_CONTENT_ID_STR); + logger.debug("defaultContentIdStr: " + defaultContentIdStr); - preparEditActivityScreenData(request, qaContent); + Map mapQuestionContent=(Map)sessionMap.get(MAP_QUESTION_CONTENT_KEY); + logger.debug("mapQuestionContent: " + mapQuestionContent); + logger.debug("mapQuestionContent size: " + mapQuestionContent.size()); + + ActionMessages errors= new ActionMessages(); + + AuthoringUtil authoringUtil= new AuthoringUtil(); + authoringUtil.reconstructQuestionContentMapForSubmit(mapQuestionContent, request); + logger.debug("before saveOrUpdateQaContent." + mapQuestionContent); + + QaGeneralAuthoringDTO qaGeneralAuthoringDTO= new QaGeneralAuthoringDTO(); + String richTextTitle = request.getParameter(TITLE); + String richTextInstructions = request.getParameter(INSTRUCTIONS); + + logger.debug("richTextTitle: " + richTextTitle); + logger.debug("richTextInstructions: " + richTextInstructions); + + qaGeneralAuthoringDTO.setActivityTitle(richTextTitle); + qaGeneralAuthoringDTO.setActivityInstructions(richTextInstructions); + + sessionMap.put(ACTIVITY_TITLE_KEY, richTextTitle); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, richTextInstructions); + + qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + logger.debug("qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + + String defaultQuestionContent=request.getParameter("questionContent0"); + logger.debug("defaultQuestionContent: " + defaultQuestionContent); + qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent); + + logger.debug("qaGeneralAuthoringDTO now: " + qaGeneralAuthoringDTO); + request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); - QaAction qaAction= new QaAction(); - return qaAction.submitAllContent(mapping, form, request, response); + /*to remove deleted entries in the questions table based on mapQuestionContent */ + authoringUtil.removeRedundantQuestions(mapQuestionContent, qaService, qaAuthoringForm, request, strToolContentID); + logger.debug("end of removing unused entries... "); + + QaContent qaContentTest=qaService.loadQa(new Long(strToolContentID).longValue()); + logger.debug("qaContentTest: " + qaContentTest); + + QaContent qaContent=authoringUtil.saveOrUpdateQaContent(mapQuestionContent, qaService, qaAuthoringForm, + request, qaContentTest, strToolContentID); + logger.debug("qaContent: " + qaContent); + + qaGeneralAuthoringDTO= QaUtils.buildGeneralAuthoringDTO(request, qaService, qaContent, qaAuthoringForm); + logger.debug("updated qaGeneralAuthoringDTO to: " + qaGeneralAuthoringDTO); + + authoringUtil.reOrganizeDisplayOrder(mapQuestionContent, qaService, qaAuthoringForm, qaContent); + + errors.clear(); + errors.add(Globals.ERROR_KEY, new ActionMessage("submit.successful")); + qaGeneralAuthoringDTO.setSbmtSuccess(new Integer(1).toString()); + + logger.debug("setting SUBMIT_SUCCESS to 1."); + + logger.debug("strToolContentID: " + strToolContentID); + QaUtils.setDefineLater(request, false, strToolContentID, qaService); + + saveErrors(request,errors); + + QaUtils.setDefineLater(request, false, qaService, strToolContentID); + logger.debug("define later set to false"); + + qaAuthoringForm.resetUserAction(); + + qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + + QaUtils.setFormProperties(request, qaService, qaContent, + qaAuthoringForm, qaGeneralAuthoringDTO, strToolContentID, defaultContentIdStr, activeModule, sessionMap, httpSessionID); + + + defaultQuestionContent=request.getParameter("questionContent0"); + logger.debug("defaultQuestionContent: " + defaultQuestionContent); + qaGeneralAuthoringDTO.setDefaultQuestionContent(defaultQuestionContent); + + + logger.debug("before saving final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); + + request.setAttribute(AuthoringConstants.LAMS_AUTHORING_SUCCESS_FLAG,Boolean.TRUE); + + request.getSession().setAttribute(httpSessionID, sessionMap); + qaAuthoringForm.setCurrentTab("3"); + + + GeneralMonitoringDTO qaGeneralMonitoringDTO=new GeneralMonitoringDTO(); + qaGeneralMonitoringDTO.setDefineLaterInEditMode(new Boolean(false).toString()); + + if (qaService.studentActivityOccurredGlobal(qaContent)) + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to false"); + qaGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(false).toString()); + } + else + { + logger.debug("USER_EXCEPTION_NO_TOOL_SESSIONS is set to true"); + qaGeneralMonitoringDTO.setUserExceptionNoToolSessions(new Boolean(true).toString()); + } + + logger.debug("final generalMonitoringDTO: " + qaGeneralMonitoringDTO ); + request.setAttribute(QA_GENERAL_MONITORING_DTO, qaGeneralMonitoringDTO); + + return mapping.findForward(LOAD_MONITORING); } /** Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java =================================================================== diff -u -r78513b1e0029cd7b09fc979852b95b465475e6c9 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -50,13 +50,12 @@ import org.lamsfoundation.lams.tool.qa.QaApplicationException; import org.lamsfoundation.lams.tool.qa.QaComparator; import org.lamsfoundation.lams.tool.qa.QaContent; -import org.lamsfoundation.lams.tool.qa.QaGeneralAuthoringDTO; import org.lamsfoundation.lams.tool.qa.QaQueContent; import org.lamsfoundation.lams.tool.qa.QaUtils; import org.lamsfoundation.lams.tool.qa.service.IQaService; import org.lamsfoundation.lams.tool.qa.service.QaServiceProxy; import org.lamsfoundation.lams.web.util.AttributeNames; -import org.lamsfoundation.lams.tool.qa.web.QaMonitoringAction; +import org.lamsfoundation.lams.web.util.SessionMap; /** * @@ -229,6 +228,16 @@ qaMonitoringAction.preparEditActivityScreenData(request, qaContent); + + SessionMap sessionMap = new SessionMap(); + sessionMap.put(ACTIVITY_TITLE_KEY, qaContent.getTitle()); + sessionMap.put(ACTIVITY_INSTRUCTIONS_KEY, qaContent.getInstructions()); + sessionMap.put(MAP_QUESTION_CONTENT_KEY, mapQuestionContent); + + qaMonitoringForm.setHttpSessionID(sessionMap.getSessionID()); + request.getSession().setAttribute(sessionMap.getSessionID(), sessionMap); + + logger.debug("fwding to : " + LOAD_MONITORING); return (mapping.findForward(LOAD_MONITORING)); } @@ -260,7 +269,6 @@ if (qaContent == null) { QaUtils.cleanUpSessionAbsolute(request); - //persistError(request, "error.content.doesNotExist"); return false; } @@ -299,7 +307,6 @@ if ((strToolContentId == null) || (strToolContentId.length() == 0)) { - //persistError(request, "error.contentId.required"); QaUtils.cleanUpSessionAbsolute(request); return (mapping.findForward(ERROR_LIST)); } @@ -314,7 +321,6 @@ } catch(NumberFormatException e) { - //persistError(request, "error.contentId.numberFormatException"); logger.debug("add error.contentId.numberFormatException to ActionMessages."); QaUtils.cleanUpSessionAbsolute(request); return (mapping.findForward(ERROR_LIST)); Index: lams_tool_laqa/web/monitoring/Edit.jsp =================================================================== diff -u -r408afbaee696ef9a560b950f9509bed0c7b92d12 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) +++ lams_tool_laqa/web/monitoring/Edit.jsp (.../Edit.jsp) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -32,7 +32,7 @@ - + Index: lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp =================================================================== diff -u -r0e25eab07d7153c61f50deb6332abc0d4ed3ec69 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp (.../MonitoringMaincontent.jsp) (revision 0e25eab07d7153c61f50deb6332abc0d4ed3ec69) +++ lams_tool_laqa/web/monitoring/MonitoringMaincontent.jsp (.../MonitoringMaincontent.jsp) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -149,8 +149,11 @@ + + + Index: lams_tool_laqa/web/monitoring/SummaryContent.jsp =================================================================== diff -u -r2b101c50f67fce212c444e41c6ec8b3422bd7075 -r1518349487f89cd30e6e04c40e0742e1c1f3d5ab --- lams_tool_laqa/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 2b101c50f67fce212c444e41c6ec8b3422bd7075) +++ lams_tool_laqa/web/monitoring/SummaryContent.jsp (.../SummaryContent.jsp) (revision 1518349487f89cd30e6e04c40e0742e1c1f3d5ab) @@ -245,50 +245,47 @@ + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + \ No newline at end of file