Index: lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbMonitoringAction.java =================================================================== diff -u -r2933e1ad39938f2c65040e8bf0199c5161e85c1f -r3ccbea8d82c19170843b617f3e8eca35a2d8bdb8 --- lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbMonitoringAction.java (.../NbMonitoringAction.java) (revision 2933e1ad39938f2c65040e8bf0199c5161e85c1f) +++ lams_tool_nb/src/java/org/lamsfoundation/lams/tool/noticeboard/web/NbMonitoringAction.java (.../NbMonitoringAction.java) (revision 3ccbea8d82c19170843b617f3e8eca35a2d8bdb8) @@ -72,7 +72,7 @@ return map; } - /** + /** * * @param mapping * @param form @@ -86,21 +86,19 @@ Long toolContentId = (Long)request.getSession().getAttribute(NoticeboardConstants.TOOL_CONTENT_ID_INMONITORMODE); INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext()); NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId); - - if (isContentEditable(content)) + NbMonitoringUtil.copyValuesIntoSession(request, content); + if (NbMonitoringUtil.isContentEditable(content)) { - request.getSession().removeAttribute(NoticeboardConstants.CONTENT_IN_USE); - - request.getSession().setAttribute(NoticeboardConstants.TITLE, content.getTitle()); - request.getSession().setAttribute(NoticeboardConstants.CONTENT, content.getContent()); + request.getSession().setAttribute(NoticeboardConstants.CONTENT_IN_USE, "false"); //used in jsp page to allow the edit button to show, so that author can edit page + request.getSession().setAttribute(NoticeboardConstants.DEFINE_LATER, "true"); } else { request.getSession().setAttribute(NoticeboardConstants.CONTENT_IN_USE, "true"); } - //copyValuesIntoSession(request, content); + + return mapping.findForward(NoticeboardConstants.MONITOR_PAGE); - return mapping.findForward(NoticeboardConstants.MONITOR_PAGE); } /** @@ -112,16 +110,13 @@ * @return */ public ActionForward instructions(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - NbMonitoringForm monitorForm = (NbMonitoringForm)form; - // NbMonitoringUtil.cleanSession(request); + Long toolContentId = (Long)request.getSession().getAttribute(NoticeboardConstants.TOOL_CONTENT_ID_INMONITORMODE); + INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext()); NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId); - //copyValuesIntoSession(request, content); + NbMonitoringUtil.copyValuesIntoSession(request, content); - request.getSession().setAttribute(NoticeboardConstants.ONLINE_INSTRUCTIONS, content.getOnlineInstructions()); - request.getSession().setAttribute(NoticeboardConstants.OFFLINE_INSTRUCTIONS, content.getOfflineInstructions()); - return mapping.findForward(NoticeboardConstants.MONITOR_PAGE); } @@ -134,7 +129,12 @@ * @return */ public ActionForward summary(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { - return mapping.findForward(NoticeboardConstants.MONITOR_PAGE); + Long toolContentId = (Long)request.getSession().getAttribute(NoticeboardConstants.TOOL_CONTENT_ID_INMONITORMODE); + INoticeboardService nbService = NoticeboardServiceProxy.getNbService(getServlet().getServletContext()); + NoticeboardContent content = nbService.retrieveNoticeboard(toolContentId); + NbMonitoringUtil.copyValuesIntoSession(request, content); + + return mapping.findForward(NoticeboardConstants.MONITOR_PAGE); } /** @@ -149,49 +149,5 @@ return mapping.findForward(NoticeboardConstants.MONITOR_PAGE); } - /** - * - * @param mapping - * @param form - * @param request - * @param response - * @return - */ - private void copyValuesIntoSession(HttpServletRequest request, NoticeboardContent content) - { - request.getSession().setAttribute(NoticeboardConstants.TITLE, content.getTitle()); - request.getSession().setAttribute(NoticeboardConstants.CONTENT, content.getContent()); - request.getSession().setAttribute(NoticeboardConstants.ONLINE_INSTRUCTIONS, content.getOnlineInstructions()); - request.getSession().setAttribute(NoticeboardConstants.OFFLINE_INSTRUCTIONS, content.getOfflineInstructions()); - } - - /** - *
This method checks the two tool content flags, defineLater and contentInUse
- * to determine whether the tool content is modifiable or not. Returns true is content is
- * modifiable and false otherwise
- *
Tool content is modifiable if:
- *