Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java =================================================================== diff -u -rf37c77ab01acdec60a9bd2f387e96ecdc30520c0 -r78513b1e0029cd7b09fc979852b95b465475e6c9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision f37c77ab01acdec60a9bd2f387e96ecdc30520c0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/AuthoringUtil.java (.../AuthoringUtil.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) @@ -191,8 +191,11 @@ logger.debug("richTextInstructions: " + richTextInstructions); String synchInMonitor=request.getParameter(SYNC_IN_MONITOR); + logger.debug("synchInMonitor: " + synchInMonitor); String usernameVisible=request.getParameter(USERNAME_VISIBLE); + logger.debug("usernameVisible: " + usernameVisible); String questionsSequenced=request.getParameter(QUESTIONS_SEQUENCED); + logger.debug("questionsSequenced: " + questionsSequenced); String reportTitle=request.getParameter(REPORT_TITLE); String monitoringReportTitle=request.getParameter(MONITORING_REPORT_TITLE); String richTextOfflineInstructions=request.getParameter(OFFLINE_INSTRUCTIONS); @@ -208,7 +211,8 @@ boolean setCommonContent=true; - if ((questionsSequenced == null) || (synchInMonitor == null) || (usernameVisible == null)) + if ((questionsSequenced == null) || (synchInMonitor == null) || + (usernameVisible == null) || (reflect == null)) { setCommonContent=false; } @@ -218,23 +222,27 @@ boolean synchInMonitorBoolean=false; boolean usernameVisibleBoolean=false; boolean reflectBoolean=false; - if (setCommonContent) - { - if (questionsSequenced.equalsIgnoreCase(ON)) - questionsSequencedBoolean=true; + //if (setCommonContent) + //{ + if ((questionsSequenced != null) && (questionsSequenced.equalsIgnoreCase("1"))) + questionsSequencedBoolean=true; - if (synchInMonitor.equalsIgnoreCase(ON)) - synchInMonitorBoolean=true; + if ((synchInMonitor != null) && (synchInMonitor.equalsIgnoreCase("1"))) + synchInMonitorBoolean=true; - - if (usernameVisible.equalsIgnoreCase(ON)) - usernameVisibleBoolean=true; - + if ((usernameVisible != null) && (usernameVisible.equalsIgnoreCase("1"))) + usernameVisibleBoolean=true; + if ((reflect != null) && (reflect.equalsIgnoreCase("1"))) reflectBoolean=true; - } + //} + + + logger.debug("questionsSequencedBoolean: " + questionsSequencedBoolean); + logger.debug("synchInMonitorBoolean: " + synchInMonitorBoolean); + logger.debug("usernameVisibleBoolean: " + usernameVisibleBoolean); + logger.debug("reflectBoolean: " + reflectBoolean); - long userId=0; if (toolUser != null) { @@ -277,7 +285,8 @@ logger.debug("end of setting common content values..."); - if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent)) + //if ((!activeModule.equals(DEFINE_LATER)) && (setCommonContent)) + if (activeModule.equals(AUTHORING)) { logger.debug("setting other content values..."); qaContent.setQuestionsSequenced(isQuestionsSequenced); /**the default question listing in learner mode will be all in the same page*/ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java =================================================================== diff -u -r408afbaee696ef9a560b950f9509bed0c7b92d12 -r78513b1e0029cd7b09fc979852b95b465475e6c9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringAction.java (.../QaMonitoringAction.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) @@ -90,6 +90,7 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.TreeMap; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -109,7 +110,10 @@ import org.lamsfoundation.lams.tool.qa.GeneralLearnerFlowDTO; import org.lamsfoundation.lams.tool.qa.GeneralMonitoringDTO; import org.lamsfoundation.lams.tool.qa.QaAppConstants; +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.QaQueUsr; import org.lamsfoundation.lams.tool.qa.QaSession; import org.lamsfoundation.lams.tool.qa.QaUsrResp; @@ -234,6 +238,8 @@ request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); prepareReflectionData(request, qaContent, qaService, null, false); + + preparEditActivityScreenData(request, qaContent); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); @@ -330,6 +336,8 @@ generalMonitoringDTO.setEditResponse(new Boolean(false).toString()); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); @@ -443,6 +451,8 @@ request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); /* note that we are casting monitoring form subclass into Authoring form*/ logger.debug("watch here: note that we are casting monitoring form subclass into Authoring form"); @@ -551,6 +561,8 @@ request.setAttribute(EDIT_ACTIVITY_DTO, editActivityDTO); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); @@ -572,7 +584,6 @@ GeneralMonitoringDTO generalMonitoringDTO = new GeneralMonitoringDTO(); - String strToolContentID= null; generalMonitoringDTO.setMonitoredContentInUse(new Boolean(false).toString()); EditActivityDTO editActivityDTO = new EditActivityDTO(); @@ -584,28 +595,61 @@ logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + 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); + QaUtils.setDefineLater(request, true,strToolContentID, qaService); + + preparEditActivityScreenData(request, qaContent); + return (mapping.findForward(LOAD_MONITORING)); } public ActionForward addNewQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { logger.debug("dispatching proxy editActivityQuestions..."); + + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("qaService: " + qaService); + QaAction qaAction= new QaAction(); + 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); } public ActionForward removeQuestion(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { logger.debug("dispatching proxy removeQuestion..."); + + 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 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); + QaAction qaAction= new QaAction(); return qaAction.removeQuestion(mapping, form, request, response); } @@ -614,15 +658,25 @@ 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()); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + + 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); QaAction qaAction= new QaAction(); return qaAction.submitAllContent(mapping, form, request, response); - } /** @@ -697,6 +751,8 @@ logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); @@ -794,6 +850,8 @@ refreshSummaryData(request, qaContent, qaService, true, false, null, null, generalLearnerFlowDTO, true); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); @@ -901,6 +959,8 @@ prepareReflectionData(request, qaContent, qaService,null, false); + preparEditActivityScreenData(request, qaContent); + EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); logger.debug("isContentInUse:" + isContentInUse); @@ -999,6 +1059,8 @@ prepareReflectionData(request, qaContent, qaService,null, false); + preparEditActivityScreenData(request, qaContent); + EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); logger.debug("isContentInUse:" + isContentInUse); @@ -1046,6 +1108,8 @@ prepareReflectionData(request, qaContent, qaService,null, false); + preparEditActivityScreenData(request, qaContent); + EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); @@ -1280,8 +1344,9 @@ request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); } - prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); @@ -1337,6 +1402,8 @@ generalMonitoringDTO.setCountSessionComplete(new Integer(countSessionComplete).toString()); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); @@ -1391,7 +1458,6 @@ request.setAttribute(SUMMARY_TOOL_SESSIONS, summaryToolSessions); logger.debug("SUMMARY_TOOL_SESSIONS: " + request.getAttribute(SUMMARY_TOOL_SESSIONS)); - Map summaryToolSessionsId=MonitoringUtil.populateToolSessionsId(request, qaContent, qaService); logger.debug("summaryToolSessionsId: " + summaryToolSessionsId); request.setAttribute(SUMMARY_TOOL_SESSIONS_ID, summaryToolSessionsId); @@ -1422,6 +1488,8 @@ logger.debug("SELECTION_CASE: " + request.getAttribute(SELECTION_CASE)); prepareReflectionData(request, qaContent, qaService,null, false); + + preparEditActivityScreenData(request, qaContent); EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); @@ -1506,6 +1574,8 @@ prepareReflectionData(request, qaContent, qaService,null, false); + preparEditActivityScreenData(request, qaContent); + EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); logger.debug("isContentInUse:" + isContentInUse); @@ -1557,10 +1627,17 @@ generalLearnerFlowDTO.setUserName(userName); } - logger.debug("generalLearnerFlowDTO: " + generalLearnerFlowDTO); request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(sessionId).longValue()); + logger.debug("qaSession: " + qaSession); + + QaContent qaContent=qaSession.getQaContent(); + logger.debug("qaContent: " + qaContent); + + preparEditActivityScreenData(request, qaContent); + return mapping.findForward(LEARNER_NOTEBOOK); } @@ -1649,4 +1726,56 @@ } } + + + public void preparEditActivityScreenData(HttpServletRequest request, QaContent qaContent) + { + logger.debug("starting preparEditActivityScreenData: " + qaContent); + QaGeneralAuthoringDTO qaGeneralAuthoringDTO= new QaGeneralAuthoringDTO(); + + if (qaContent.getTitle() == null) + { + qaGeneralAuthoringDTO.setActivityTitle(DEFAULT_QA_TITLE); + } + else + { + qaGeneralAuthoringDTO.setActivityTitle(qaContent.getTitle()); + } + + + if (qaContent.getInstructions() == null) + { + qaGeneralAuthoringDTO.setActivityInstructions(DEFAULT_QA_INSTRUCTIONS); + } + else + { + qaGeneralAuthoringDTO.setActivityInstructions(qaContent.getInstructions()); + } + + Map mapQuestionContent= new TreeMap(new QaComparator()); + + Iterator queIterator=qaContent.getQaQueContents().iterator(); + Long mapIndex=new Long(1); + while (queIterator.hasNext()) + { + QaQueContent qaQueContent=(QaQueContent) queIterator.next(); + if (qaQueContent != null) + { + logger.debug("question: " + qaQueContent.getQuestion()); + mapQuestionContent.put(mapIndex.toString(),qaQueContent.getQuestion()); + /** + * make the first entry the default(first) one for jsp + */ + if (mapIndex.longValue() == 1) + qaGeneralAuthoringDTO.setDefaultQuestionContent(qaQueContent.getQuestion()); + mapIndex=new Long(mapIndex.longValue()+1); + } + } + logger.debug("Map initialized with mapQuestionContent: " + mapQuestionContent); + qaGeneralAuthoringDTO.setMapQuestionContent(mapQuestionContent); + + logger.debug("final qaGeneralAuthoringDTO: " + qaGeneralAuthoringDTO); + request.setAttribute(QA_GENERAL_AUTHORING_DTO, qaGeneralAuthoringDTO); + } + } \ No newline at end of file Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java =================================================================== diff -u -r408afbaee696ef9a560b950f9509bed0c7b92d12 -r78513b1e0029cd7b09fc979852b95b465475e6c9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 408afbaee696ef9a560b950f9509bed0c7b92d12) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaMonitoringStarterAction.java (.../QaMonitoringStarterAction.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) @@ -50,6 +50,7 @@ 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; @@ -111,6 +112,7 @@ return validateParameters; } + GeneralMonitoringDTO generalMonitoringDTO= new GeneralMonitoringDTO(); boolean initData=initialiseMonitoringData(mapping, qaMonitoringForm, request, response, qaService, generalMonitoringDTO); logger.debug("initData: " + initData); @@ -205,6 +207,7 @@ generalMonitoringDTO.setDeletedAttachmentList(new ArrayList()); /** ...till here **/ + EditActivityDTO editActivityDTO = new EditActivityDTO(); boolean isContentInUse=QaUtils.isContentInUse(qaContent); logger.debug("isContentInUse:" + isContentInUse); @@ -221,6 +224,12 @@ logger.debug("final generalMonitoringDTO: " + generalMonitoringDTO ); request.setAttribute(QA_GENERAL_MONITORING_DTO, generalMonitoringDTO); + + /*for Edit Activity screen, BasicTab-ViewOnly*/ + qaMonitoringAction.preparEditActivityScreenData(request, qaContent); + + + logger.debug("fwding to : " + LOAD_MONITORING); return (mapping.findForward(LOAD_MONITORING)); } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java =================================================================== diff -u -rf37c77ab01acdec60a9bd2f387e96ecdc30520c0 -r78513b1e0029cd7b09fc979852b95b465475e6c9 --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision f37c77ab01acdec60a9bd2f387e96ecdc30520c0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaStarterAction.java (.../QaStarterAction.java) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) @@ -409,10 +409,15 @@ QaUtils.populateAuthoringDTO(request, qaContent, qaGeneralAuthoringDTO); - qaAuthoringForm.setUsernameVisible(qaContent.isUsernameVisible()?ON:OFF); - qaAuthoringForm.setSynchInMonitor(qaContent.isSynchInMonitor()?ON:OFF); - qaAuthoringForm.setQuestionsSequenced(qaContent.isQuestionsSequenced()?ON:OFF); + //qaAuthoringForm.setUsernameVisible(qaContent.isUsernameVisible()?ON:OFF); + qaAuthoringForm.setUsernameVisible(qaContent.isUsernameVisible()?"1":"0"); + //qaAuthoringForm.setSynchInMonitor(qaContent.isSynchInMonitor()?ON:OFF); + qaAuthoringForm.setSynchInMonitor(qaContent.isSynchInMonitor()?"1":"0"); + + //qaAuthoringForm.setQuestionsSequenced(qaContent.isQuestionsSequenced()?ON:OFF); + qaAuthoringForm.setQuestionsSequenced(qaContent.isQuestionsSequenced()?"1":"0"); + logger.debug("QaContent isReflect: " + qaContent.isReflect()); qaAuthoringForm.setReflect(qaContent.isReflect()?"1":"0"); Index: lams_tool_laqa/web/authoring/AdvancedContent.jsp =================================================================== diff -u -rf37c77ab01acdec60a9bd2f387e96ecdc30520c0 -r78513b1e0029cd7b09fc979852b95b465475e6c9 --- lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision f37c77ab01acdec60a9bd2f387e96ecdc30520c0) +++ lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 78513b1e0029cd7b09fc979852b95b465475e6c9) @@ -34,13 +34,10 @@ : - - - - - - - + + + @@ -49,13 +46,10 @@ : - - - + + - - - @@ -80,20 +74,14 @@ - - : - - - - - - - + +