Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java =================================================================== diff -u -r1046868d6997114f3b043778a68b371e03182faf -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 1046868d6997114f3b043778a68b371e03182faf) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/QaUtils.java (.../QaUtils.java) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -76,8 +76,12 @@ public static String replaceNewLines(String text) { logger.debug("using text: " + text); - String newText = text.replaceAll("\n","
"); - logger.debug("newText: " + newText); + String newText = ""; + if (text != null) + { + newText = text.replaceAll("\n","
"); + logger.debug("newText: " + newText); + } return newText; } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java =================================================================== diff -u -r47ed08dc3daff962ae3af84bef5d38bb531eeabb -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 47ed08dc3daff962ae3af84bef5d38bb531eeabb) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/IQaService.java (.../IQaService.java) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -274,5 +274,8 @@ /** Get the LAMS audit service. Needed as the web layer controls the staff updating of an answer, * so the log entry must be made by the web layer. */ public IAuditService getAuditService(); + + public void updateEntry(NotebookEntry notebookEntry); + } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java =================================================================== diff -u -r9ce947cc9852ebd555bc58f4d2e632b667b86e70 -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 9ce947cc9852ebd555bc58f4d2e632b667b86e70) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/service/QaServicePOJO.java (.../QaServicePOJO.java) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -2184,4 +2184,9 @@ public void setCoreNotebookService(ICoreNotebookService coreNotebookService) { this.coreNotebookService = coreNotebookService; } + + public void updateEntry(NotebookEntry notebookEntry) { + coreNotebookService.updateEntry(notebookEntry); + } + } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java =================================================================== diff -u -r64c99cc085211cff0d1ec2cb58892bf9c0cd8bc3 -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 64c99cc085211cff0d1ec2cb58892bf9c0cd8bc3) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningAction.java (.../QaLearningAction.java) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -114,6 +114,7 @@ import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; import org.lamsfoundation.lams.tool.exception.ToolException; import org.lamsfoundation.lams.tool.qa.GeneralLearnerFlowDTO; @@ -127,6 +128,7 @@ 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.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.session.SessionManager; @@ -680,6 +682,23 @@ boolean usernameVisible=qaContent.isUsernameVisible(); generalLearnerFlowDTO.setUserNameVisible(new Boolean(usernameVisible).toString()); + + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + //String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntry.getEntry()); + String notebookEntryPresentable=notebookEntry.getEntry(); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); + qaLearningForm.setEntryText(notebookEntryPresentable); + } + + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); @@ -1069,7 +1088,36 @@ logger.debug("userID: " + userID); qaLearningForm.setUserID(userID); + //QaUtils.replaceNewLines(entryText) + String entryText=request.getParameter("entryText"); + logger.debug("entryText: " + entryText); + + /* + NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntry: " + notebookEntry); + if (notebookEntry != null) { + notebookEntry.setEntry(entryText); + qaService.updateEntry(notebookEntry); + } + + + NotebookEntry notebookEntryLocal = new NotebookEntry(); + notebookEntryLocal.setEntry(entryText); + + User userLocal = new User(); + userLocal.setUserId(new Integer(userID)); + notebookEntryLocal.setUser(userLocal); + + qaService.updateEntry(notebookEntryLocal); + logger.debug("entry updated: " + entryText); + */ + + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(toolSessionID).longValue()); logger.debug("retrieving qaSession: " + qaSession); @@ -1151,7 +1199,114 @@ return null; } + + + public ActionForward updateReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException, ToolException + { + logger.debug("dispatching updateReflection..."); + QaLearningForm qaLearningForm = (QaLearningForm) form; + + LearningUtil.saveFormRequestData(request, qaLearningForm); + + IQaService qaService = QaServiceProxy.getQaService(getServlet().getServletContext()); + logger.debug("qaService: " + qaService); + String httpSessionID=qaLearningForm.getHttpSessionID(); + logger.debug("httpSessionID: " + httpSessionID); + + qaLearningForm.setHttpSessionID(httpSessionID); + + String toolSessionID=request.getParameter(AttributeNames.PARAM_TOOL_SESSION_ID); + logger.debug("toolSessionID: " + toolSessionID); + qaLearningForm.setToolSessionID(toolSessionID); + + String userID=request.getParameter("userID"); + logger.debug("userID: " + userID); + qaLearningForm.setUserID(userID); + + QaSession qaSession=qaService.retrieveQaSessionOrNullById(new Long(toolSessionID).longValue()); + logger.debug("retrieving qaSession: " + qaSession); + + QaContent qaContent=qaSession.getQaContent(); + logger.debug("using qaContent: " + qaContent); + + + QaQueUsr qaQueUsr=qaService.getQaUserBySession(new Long(userID), qaSession.getUid()); + logger.debug("QaQueUsr:" + qaQueUsr); + + + String entryText=request.getParameter("entryText"); + logger.debug("entryText: " + entryText); + qaLearningForm.setEntryText(entryText); + + NotebookEntry notebookEntryLocal = new NotebookEntry(); + notebookEntryLocal.setEntry(entryText); + //notebookEntry.setUser(qaQueUsr); + User user = new User(); + user.setUserId(new Integer(userID)); + notebookEntryLocal.setUser(user); + + qaService.updateEntry(notebookEntryLocal); + logger.debug("entry updated: " + entryText); + + GeneralLearnerFlowDTO generalLearnerFlowDTO= new GeneralLearnerFlowDTO(); + + generalLearnerFlowDTO.setNotebookEntry(entryText); + generalLearnerFlowDTO.setRequestLearningReportProgress(new Boolean(true).toString()); + Boolean isUserNamesVisibleBoolean=new Boolean(qaContent.isUsernameVisible()); + boolean isUserNamesVisible=isUserNamesVisibleBoolean.booleanValue(); + + + QaMonitoringAction qaMonitoringAction = new QaMonitoringAction(); + logger.debug("using generalLearnerFlowDTO: " + generalLearnerFlowDTO); + qaMonitoringAction.refreshSummaryData(request, qaContent, qaService, isUserNamesVisible, true, + toolSessionID, null, generalLearnerFlowDTO, false, toolSessionID); + logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); + + + int sessionUserCount=0; + if (qaSession.getQaQueUsers() != null) + { + sessionUserCount=qaSession.getQaQueUsers().size(); + } + + if (sessionUserCount > 1) + { + logger.debug("there are multiple user responses"); + generalLearnerFlowDTO.setExistMultipleUserResponses(new Boolean(true).toString()); + } + + boolean isLearnerFinished=qaQueUsr.isLearnerFinished(); + logger.debug("isLearnerFinished: " + isLearnerFinished); + generalLearnerFlowDTO.setRequestLearningReportViewOnly(new Boolean(isLearnerFinished).toString()); + + boolean lockWhenFinished=qaContent.isLockWhenFinished(); + generalLearnerFlowDTO.setLockWhenFinished(new Boolean(lockWhenFinished).toString()); + + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntry.getEntry()); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); + qaLearningForm.setEntryText(notebookEntryPresentable); + } + + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); + logger.debug("before fwd, GENERAL_LEARNER_FLOW_DTO: " + request.getAttribute(GENERAL_LEARNER_FLOW_DTO)); + + + logger.debug("fwd'ing to." + REVISITED_LEARNER_REP); + return (mapping.findForward(REVISITED_LEARNER_REP)); + } + + /** * ActionForward submitReflection(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, ToolException @@ -1281,13 +1436,34 @@ QaContent qaContent=qaSession.getQaContent(); logger.debug("using qaContent: " + qaContent); - + + String userID=request.getParameter("userID"); + logger.debug("userID: " + userID); + qaLearningForm.setUserID(userID); + + GeneralLearnerFlowDTO generalLearnerFlowDTO= new GeneralLearnerFlowDTO(); generalLearnerFlowDTO.setActivityTitle(qaContent.getTitle()); String reflectionSubject=qaContent.getReflectionSubject(); reflectionSubject=QaUtils.replaceNewLines(reflectionSubject); generalLearnerFlowDTO.setReflectionSubject(reflectionSubject); + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntry = qaService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntry: " + notebookEntry); + + if (notebookEntry != null) { + //String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntry.getEntry()); + String notebookEntryPresentable=notebookEntry.getEntry(); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); + generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); + qaLearningForm.setEntryText(notebookEntryPresentable); + } + + request.setAttribute(GENERAL_LEARNER_FLOW_DTO, generalLearnerFlowDTO); logger.debug("final generalLearnerFlowDTO: " + generalLearnerFlowDTO); qaLearningForm.resetUserActions(); /*resets all except submitAnswersContent */ Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java =================================================================== diff -u -r332d629b3991d37d88f16c0174dc6ae2f521b4d0 -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java (.../QaLearningForm.java) (revision 332d629b3991d37d88f16c0174dc6ae2f521b4d0) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningForm.java (.../QaLearningForm.java) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -44,6 +44,7 @@ protected String endLearning; protected String refreshAnswers; protected String submitReflection; + protected String updateReflection; protected String forwardtoReflection; protected String totalQuestionCount; @@ -454,4 +455,17 @@ public void setViewAll(String viewAll) { this.viewAll = viewAll; } + /** + * @return Returns the updateReflection. + */ + public String getUpdateReflection() { + return updateReflection; + } + /** + * @param updateReflection The updateReflection to set. + */ + public void setUpdateReflection(String updateReflection) { + this.updateReflection = updateReflection; + } + } Index: lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java =================================================================== diff -u -r64c99cc085211cff0d1ec2cb58892bf9c0cd8bc3 -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 64c99cc085211cff0d1ec2cb58892bf9c0cd8bc3) +++ lams_tool_laqa/src/java/org/lamsfoundation/lams/tool/qa/web/QaLearningStarterAction.java (.../QaLearningStarterAction.java) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -302,6 +302,8 @@ if (notebookEntry != null) { String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntry.getEntry()); + //String notebookEntryPresentable=notebookEntry.getEntry(); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); } @@ -573,7 +575,26 @@ logger.debug("qaQueUsrLocal uid : " + qaQueUsrLocal.getUid()); generalLearnerFlowDTO.setUserUid(qaQueUsrLocal.getUid().toString()); + String noteBookEntry=generalLearnerFlowDTO.getNotebookEntry(); + logger.debug("noteBookEntry : " + noteBookEntry); + qaLearningForm.setEntryText(noteBookEntry); + + logger.debug("attempt getting notebookEntry: "); + NotebookEntry notebookEntryLocal = qaService.getEntry(new Long(toolSessionID), + CoreNotebookConstants.NOTEBOOK_TOOL, + MY_SIGNATURE, new Integer(userID)); + + logger.debug("notebookEntryLocal: " + notebookEntryLocal); + + if (notebookEntryLocal != null) { + String notebookEntryPresentable=QaUtils.replaceNewLines(notebookEntryLocal.getEntry()); + logger.debug("notebookEntryPresentable: " + notebookEntryPresentable); + generalLearnerFlowDTO.setNotebookEntry(notebookEntryPresentable); + qaLearningForm.setEntryText(notebookEntryPresentable); + } + + if (isLearnerFinished) { Index: lams_tool_laqa/web/authoring/AdvancedContent.jsp =================================================================== diff -u -r1046868d6997114f3b043778a68b371e03182faf -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 1046868d6997114f3b043778a68b371e03182faf) +++ lams_tool_laqa/web/authoring/AdvancedContent.jsp (.../AdvancedContent.jsp) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -25,7 +25,7 @@ styleClass="noBorder">
Index: lams_tool_laqa/web/learning/LearnerRep.jsp =================================================================== diff -u -rc7d3fcf4395bbe2cd1d4fde631985e7ca3d265de -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/web/learning/LearnerRep.jsp (.../LearnerRep.jsp) (revision c7d3fcf4395bbe2cd1d4fde631985e7ca3d265de) +++ lams_tool_laqa/web/learning/LearnerRep.jsp (.../LearnerRep.jsp) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -152,14 +152,7 @@ - -

- -

- -
+ @@ -299,16 +292,7 @@ - -

- -

-

- -

-
+ Index: lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp =================================================================== diff -u -rc7d3fcf4395bbe2cd1d4fde631985e7ca3d265de -r70dfdae7eb53ac8dd1a90f179e5b228dff55de5c --- lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp (.../RevisitedLearnerRep.jsp) (revision c7d3fcf4395bbe2cd1d4fde631985e7ca3d265de) +++ lams_tool_laqa/web/learning/RevisitedLearnerRep.jsp (.../RevisitedLearnerRep.jsp) (revision 70dfdae7eb53ac8dd1a90f179e5b228dff55de5c) @@ -157,20 +157,28 @@ - +

- +

- -
+ + + +
+ + + +
+ + +
@@ -207,7 +215,6 @@
- @@ -304,23 +311,27 @@ -

- +

-

- -

-
+ + + +
+ + + +
+ +
@@ -342,6 +353,7 @@ +