Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/BranchingActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/BranchingActivityController.java (.../BranchingActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/BranchingActivityController.java (.../BranchingActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -31,11 +31,9 @@ import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.DynaActionForm; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.bean.ActivityURL; +import org.lamsfoundation.lams.learning.web.form.BranchingForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; @@ -84,7 +82,7 @@ * Gets an options activity from the request (attribute) and forwards to the display JSP. */ @RequestMapping("/performBranching") - public String performBranching(@ModelAttribute("BranchingForm") DynaActionForm branchForm, + public String performBranching(@ModelAttribute("BranchingForm") BranchingForm branchForm, HttpServletRequest request, HttpServletResponse response) { ActivityMapping actionMappings = LearningWebUtil @@ -111,17 +109,17 @@ SequenceActivity branch = learnerService.determineBranch(learnerProgress.getLesson(), branchingActivity, learnerId); - branchForm.set("activityID", activity.getActivityId()); - branchForm.set("progressID", learnerProgress.getLearnerProgressId()); - branchForm.set("showFinishButton", Boolean.TRUE); - branchForm.set("title", activity.getTitle()); + branchForm.setActivityID(activity.getActivityId()); + branchForm.setProgressID(learnerProgress.getLearnerProgressId()); + branchForm.setShowFinishButton(Boolean.TRUE); + branchForm.setTitle(activity.getTitle()); if (learnerProgress.getLesson().isPreviewLesson()) { // The preview version gives you a choice of branches // If a "normal" branch can be determined based on the group, tool marks, etc then it is marked as the default branch - branchForm.set("previewLesson", Boolean.TRUE); + branchForm.setPreviewLesson(Boolean.TRUE); forward = "branching/preview"; List activityURLs = new ArrayList<>(); @@ -136,21 +134,21 @@ } activityURLs.add(activityURL); } - branchForm.set("activityURLs", activityURLs); + branchForm.setActivityURLs(activityURLs); } else if (branch == null) { // show the learner waiting page - branchForm.set("previewLesson", Boolean.FALSE); + branchForm.setPreviewLesson(Boolean.FALSE); forward = "branching/wait"; - branchForm.set("showNextButton", Boolean.TRUE); + branchForm.setShowNextButton(Boolean.TRUE); if (branchingActivity.isChosenBranchingActivity()) { - branchForm.set("type", BranchingActivity.CHOSEN_TYPE); + branchForm.setType(BranchingActivity.CHOSEN_TYPE); } else if (branchingActivity.isGroupBranchingActivity()) { - branchForm.set("type", BranchingActivity.GROUP_BASED_TYPE); + branchForm.setType(BranchingActivity.GROUP_BASED_TYPE); } else if (branchingActivity.isToolBranchingActivity()) { - branchForm.set("type", BranchingActivity.TOOL_BASED_TYPE); + branchForm.setType(BranchingActivity.TOOL_BASED_TYPE); } // lessonId needed for the progress bar request.setAttribute(AttributeNames.PARAM_LESSON_ID, learnerProgress.getLesson().getLessonId()); @@ -174,8 +172,8 @@ * We are in the preview lesson and the author has selected a particular branch. Force it to take that branch. */ @RequestMapping("/forceBranching") - public String forceBranching(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, - HttpServletResponse response) { + public String forceBranching(@ModelAttribute("BranchingForm") BranchingForm branchForm, + HttpServletRequest request) { ActivityMapping actionMappings = LearningWebUtil .getActivityMapping(this.applicationContext.getServletContext()); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/ChooseActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/ChooseActivityController.java (.../ChooseActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/ChooseActivityController.java (.../ChooseActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,27 +21,24 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; import org.apache.struts.util.TokenProcessor; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; +import org.lamsfoundation.lams.learning.web.form.ActivityForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.lesson.LearnerProgress; import org.lamsfoundation.lams.lesson.Lesson; -import org.lamsfoundation.lams.web.action.LamsAction; 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; @@ -54,33 +51,34 @@ * */ @Controller -public class ChooseActivityController extends ActivityController{ +public class ChooseActivityController extends ActivityController { protected static String className = "ChooseActivity"; - + private static Logger log = Logger.getLogger(ChooseActivityController.class); @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; - + @Autowired private WebApplicationContext applicationContext; - + /** * Gets an activity from the request (attribute) and forwards onto the required jsp (SingleActivity or * ParallelActivity). */ @RequestMapping("/ChooseActivity") - public String execute(ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, + public String execute(@ModelAttribute("activityForm") ActivityForm activityForm, HttpServletRequest request, HttpServletResponse response) { - ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.applicationContext.getServletContext()); + ActivityMapping actionMappings = LearningWebUtil + .getActivityMapping(this.applicationContext.getServletContext()); // check token if (!TokenProcessor.getInstance().isTokenValid(request, true)) { // didn't come here from options page log.info("No valid token in request"); - return mapping.findForward(ActivityMapping.DOUBLE_SUBMIT_ERROR); + return "error"; } // Get learner and lesson details. @@ -97,7 +95,7 @@ progress = learnerService.joinLesson(learnerId, lesson.getLessonId()); } - ActionForward forward = actionMappings.getActivityForward(activity, progress, true); + String forward = actionMappings.getActivityForward(activity, progress, true); return forward; } } \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java (.../CompleteActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/CompleteActivityController.java (.../CompleteActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -30,12 +30,10 @@ import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.integration.service.IntegrationService; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; +import org.lamsfoundation.lams.learning.web.form.ActivityForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; @@ -45,6 +43,7 @@ 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; import org.springframework.web.context.support.WebApplicationContextUtils; @@ -59,7 +58,7 @@ */ @Controller public class CompleteActivityController extends ActivityController { - + private static Logger log = Logger.getLogger(CompleteActivityController.class); protected static String className = "CompleteActivity"; @@ -68,10 +67,10 @@ @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; - + @Autowired private WebApplicationContext applicationContext; - + /** * Sets the current activity as complete and uses the progress engine to find the next activity (may be null). * @@ -82,8 +81,10 @@ * @throws ServletException */ @RequestMapping("/CompleteActivity") - public String execute(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { - ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.applicationContext.getServletContext()); + public String execute(@ModelAttribute("messageForm") ActivityForm messageForm, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + ActivityMapping actionMappings = LearningWebUtil + .getActivityMapping(this.applicationContext.getServletContext()); Integer learnerId = LearningWebUtil.getUserId(); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); @@ -113,21 +114,22 @@ } } - ActionForward forward = null; + String forward = null; // Set activity as complete try { forward = LearningWebUtil.completeActivity(request, response, actionMappings, progress, activity, learnerId, learnerService, false); } catch (LearnerServiceException e) { - return mapping.findForward("error"); + return "error"; } return forward; } private IntegrationService getIntegrationService() { if (CompleteActivityController.integrationService == null) { CompleteActivityController.integrationService = (IntegrationService) WebApplicationContextUtils - .getRequiredWebApplicationContext(applicationContext.getServletContext()).getBean("integrationService"); + .getRequiredWebApplicationContext(applicationContext.getServletContext()) + .getBean("integrationService"); } return CompleteActivityController.integrationService; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayActivityController.java (.../DisplayActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayActivityController.java (.../DisplayActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,18 +21,13 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.controller; import java.io.UnsupportedEncodingException; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; @@ -44,6 +39,7 @@ import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.WebApplicationContext; /** * Action class to display an activity. This is used when UI calls starts of the learning process. It is needed to put @@ -76,19 +72,22 @@ private static Logger log = Logger.getLogger(DisplayActivityController.class); public static final String PARAM_INITIAL_DISPLAY = "initialDisplay"; - + @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; + @Autowired + private WebApplicationContext applicationContext; + /** * Gets an activity from the request (attribute) and forwards onto a display action using the ActionMappings class. * If no activity is in request then use the current activity in learnerProgress. * * @throws UnsupportedEncodingException */ @RequestMapping("/DisplayActivity") - public String execute( HttpServletRequest request) throws UnsupportedEncodingException { + public String execute(HttpServletRequest request) throws UnsupportedEncodingException { // UI can only send the lessonID as that is all it has... Integer learnerId = LearningWebUtil.getUserId(); @@ -101,12 +100,12 @@ // Normally this is used to display the initial page, so initialDisplay=true. But if called from the // special handling for completed activities (ie close window) then we need to set it to false. - boolean displayParallelFrames = WebUtil.readBooleanParam(request, DisplayActivityController.PARAM_INITIAL_DISPLAY, - true); + boolean displayParallelFrames = WebUtil.readBooleanParam(request, + DisplayActivityController.PARAM_INITIAL_DISPLAY, true); - ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(getServlet().getServletContext()); - ActionForward forward = actionMappings.getProgressForward(learnerProgress, false, displayParallelFrames, - request, learnerService); + ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(applicationContext.getServletContext()); + String forward = actionMappings.getProgressForward(learnerProgress, false, displayParallelFrames, request, + learnerService); if (DisplayActivityController.log.isDebugEnabled()) { DisplayActivityController.log.debug(forward); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayOptionsActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayOptionsActivityController.java (.../DisplayOptionsActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayOptionsActivityController.java (.../DisplayOptionsActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,7 +21,6 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.controller; import java.util.ArrayList; @@ -33,9 +32,6 @@ import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; import org.apache.struts.util.TokenProcessor; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.bean.ActivityURL; @@ -45,7 +41,6 @@ import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.OptionsActivity; import org.lamsfoundation.lams.lesson.LearnerProgress; -import org.lamsfoundation.lams.web.action.LamsAction; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -69,13 +64,13 @@ */ @Controller public class DisplayOptionsActivityController extends ActivityController { - + private static Logger log = Logger.getLogger(DisplayOptionsActivityController.class); - + @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; - + @Autowired private WebApplicationContext applicationContext; @@ -84,23 +79,24 @@ */ @SuppressWarnings("unchecked") @RequestMapping("/DisplayOptionsActivity") - public ActionForward execute(@ModelAttribute OptionsActivityForm form,HttpServletRequest request, + public String execute(@ModelAttribute OptionsActivityForm form, HttpServletRequest request, HttpServletResponse response) { - - ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.getServlet().getServletContext()); + ActivityMapping actionMappings = LearningWebUtil + .getActivityMapping(this.applicationContext.getServletContext()); + LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof OptionsActivity)) { log.error("activity not OptionsActivity " + activity.getActivityId()); - return mapping.findForward(ActivityMapping.ERROR); + return "error"; } OptionsActivity optionsActivity = (OptionsActivity) activity; form.setActivityID(activity.getActivityId()); - List activityURLs = new ArrayList(); + List activityURLs = new ArrayList<>(); Set subActivities = optionsActivity.getActivities(); Iterator i = subActivities.iterator(); int completedCount = 0; @@ -131,12 +127,12 @@ TokenProcessor.getInstance().saveToken(request); - LearningWebUtil.putActivityPositionInRequest(form.getActivityID(), request, applicationContext.getServletContext()); + LearningWebUtil.putActivityPositionInRequest(form.getActivityID(), request, + applicationContext.getServletContext()); // lessonId needed for the progress bar request.setAttribute(AttributeNames.PARAM_LESSON_ID, learnerProgress.getLesson().getLessonId()); - - String forward = "displayOptions"; - return mapping.findForward(forward); + + return "optionsActivity"; } } \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayParallelActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayParallelActivityController.java (.../DisplayParallelActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayParallelActivityController.java (.../DisplayParallelActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,7 +21,6 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.controller; import java.util.ArrayList; @@ -32,9 +31,6 @@ import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.bean.ActivityURL; @@ -44,12 +40,12 @@ import org.lamsfoundation.lams.learning.web.util.ParallelActivityMappingStrategy; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ParallelActivity; -import org.lamsfoundation.lams.web.action.LamsAction; 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; /** * Action class to display a ParallelActivity. @@ -64,29 +60,31 @@ */ @Controller public class DisplayParallelActivityController extends ActivityController { - + private static Logger log = Logger.getLogger(DisplayParallelActivityController.class); - + @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; + @Autowired + private WebApplicationContext applicationContext; + /** * Gets a parallel activity from the request (attribute) and forwards to the display JSP. */ @RequestMapping("/DisplayParallelActivity") - public String execute(@ModelAttribute ActivityForm form,HttpServletRequest request, - HttpServletResponse response) { + public String execute(@ModelAttribute ActivityForm form, HttpServletRequest request, HttpServletResponse response) { + ActivityMapping actionMappings = LearnerServiceProxy + .getActivityMapping(this.applicationContext.getServletContext()); - ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(this.getServlet().getServletContext()); - actionMappings.setActivityMappingStrategy(new ParallelActivityMappingStrategy()); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof ParallelActivity)) { log.error("activity not ParallelActivity " + activity.getActivityId()); - return mapping.findForward(ActivityMapping.ERROR); + return "error"; } ParallelActivity parallelActivity = (ParallelActivity) activity; @@ -104,10 +102,10 @@ } if (activityURLs.size() == 0) { log.error("No sub-activity URLs for activity " + activity.getActivityId()); - return mapping.findForward(ActivityMapping.ERROR); + return "error"; } form.setActivityURLs(activityURLs); - return mapping.findForward("displayParallel"); + return "parallelActivity"; } } \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayToolActivityController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayToolActivityController.java (.../DisplayToolActivityController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/DisplayToolActivityController.java (.../DisplayToolActivityController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,27 +21,23 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.ToolActivity; import org.lamsfoundation.lams.lesson.LearnerProgress; -import org.lamsfoundation.lams.web.action.LamsAction; 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.RequestMapping; +import org.springframework.web.context.WebApplicationContext; /** * Action class to forward the user to a Tool. @@ -55,27 +51,31 @@ */ @Controller public class DisplayToolActivityController extends ActivityController { - + private static Logger log = Logger.getLogger(DisplayToolActivityController.class); - + @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; + @Autowired + private WebApplicationContext applicationContext; + /** * Gets a tool activity from the request (attribute) and uses a redirect to forward the user to the tool. */ - @RequestMapping("//DisplayToolActivity") + @RequestMapping("/DisplayToolActivity") public String execute(HttpServletRequest request, HttpServletResponse response) { //ActivityForm form = (ActivityForm)actionForm; - ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.getServlet().getServletContext()); + ActivityMapping actionMappings = LearningWebUtil + .getActivityMapping(this.applicationContext.getServletContext()); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); if (!(activity instanceof ToolActivity)) { log.error("activity not ToolActivity"); - return mapping.findForward(ActivityMapping.ERROR); + return "error"; } ToolActivity toolActivity = (ToolActivity) activity; @@ -85,7 +85,7 @@ try { response.sendRedirect(url); } catch (java.io.IOException e) { - return mapping.findForward(ActivityMapping.ERROR); + return "error"; } return null; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java (.../GateController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GateController.java (.../GateController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -33,13 +33,8 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.DynaActionForm; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; -import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.bean.GateActivityDTO; import org.lamsfoundation.lams.learning.web.form.GateForm; import org.lamsfoundation.lams.learning.web.util.ActivityMapping; @@ -52,13 +47,13 @@ import org.lamsfoundation.lams.lesson.Lesson; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.util.WebUtil; -import org.lamsfoundation.lams.web.action.LamsDispatchAction; 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; /** *

@@ -92,11 +87,14 @@ */ @Controller @RequestMapping("/gate") -public class GateController{ +public class GateController { @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; + + @Autowired + private WebApplicationContext applicationContext; // --------------------------------------------------------------------- // Instance variables // --------------------------------------------------------------------- @@ -127,15 +125,16 @@ * @throws ServletException */ @RequestMapping("") - public ActionForward knockGate(@ModelAttribute GateForm gateForm, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { + public String knockGate(@ModelAttribute GateForm gateForm, HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { boolean forceGate = WebUtil.readBooleanParam(request, GateController.PARAM_FORCE_GATE_OPEN, false); Long activityId = WebUtil.readLongParam(request, AttributeNames.PARAM_ACTIVITY_ID); Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); // initialize service object Activity activity = learnerService.getActivity(activityId); - ActivityMapping actionMappings = LearningWebUtil.getActivityMapping(this.getServlet().getServletContext()); + ActivityMapping actionMappings = LearningWebUtil + .getActivityMapping(this.applicationContext.getServletContext()); User learner = LearningWebUtil.getUser(learnerService); Lesson lesson = learnerService.getLesson(lessonId); @@ -152,7 +151,7 @@ // if the gate is closed, ask the learner to wait ( updating the cached learner progress on the way ) if (!gateDTO.getAllowToPass()) { - ActionForward forward = findViewByGateType(mapping, gateForm, gateDTO, lesson); + String forward = findViewByGateType(gateForm, gateDTO, lesson); return forward; } } @@ -182,8 +181,7 @@ * next. */ @RequestMapping("/findViewByGateType") - private String findViewByGateType(@ModelAttribute GateForm gateForm, GateActivityDTO gateDTO, - Lesson lesson) { + private String findViewByGateType(@ModelAttribute GateForm gateForm, GateActivityDTO gateDTO, Lesson lesson) { gateForm.setTotalLearners(gateDTO.getExpectedLearnerCount()); gateForm.setWaitingLearners(gateDTO.getWaitingLearnerCount()); gateForm.setPreviewLesson(lesson.isPreviewLesson()); @@ -193,12 +191,12 @@ gateForm.setLessonID(lesson.getLessonId()); gateForm.setGate(gate); if (gate.isSynchGate()) { - return mapping.findForward(GateController.VIEW_SYNCH_GATE); + return "gate/synchGateContent"; } else if (gate.isScheduleGate()) { ScheduleGateActivity scheduleGate = (ScheduleGateActivity) gate; if (Boolean.TRUE.equals(scheduleGate.getGateActivityCompletionBased())) { // so it is in seconds - gateForm.set("startOffset", scheduleGate.getGateStartTimeOffset() * 60); + gateForm.setStartOffset(scheduleGate.getGateStartTimeOffset() * 60); User learner = LearningWebUtil.getUser(learnerService); Date reachTime = ScheduleGateActivityStrategy.getPreviousActivityCompletionDate(scheduleGate, learner); @@ -210,7 +208,7 @@ gateForm.setStartingTime(startingTime.getTime()); long diff = startingTime.getTimeInMillis() - new Date().getTime(); long remainTime = diff / 1000; - gateForm.setRemainTime(remainTime);(remainTime); + gateForm.setRemainTime(remainTime); gateForm.setEndingTime(null); } else { gateForm.setStartOffset(null); @@ -224,12 +222,12 @@ gateForm.setRemainTime(remainTime); gateForm.setEndingTime(null); } - return mapping.findForward(GateController.VIEW_SCHEDULE_GATE); + return "gate/scheduleGateContent"; } else if (gate.isConditionGate()) { gateForm.setMonitorCanOpenGate(false); - return mapping.findForward(GateController.VIEW_CONDITION_GATE); + return "gate/conditionGateContent"; } else if (gate.isPermissionGate() || gate.isSystemGate()) { - return mapping.findForward(GateController.VIEW_PERMISSION_GATE); + return "gate/permissionGateContent"; } else { throw new LearnerServiceException("Invalid gate activity. " + "gate id [" + gate.getActivityId() + "] - the type [" + gate.getActivityTypeId() + "] is not a gate type"); Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/GroupingController.java (.../GroupingController.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -32,15 +32,8 @@ import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionForward; -import org.apache.struts.action.ActionMapping; -import org.apache.struts.action.DynaActionForm; -import org.apache.struts.action.RedirectingActionForward; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; -import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; import org.lamsfoundation.lams.learning.web.form.GroupingForm; -import org.lamsfoundation.lams.learning.web.util.ActivityMapping; import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; import org.lamsfoundation.lams.learningdesign.Activity; import org.lamsfoundation.lams.learningdesign.Group; @@ -52,7 +45,6 @@ import org.lamsfoundation.lams.tool.ToolAccessMode; import org.lamsfoundation.lams.usermanagement.dto.UserBasicDTO; import org.lamsfoundation.lams.util.WebUtil; -import org.lamsfoundation.lams.web.action.LamsDispatchAction; import org.lamsfoundation.lams.web.util.AttributeNames; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; @@ -87,11 +79,11 @@ // Instance variables // --------------------------------------------------------------------- private static Logger log = Logger.getLogger(GroupingController.class); - + @Autowired @Qualifier("learnerService") private ICoreLearnerService learnerService; - + @Autowired private WebApplicationContext applicationContext; // --------------------------------------------------------------------- @@ -128,7 +120,8 @@ * @throws ServletException */ @RequestMapping("/performGrouping") - public String performGrouping(@ModelAttribute GroupingForm groupForm,HttpServletRequest request) throws IOException, ServletException { + public String performGrouping(@ModelAttribute GroupingForm GroupingForm, HttpServletRequest request) + throws IOException, ServletException { boolean forceGroup = WebUtil.readBooleanParam(request, GroupingController.PARAM_FORCE_GROUPING, false); @@ -143,9 +136,9 @@ boolean groupingDone = learnerService.performGrouping(lessonId, activity.getActivityId(), LearningWebUtil.getUserId(), forceGroup); - groupForm.setPreviewLesson(learnerProgress.getLesson().isPreviewLesson()); - groupForm.setTitle(activity.getTitle()); - groupForm.setActivityID(activity.getActivityId()); + GroupingForm.setPreviewLesson(learnerProgress.getLesson().isPreviewLesson()); + GroupingForm.setTitle(activity.getTitle()); + GroupingForm.setActivityID(activity.getActivityId()); request.setAttribute(AttributeNames.PARAM_LESSON_ID, lessonId); if (groupingDone) { @@ -182,11 +175,12 @@ */ @RequestMapping("/viewGroup") public String viewGrouping(HttpServletRequest request) throws IOException, ServletException { - return viewGrouping(request,null); + return viewGrouping(request, null); } @RequestMapping("/viewGroup") - public String viewGrouping(HttpServletRequest request, LearnerProgress learnerProgress) throws IOException, ServletException { + public String viewGrouping(HttpServletRequest request, LearnerProgress learnerProgress) + throws IOException, ServletException { prepareGroupData(request); request.setAttribute(GroupingController.LOCAL_FILES, Boolean.FALSE); ToolAccessMode mode = WebUtil.readToolAccessModeParam(request, AttributeNames.PARAM_MODE, true); @@ -216,18 +210,18 @@ * @throws IOException * @throws ServletException */ - public ActionForward completeActivity(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { + @RequestMapping("/completeActivity") + public String completeActivity(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { // initialize service object - ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); LearnerProgress progress = LearningWebUtil.getLearnerProgress(request, learnerService); Activity groupingActivity = LearningWebUtil.getActivityFromRequest(request, learnerService); Integer learnerId = LearningWebUtil.getUserId(); // so manually resume the progress. The completeActivity code can cope with a missing activity. return LearningWebUtil.completeActivity(request, response, - LearningWebUtil.getActivityMapping(this.getServlet().getServletContext()), progress, groupingActivity, - learnerId, learnerService, true); + LearningWebUtil.getActivityMapping(this.applicationContext.getServletContext()), progress, + groupingActivity, learnerId, learnerService, true); } /** @@ -236,11 +230,10 @@ * @param request */ @SuppressWarnings("unchecked") + @RequestMapping("/prepareGroupData") private void prepareGroupData(HttpServletRequest request) { - ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); - - SortedSet groups = new TreeSet(GroupDTO.GROUP_NAME_COMPARATOR); + SortedSet groups = new TreeSet<>(GroupDTO.GROUP_NAME_COMPARATOR); Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); Grouping grouping = ((GroupingActivity) activity).getCreateGrouping(); @@ -268,9 +261,8 @@ * @throws IOException * @throws ServletException */ - public ActionForward learnerChooseGroup(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws IOException, ServletException { - ICoreLearnerService learnerService = LearnerServiceProxy.getLearnerService(getServlet().getServletContext()); + @RequestMapping("/learnerChooseGroup") + public String learnerChooseGroup(HttpServletRequest request) throws IOException, ServletException { Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); Long groupId = WebUtil.readLongParam(request, "groupId"); LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); @@ -281,7 +273,7 @@ redirectURL = WebUtil.appendParameterToURL(redirectURL, "method", "performGrouping"); redirectURL = WebUtil.appendParameterToURL(redirectURL, "activityID", activity.getActivityId().toString()); - return new RedirectingActionForward(redirectURL); + return redirectURL; } } \ No newline at end of file Fisheye: Tag 1f7150d6142f994d113ba543736a9f7c0e154337 refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerController.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerController.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LearnerController.java (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -0,0 +1,480 @@ +/**************************************************************** + * 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.learning.web.controller; + +import java.io.IOException; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +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.apache.struts.action.ActionForm; +import org.apache.struts.action.ActionForward; +import org.apache.struts.action.ActionMapping; +import org.lamsfoundation.lams.gradebook.service.IGradebookService; +import org.lamsfoundation.lams.learning.presence.PresenceWebsocketServer; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; +import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; +import org.lamsfoundation.lams.learning.web.bean.ActivityURL; +import org.lamsfoundation.lams.learning.web.util.ActivityMapping; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +import org.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.lesson.CompletedActivityProgress; +import org.lamsfoundation.lams.lesson.CompletedActivityProgressArchive; +import org.lamsfoundation.lams.lesson.LearnerProgress; +import org.lamsfoundation.lams.lesson.LearnerProgressArchive; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.service.ILessonService; +import org.lamsfoundation.lams.monitoring.service.IMonitoringService; +import org.lamsfoundation.lams.tool.ToolSession; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.dto.UserDTO; +import org.lamsfoundation.lams.usermanagement.service.UserManagementService; +import org.lamsfoundation.lams.util.Configuration; +import org.lamsfoundation.lams.util.ConfigurationKeys; +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.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.context.WebApplicationContext; + +import com.fasterxml.jackson.databind.node.JsonNodeFactory; +import com.fasterxml.jackson.databind.node.ObjectNode; + +/** + * + *

+ * The action servlet that interacts with learner to start a lams learner module, join a user to the lesson and allows a + * user to exit a lesson. + *

+ * + *

+ * It is also responsible for the interaction between lams server and UI. UI will call method implemented in this class + * to get progress data or trigger a lams server calculation here + *

+ * + * Note:It needs to extend the LamsDispatchAction which has been customized to accomodate struts + * features to solve duplicate submission problem. + * + * @author Jacky Fang + * @since 3/03/2005 + * @version 1.1 + */ +@Controller +@RequestMapping("/learner") +public class LearnerController { + // --------------------------------------------------------------------- + // Instance variables + // --------------------------------------------------------------------- + private static Logger log = Logger.getLogger(LearnerController.class); + + @Autowired + @Qualifier("learnerService") + private ICoreLearnerService learnerService; + + @Autowired + private UserManagementService userManagementService; + + @Autowired + @Qualifier("gradebookService") + private IGradebookService gradebookService; + + @Autowired + @Qualifier("monitoringService") + private IMonitoringService monitoringService; + + @Autowired + @Qualifier("lessonService") + private ILessonService lessonService; + + @Autowired + private MessageService messageService; + + @Autowired + private WebApplicationContext applicationContext; + + private static final String[] MONITOR_MESSAGE_KEYS = new String[] { + "label.learner.progress.activity.current.tooltip", "label.learner.progress.activity.completed.tooltip", + "label.learner.progress.activity.attempted.tooltip", "label.learner.progress.activity.tostart.tooltip", + "label.learner.progress.activity.support.tooltip" }; + + private static final String[] LEARNER_MESSAGE_KEYS = new String[] { "message.learner.progress.restart.confirm", + "message.lesson.restart.button", "label.learner.progress.notebook", "button.exit", + "label.learner.progress.support", "label.my.progress" }; + + // --------------------------------------------------------------------- + // Class level constants - Struts forward + // --------------------------------------------------------------------- + + @RequestMapping("/redirectToURL") + @ResponseBody + private String redirectToURL(HttpServletResponse response, String url) throws IOException, ServletException { + if (url != null) { + String fullURL = WebUtil.convertToFullURL(url); + response.sendRedirect(response.encodeRedirectURL(fullURL)); + } else { + throw new ServletException("Tried to redirect to url but url is null"); + } + return null; + } + + /** + *

+ * The structs dispatch action that joins a learner into a lesson. This call is used for a user to start a lesson. + *

+ * + * @param mapping + * An ActionMapping class that will be used by the Action class to tell the ActionServlet where to send + * the end-user. + * + * @param form + * The ActionForm class that will contain any data submitted by the end-user via a form. + * @param request + * A standard Servlet HttpServletRequest class. + * @param response + * A standard Servlet HttpServletResponse class. + * @return An ActionForward class that will be returned to the ActionServlet indicating where the user is to go + * next. + * + * @throws IOException + * @throws ServletException + */ + + @RequestMapping("/joinLesson") + public String joinLesson(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + // initialize service object + Integer learner = null; + try { + + // get user and lesson based on request. + learner = LearningWebUtil.getUserId(); + long lessonID = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + + // security check + Lesson lesson = learnerService.getLesson(lessonID); + User user = (User) LearnerServiceProxy.getUserManagementService(applicationContext.getServletContext()) + .findById(User.class, learner); + if ((lesson.getLessonClass() == null) || !lesson.getLessonClass().getLearners().contains(user)) { + request.setAttribute("messageKey", + "User " + user.getLogin() + " is not a learner in the requested lesson."); + return "msgContent"; + } + // check lesson's state if its suitable for learner's access + if (!lesson.isLessonAccessibleForLearner()) { + request.setAttribute("messageKey", "Lesson is inaccessible"); + return "msgContent"; + } + + if (LearnerController.log.isDebugEnabled()) { + LearnerController.log.debug("The learner [" + learner + "] is joining the lesson [" + lessonID + "]"); + } + + // join user to the lesson on the server + LearnerProgress learnerProgress = learnerService.joinLesson(learner, lessonID); + + if (LearnerController.log.isDebugEnabled()) { + LearnerController.log.debug("The learner [" + learner + "] joined lesson. The" + "progress data is:" + + learnerProgress.toString()); + } + + ActivityMapping activityMapping = LearnerServiceProxy + .getActivityMapping(this.applicationContext.getServletContext()); + String url = "learning/" + activityMapping.getDisplayActivityAction(lessonID); + + redirectToURL(response, url); + + } catch (Exception e) { + LearnerController.log + .error("An error occurred while learner " + learner + " attempting to join the lesson.", e); + return "error"; + } + + return null; + } + + /** + * Archives current learner progress and moves a learner back to the start of lesson. + */ + @RequestMapping("/restartLesson") + public String restartLesson(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + // fetch necessary parameters + long lessonID = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + User user = LearningWebUtil.getUser(learnerService); + Integer userID = user.getUserId(); + + // find number of previous attempts + Integer attemptID = learnerService.getProgressArchiveMaxAttemptID(userID, lessonID); + if (attemptID == null) { + attemptID = 0; + } + attemptID++; + + // make a copy of attempted and completed activities + LearnerProgress learnerProgress = learnerService.getProgress(userID, lessonID); + Map attemptedActivities = new HashMap<>(learnerProgress.getAttemptedActivities()); + Map completedActivities = new HashMap<>(); + for (Entry entry : learnerProgress.getCompletedActivities().entrySet()) { + CompletedActivityProgressArchive activityArchive = new CompletedActivityProgressArchive(learnerProgress, + entry.getKey(), entry.getValue().getStartDate(), entry.getValue().getFinishDate()); + completedActivities.put(entry.getKey(), activityArchive); + } + + // save the historic attempt + LearnerProgressArchive learnerProgressArchive = new LearnerProgressArchive(user, learnerProgress.getLesson(), + attemptID, attemptedActivities, completedActivities, learnerProgress.getCurrentActivity(), + learnerProgress.getLessonComplete(), learnerProgress.getStartDate(), learnerProgress.getFinishDate()); + userManagementService.save(learnerProgressArchive); + gradebookService.removeLearnerFromLesson(lessonID, userID); + monitoringService.removeLearnerContent(lessonID, userID); + // remove learner progress + lessonService.removeLearnerProgress(lessonID, userID); + + // display Learner interface with updated data + return joinLesson(request, response); + } + + /** + * Produces necessary data for learner progress bar. + */ + @SuppressWarnings("unchecked") + @RequestMapping("/getLearnerProgress") + @ResponseBody + public String getLearnerProgress(HttpServletRequest request, HttpServletResponse response) throws IOException { + Integer learnerId = WebUtil.readIntParam(request, AttributeNames.PARAM_USER_ID, true); + Integer monitorId = null; + HttpSession ss = SessionManager.getSession(); + UserDTO user = (UserDTO) ss.getAttribute(AttributeNames.USER); + Integer userId = user != null ? user.getUserID() : null; + if (learnerId == null) { + // get progress for current user + learnerId = userId; + } else { + // monitor mode; get progress for user given in the parameter + monitorId = userId; + } + + ObjectNode responseJSON = JsonNodeFactory.instance.objectNode(); + Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID, true); + if (lessonId == null) { + // depending on when this is called, there may only be a toolSessionId known, not the lessonId. + Long toolSessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + ToolSession toolSession = LearnerServiceProxy.getLamsToolService(applicationContext.getServletContext()) + .getToolSession(toolSessionId); + lessonId = toolSession.getLesson().getLessonId(); + } + + responseJSON.set("messages", getProgressBarMessages()); + + Object[] ret = learnerService.getStructuredActivityURLs(learnerId, lessonId); + if (ret == null) { + response.setStatus(HttpServletResponse.SC_NO_CONTENT); + return null; + } + + responseJSON.put("currentActivityId", (Long) ret[1]); + responseJSON.put("isPreview", (boolean) ret[2]); + for (ActivityURL activity : (List) ret[0]) { + if (activity.getFloating()) { + // these are support activities + for (ActivityURL childActivity : activity.getChildActivities()) { + responseJSON.withArray("support") + .add(activityProgressToJSON(childActivity, null, lessonId, learnerId, monitorId)); + } + } else { + responseJSON.withArray("activities") + .add(activityProgressToJSON(activity, (Long) ret[1], lessonId, learnerId, monitorId)); + } + } + + response.setContentType("application/json;charset=utf-8"); + + return responseJSON.toString(); + } + + @RequestMapping("/getPresenceChatActiveUserCount") + @ResponseBody + public String getPresenceChatActiveUserCount(HttpServletRequest request, HttpServletResponse response) + throws IOException { + Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + int count = PresenceWebsocketServer.getActiveUserCount(lessonId); + + return String.valueOf(count); + } + + /** + * Forces a move to a destination Activity in the learning sequence, redirecting to the new page rather. + */ + + @RequestMapping("/forceMoveRedirect") + public String forceMoveRedirect(HttpServletRequest request, HttpServletResponse response) + throws IOException, ServletException { + + Long fromActivityId = WebUtil.readLongParam(request, AttributeNames.PARAM_CURRENT_ACTIVITY_ID, true); + Long toActivityId = WebUtil.readLongParam(request, AttributeNames.PARAM_DEST_ACTIVITY_ID, true); + + Activity fromActivity = null; + Activity toActivity = null; + + if (fromActivityId != null) { + fromActivity = learnerService.getActivity(fromActivityId); + } + + if (toActivityId != null) { + toActivity = learnerService.getActivity(toActivityId); + } + + Integer learnerId = LearningWebUtil.getUserId(); + Long lessonId = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID); + learnerService.moveToActivity(learnerId, lessonId, fromActivity, toActivity); + + if (LearnerController.log.isDebugEnabled()) { + LearnerController.log.debug("Force move for learner " + learnerId + " lesson " + lessonId + ". "); + } + + String url = null; + ActivityMapping activityMapping = LearnerServiceProxy + .getActivityMapping(this.applicationContext.getServletContext()); + if (!toActivity.isFloating()) { + url = "/learning" + activityMapping.getDisplayActivityAction(lessonId); + } else { + url = activityMapping.getActivityURL(toActivity); + } + + return redirectToURL(response, url); + } + + /** + * Converts an activity in learner progress to a JSON object. + */ + private ObjectNode activityProgressToJSON(ActivityURL activity, Long currentActivityId, Long lessonId, + Integer learnerId, Integer monitorId) throws IOException { + ObjectNode activityJSON = JsonNodeFactory.instance.objectNode(); + activityJSON.put("id", activity.getActivityId()); + activityJSON.put("name", activity.getTitle()); + activityJSON.put("status", activity.getActivityId().equals(currentActivityId) ? 0 : activity.getStatus()); + + // URL in learner mode + String url = activity.getUrl(); + if ((url != null) && (monitorId != null)) { + // URL in monitor mode + url = Configuration.get(ConfigurationKeys.SERVER_URL) + + "monitoring/monitoring.do?method=getLearnerActivityURL&lessonID=" + lessonId + "&activityID=" + + activity.getActivityId() + "&userID=" + learnerId; + } + + if (url != null) { + if (url.startsWith("learner.do")) { + url = "learning/" + url; + } + String serverUrl = Configuration.get(ConfigurationKeys.SERVER_URL); + if (!url.startsWith(serverUrl)) { + // monitor mode URLs should be prepended with server URL + url = serverUrl + url; + } + activityJSON.put("url", url); + } + + String actType = activity.getType().toLowerCase(); + String type = "a"; + if (actType.contains("gate")) { + type = "g"; + } else if (actType.contains("options")) { + type = "o"; + } else if (actType.contains("branching")) { + type = "b"; + } + activityJSON.put("type", type); + + if (activity.getChildActivities() != null) { + for (ActivityURL childActivity : activity.getChildActivities()) { + activityJSON.withArray("childActivities") + .add(activityProgressToJSON(childActivity, currentActivityId, lessonId, learnerId, monitorId)); + } + } + + return activityJSON; + } + + private ObjectNode getProgressBarMessages() { + ObjectNode progressBarMessages = JsonNodeFactory.instance.objectNode(); + MessageService messageService = LearnerServiceProxy + .getMonitoringMessageService(applicationContext.getServletContext()); + for (String key : MONITOR_MESSAGE_KEYS) { + String value = messageService.getMessage(key); + progressBarMessages.put(key, value); + } + messageService = LearnerServiceProxy.getMessageService(applicationContext.getServletContext()); + for (String key : LEARNER_MESSAGE_KEYS) { + String value = messageService.getMessage(key); + progressBarMessages.put(key, value); + } + return progressBarMessages; + } + + /** + * Gets the lesson details based on lesson id or the current tool session + */ + public ActionForward getLessonDetails(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws IOException { + + ObjectNode responseJSON = JsonNodeFactory.instance.objectNode(); + Lesson lesson = null; + + Long lessonID = WebUtil.readLongParam(request, AttributeNames.PARAM_LESSON_ID, true); + if (lessonID != null) { + lesson = lessonService.getLesson(lessonID); + + } else { + Long toolSessionId = WebUtil.readLongParam(request, AttributeNames.PARAM_TOOL_SESSION_ID); + ToolSession toolSession = LearnerServiceProxy.getLamsToolService(applicationContext.getServletContext()) + .getToolSession(toolSessionId); + lesson = toolSession.getLesson(); + } + + responseJSON.put(AttributeNames.PARAM_LESSON_ID, lesson.getLessonId()); + responseJSON.put(AttributeNames.PARAM_TITLE, lesson.getLessonName()); + responseJSON.put("allowRestart", lesson.getAllowLearnerRestart()); + responseJSON.put(AttributeNames.PARAM_PRESENCE_ENABLED, lesson.getLearnerPresenceAvailable()); + responseJSON.put(AttributeNames.PARAM_PRESENCE_IM_ENABLED, lesson.getLearnerImAvailable()); + + response.setContentType("application/json;charset=utf-8"); + response.getWriter().print(responseJSON.toString()); + + return null; + } +} \ No newline at end of file Fisheye: Tag 1f7150d6142f994d113ba543736a9f7c0e154337 refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LessonCompleteActivityAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LessonCompleteActivityController.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LessonCompleteActivityController.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LessonCompleteActivityController.java (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -0,0 +1,112 @@ +/**************************************************************** + * 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.learning.web.controller; + +import java.io.UnsupportedEncodingException; +import java.util.Set; + +import javax.servlet.http.HttpServletRequest; + +import org.lamsfoundation.lams.integration.service.IntegrationService; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +import org.lamsfoundation.lams.lesson.LearnerProgress; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.lesson.service.ILessonService; +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.RequestMapping; +import org.springframework.web.context.WebApplicationContext; +import org.springframework.web.context.support.WebApplicationContextUtils; + +/** + * Action class run when the learner finishes a lesson. + */ +@Controller +public class LessonCompleteActivityController extends ActivityController { + + @Autowired + @Qualifier("learnerService") + private ICoreLearnerService learnerService; + + @Autowired + private static IntegrationService integrationService; + + @Autowired + @Qualifier("lessonService") + private static ILessonService lessonService; + + @Autowired + private WebApplicationContext applicationContext; + + /** + * Gets an activity from the request (attribute) and forwards onto a display action using the ActionMappings class. + * If no activity is in request then use the current activity in learnerProgress. + */ + + @RequestMapping("/LessonComplete") + public String execute(HttpServletRequest request) throws UnsupportedEncodingException { + LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); + Lesson lesson = learnerProgress.getLesson(); + Set releasedLessons = getLessonService().getReleasedSucceedingLessons(lesson.getLessonId(), + learnerProgress.getUser().getUserId()); + if (!releasedLessons.isEmpty()) { + StringBuilder releasedLessonNames = new StringBuilder(); + for (Lesson releasedLesson : releasedLessons) { + releasedLessonNames.append(releasedLesson.getLessonName()).append(", "); + } + releasedLessonNames.delete(releasedLessonNames.length() - 2, releasedLessonNames.length()); + request.setAttribute(ActivityController.RELEASED_LESSONS_REQUEST_ATTRIBUTE, releasedLessonNames.toString()); + } + + //checks for lessonFinishUrl parameter + String lessonFinishCallbackUrl = getIntegrationService().getLessonFinishCallbackUrl(learnerProgress.getUser(), + lesson); + if (lessonFinishCallbackUrl != null) { + request.setAttribute("lessonFinishUrl", lessonFinishCallbackUrl); + } + request.setAttribute("lessonID", lesson.getLessonId()); + request.setAttribute("gradebookOnComplete", lesson.getGradebookOnComplete()); + + return "lessonComplete"; + } + + private IntegrationService getIntegrationService() { + if (LessonCompleteActivityController.integrationService == null) { + LessonCompleteActivityController.integrationService = (IntegrationService) WebApplicationContextUtils + .getRequiredWebApplicationContext(applicationContext.getServletContext()) + .getBean("integrationService"); + } + return LessonCompleteActivityController.integrationService; + } + + private ILessonService getLessonService() { + if (LessonCompleteActivityController.lessonService == null) { + LessonCompleteActivityController.lessonService = (ILessonService) WebApplicationContextUtils + .getRequiredWebApplicationContext(applicationContext.getServletContext()).getBean("lessonService"); + } + return LessonCompleteActivityController.lessonService; + } +} \ No newline at end of file Fisheye: Tag 1f7150d6142f994d113ba543736a9f7c0e154337 refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityController.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityController.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/LoadToolActivityController.java (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -0,0 +1,143 @@ +/**************************************************************** + * 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.learning.web.controller; + +import java.util.Map; +import java.util.TreeMap; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; +import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; +import org.lamsfoundation.lams.learning.web.bean.ActivityURL; +import org.lamsfoundation.lams.learning.web.form.ActivityForm; +import org.lamsfoundation.lams.learning.web.util.ActivityMapping; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +import org.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.lesson.LearnerProgress; +import org.lamsfoundation.lams.tool.exception.RequiredGroupMissingException; +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; + +/** + * Action class to forward the user to a Tool using an intermediate loading page. Can handle regular tools + grouping + * and gates (system tools). Displays the activity that is in the request. This allows it to show any arbitrary + * activity, not just the current activity. + * + * XDoclet definition: + * + * + * + * + * + * + */ +@Controller +public class LoadToolActivityController extends ActivityController { + + private static Logger log = Logger.getLogger(LoadToolActivityController.class); + + @Autowired + @Qualifier("learnerService") + private ICoreLearnerService learnerService; + + @Autowired + private WebApplicationContext applicationContext; + + public static final String PARAM_ACTIVITY_URL = "activityURL"; + public static final String PARAM_IS_BRANCHING = "isBranching"; + + private static final Map toolSessionCreationLocks = new TreeMap<>(); + + /** + * Gets an activity from the request (attribute) and forwards onto a loading page. + */ + @RequestMapping("/LoadToolActivity") + public String execute(@ModelAttribute ActivityForm form, HttpServletRequest request, HttpServletResponse response) { + + ActivityMapping actionMappings = LearnerServiceProxy + .getActivityMapping(this.applicationContext.getServletContext()); + + LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); + Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); + + /* + * Synchronise calls to the same activity and attempt to create a session, if it does not exist. + * Even though the method creating sessions in LamsCoreToolService is synchronised, + * subsequent reads from DB are (probably) dirty, + * i.e. they show that session does not exist while it is already there, + * created by another, isolated transaction. + * Reattempting session creation from within transaction not only is broken (because of the dirty reads) + * but also does not make sense, because if the session already exists, + * there is no point in repeating a failed attempt to create it. + * + * The synchronisation code below prevents threads from creating sessions at the same time. + * + * + * Object toolSessionCreationLock = null; + * synchronized (LoadToolActivityAction.toolSessionCreationLocks) { + * toolSessionCreationLock = LoadToolActivityAction.toolSessionCreationLocks.get(activityID); + * if (toolSessionCreationLock == null) { + * toolSessionCreationLock = activityID; + * LoadToolActivityAction.toolSessionCreationLocks.put(activityID, toolSessionCreationLock); + * } + * } + * synchronized (toolSessionCreationLock) { + */ + try { + learnerService.createToolSessionsIfNecessary(activity, learnerProgress); + + /* + * } catch (UnexpectedRollbackException e) { + * LamsAction.log.warn("Got exception while trying to create a tool session, but carrying on.", e); + */ + } catch (RequiredGroupMissingException e) { + + //got here when activity requires existing grouping but no group for user exists yet + log.warn(e.getMessage()); + request.setAttribute("messageKey", e.getMessage()); + return "msgContent"; + } + + form.setActivityID(activity.getActivityId()); + + if (activity.isToolActivity() || activity.isSystemToolActivity()) { + + String url = actionMappings.getLearnerToolURL(learnerProgress.getLesson(), activity, + learnerProgress.getUser()); + form.addActivityURL(new ActivityURL(activity.getActivityId(), url)); + + } else { + log.error("activity not ToolActivity"); + return "error"; + } + return "loadToolActivity"; + } +} \ No newline at end of file Fisheye: Tag 1f7150d6142f994d113ba543736a9f7c0e154337 refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/NotebookAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/NotebookController.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/NotebookController.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/NotebookController.java (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -0,0 +1,264 @@ +/**************************************************************** + * 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.learning.web.controller; + +import java.io.IOException; +import java.util.List; +import java.util.TreeMap; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServletRequest; + +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; +import org.lamsfoundation.lams.learning.service.LearnerServiceProxy; +import org.lamsfoundation.lams.learning.web.form.NotebookForm; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +import org.lamsfoundation.lams.lesson.Lesson; +import org.lamsfoundation.lams.notebook.model.NotebookEntry; +import org.lamsfoundation.lams.notebook.service.CoreNotebookConstants; +import org.lamsfoundation.lams.notebook.service.ICoreNotebookService; +import org.lamsfoundation.lams.usermanagement.User; +import org.lamsfoundation.lams.usermanagement.exception.UserAccessDeniedException; +import org.lamsfoundation.lams.util.WebUtil; +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; + +/** + * @author M Seaton + */ +@Controller +@RequestMapping("/notebook") +public class NotebookController { + + // --------------------------------------------------------------------- + // Instance variables + // --------------------------------------------------------------------- + private static final String VIEW_ALL = "viewAll"; + private static final String VIEW_SINGLE = "viewSingle"; + private static final String VIEW_JOURNALS = "viewJournals"; + + @Autowired + @Qualifier("notebookService") + private ICoreNotebookService notebookService; + + @Autowired + @Qualifier("learnerService") + private ICoreLearnerService learnerService; + + @Autowired + private WebApplicationContext applicationContext; + + /** + * View all notebook entries + */ + @RequestMapping("/viewAll") + public String viewAll(@ModelAttribute NotebookForm notebookForm, HttpServletRequest request) + throws IOException, ServletException { + + // getting requested object according to coming parameters + Integer learnerID = LearningWebUtil.getUserId(); + + // lessonID + Long lessonID = notebookForm.getCurrentLessonID(); + if (lessonID == null || lessonID == 0) { + lessonID = notebookForm.getLessonID(); + } + + // get all notebook entries for the learner + + TreeMap> entries = notebookService.getEntryByLesson(learnerID, + CoreNotebookConstants.SCRATCH_PAD); + + request.getSession().setAttribute("entries", entries.values()); + request.setAttribute("lessonID", lessonID); + + return "notebook/viewall"; + + } + + /** + * View all journals entries from a lesson call + */ + @RequestMapping("/viewAllJournals") + public String viewAllJournals(@ModelAttribute NotebookForm notebookForm, HttpServletRequest request) + throws IOException, ServletException { + + // getting requested object according to coming parameters + Integer userID = LearningWebUtil.getUserId(); + User user = (User) LearnerServiceProxy.getUserManagementService(applicationContext.getServletContext()) + .findById(User.class, userID); + + // lesson service + Long lessonID = notebookForm.getLessonID(); + Lesson lesson = learnerService.getLesson(lessonID); + + if (!hasStaffAccessToJournals(user, lesson)) { + throw new UserAccessDeniedException( + "User " + userID + " may not retrieve journal entries for lesson " + lessonID); + } + + // List of Journal entries + List journals = getJournals(lesson.getLessonId()); + request.getSession().setAttribute("journals", journals); + request.setAttribute(AttributeNames.PARAM_LESSON_ID, lessonID); + + return "notebook/viewalljournals"; + } + + // check user has permission to access all the journals for a lesson + private boolean hasStaffAccessToJournals(User user, Lesson lesson) { + + if (lesson == null) { + return false; + } + + // lesson owner okay + if ((lesson.getUser() != null) && lesson.getUser().getUserId().equals(user.getUserId())) { + return true; + } + + // staff member okay + if ((lesson.getLessonClass() != null) && lesson.getLessonClass().isStaffMember(user)) { + return true; + } + + return false; + } + + /** + * + * @param lessonID + * Lesson to get the journals from. + * @return List of Journal entries + */ + private List getJournals(Long lessonID) { + // initialize service object + + if (lessonID == null) { + return null; + } + + return notebookService.getEntry(lessonID, CoreNotebookConstants.SCRATCH_PAD, CoreNotebookConstants.JOURNAL_SIG); + + } + + /** + * View single notebook entry + */ + @RequestMapping("/viewEntry") + public String viewEntry(@ModelAttribute NotebookForm notebookForm, HttpServletRequest request) + throws IOException, ServletException { + + Long uid = notebookForm.getUid(); + Long currentLessonID = notebookForm.getCurrentLessonID(); + String mode = WebUtil.readStrParam(request, "mode", true); + + NotebookEntry entry = notebookService.getEntry(uid); + + // getting requested object according to coming parameters + Integer userID = LearningWebUtil.getUserId(); + User user = (User) LearnerServiceProxy.getUserManagementService(applicationContext.getServletContext()) + .findById(User.class, userID); + + if (entry.getUser() != null && !entry.getUser().getUserId().equals(user.getUserId())) { + // wants to look at someone else's entry - check they are a teacher + Lesson lesson = learnerService.getLesson(currentLessonID); + if (!hasStaffAccessToJournals(user, lesson)) { + throw new UserAccessDeniedException( + "User " + userID + " may not retrieve journal entries for lesson " + currentLessonID); + } + } + + if (mode != null) { + request.setAttribute("mode", mode); + } + + if (entry != null) { + request.setAttribute("entry", entry); + } + + if (currentLessonID != null) { + request.setAttribute("currentLessonID", currentLessonID); + } + + return "notebook/view"; + } + + /** + * + */ + @RequestMapping("/processNewEntry") + public String processNewEntry(@ModelAttribute NotebookForm notebookForm, HttpServletRequest request) + throws IOException, ServletException { + + Long id = notebookForm.getLessonID(); + String title = notebookForm.getTitle(); + String entry = notebookForm.getEntry(); + String signature = notebookForm.getSignature(); + Integer userID = LearningWebUtil.getUserId(); + + notebookService.createNotebookEntry(id, CoreNotebookConstants.SCRATCH_PAD, signature, userID, title, entry); + + boolean skipViewAll = WebUtil.readBooleanParam(request, "skipViewAll", false); + return skipViewAll ? null : viewAll(notebookForm, request); + } + + /** + * + */ + @RequestMapping("/updateEntry") + public String updateEntry(@ModelAttribute NotebookForm notebookForm, HttpServletRequest request) + throws IOException, ServletException { + + Long uid = notebookForm.getUid(); + String title = notebookForm.getTitle(); + String entry = notebookForm.getEntry(); + String signature = notebookForm.getSignature(); + + // get existing entry to edit + NotebookEntry entryObj = notebookService.getEntry(uid); + + // check entry is being edited by it's owner + Integer userID = LearningWebUtil.getUserId(); + if (userID != entryObj.getUser().getUserId()) { + // throw exception + } + + // update entry + entryObj.setTitle(title); + entryObj.setEntry(entry); + entryObj.setExternalSignature(signature); + + notebookService.updateEntry(entryObj); + + return viewAll(notebookForm, request); + + } + +} \ No newline at end of file Fisheye: Tag 1f7150d6142f994d113ba543736a9f7c0e154337 refers to a dead (removed) revision in file `lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityAction.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/controller/SequenceActivityController.java (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -0,0 +1,105 @@ +/**************************************************************** + * 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.learning.web.controller; + +import java.io.UnsupportedEncodingException; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.log4j.Logger; +import org.lamsfoundation.lams.learning.service.ICoreLearnerService; +import org.lamsfoundation.lams.learning.service.LearnerServiceException; +import org.lamsfoundation.lams.learning.web.util.ActivityMapping; +import org.lamsfoundation.lams.learning.web.util.LearningWebUtil; +import org.lamsfoundation.lams.learningdesign.Activity; +import org.lamsfoundation.lams.learningdesign.NullActivity; +import org.lamsfoundation.lams.learningdesign.SequenceActivity; +import org.lamsfoundation.lams.lesson.LearnerProgress; +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.RequestMapping; +import org.springframework.web.context.WebApplicationContext; + +/** + * Action class to display a sequence activity. + * + * Normally this will display the first activity inside a sequence activity. If there are no activities within the + * sequence activity then it will display an "empty" message. + * + * + * + */ +@Controller +public class SequenceActivityController extends ActivityController { + + private static Logger log = Logger.getLogger(SequenceActivityController.class); + + @Autowired + @Qualifier("learnerService") + private ICoreLearnerService learnerService; + + @Autowired + private WebApplicationContext applicationContext; + + /** + * Gets an sequence activity from the request (attribute) and forwards to either the first activity in the sequence + * activity or the "empty" JSP. + * + * @throws UnsupportedEncodingException + * @throws LearnerServiceException + */ + @RequestMapping("/SequenceActivity") + public String execute(HttpServletRequest request, HttpServletResponse response) + throws LearnerServiceException, UnsupportedEncodingException { + + ActivityMapping actionMappings = LearningWebUtil + .getActivityMapping(this.applicationContext.getServletContext()); + Integer learnerId = LearningWebUtil.getUserId(); + + LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgress(request, learnerService); + Activity activity = LearningWebUtil.getActivityFromRequest(request, learnerService); + if (!(activity instanceof SequenceActivity)) { + log.error("activity not SequenceActivity " + activity.getActivityId()); + return "error"; + } + + String forward = null; + SequenceActivity sequenceActivity = (SequenceActivity) activity; + Activity firstActivityInSequence = sequenceActivity.getNextActivityByParent(new NullActivity()); + + if ((firstActivityInSequence != null) && !firstActivityInSequence.isNull()) { + // Set the first activity as the current activity and display it + learnerProgress = learnerService.chooseActivity(learnerId, learnerProgress.getLesson().getLessonId(), + firstActivityInSequence, true); + forward = actionMappings.getActivityForward(firstActivityInSequence, learnerProgress, true); + return forward; + } else { + // No activities exist in the sequence, so go to the next activity. + return LearningWebUtil.completeActivity(request, response, actionMappings, learnerProgress, activity, + learnerId, learnerService, true); + } + } +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/ActivityForm.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/ActivityForm.java (.../ActivityForm.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/ActivityForm.java (.../ActivityForm.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,16 +21,13 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.form; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; -import org.apache.struts.action.ActionForm; -import org.apache.struts.action.ActionMapping; import org.lamsfoundation.lams.learning.web.bean.ActivityURL; /** @@ -39,7 +36,7 @@ * XDoclet definition: * */ -public class ActivityForm extends ActionForm { +public class ActivityForm { /** * Unique identifier specifying the session for this activity, maps back to LearnerProgress (or Learner) and @@ -62,8 +59,8 @@ * @param mapping * @param request */ - @Override - public void reset(ActionMapping mapping, HttpServletRequest request) { + + public void reset(HttpServletRequest request) { activityURLs = null; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/BranchingForm.java =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/BranchingForm.java (.../BranchingForm.java) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/BranchingForm.java (.../BranchingForm.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -2,16 +2,18 @@ import java.util.List; +import org.lamsfoundation.lams.learning.web.bean.ActivityURL; + public class BranchingForm { private Long activityID; private Long progressID; - private Long previewLesson; - private boolean showNextButton; - private boolean showFinishButton; + private Boolean previewLesson; + private Boolean showNextButton; + private Boolean showFinishButton; private String title; private String type; - private List activityURLs; + private List activityURLs; // used for updating the the progress bar private Long lessonID; @@ -34,27 +36,27 @@ this.progressID = progressID; } - public Long getPreviewLesson() { + public Boolean getPreviewLesson() { return previewLesson; } - public void setPreviewLesson(Long previewLesson) { + public void setPreviewLesson(Boolean previewLesson) { this.previewLesson = previewLesson; } - public boolean isShowNextButton() { + public Boolean isShowNextButton() { return showNextButton; } - public void setShowNextButton(boolean showNextButton) { + public void setShowNextButton(Boolean showNextButton) { this.showNextButton = showNextButton; } - public boolean isShowFinishButton() { + public Boolean isShowFinishButton() { return showFinishButton; } - public void setShowFinishButton(boolean showFinishButton) { + public void setShowFinishButton(Boolean showFinishButton) { this.showFinishButton = showFinishButton; } @@ -74,11 +76,11 @@ this.type = type; } - public List getActivityURLs() { + public List getActivityURLs() { return activityURLs; } - public void setActivityURLs(List activityURLs) { + public void setActivityURLs(List activityURLs) { this.activityURLs = activityURLs; } Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/NotebookForm.java =================================================================== diff -u --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/NotebookForm.java (revision 0) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/NotebookForm.java (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -0,0 +1,60 @@ +package org.lamsfoundation.lams.learning.web.form; + +public class NotebookForm { + + private Long uid; + private String title; + private String entry; + private Long lessonID; + private Long currentLessonID; + private String signature; + + public Long getUid() { + return uid; + } + + public void setUid(Long uid) { + this.uid = uid; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getEntry() { + return entry; + } + + public void setEntry(String entry) { + this.entry = entry; + } + + public Long getLessonID() { + return lessonID; + } + + public void setLessonID(Long lessonID) { + this.lessonID = lessonID; + } + + public Long getCurrentLessonID() { + return currentLessonID; + } + + public void setCurrentLessonID(Long currentLessonID) { + this.currentLessonID = currentLessonID; + } + + public String getSignature() { + return signature; + } + + public void setSignature(String signature) { + this.signature = signature; + } + +} \ No newline at end of file Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/OptionsActivityForm.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/OptionsActivityForm.java (.../OptionsActivityForm.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/form/OptionsActivityForm.java (.../OptionsActivityForm.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -21,7 +21,6 @@ * **************************************************************** */ - package org.lamsfoundation.lams.learning.web.form; /** Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/LearningWebUtil.java (.../LearningWebUtil.java) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -31,7 +31,6 @@ import javax.servlet.http.HttpSession; import org.apache.log4j.Logger; -import org.apache.struts.action.ActionForward; import org.lamsfoundation.lams.learning.service.ICoreLearnerService; import org.lamsfoundation.lams.learning.service.ILearnerService; import org.lamsfoundation.lams.learning.service.LearnerServiceException; @@ -81,7 +80,8 @@ HttpSession ss = SessionManager.getSession(); UserDTO learner = (UserDTO) ss.getAttribute(AttributeNames.USER); return learner != null - ? (User) learnerService.getUserManagementService().findById(User.class, learner.getUserID()) : null; + ? (User) learnerService.getUserManagementService().findById(User.class, learner.getUserID()) + : null; } /** @@ -142,7 +142,7 @@ * @throws InterruptedException * */ - public static ActionForward completeActivity(HttpServletRequest request, HttpServletResponse response, + public static String completeActivity(HttpServletRequest request, HttpServletResponse response, ActivityMapping actionMappings, LearnerProgress progress, Activity currentActivity, Integer learnerId, ICoreLearnerService learnerService, boolean redirect) throws LearnerServiceException, UnsupportedEncodingException { Index: lams_learning/web/WEB-INF/tags/AuthoringButton.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/AuthoringButton.tag (.../AuthoringButton.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -32,7 +32,7 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ attribute name="formID" required="true" rtexprvalue="true" %> @@ -123,11 +123,11 @@ } \ No newline at end of file Index: lams_learning/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag (.../AuthoringRatingAllStyleCriteria.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/AuthoringRatingAllStyleCriteria.tag (.../AuthoringRatingAllStyleCriteria.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -8,7 +8,7 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_learning/web/WEB-INF/tags/AuthoringRatingCriteria.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/AuthoringRatingCriteria.tag (.../AuthoringRatingCriteria.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/AuthoringRatingCriteria.tag (.../AuthoringRatingCriteria.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -8,7 +8,7 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> @@ -284,42 +284,42 @@ - - + + - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + - - + + - - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9 - 10 - + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + Index: lams_learning/web/WEB-INF/tags/CommentsAuthor.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/CommentsAuthor.tag (.../CommentsAuthor.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -1,5 +1,5 @@ <%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-html" prefix="html"%> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> @@ -42,23 +42,23 @@
-     -   +     +  
Index: lams_learning/web/WEB-INF/tags/Page.tag =================================================================== diff -u -r6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 6f37a4eb8b2023d6e6dffceffa91ebdbf74c54f5) +++ lams_learning/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -138,12 +138,12 @@ function restartLesson(){ if (confirm(restartLessonConfirmation)) { - window.location.href = LEARNING_URL + 'learner.do?method=restartLesson&lessonID=' + lessonId; + window.location.href = LEARNING_URL + 'learner/restartLesson.do?lessonID=' + lessonId; } } function viewNotebookEntries(){ - openPopUp(LEARNING_URL + "notebook.do?method=viewAll&lessonID=" + lessonId, + openPopUp(LEARNING_URL + "notebook/viewAll.do?lessonID=" + lessonId, "Notebook", 648,1152, "no"); @@ -245,9 +245,8 @@ if ( lessonId != "" || toolSessionId != "" ) { $.ajax({ - url : LEARNING_URL + 'learner.do', + url : LEARNING_URL + 'learner/getLessonDetails.do', data : { - 'method' : 'getLessonDetails', 'lessonID' : lessonId, 'toolSessionID' : toolSessionId, }, Index: lams_learning/web/WEB-INF/tags/Rating.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/Rating.tag (.../Rating.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/Rating.tag (.../Rating.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -8,7 +8,7 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_learning/web/WEB-INF/tags/StyledRating.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/StyledRating.tag (.../StyledRating.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/StyledRating.tag (.../StyledRating.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -8,7 +8,7 @@ <%@ tag body-content="scriptless" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> -<%@ taglib uri="tags-html" prefix="html" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-lams" prefix="lams"%> <%@ taglib uri="tags-function" prefix="fn" %> Index: lams_learning/web/WEB-INF/tags/TabBody.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/TabBody.tag (.../TabBody.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/TabBody.tag (.../TabBody.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -34,7 +34,6 @@ <%@ attribute name="titleKey" required="false" rtexprvalue="true"%> <%@ attribute name="page" required="false" rtexprvalue="true"%> <%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-bean" prefix="bean"%> Index: lams_learning/web/WEB-INF/tags/TabBodyArea.tag =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/WEB-INF/tags/TabBodyArea.tag (.../TabBodyArea.tag) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/WEB-INF/tags/TabBodyArea.tag (.../TabBodyArea.tag) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -30,7 +30,6 @@ %> <%@ taglib uri="tags-core" prefix="c"%> -<%@ taglib uri="tags-bean" prefix="bean"%>
Index: lams_learning/web/branching/preview.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/branching/preview.jsp (.../preview.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/branching/preview.jsp (.../preview.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -58,9 +58,9 @@
- +
- + -
+
Index: lams_learning/web/branching/wait.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/branching/wait.jsp (.../wait.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/branching/wait.jsp (.../wait.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -19,26 +19,24 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-html" prefix="html" %> -<%@ taglib uri="tags-bean" prefix="bean" %> -<%@ taglib uri="tags-logic" prefix="logic" %> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-core" prefix="c" %> <%@ taglib uri="tags-fmt" prefix="fmt" %> <%@ taglib uri="tags-lams" prefix="lams" %> - /branching.do?method=performBranching&type=${BranchingForm.map.type}&activityID=${BranchingForm.map.activityID}&progressID=${BranchingForm.map.progressID} + /branching/performBranching.do?type=${BranchingForm.map.type}&activityID=${BranchingForm.map.activityID}&progressID=${BranchingForm.map.progressID} - +

- +
-
+ Index: lams_learning/web/common/taglibs.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/common/taglibs.jsp (.../taglibs.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/common/taglibs.jsp (.../taglibs.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -1,11 +1,8 @@ <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-logic" prefix="logic"%> -<%@ taglib uri="tags-tiles" prefix="tiles"%> -<%@ taglib uri="tags-html" prefix="html"%> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-function" prefix="fn" %> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> \ No newline at end of file Index: lams_learning/web/gate/gateNext.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/gate/gateNext.jsp (.../gateNext.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/gate/gateNext.jsp (.../gateNext.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -1,5 +1,5 @@ + value="/gate/knockGate.do?activityID=${GateForm.map.activityID}&lessonID=${GateForm.map.lessonID }" />
@@ -14,10 +14,10 @@
- +
- +
-
+ Index: lams_learning/web/gate/scheduleGateContent.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/gate/scheduleGateContent.jsp (.../scheduleGateContent.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/gate/scheduleGateContent.jsp (.../scheduleGateContent.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -19,9 +19,7 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-logic" prefix="logic"%> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> Index: lams_learning/web/gate/synchGateContent.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/gate/synchGateContent.jsp (.../synchGateContent.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/gate/synchGateContent.jsp (.../synchGateContent.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -19,9 +19,7 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-logic" prefix="logic"%> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> Index: lams_learning/web/grouping/choose.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/grouping/choose.jsp (.../choose.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/grouping/choose.jsp (.../choose.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -19,9 +19,7 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-logic" prefix="logic"%> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-function" prefix="fn"%> @@ -83,10 +81,10 @@ - - + +
- + \ No newline at end of file Index: lams_learning/web/kumalive/kumaliveReport.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/kumalive/kumaliveReport.jsp (.../kumaliveReport.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/kumalive/kumaliveReport.jsp (.../kumaliveReport.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -25,7 +25,7 @@ // Create the organisation view grid with sub grid for users $("#organisationGrid").jqGrid({ datatype : "json", - url : "learning/kumalive.do?method=getReportOrganisationData&organisationID=${param.organisationID}", + url : "learning/kumalive/getReportOrganisationData.do?organisationID=${param.organisationID}", height : "100%", // use new theme guiStyle : "bootstrap", @@ -74,9 +74,8 @@ // fetch rubrics first so we can build column model $.ajax({ - url: "learning/kumalive.do", + url: "learning/kumalive/getReportKumaliveRubrics.do", data: { - 'method' : 'getReportKumaliveRubrics', 'kumaliveId' : kumaliveId }, dataType: "json", @@ -95,7 +94,7 @@ $("#" + user_subgrid_table_id).jqGrid({ datatype : 'json', - url : "learning/kumalive.do?method=getReportKumaliveData&kumaliveId=" + url : "learning/kumalive/getReportKumaliveData.do?kumaliveId=" + kumaliveId, colNames : [''].concat(columnNames), colModel : [ @@ -128,7 +127,7 @@ $("#" + score_subgrid_table_id).jqGrid({ datatype : 'json', - url : "learning/kumalive.do?method=getReportUserData&kumaliveId=" + url : "learning/kumalive/getReportUserData.do?kumaliveId=" + kumaliveId + "&userId=" + userId, colNames : ['#'].concat(columnNames), colModel : [ @@ -160,11 +159,11 @@ }); function exportAll(){ - blockExportButtons('learning/kumalive.do?method=exportKumalives&organisationID=${param.organisationID}'); + blockExportButtons('learning/kumalive/exportKumalives.do?organisationID=${param.organisationID}'); } function exportSelected(){ - blockExportButtons('learning/kumalive.do?method=exportKumalives&kumaliveIds=' + blockExportButtons('learning/kumalive/exportKumalives.do?kumaliveIds=' // return an array of IDs of rows (Kumalives) selected on all pages + JSON.stringify($("#organisationGrid").jqGrid('getGridParam','selarrrow'))); } Index: lams_learning/web/layout/branchingWaitLayout.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/layout/branchingWaitLayout.jsp (.../branchingWaitLayout.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/layout/branchingWaitLayout.jsp (.../branchingWaitLayout.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -29,7 +29,7 @@ <fmt:message key="label.branching.title"/> - /branching.do?method=performBranching&type=${BranchingForm.map.type}&activityID=${BranchingForm.map.activityID}&progressID=${BranchingForm.map.progressID} + /branching/performBranching.do?type=${BranchingForm.map.type}&activityID=${BranchingForm.map.activityID}&progressID=${BranchingForm.map.progressID} &force=true Index: lams_learning/web/layout/gateLayout.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/layout/gateLayout.jsp (.../gateLayout.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/layout/gateLayout.jsp (.../gateLayout.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -36,7 +36,7 @@ <c:out value="${title}" /> + CONTENT="60;URL=/gate/knockGate.do?activityID=${GateForm.map.activityID}&lessonID=${GateForm.map.lessonID }"> Index: lams_learning/web/layout/groupWaitLayout.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/layout/groupWaitLayout.jsp (.../groupWaitLayout.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/layout/groupWaitLayout.jsp (.../groupWaitLayout.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -28,7 +28,7 @@ <fmt:message key="label.view.groups.title"/> - + Index: lams_learning/web/lessonComplete.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/lessonComplete.jsp (.../lessonComplete.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/lessonComplete.jsp (.../lessonComplete.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -20,8 +20,7 @@ --%> <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> +<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-lams" prefix="lams"%> @@ -47,7 +46,7 @@ - + @@ -174,7 +174,7 @@
- @@ -184,9 +184,9 @@ - +
-
+
\ No newline at end of file Index: lams_learning/web/parallelActivity.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/parallelActivity.jsp (.../parallelActivity.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/parallelActivity.jsp (.../parallelActivity.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -20,8 +20,6 @@ --%> <%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=utf-8" %> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-html" prefix="html"%> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt" %> Index: lams_learning/web/partialCompleted.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/partialCompleted.jsp (.../partialCompleted.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/partialCompleted.jsp (.../partialCompleted.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -19,9 +19,6 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-html" prefix="html"%> -<%@ taglib uri="tags-bean" prefix="bean"%> -<%@ taglib uri="tags-logic" prefix="logic"%> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-function" prefix="fn"%> Index: lams_learning/web/welcome.jsp =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r1f7150d6142f994d113ba543736a9f7c0e154337 --- lams_learning/web/welcome.jsp (.../welcome.jsp) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_learning/web/welcome.jsp (.../welcome.jsp) (revision 1f7150d6142f994d113ba543736a9f7c0e154337) @@ -19,7 +19,6 @@ http://www.gnu.org/licenses/gpl.txt --%> -<%@ taglib uri="tags-bean" prefix="bean"%> <%@ taglib uri="tags-fmt" prefix="fmt"%> <%@ taglib uri="tags-core" prefix="c"%> <%@ taglib uri="tags-lams" prefix="lams" %> @@ -30,7 +29,7 @@