Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dbupdates/patch20180716.sql =================================================================== diff -u --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dbupdates/patch20180716.sql (revision 0) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/dbupdates/patch20180716.sql (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -0,0 +1,23 @@ +-- Turn off autocommit, so nothing is committed if there is an error +SET AUTOCOMMIT = 0; +SET FOREIGN_KEY_CHECKS=0; +----------------------Put all sql statements below here------------------------- + +-- LDEV-4440 Change tool access URLs after migration to Spring MVC +UPDATE lams_tool SET + author_url = 'tool/lanb11/authoring/authoring.do', + learner_url = 'tool/lanb11/learning/learner.do', + learner_preview_url = 'tool/lanb11/learning/author.do', + learner_progress_url = 'tool/lanb11/learning/teacher.do', + monitor_url = 'tool/lanb11/monitoring/monitoring.do', + pedagogical_planner_url = 'tool/lanb11/pedagogicalPlanner/initPedagogicalPlannerForm.do' +WHERE tool_signature = 'lanb11'; + +UPDATE lams_tool SET tool_version='20180716' WHERE tool_signature='lanb11'; + +----------------------Put all sql statements above here------------------------- + +-- If there were no errors, commit and restore autocommit to on +COMMIT; +SET AUTOCOMMIT = 1; +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbAuthoringController.java =================================================================== diff -u -rebd388504924fe0a06bbf20a06fe0032abbf8d15 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbAuthoringController.java (.../NbAuthoringController.java) (revision ebd388504924fe0a06bbf20a06fe0032abbf8d15) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbAuthoringController.java (.../NbAuthoringController.java) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -67,6 +67,7 @@ * @author mtruong */ @Controller +@RequestMapping("/authoring") public class NbAuthoringController { private static Logger logger = Logger.getLogger(NbAuthoringController.class.getName()); Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerController.java =================================================================== diff -u -r692cfbd845483c893176e6a4eb78d789399977ba -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerController.java (.../NbLearnerController.java) (revision 692cfbd845483c893176e6a4eb78d789399977ba) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerController.java (.../NbLearnerController.java) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -1,210 +1,387 @@ -///**************************************************************** -// * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) -// * ============================================================= -// * License Information: http://lamsfoundation.org/licensing/lams/2.0/ -// * -// * This program is free software; you can redistribute it and/or modify -// * it under the terms of the GNU General Public License version 2.0 -// * as published by the Free Software Foundation. -// * -// * This program is distributed in the hope that it will be useful, -// * but WITHOUT ANY WARRANTY; without even the implied warranty of -// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// * GNU General Public License for more details. -// * -// * You should have received a copy of the GNU General Public License -// * along with this program; if not, write to the Free Software -// * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 -// * USA -// * -// * http://www.gnu.org/licenses/gpl.txt -// * **************************************************************** -// */ -// -//package org.lamsfoundation.lams.tool.noticeboard.web.controller; -// -//import java.io.IOException; -//import java.util.Date; -// -//import javax.servlet.ServletException; -//import javax.servlet.http.HttpServletRequest; -//import javax.servlet.http.HttpServletResponse; -//import javax.servlet.http.HttpSession; -// -//import org.apache.log4j.Logger; -//import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; -//import org.lamsfoundation.lams.notebook.model.NotebookEntry; -//import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; -//import org.lamsfoundation.lams.tool.ToolAccessMode; -//import org.lamsfoundation.lams.tool.ToolSessionManager; -//import org.lamsfoundation.lams.tool.exception.DataMissingException; -//import org.lamsfoundation.lams.tool.exception.ToolException; -//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants; -//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; -//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession; -//import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; -//import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; -//import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy; -//import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; -//import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; -//import org.lamsfoundation.lams.tool.noticeboard.web.form.NbLearnerForm; -//import org.lamsfoundation.lams.usermanagement.dto.UserDTO; -//import org.lamsfoundation.lams.util.MessageService; -//import org.lamsfoundation.lams.util.WebUtil; -//import org.lamsfoundation.lams.web.session.SessionManager; -//import org.lamsfoundation.lams.web.util.AttributeNames; -//import org.springframework.beans.factory.annotation.Autowired; -//import org.springframework.beans.factory.annotation.Qualifier; -//import org.springframework.stereotype.Controller; -//import org.springframework.web.bind.annotation.ModelAttribute; -//import org.springframework.web.bind.annotation.RequestMapping; -//import org.springframework.web.context.WebApplicationContext; -// -///** -// * Creation Date: 29-06-05 -// * -// * This class has been created so that when a learner finishes an activity, -// * leaveToolSession() will be called to inform the progress engine -// * that the user has completed this activity. -// * -// * A note: at the time of writing (11-08-05) a null pointer exception -// * occurs when making a call to leaveToolSession(). Will have to wait until -// * the learner side of things is tested first. -// * -// * -// * -// * -// * -// * -// * -// * -// */ -//@Controller -//@RequestMapping("/learner") -//public class NbLearnerController implements NoticeboardConstants { -// -// static Logger logger = Logger.getLogger(NbLearnerController.class.getName()); -// -// @Autowired -// @Qualifier("nbService") -// private INoticeboardService nbService; -// -// @Autowired -// @Qualifier("nbMessageService") -// private MessageService messageService; -// -// @Autowired -// private WebApplicationContext applicationContext; -// -// /** Get the user id from the shared session */ -// public Long getUserID(HttpServletRequest request) { -// // set up the user details -// HttpSession ss = SessionManager.getSession(); -// UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); -// if (user == null) { -// String error = messageService.getMessage(NoticeboardConstants.ERR_MISSING_PARAM, "User"); -// logger.error(error); -// throw new NbApplicationException(error); -// } -// return new Long(user.getUserID().longValue()); -// } -// -// /** -// * Indicates that the user has finished viewing the noticeboard. -// * The session is set to complete and leaveToolSession is called. -// * -// * @throws ServletException -// * @throws IOException -// */ -// public String finish(@ModelAttribute NbLearnerForm nbLearnerForm, HttpServletRequest request, -// HttpServletResponse response) throws ServletException, IOException { -// -// Long userID = getUserID(request); -// -// Long toolSessionID = NbWebUtil.convertToLong(nbLearnerForm.getToolSessionID()); -// if (toolSessionID == null) { -// String error = "Unable to continue. The parameters tool session id is missing"; -// logger.error(error); -// throw new NbApplicationException(error); -// } -// -// ToolSessionManager sessionMgrService = NoticeboardServiceProxy -// .getNbSessionManager(applicationContext.getServletContext()); -// -// ToolAccessMode mode = WebUtil.getToolAccessMode(nbLearnerForm.getMode()); -// if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { -// NoticeboardSession nbSession = nbService.retrieveNoticeboardSession(toolSessionID); -// NoticeboardUser nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); -// -// nbUser.setUserStatus(NoticeboardUser.COMPLETED); -// nbService.updateNoticeboardSession(nbSession); -// nbService.updateNoticeboardUser(nbUser); -// -// // Create the notebook entry if reflection is set. -// NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); -// if (nbContent.getReflectOnActivity()) { -// // check for existing notebook entry -// NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, -// NoticeboardConstants.TOOL_SIGNATURE, userID.intValue()); -// -// if (entry == null) { -// // create new entry -// nbService.createNotebookEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, -// NoticeboardConstants.TOOL_SIGNATURE, userID.intValue(), nbLearnerForm.getReflectionText()); -// } else { -// // update existing entry -// entry.setEntry(nbLearnerForm.getReflectionText()); -// entry.setLastModified(new Date()); -// nbService.updateEntry(entry); -// } -// } -// -// String nextActivityUrl; -// try { -// nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, getUserID(request)); -// } catch (DataMissingException e) { -// logger.error(e); -// throw new ServletException(e); -// } catch (ToolException e) { -// logger.error(e); -// throw new ServletException(e); -// } -// -// response.sendRedirect(nextActivityUrl); -// -// return null; -// -// } -// request.setAttribute(NoticeboardConstants.READ_ONLY_MODE, "true"); -// -// return "learnerContent"; -// -// } -// -// /** -// * Indicates that the user has finished viewing the noticeboard, and will be -// * passed onto the Notebook reflection screen. -// */ -// public String reflect(@ModelAttribute NbLearnerForm nbLearnerForm, HttpServletRequest request) { -// -// Long toolSessionID = NbWebUtil.convertToLong(nbLearnerForm.getToolSessionID()); -// NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); -// request.setAttribute("reflectInstructions", nbContent.getReflectInstructions()); -// request.setAttribute("title", nbContent.getTitle()); -// request.setAttribute("allowComments", nbContent.isAllowComments()); -// request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike()); -// request.setAttribute("anonymous", nbContent.isAllowAnonymous()); -// -// // get the existing reflection entry -// NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, -// NoticeboardConstants.TOOL_SIGNATURE, getUserID(request).intValue()); -// if (entry != null) { -// request.setAttribute("reflectEntry", entry.getEntry()); -// } -// -// LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, -// applicationContext.getServletContext()); -// -// return "reflect"; -// } -//} \ No newline at end of file +/**************************************************************** + * Copyright (C) 2005 LAMS Foundation (http://lamsfoundation.org) + * ============================================================= + * License Information: http://lamsfoundation.org/licensing/lams/2.0/ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2.0 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 + * USA + * + * http://www.gnu.org/licenses/gpl.txt + * **************************************************************** + */ + +package org.lamsfoundation.lams.tool.noticeboard.web.controller; + +import java.io.IOException; +import java.util.Date; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.lamsfoundation.lams.tool.ToolAccessMode; +import org.lamsfoundation.lams.tool.ToolSessionManager; +import org.lamsfoundation.lams.tool.exception.DataMissingException; +import org.lamsfoundation.lams.tool.exception.ToolException; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardConstants; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardContent; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardSession; +import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; +import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.service.NoticeboardServiceProxy; +import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; +import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; +import org.lamsfoundation.lams.tool.noticeboard.web.form.NbLearnerForm; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.util.MessageService; +import org.lamsfoundation.lams.util.WebUtil; +import org.lamsfoundation.lams.web.session.SessionManager; +import org.lamsfoundation.lams.web.util.AttributeNames; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Controller; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.context.WebApplicationContext; + +/** + * Creation Date: 27-06-05 + * + * The learner url can be of three modes learner, teacher or author. Depending on + * what mode was set, it will trigger the corresponding action. If the mode parameter + * is missing or a key is not found in the keymap, it will call the unspecified method + * which defaults to the learner action. + * + *

+ * The difference between author mode (which is basically the preview) + * is that if the defineLater flag is set, it will not be able to see the noticeboard screen + *

+ * + * + * + * + * + * + * + * + * + */ +@Controller +@RequestMapping("/learning") +public class NbLearnerController { + + static Logger logger = Logger.getLogger(NbLearnerController.class.getName()); + + @Autowired + @Qualifier("nbService") + private INoticeboardService nbService; + + @Autowired + @Qualifier("nbMessageService") + private MessageService messageService; + + @Autowired + private WebApplicationContext applicationContext; + + private UserDTO getUserDTO(HttpServletRequest request) { + // set up the user details + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + if (user == null) { + String error = messageService.getMessage(NoticeboardConstants.ERR_MISSING_PARAM, "User"); + logger.error(error); + throw new NbApplicationException(error); + } + return user; + } + + /** Get the user id from the shared session */ + public Long getUserID(HttpServletRequest request) { + UserDTO user = getUserDTO(request); + return new Long(user.getUserID().longValue()); + } + + /** Get the user id from the url - needed for the monitoring mode */ + public Long getUserIDFromURLCall(HttpServletRequest request) { + return WebUtil.readLongParam(request, AttributeNames.PARAM_USER_ID, false); + } + + public String unspecified(@ModelAttribute NbLearnerForm NbLearnerForm, HttpServletRequest request, + HttpServletResponse response) { + + return learner(NbLearnerForm, request, response); + } + + @RequestMapping("/learner") + public String learner(@ModelAttribute NbLearnerForm NbLearnerForm, HttpServletRequest request, + HttpServletResponse response) { + + NoticeboardContent nbContent = null; + NoticeboardUser nbUser = null; + + MultiValueMap errorMap = new LinkedMultiValueMap<>(); + + Long toolSessionID = Long.valueOf(NbLearnerForm.getToolSessionID()); + + if (toolSessionID == null) { + String error = "Unable to continue. The parameters tool session id is missing"; + logger.error(error); + throw new NbApplicationException(error); + } + + nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + // nbSession = nbService.retrieveNoticeboardSession(toolSessionId); + + if (nbContent == null) { + String error = "An Internal error has occurred. Please exit and retry this sequence"; + logger.error(error); + throw new NbApplicationException(error); + } + + if (isFlagSet(nbContent, NoticeboardConstants.FLAG_DEFINE_LATER)) { + return "defineLater"; + } + + boolean readOnly = false; + ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, false); + Long userID = null; + if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { + userID = getUserID(request); + nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); + + if (!nbContent.isContentInUse()) { + /* Set the ContentInUse flag to true, and defineLater flag to false */ + nbContent.setContentInUse(true); + nbService.saveNoticeboard(nbContent); + } + + if (nbUser == null) { + //create a new user with this session id + nbUser = new NoticeboardUser(userID); + UserDTO user = getUserDTO(request); + nbUser.setUsername(user.getLogin()); + nbUser.setFullname(user.getFirstName() + " " + user.getLastName()); + nbService.addUser(toolSessionID, nbUser); + } + } else { + // user will not exist if force completed. + userID = getUserIDFromURLCall(request); + nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); + readOnly = true; + } + + NbLearnerForm.copyValuesIntoForm(nbContent, readOnly, mode.toString()); + + NotebookEntry notebookEntry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, userID.intValue()); + if (notebookEntry != null) { + request.setAttribute("reflectEntry", notebookEntry.getEntry()); + } + request.setAttribute("reflectInstructions", nbContent.getReflectInstructions()); + request.setAttribute("reflectOnActivity", nbContent.getReflectOnActivity()); + request.setAttribute("allowComments", nbContent.isAllowComments()); + request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike()); + request.setAttribute("anonymous", nbContent.isAllowAnonymous()); + + Boolean userFinished = (nbUser != null && NoticeboardUser.COMPLETED.equals(nbUser.getUserStatus())); + request.setAttribute("userFinished", userFinished); + + LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, + applicationContext.getServletContext()); + + /* + * Checks to see if the runOffline flag is set. + * If the particular flag is set, control is forwarded to jsp page + * displaying to the user the message according to what flag is set. + */ + if (displayMessageToUser(nbContent, errorMap)) { + request.setAttribute("errorMap", errorMap); + return "message"; + } + + return "learnerContent"; + + } + + @RequestMapping("/teacher") + public String teacher(@ModelAttribute NbLearnerForm NbLearnerForm, HttpServletRequest request, + HttpServletResponse response) throws NbApplicationException { + + request.setAttribute("mode", "teacher"); + return learner(NbLearnerForm, request, response); + } + + @RequestMapping("/author") + public String author(@ModelAttribute NbLearnerForm NbLearnerForm, HttpServletRequest request, + HttpServletResponse response) throws NbApplicationException { + + request.setAttribute("mode", "author"); + return learner(NbLearnerForm, request, response); + + } + + /** + *

+ * Performs a check on the flag indicated by flag + * In this noticeboard tool, there are 3 possible flags: + *

  • defineLater
  • + *
  • contentInUse
  • + *
    + * Returns true if the flag is set, false otherwise + */ + private boolean isFlagSet(NoticeboardContent content, int flag) throws NbApplicationException { + switch (flag) { + case NoticeboardConstants.FLAG_DEFINE_LATER: + return (content.isDefineLater()); + // break; + case NoticeboardConstants.FLAG_CONTENT_IN_USE: + return (content.isContentInUse()); + // break; + default: + throw new NbApplicationException("Invalid flag"); + } + + } + + /** + *

    + * This methods checks the defineLater and runOffline flag. + * If defineLater flag is set, then a message is added to an ActionMessages + * object saying that the contents have not been defined yet. If the runOffline + * flag is set, a message is added to ActionMessages saying that the contents + * are not being run online. + * This method will return true if any one of the defineLater or runOffline flag is set. + * Otherwise false will be returned. + *

    + */ + private boolean displayMessageToUser(NoticeboardContent content, MultiValueMap errorMap) { + boolean isDefineLaterSet = isFlagSet(content, NoticeboardConstants.FLAG_DEFINE_LATER); + errorMap = new LinkedMultiValueMap<>(); + if (isDefineLaterSet) { + if (isDefineLaterSet) { + errorMap.add("GLOBAL", "message.defineLaterSet"); + } + return true; + } else { + return false; + } + } + + /** + * Indicates that the user has finished viewing the noticeboard. + * The session is set to complete and leaveToolSession is called. + */ + @RequestMapping("/finish") + public String finish(@ModelAttribute NbLearnerForm nbLearnerForm, HttpServletRequest request, + HttpServletResponse response) throws ServletException, IOException { + + Long userID = getUserID(request); + + Long toolSessionID = NbWebUtil.convertToLong(nbLearnerForm.getToolSessionID()); + if (toolSessionID == null) { + String error = "Unable to continue. The parameters tool session id is missing"; + logger.error(error); + throw new NbApplicationException(error); + } + + ToolSessionManager sessionMgrService = NoticeboardServiceProxy + .getNbSessionManager(applicationContext.getServletContext()); + + ToolAccessMode mode = WebUtil.getToolAccessMode(nbLearnerForm.getMode()); + if (mode == ToolAccessMode.LEARNER || mode == ToolAccessMode.AUTHOR) { + NoticeboardSession nbSession = nbService.retrieveNoticeboardSession(toolSessionID); + NoticeboardUser nbUser = nbService.retrieveNbUserBySession(userID, toolSessionID); + + nbUser.setUserStatus(NoticeboardUser.COMPLETED); + nbService.updateNoticeboardSession(nbSession); + nbService.updateNoticeboardUser(nbUser); + + // Create the notebook entry if reflection is set. + NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + if (nbContent.getReflectOnActivity()) { + // check for existing notebook entry + NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, userID.intValue()); + + if (entry == null) { + // create new entry + nbService.createNotebookEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, userID.intValue(), nbLearnerForm.getReflectionText()); + } else { + // update existing entry + entry.setEntry(nbLearnerForm.getReflectionText()); + entry.setLastModified(new Date()); + nbService.updateEntry(entry); + } + } + + String nextActivityUrl; + try { + nextActivityUrl = sessionMgrService.leaveToolSession(toolSessionID, getUserID(request)); + } catch (DataMissingException e) { + logger.error(e); + throw new ServletException(e); + } catch (ToolException e) { + logger.error(e); + throw new ServletException(e); + } + + response.sendRedirect(nextActivityUrl); + + return null; + + } + request.setAttribute(NoticeboardConstants.READ_ONLY_MODE, "true"); + + return "learnerContent"; + + } + + /** + * Indicates that the user has finished viewing the noticeboard, and will be + * passed onto the Notebook reflection screen. + */ + @RequestMapping(path = "/reflect", method = RequestMethod.POST) + public String reflect(@ModelAttribute NbLearnerForm nbLearnerForm, HttpServletRequest request) { + + Long toolSessionID = NbWebUtil.convertToLong(nbLearnerForm.getToolSessionID()); + NoticeboardContent nbContent = nbService.retrieveNoticeboardBySessionID(toolSessionID); + request.setAttribute("reflectInstructions", nbContent.getReflectInstructions()); + request.setAttribute("title", nbContent.getTitle()); + request.setAttribute("allowComments", nbContent.isAllowComments()); + request.setAttribute("likeAndDislike", nbContent.isCommentsLikeAndDislike()); + request.setAttribute("anonymous", nbContent.isAllowAnonymous()); + + // get the existing reflection entry + NotebookEntry entry = nbService.getEntry(toolSessionID, CoreNotebookConstants.NOTEBOOK_TOOL, + NoticeboardConstants.TOOL_SIGNATURE, getUserID(request).intValue()); + if (entry != null) { + request.setAttribute("reflectEntry", entry.getEntry()); + } + + LearningWebUtil.putActivityPositionInRequestByToolSessionId(toolSessionID, request, + applicationContext.getServletContext()); + + return "reflect"; + } + +} \ No newline at end of file Fisheye: Tag 0d58de1fbc5b7e7ab913902946d3368c14ccfb98 refers to a dead (removed) revision in file `lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbLearnerStarterController.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbMonitoringController.java =================================================================== diff -u -r692cfbd845483c893176e6a4eb78d789399977ba -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbMonitoringController.java (.../NbMonitoringController.java) (revision 692cfbd845483c893176e6a4eb78d789399977ba) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbMonitoringController.java (.../NbMonitoringController.java) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -41,6 +41,7 @@ import org.lamsfoundation.lams.tool.noticeboard.NoticeboardUser; import org.lamsfoundation.lams.tool.noticeboard.dto.ReflectionDTO; import org.lamsfoundation.lams.tool.noticeboard.service.INoticeboardService; +import org.lamsfoundation.lams.tool.noticeboard.util.NbApplicationException; import org.lamsfoundation.lams.tool.noticeboard.util.NbWebUtil; import org.lamsfoundation.lams.tool.noticeboard.web.form.NbMonitoringForm; import org.lamsfoundation.lams.util.WebUtil; @@ -58,6 +59,7 @@ * @author mtruong */ @Controller +@RequestMapping("/monitoring") public class NbMonitoringController { static Logger logger = Logger.getLogger(NbMonitoringController.class.getName()); @@ -73,11 +75,11 @@ Long toolContentId = NbWebUtil.convertToLong(request.getParameter(NoticeboardConstants.TOOL_CONTENT_ID)); String contentFolderID = WebUtil.readStrParam(request, NoticeboardConstants.CONTENT_FOLDER_ID); - List messages = new ArrayList<>(); + if (toolContentId == null) { String error = "Unable to continue. Tool content id missing"; - messages.add(error); - request.setAttribute("messages", messages); + logger.error(error); + throw new NbApplicationException(error); } NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId); @@ -138,6 +140,7 @@ return "/monitoring/monitoring"; } + @RequestMapping("/viewReflection") public String viewReflection(@ModelAttribute NbMonitoringForm nbMonitoringForm, HttpServletRequest request) { Long userId = NbWebUtil.convertToLong(request.getParameter(NoticeboardConstants.USER_ID)); Long toolSessionId = NbWebUtil.convertToLong(request.getParameter(NoticeboardConstants.TOOL_SESSION_ID)); @@ -152,6 +155,7 @@ return "/monitoring/reflection"; } + @RequestMapping("/viewComments") public String viewComments(@ModelAttribute NbMonitoringForm nbMonitoringForm, HttpServletRequest request) { Long toolSessionID = WebUtil.readLongParam(request, NoticeboardConstants.TOOL_SESSION_ID, false); Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbPedagogicalPlannerController.java =================================================================== diff -u -rebd388504924fe0a06bbf20a06fe0032abbf8d15 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbPedagogicalPlannerController.java (.../NbPedagogicalPlannerController.java) (revision ebd388504924fe0a06bbf20a06fe0032abbf8d15) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/controller/NbPedagogicalPlannerController.java (.../NbPedagogicalPlannerController.java) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -23,9 +23,6 @@ package org.lamsfoundation.lams.tool.noticeboard.web.controller; -import java.util.ArrayList; -import java.util.List; - import javax.servlet.http.HttpServletRequest; import org.apache.log4j.Logger; @@ -37,6 +34,8 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; @@ -75,17 +74,20 @@ } - @RequestMapping("/saveorupdate") + @RequestMapping("/saveOrUpdate") public String saveOrUpdatePedagogicalPlannerForm(@ModelAttribute NbPedagogicalPlannerForm plannerForm, - List messages, HttpServletRequest request) { + HttpServletRequest request) { - plannerForm.validate(messages); - if (messages != null && !messages.isEmpty()) { + MultiValueMap errorMap = new LinkedMultiValueMap<>(); + errorMap = plannerForm.validate(); + if (errorMap.isEmpty()) { String content = plannerForm.getBasicContent(); Long toolContentID = plannerForm.getToolContentID(); NoticeboardContent noticeboard = nbService.retrieveNoticeboard(toolContentID); noticeboard.setContent(content); nbService.saveNoticeboard(noticeboard); + } else { + request.setAttribute("errorMap", errorMap); } return "authoring/pedagogicalPlannerForm"; Index: lams_tool_nb/web/WEB-INF/tags/AuthoringButton.tag =================================================================== diff -u -r36580dd1c205ab30b25db66efa5e8499ae5a308e -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 36580dd1c205ab30b25db66efa5e8499ae5a308e) +++ lams_tool_nb/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -32,7 +32,6 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> Index: lams_tool_nb/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag =================================================================== diff -u -r540199b8a30f643c2ca5960c007e5bef74acd397 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag (.../AuthoringRatingAllStyleCriteria.tag) (revision 540199b8a30f643c2ca5960c007e5bef74acd397) +++ lams_tool_nb/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag (.../AuthoringRatingAllStyleCriteria.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -8,7 +8,6 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_tool_nb/web/WEB-INF/tags/AuthoringRatingCriteria.tag =================================================================== diff -u -ra2d72bee6029b7e05e8cd696c02db214f3049365 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/AuthoringRatingCriteria.tag (.../AuthoringRatingCriteria.tag) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) +++ lams_tool_nb/web/WEB-INF/tags/AuthoringRatingCriteria.tag (.../AuthoringRatingCriteria.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -8,7 +8,6 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_tool_nb/web/WEB-INF/tags/CommentsAuthor.tag =================================================================== diff -u -r36580dd1c205ab30b25db66efa5e8499ae5a308e -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision 36580dd1c205ab30b25db66efa5e8499ae5a308e) +++ lams_tool_nb/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -1,5 +1,4 @@ <%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-html" prefix="html"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> Index: lams_tool_nb/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rb32cbfc76a3cd150823b3696160d5fd4fa6cde84 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision b32cbfc76a3cd150823b3696160d5fd4fa6cde84) +++ lams_tool_nb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -89,7 +89,6 @@ - ${toolForm.toolSessionID} Index: lams_tool_nb/web/WEB-INF/tags/Rating.tag =================================================================== diff -u -r35a96de80ddf8f88a34d7f75eaf71748db934044 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/Rating.tag (.../Rating.tag) (revision 35a96de80ddf8f88a34d7f75eaf71748db934044) +++ lams_tool_nb/web/WEB-INF/tags/Rating.tag (.../Rating.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -8,7 +8,6 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_tool_nb/web/WEB-INF/tags/StyledRating.tag =================================================================== diff -u -refa51a5d0464d96fada4e5a70f1fb86c2d726717 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/StyledRating.tag (.../StyledRating.tag) (revision efa51a5d0464d96fada4e5a70f1fb86c2d726717) +++ lams_tool_nb/web/WEB-INF/tags/StyledRating.tag (.../StyledRating.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -8,7 +8,6 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_tool_nb/web/WEB-INF/tags/TextSearch.tag =================================================================== diff -u -ra2d72bee6029b7e05e8cd696c02db214f3049365 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/WEB-INF/tags/TextSearch.tag (.../TextSearch.tag) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) +++ lams_tool_nb/web/WEB-INF/tags/TextSearch.tag (.../TextSearch.tag) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -32,7 +32,6 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> <%@ taglib uri="tags-lams" prefix="lams" %> <%-- Required attributes --%> Index: lams_tool_nb/web/authoring/pedagogicalPlannerForm.jsp =================================================================== diff -u -ra2d72bee6029b7e05e8cd696c02db214f3049365 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/authoring/pedagogicalPlannerForm.jsp (.../pedagogicalPlannerForm.jsp) (revision a2d72bee6029b7e05e8cd696c02db214f3049365) +++ lams_tool_nb/web/authoring/pedagogicalPlannerForm.jsp (.../pedagogicalPlannerForm.jsp) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -15,7 +15,7 @@

    - + Index: lams_tool_nb/web/learnerContent.jsp =================================================================== diff -u -r692cfbd845483c893176e6a4eb78d789399977ba -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/learnerContent.jsp (.../learnerContent.jsp) (revision 692cfbd845483c893176e6a4eb78d789399977ba) +++ lams_tool_nb/web/learnerContent.jsp (.../learnerContent.jsp) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -24,7 +24,7 @@ } function submitForm(methodName) { var f = document.getElementById('nbLearnerForm'); - f.action += "?method=" + methodName; + f.action += "?mode=" + methodName; f.submit(); } @@ -34,9 +34,8 @@ - + -
    Index: lams_tool_nb/web/message.jsp =================================================================== diff -u -re998cf2de8c4714022559cb5f67e61b677a2dd28 -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/message.jsp (.../message.jsp) (revision e998cf2de8c4714022559cb5f67e61b677a2dd28) +++ lams_tool_nb/web/message.jsp (.../message.jsp) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -21,14 +21,14 @@ - - - - - - - - + + + + + + + +
    Index: lams_tool_nb/web/monitoring/m_EditActivity.jsp =================================================================== diff -u -r692cfbd845483c893176e6a4eb78d789399977ba -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/monitoring/m_EditActivity.jsp (.../m_EditActivity.jsp) (revision 692cfbd845483c893176e6a4eb78d789399977ba) +++ lams_tool_nb/web/monitoring/m_EditActivity.jsp (.../m_EditActivity.jsp) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -28,7 +28,7 @@

    - + Index: lams_tool_nb/web/monitoring/m_Statistics.jsp =================================================================== diff -u -r692cfbd845483c893176e6a4eb78d789399977ba -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/monitoring/m_Statistics.jsp (.../m_Statistics.jsp) (revision 692cfbd845483c893176e6a4eb78d789399977ba) +++ lams_tool_nb/web/monitoring/m_Statistics.jsp (.../m_Statistics.jsp) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -13,8 +13,7 @@ - - + @@ -30,8 +29,7 @@ - - + Index: lams_tool_nb/web/monitoring/m_Summary.jsp =================================================================== diff -u -r692cfbd845483c893176e6a4eb78d789399977ba -r0d58de1fbc5b7e7ab913902946d3368c14ccfb98 --- lams_tool_nb/web/monitoring/m_Summary.jsp (.../m_Summary.jsp) (revision 692cfbd845483c893176e6a4eb78d789399977ba) +++ lams_tool_nb/web/monitoring/m_Summary.jsp (.../m_Summary.jsp) (revision 0d58de1fbc5b7e7ab913902946d3368c14ccfb98) @@ -31,7 +31,7 @@ - +