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.6 -r1.7 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 18 Jan 2006 17:43:15 -0000 1.6 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McMonitoringAction.java 19 Jan 2006 12:25:00 -0000 1.7 @@ -31,9 +31,11 @@ import org.apache.struts.action.ActionMapping; import org.apache.struts.action.ActionMessage; import org.apache.struts.action.ActionMessages; +import org.lamsfoundation.lams.tool.exception.ToolException; 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.web.action.LamsDispatchAction; @@ -214,8 +216,33 @@ return mcStarterAction.executeDefineLater(mapping, form, request, response, mcService); } + + public ActionForward editActivityQuestions(ActionMapping mapping, + ActionForm form, + HttpServletRequest request, + HttpServletResponse response) throws IOException, + ServletException, + ToolException + { + logger.debug("dispatching editActivityQuestions.."); + IMcService mcService =McUtils.getToolService(request); + + request.setAttribute(CURRENT_MONITORING_TAB, "editActivity"); + + String userAction="editActivityQuestions"; + request.setAttribute(USER_ACTION, userAction); + logger.debug("userAction:" + userAction); + request.getSession().setAttribute(DEFINE_LATER_IN_EDIT_MODE, new Boolean(true)); + setDefineLater(request, true); + + request.getSession().setAttribute(EDIT_OPTIONS_MODE, new Integer(0)); + logger.debug("setting EDIT_OPTIONS_MODE to 0"); + + return (mapping.findForward(LOAD_MONITORING)); + } + public ActionForward getSummary(ActionMapping mapping, ActionForm form, HttpServletRequest request, @@ -274,6 +301,21 @@ return (mapping.findForward(LOAD_MONITORING)); } + + + protected void setDefineLater(HttpServletRequest request, boolean value) + { + IMcService mcService =McUtils.getToolService(request); + Long toolContentId=(Long)request.getSession().getAttribute(TOOL_CONTENT_ID); + logger.debug("toolContentId:" + toolContentId); + logger.debug("value:" + value); + + McContent mcContent=mcService.retrieveMc(toolContentId); + logger.debug("mcContent:" + mcContent); + mcContent.setDefineLater(value); + logger.debug("defineLater has been set to true"); + mcService.saveMcContent(mcContent); + } /** 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.43 -r1.44 --- lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 18 Jan 2006 17:45:04 -0000 1.43 +++ lams_tool_lamc/src/java/org/lamsfoundation/lams/tool/mc/web/McStarterAction.java 19 Jan 2006 12:25:38 -0000 1.44 @@ -136,6 +136,11 @@ String activeModule=(String) request.getSession().getAttribute(ACTIVE_MODULE); logger.debug("activeModule: " + activeModule); + /* determine whether the request is from Monitoring url Edit Activity*/ + String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER); + logger.debug("sourceMcStarter: " + sourceMcStarter); + + if ( (activeModule == null) || (!activeModule.equals(DEFINE_LATER)) ) @@ -162,12 +167,12 @@ McAuthoringForm mcAuthoringForm = (McAuthoringForm) form; mcAuthoringForm.resetRadioBoxes(); - ActionForward validateParameters=readSignature(request,mapping); - logger.debug("validateParameters: " + validateParameters); - if (validateParameters != null) + ActionForward validateSignature=readSignature(request,mapping); + logger.debug("validateSignature: " + validateSignature); + if (validateSignature != null) { - logger.debug("validateParameters not null : " + validateParameters); - return validateParameters; + logger.debug("validateSignature not null : " + validateSignature); + return validateSignature; } else { @@ -217,9 +222,12 @@ } - /* test whether the authoring level tool contract: + /* note: copyToolContent and removeToolContent code is redundant for production. + * test whether the authoring level tool contract: public void copyToolContent(Long fromContentId, Long toContentId) throws ToolException; - * is working or not + * is working or not + * + * test code from here... */ String copyToolContent= (String) request.getParameter(COPY_TOOL_CONTENT); logger.debug("copyToolContent: " + copyToolContent); @@ -254,7 +262,7 @@ mcService.removeToolContent(fromContentId); } - + /* ...till here*/ /* * find out if the passed tool content id exists in the db @@ -264,6 +272,7 @@ * there is no need to check if the content is in use in this case. * It is always unlocked -> not in use since it is the default content. */ + if (!existsContent(toolContentId, request)) { logger.debug("retrieving default content"); @@ -275,9 +284,6 @@ McContent mcContent=mcService.retrieveMc(new Long(toolContentId)); logger.debug("existing mcContent:" + mcContent); - String sourceMcStarter = (String) request.getAttribute(SOURCE_MC_STARTER); - logger.debug("sourceMcStarter: " + sourceMcStarter); - /* do not make these tests if the request is coming from monitoring url for Edit Activity*/ if ((sourceMcStarter != null) && !sourceMcStarter.equals("monitoring")) { @@ -309,8 +315,18 @@ } } mcAuthoringForm.resetUserAction(); - logger.debug("return to: " + LOAD_QUESTIONS); - return (mapping.findForward(LOAD_QUESTIONS)); + + logger.debug("will return to jsp."); + if ((sourceMcStarter != null) && !sourceMcStarter.equals("monitoring")) + { + logger.debug("request is from authoring or define Later url. return to: " + LOAD_QUESTIONS); + return (mapping.findForward(LOAD_QUESTIONS)); + } + else + { + logger.debug("request is from amonitoring url. return to: " + LOAD_MONITORING); + return (mapping.findForward(LOAD_MONITORING)); + } } /**