Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java,v diff -u -r1.66 -r1.67 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java 31 Jan 2006 16:22:13 -0000 1.66 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McAppConstants.java 2 Feb 2006 22:56:25 -0000 1.67 @@ -202,6 +202,7 @@ public static final String IS_TOOL_ACTIVITY_OFFLINE ="isToolActivityOffline"; public static final String IS_USERNAME_VISIBLE ="isUsernameVisible"; public static final String IS_CONTENT_IN_USE ="isContentInUse"; + public static final String IS_MONITORED_CONTENT_IN_USE ="isMonitoredContentInUse"; public static final String IS_RETRIES ="isRetries"; public static final String IS_SHOW_FEEDBACK ="isShowFeedback"; public static final String IS_SHOW_LEARNERS_REPORT ="isShowLearnersReport"; Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java,v diff -u -r1.25 -r1.26 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java 2 Feb 2006 20:55:13 -0000 1.25 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/McUtils.java 2 Feb 2006 22:56:25 -0000 1.26 @@ -524,7 +524,7 @@ /** - * + * the only attributes kept are TOOL_SESSION and TOOL_CONTENT_ID * cleanUpSessionAbsolute(HttpServletRequest request) * @param request */ @@ -563,7 +563,6 @@ request.getSession().removeAttribute(IS_REMOVE_CONTENT); request.getSession().removeAttribute(IS_REVISITING_USER); request.getSession().removeAttribute(USER); - request.getSession().removeAttribute(TOOL_CONTENT_ID); request.getSession().removeAttribute(TOOL_CONTENT_UID); request.getSession().removeAttribute(TOOL_SESSION_ID); request.getSession().removeAttribute(USER_ID); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java,v diff -u -r1.30 -r1.31 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 31 Jan 2006 19:06:58 -0000 1.30 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McLearningStarterAction.java 2 Feb 2006 22:56:25 -0000 1.31 @@ -122,6 +122,9 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { + + McUtils.cleanUpSessionAbsolute(request); + Map mapQuestionsContent= new TreeMap(new McComparator()); Map mapAnswers= new TreeMap(new McComparator()); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java,v diff -u -r1.12 -r1.13 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 31 Jan 2006 16:27:04 -0000 1.12 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 2 Feb 2006 22:56:25 -0000 1.13 @@ -36,7 +36,9 @@ import org.lamsfoundation.lams.tool.mc.McAppConstants; import org.lamsfoundation.lams.tool.mc.McApplicationException; import org.lamsfoundation.lams.tool.mc.McUtils; +import org.lamsfoundation.lams.tool.mc.pojos.McContent; import org.lamsfoundation.lams.tool.mc.service.IMcService; +import org.lamsfoundation.lams.tool.mc.service.McServiceProxy; import org.lamsfoundation.lams.web.action.LamsDispatchAction; /** @@ -165,6 +167,13 @@ logger.debug("dispatching submitSession..."); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; IMcService mcService =McUtils.getToolService(request); + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(TOOL_SERVICE, mcService); String currentMonitoredToolSession=mcMonitoringForm.getSelectedToolSessionId(); logger.debug("currentMonitoredToolSession: " + currentMonitoredToolSession); @@ -213,15 +222,43 @@ logger.debug("dispatching editActivity..."); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; IMcService mcService =McUtils.getToolService(request); - - request.setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + logger.debug("mcService: " + mcService); + + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(TOOL_SERVICE, mcService); + + request.setAttribute(CURRENT_MONITORING_TAB, "editActivity"); McStarterAction mcStarterAction= new McStarterAction(); request.getSession().setAttribute(TOOL_SERVICE, mcService); Long toolContentId =(Long) request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId: " + toolContentId); request.setAttribute(SOURCE_MC_STARTER, "monitoring"); logger.debug("SOURCE_MC_STARTER: monitoring"); + + /* it is possible that the content is being used by some learners. In this situation, the content is marked as "in use" and + content in use is not modifiable*/ + McContent mcContent=mcService.retrieveMc(toolContentId); + logger.debug("mcContent:" + mcContent); + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + + if (isContentInUse == true) + { + logger.debug("monitoring url does not allow editActivity since the content is in use."); + persistError(request,"error.content.inUse"); + McUtils.cleanUpSessionAbsolute(request); + request.setAttribute(IS_MONITORED_CONTENT_IN_USE, new Boolean(true).toString()); + logger.debug("forwarding to: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } + return mcStarterAction.executeDefineLater(mapping, form, request, response, mcService); } @@ -252,6 +289,13 @@ { logger.debug("dispatching editActivityQuestions.."); IMcService mcService =McUtils.getToolService(request); + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(TOOL_SERVICE, mcService); request.setAttribute(CURRENT_MONITORING_TAB, "editActivity"); @@ -290,6 +334,13 @@ logger.debug("dispatching getSummary..."); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; IMcService mcService =McUtils.getToolService(request); + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(TOOL_SERVICE, mcService); request.setAttribute(CURRENT_MONITORING_TAB, "summary"); return (mapping.findForward(LOAD_MONITORING)); @@ -321,6 +372,14 @@ logger.debug("dispatching getInstructions..."); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; IMcService mcService =McUtils.getToolService(request); + + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(TOOL_SERVICE, mcService); request.setAttribute(CURRENT_MONITORING_TAB, "instructions"); return (mapping.findForward(LOAD_MONITORING)); @@ -351,6 +410,13 @@ logger.debug("dispatching getStats..."); McMonitoringForm mcMonitoringForm = (McMonitoringForm) form; IMcService mcService =McUtils.getToolService(request); + if (mcService == null) + { + logger.debug("will retrieve mcService"); + mcService = McServiceProxy.getMcService(getServlet().getServletContext()); + logger.debug("retrieving mcService from cache: " + mcService); + } + request.getSession().setAttribute(TOOL_SERVICE, mcService); request.setAttribute(CURRENT_MONITORING_TAB, "stats"); return (mapping.findForward(LOAD_MONITORING)); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java,v diff -u -r1.11 -r1.12 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java 31 Jan 2006 16:27:04 -0000 1.11 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringStarterAction.java 2 Feb 2006 22:56:25 -0000 1.12 @@ -77,6 +77,8 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { + + McUtils.cleanUpSessionAbsolute(request); IMcService mcService = McServiceProxy.getMcService(getServlet().getServletContext()); logger.debug("retrieving mcService from proxy: " + mcService); Index: lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java,v diff -u -r1.61 -r1.62 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 2 Feb 2006 20:58:38 -0000 1.61 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 2 Feb 2006 22:56:25 -0000 1.62 @@ -124,25 +124,13 @@ public class McStarterAction extends Action implements McAppConstants { /* - * CONTENT_LOCKED refers to content being in use or not: Any students answered that content? - * Currently CONTENT_LOCKED ->CONTENT_IN_USE - * + * This class is reused by defineLater and monitoring modules as well. */ static Logger logger = Logger.getLogger(McStarterAction.class.getName()); public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException, McApplicationException { - /* - String showAuthoringTabs=(String) request.getSession().getAttribute(SHOW_AUTHORING_TABS); - logger.debug("showAuthoringTabs: " + showAuthoringTabs); - - if (showAuthoringTabs == null) - { - request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(true).toString()); - } - logger.debug("final showAuthoringTabs: " + request.getSession().getAttribute(SHOW_AUTHORING_TABS)); - */ McUtils.cleanUpSessionAbsolute(request); logger.debug("init authoring mode. removed attributes..."); @@ -158,39 +146,21 @@ String servletPath=request.getServletPath(); logger.debug("getServletPath: "+ servletPath); - if (servletPath.indexOf("defineLaterStarter") > 0) + if (servletPath.indexOf("authoringStarter") > 0) { - logger.debug("request is for define later module."); - request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); - request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); - request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString()); - } - else - { logger.debug("request is for authoring module"); request.getSession().setAttribute(ACTIVE_MODULE, AUTHORING); request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true)); request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(true).toString()); } - - /* - String activeModule=(String) request.getSession().getAttribute(ACTIVE_MODULE); - logger.debug("activeModule: " + activeModule); - - if ( (activeModule == null) || - (!activeModule.equals(DEFINE_LATER)) - ) + else { - McUtils.cleanUpSessionAbsolute(request); - logger.debug("init authoring mode. removed attributes..."); - request.getSession().setAttribute(ACTIVE_MODULE, AUTHORING); - logger.debug("activeModule set to Authoring: " + activeModule); - request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(true).toString()); + logger.debug("request is for define later module. either direct or by monitoring module"); + request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); + request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); + request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString()); } - logger.debug("final active activeModule is: " + request.getSession().getAttribute(ACTIVE_MODULE)); - logger.debug("final showAuthoringTabs: " + request.getSession().getAttribute(SHOW_AUTHORING_TABS)); - */ - + initialiseAttributes(request); /* determine whether the request is from Monitoring url Edit Activity * null sourceMcStarter indicates that the request is from authoring url. @@ -378,24 +348,25 @@ McContent mcContent=mcService.retrieveMc(new Long(toolContentId)); logger.debug("existing mcContent:" + mcContent); + /* it is possible that the content is being used by some learners. In this situation, the content is marked as "in use" and + content in use is not modifiable*/ + boolean isContentInUse=McUtils.isContentInUse(mcContent); + logger.debug("isContentInUse:" + isContentInUse); + + if (isContentInUse == true) + { + persistError(request,"error.content.inUse"); + McUtils.cleanUpSessionAbsolute(request); + logger.debug("forwarding to: " + ERROR_LIST); + return (mapping.findForward(ERROR_LIST)); + } + /* do not make these tests if the request is coming from monitoring url for Edit Activity*/ if ( (sourceMcStarter == null) || ((sourceMcStarter != null) && !sourceMcStarter.equals("monitoring")) ) { - /* it is possible that the content is being used by some learners. In this situation, the content is marked as "in use" and - a content in use is not modifiable*/ - boolean isContentInUse=McUtils.isContentInUse(mcContent); - logger.debug("isContentInUse:" + isContentInUse); - if (isContentInUse == true) - { - persistError(request,"error.content.inUse"); - McUtils.cleanUpSessionAbsolute(request); - logger.debug("forwarding to: " + ERROR_LIST); - return (mapping.findForward(ERROR_LIST)); - } - /* it is possible that the content is being EDITED in the monitoring interface. In this situation, the content is not modifiable*/ boolean isDefineLater=McUtils.isDefineLater(mcContent); logger.debug("isDefineLater:" + isDefineLater); @@ -806,19 +777,29 @@ } + /** + * is reused by defineLater and monitoring urls to activate defineLater module + * + * executeDefineLater(ActionMapping mapping, ActionForm form, + HttpServletRequest request, HttpServletResponse response, IMcService mcService) + throws IOException, ServletException, McApplicationException + * + * @param mapping + * @param form + * @param request + * @param response + * @param mcService + * @return ActionForward + * @throws IOException + * @throws ServletException + * @throws McApplicationException + */ public ActionForward executeDefineLater(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, IMcService mcService) throws IOException, ServletException, McApplicationException { logger.debug("passed mcService: " + mcService); request.getSession().setAttribute(TOOL_SERVICE, mcService); - /* present the view-only screen first */ - /* - request.getSession().setAttribute(ACTIVE_MODULE, DEFINE_LATER); - request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(false)); - request.getSession().setAttribute(SHOW_AUTHORING_TABS,new Boolean(false).toString()); - */ - return execute(mapping, form, request, response); } Index: lams_tool_lamc/web/monitoring/MonitoringMaincontent.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_lamc/web/monitoring/MonitoringMaincontent.jsp,v diff -u -r1.16 -r1.17 --- lams_tool_lamc/web/monitoring/MonitoringMaincontent.jsp 31 Jan 2006 11:01:39 -0000 1.16 +++ lams_tool_lamc/web/monitoring/MonitoringMaincontent.jsp 2 Feb 2006 22:56:25 -0000 1.17 @@ -174,12 +174,25 @@
- - - - - - + + + + + + + + + + + + + +
+ + <%@ include file="/McErrorBox.jsp" %> + +
+