Index: lams_build/lib/lams/lams-learning.jar
===================================================================
diff -u -r56dc9e59c9512b28858b2da10f756103010d9cca -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
Binary files differ
Index: lams_learning/conf/language/ApplicationResources.properties
===================================================================
diff -u -r4f63e229406635f45a2a98726c9c47e554210e01 -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 4f63e229406635f45a2a98726c9c47e554210e01)
+++ lams_learning/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -1,9 +1,17 @@
# CVS ID: $Id$
# Language strings for the Progress Engine related classes and screens. Mostly error messages.
learner.title=Learner :: LAMS
+# Message which appears when the learner window is opened or between activities.
message.activity.loading=The next task is loading. Please wait....
+# Message which appears when the learner finishes a lesson (part 1)
message.lesson.finished=Congratulations, you have finished.
-message.lesson.finishedCont=You have now completed your learning activity. Please log out or select a new session from the Available Sessions Panel
+# Message which appears when the learner finishes a lesson (part 2)
+message.lesson.finishedCont=You have now completed this lesson. Please close the window and select another lesson from the main page.
+# Heading for the "You have exited" screen
+exit.heading=You have exited from this Lesson.
+# Message for the "You have exited" screen
+exit.message=You can resume this lesson using the Resume button.
+
message.activity.parallel.partialComplete=You have to complete the other task before progressing to the next activity....
message.activity.parallel.noFrames=Your browser does not handle frames!
message.activity.options.noActivitySelected=Please select an activity from the list
@@ -42,14 +50,6 @@
export.html.exportFailed=
Export Portfolio
Export Portfolio Failed
This sequence does not support portfolio exports
# HTML used to create the export portfolio activity page when an activity does not support export portfolio (stops it being just a blank page)
export.html.exportNotSupported=Export Portfolio Unsupported
Export Portfolio for this activity is unsupported
-# Heading for the "You have exited" screen
-exit.heading=You have exited from this Lesson
-# Message for the "You have exited" screen
-exit.message=You will find it in the "Started Lessons" part of the available lessons panel. You can resume this lesson using the Resume button.
-# Heading for the initial Learning "Welcome" screen
-welcome.heading=Select a Lesson from the panel on the left to begin.
-# Message for the initial Learning "Welcome" screen
-welcome.message=You may start a new lesson, resume an existing lesson or view a completed lesson.
# General system error message.
error.system.error=An error has occurred. Please start again. Reason for error: {0}
Index: lams_learning/conf/xdoclet/struts-actions.xml
===================================================================
diff -u -r763b25eefdb9fdfb17e1e4352a74ae964c83bc54 -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 763b25eefdb9fdfb17e1e4352a74ae964c83bc54)
+++ lams_learning/conf/xdoclet/struts-actions.xml (.../struts-actions.xml) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -15,6 +15,3 @@
-
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java
===================================================================
diff -u -r6c93a29e621c20da5662066e4be018eab3f5d17d -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java (.../ProgressEngine.java) (revision 6c93a29e621c20da5662066e4be018eab3f5d17d)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/progress/ProgressEngine.java (.../ProgressEngine.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -24,12 +24,14 @@
/* $$Id$$ */
package org.lamsfoundation.lams.learning.progress;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.lamsfoundation.lams.learningdesign.Activity;
import org.lamsfoundation.lams.learningdesign.ComplexActivity;
import org.lamsfoundation.lams.learningdesign.LearningDesign;
+import org.lamsfoundation.lams.learningdesign.ParallelActivity;
import org.lamsfoundation.lams.learningdesign.SequenceActivity;
import org.lamsfoundation.lams.learningdesign.Transition;
import org.lamsfoundation.lams.learningdesign.dao.IActivityDAO;
@@ -78,7 +80,8 @@
Transition transition = completedActivity.getTransitionFrom();
if (transition != null)
- return progressCompletedActivity(completedActivity,
+ return progressCompletedActivity(learner,
+ completedActivity,
learnerProgress,
transition);
else
@@ -107,9 +110,21 @@
progress.setCurrentActivity(ld.getFirstActivity());
progress.setNextActivity(ld.getFirstActivity());
- progress.setProgressState(ld.getFirstActivity(),LearnerProgress.ACTIVITY_ATTEMPTED);
+ setActivityAttempted(progress, ld.getFirstActivity());
}
+ /** Set the current activity as attempted. If it is a parallel activity, mark its children as attempted too. */
+ private void setActivityAttempted(LearnerProgress progress, Activity activity) {
+ progress.setProgressState(activity,LearnerProgress.ACTIVITY_ATTEMPTED);
+ if ( activity.isParallelActivity() ) {
+ ParallelActivity parallel = (ParallelActivity) activityDAO.getActivityByActivityId(activity.getActivityId(), ParallelActivity.class);
+ Iterator iter = parallel.getActivities().iterator();
+ while (iter.hasNext()) {
+ Activity element = (Activity) iter.next();
+ setActivityAttempted(progress,element);
+ }
+ }
+ }
/**
* We setup the progress data for a completed activity. This happens when
* we find a transition to progress to. It should setup all activity states
@@ -123,32 +138,46 @@
* @param learnerProgress the progress we based on.
* @param transition the transition we progress to.
* @return the learner progress data we calculated.
+ * @throws ProgressException
*/
- private LearnerProgress progressCompletedActivity(Activity completedActivity,
+ private LearnerProgress progressCompletedActivity(User learner,
+ Activity completedActivity,
LearnerProgress learnerProgress,
- Transition transition)
+ Transition transition) throws ProgressException
{
- learnerProgress.setPreviousActivity(completedActivity);
-
- populateCurrentCompletedActivityList(learnerProgress);
-
- learnerProgress.setCurrentActivity(transition.getToActivity());
-
- //we set the next activity to be the first child activity if it
- //is a sequence activity.
- if(transition.getToActivity().isSequenceActivity())
- {
- Activity firstActivityInSequence =
- ((SequenceActivity)transition.getToActivity()).getFirstActivityInSequenceActivity();
- learnerProgress.setNextActivity(firstActivityInSequence);
- }
- //set next activity as the activity follows the transition.
- else
- learnerProgress.setNextActivity(transition.getToActivity());
- learnerProgress.setProgressState(transition.getToActivity(),
- LearnerProgress.ACTIVITY_ATTEMPTED);
- learnerProgress.setParallelWaiting(false);
- return learnerProgress;
+ Activity nextActivity = transition.getToActivity();
+
+ if ( ! learnerProgress.getCompletedActivities().contains(nextActivity) ) {
+ // normal case - the next activity is still yet to be done
+
+ learnerProgress.setPreviousActivity(completedActivity);
+
+ populateCurrentCompletedActivityList(learnerProgress);
+
+ learnerProgress.setCurrentActivity(nextActivity);
+
+ //we set the next activity to be the first child activity if it
+ //is a sequence activity.
+ if(nextActivity.isSequenceActivity())
+ {
+ Activity firstActivityInSequence =
+ ((SequenceActivity)nextActivity).getFirstActivityInSequenceActivity();
+ learnerProgress.setNextActivity(firstActivityInSequence);
+ }
+ //set next activity as the activity follows the transition.
+ else
+ learnerProgress.setNextActivity(nextActivity);
+ setActivityAttempted(learnerProgress, nextActivity);
+ learnerProgress.setParallelWaiting(false);
+ return learnerProgress;
+
+ } else {
+ // abnormal case: next activity already done. Must have jumped back to an earlier
+ // optional activity, done another activity and then kept going
+
+ return calculateProgress(learner,nextActivity,learnerProgress);
+ }
+
}
/**
@@ -183,7 +212,7 @@
//move to next activity within parent if not all children are completed.
ComplexActivity complexParent = (ComplexActivity) activityDAO.getActivityByActivityId(parent.getActivityId(),ComplexActivity.class);
- if (!complexParent.areChildrenCompleted(learnerProgress))
+ if (! learnerProgress.getCompletedActivities().contains(complexParent) && !complexParent.areChildrenCompleted(learnerProgress))
{
Activity nextActivity = complexParent.getNextActivityByParent(completedActivity);
@@ -206,8 +235,7 @@
{
learnerProgress.setParallelWaiting(false);
learnerProgress.setNextActivity(nextActivity);
- learnerProgress.setProgressState(nextActivity,
- LearnerProgress.ACTIVITY_ATTEMPTED);
+ setActivityAttempted(learnerProgress, nextActivity);
populateCurrentCompletedActivityList(learnerProgress);
}
}
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ActivityAction.java
===================================================================
diff -u -r2b6827b06455b7269c88062bd218427529ee0a4c -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ActivityAction.java (.../ActivityAction.java) (revision 2b6827b06455b7269c88062bd218427529ee0a4c)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ActivityAction.java (.../ActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -25,26 +25,51 @@
package org.lamsfoundation.lams.learning.web.action;
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.lamsfoundation.lams.learning.service.ILearnerService;
import org.lamsfoundation.lams.learning.service.LearnerServiceProxy;
+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.web.action.LamsAction;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;
/**
- * MyEclipse Struts
- * Creation date: 01-12-2005
- *
+ * Base class for all activity action classes. Each subclass should call
+ * super.execute() to set up the progress data in the ActivityForm.
*/
-public class ActivityAction extends LamsAction {
+public abstract class ActivityAction extends LamsAction {
public static final String ACTIVITY_REQUEST_ATTRIBUTE = "activity";
public static final String LEARNER_PROGRESS_REQUEST_ATTRIBUTE = "learnerprogress";
+ public ActionForward setupProgressString(ActionForm actionForm, HttpServletRequest request) {
+
+ LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgressByID(request,
+ getServlet().getServletContext());
+
+ ActivityForm activityForm = (ActivityForm) actionForm;
+
+ // Calculate the progress summary. On join this method gets called twice, and we
+ // only want to calculate once
+ String progressSummary = activityForm.getProgressSummary();
+ if ( progressSummary == null ) {
+ progressSummary = getProgressSummary(learnerProgress);
+ activityForm.setProgressSummary(progressSummary);
+ }
+
+ if(log.isDebugEnabled())
+ log.debug("Entering activity: progress summary is "+activityForm.getProgressSummary());
+
+ return null;
+ }
/**
* Get the learner service.
*/
@@ -77,7 +102,46 @@
* have to reload it.
*/
protected void setLearnerProgress(HttpServletRequest request, LearnerProgress learnerProgress) {
- request.setAttribute(ActivityAction.LEARNER_PROGRESS_REQUEST_ATTRIBUTE, learnerProgress);
+ LearningWebUtil.setLearnerProgress(learnerProgress);
}
+ private String getProgressSummary(LearnerProgress learnerProgress) {
+ StringBuffer progressSummary = new StringBuffer(100);
+ if ( learnerProgress == null ) {
+ progressSummary.append("attempted=&completed=¤t=");
+ } else {
+ progressSummary.append("attempted=");
+ boolean first = true;
+ for ( Object obj : learnerProgress.getAttemptedActivities() ) {
+ Activity activity = (Activity ) obj;
+ if ( ! first ) {
+ progressSummary.append("_");
+ } else {
+ first = false;
+ }
+ progressSummary.append(activity.getActivityId());
+ }
+
+ progressSummary.append("&completed=");
+ first = true;
+ for ( Object obj : learnerProgress.getCompletedActivities() ) {
+ Activity activity = (Activity ) obj;
+ if ( ! first ) {
+ progressSummary.append("_");
+ } else {
+ first = false;
+ }
+ progressSummary.append(activity.getActivityId());
+ }
+
+ progressSummary.append("¤t=");
+ Activity currentActivity = learnerProgress.getCurrentActivity();
+ if ( currentActivity != null ) {
+ progressSummary.append(currentActivity.getActivityId());
+ }
+ }
+ return progressSummary.toString();
+ }
+
+
}
\ No newline at end of file
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ChooseActivityAction.java
===================================================================
diff -u -r6c93a29e621c20da5662066e4be018eab3f5d17d -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ChooseActivityAction.java (.../ChooseActivityAction.java) (revision 6c93a29e621c20da5662066e4be018eab3f5d17d)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/ChooseActivityAction.java (.../ChooseActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -81,8 +81,12 @@
}
ILearnerService learnerService = getLearnerService();
- learnerService.chooseActivity(learner, lesson.getLessonId(), activity);
-
+ progress = learnerService.chooseActivity(learner, lesson.getLessonId(), activity);
+ setLearnerProgress(request,progress);
+
+ // need to do the choose first as the chooseActivity changes the progress details
+ setupProgressString(actionForm, request);
+
ActionForward forward = actionMappings.getActivityForward(activity, progress, true);
return forward;
}
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/CompleteActivityAction.java
===================================================================
diff -u -r6c93a29e621c20da5662066e4be018eab3f5d17d -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/CompleteActivityAction.java (.../CompleteActivityAction.java) (revision 6c93a29e621c20da5662066e4be018eab3f5d17d)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/CompleteActivityAction.java (.../CompleteActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -92,6 +92,10 @@
return mapping.findForward("error");
}
LearningWebUtil.putActivityInRequest(request, progress.getNextActivity(), learnerService);
+ setLearnerProgress(request,progress);
+
+ // need to do the calculateProgress first as the chooseActivity changes the progress details
+ setupProgressString(actionForm, request);
ActionForward forward = actionMappings.getProgressForward(progress,true,request, learnerService);
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayActivityAction.java
===================================================================
diff -u -r2b6827b06455b7269c88062bd218427529ee0a4c -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayActivityAction.java (.../DisplayActivityAction.java) (revision 2b6827b06455b7269c88062bd218427529ee0a4c)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayActivityAction.java (.../DisplayActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -24,9 +24,6 @@
/* $$Id$$ */
package org.lamsfoundation.lams.learning.web.action;
-import java.util.Iterator;
-import java.util.Set;
-
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -35,16 +32,17 @@
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.lamsfoundation.lams.learning.service.LearnerServiceProxy;
-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;
/**
- * Action class to display an activity.
+ * Action class to display an activity. This is used when Flash calls the service to the
+ * learning process. It is needed to put the activity in the request, on which
+ * LoadToolActivityAction relies. If you try to go straight to LoadToolActivityAction
+ * then the activity won't be the request.
*
* XDoclet definition:
*
@@ -78,62 +76,14 @@
HttpServletResponse response)
{
- ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(this.getServlet().getServletContext());
-
- LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgressByID(request,
- getServlet().getServletContext());
- String progressSummary = getProgressSummary(learnerProgress);
-
- if(log.isDebugEnabled())
- log.debug("Entering display activity: progress summary is "+progressSummary);
-
- ActivityForm activityForm = (ActivityForm) actionForm;
- activityForm.setProgressSummary(progressSummary);
+ setupProgressString(actionForm, request);
+ ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(getServlet().getServletContext());
+ LearnerProgress learnerProgress = LearningWebUtil.getLearnerProgressByID(request, getServlet().getServletContext());
ActionForward forward =actionMappings.getProgressForward(learnerProgress,false,request,getLearnerService());
if(log.isDebugEnabled())
log.debug(forward.toString());
return forward;
}
-
- private String getProgressSummary(LearnerProgress learnerProgress) {
- StringBuffer progressSummary = new StringBuffer(100);
- if ( learnerProgress == null ) {
- progressSummary.append("attempted=&completed=¤t=");
- } else {
- progressSummary.append("attempted=");
- boolean first = true;
- for ( Object obj : learnerProgress.getAttemptedActivities() ) {
- Activity activity = (Activity ) obj;
- if ( ! first ) {
- progressSummary.append("_");
- } else {
- first = false;
- }
- progressSummary.append(activity.getActivityId());
- }
-
- progressSummary.append("&completed=");
- first = true;
- for ( Object obj : learnerProgress.getCompletedActivities() ) {
- Activity activity = (Activity ) obj;
- if ( ! first ) {
- progressSummary.append("_");
- } else {
- first = false;
- }
- progressSummary.append(activity.getActivityId());
- }
-
- progressSummary.append("¤t=");
- Activity currentActivity = learnerProgress.getCurrentActivity();
- if ( currentActivity != null ) {
- progressSummary.append(currentActivity.getActivityId());
- }
- }
- return progressSummary.toString();
- }
-
-
}
\ No newline at end of file
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayOptionsActivityAction.java
===================================================================
diff -u -r656dbb791ab57da2b9333c23220ea29eb59a7d6b -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayOptionsActivityAction.java (.../DisplayOptionsActivityAction.java) (revision 656dbb791ab57da2b9333c23220ea29eb59a7d6b)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayOptionsActivityAction.java (.../DisplayOptionsActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -111,6 +111,9 @@
this.saveToken(request);
+ // need to do the calculateProgress first as the chooseActivity changes the progress details
+ setupProgressString(form, request);
+
String forward = "displayOptions";
return mapping.findForward(forward);
}
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayParallelActivityAction.java
===================================================================
diff -u -r656dbb791ab57da2b9333c23220ea29eb59a7d6b -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayParallelActivityAction.java (.../DisplayParallelActivityAction.java) (revision 656dbb791ab57da2b9333c23220ea29eb59a7d6b)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayParallelActivityAction.java (.../DisplayParallelActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -64,6 +64,8 @@
HttpServletRequest request,
HttpServletResponse response)
{
+ setupProgressString(actionForm, request);
+
ActivityForm form = (ActivityForm)actionForm;
ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(this.getServlet().getServletContext());
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayToolActivityAction.java
===================================================================
diff -u -r29e550368d14fc56c421abeabad9215d043fa77e -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayToolActivityAction.java (.../DisplayToolActivityAction.java) (revision 29e550368d14fc56c421abeabad9215d043fa77e)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/DisplayToolActivityAction.java (.../DisplayToolActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -58,6 +58,8 @@
HttpServletRequest request,
HttpServletResponse response)
{
+ setupProgressString(actionForm, request);
+
//ActivityForm form = (ActivityForm)actionForm;
ActivityMapping actionMappings = getActivityMapping();
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LessonCompleteActivityAction.java
===================================================================
diff -u
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LessonCompleteActivityAction.java (revision 0)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LessonCompleteActivityAction.java (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -0,0 +1,69 @@
+/****************************************************************
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ *
+ * http://www.gnu.org/licenses/gpl.txt
+ * ****************************************************************
+ */
+
+/* $$Id$$ */
+package org.lamsfoundation.lams.learning.web.action;
+
+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;
+
+
+
+/**
+ * Action class run when the learner finishes a lesson.
+ *
+ * XDoclet definition:
+ *
+ * ----------------XDoclet Tags--------------------
+ * @struts:action path="/LessonComplete" name="activityForm"
+ * validate="false" scope="request"
+ * @struts:action-forward name="lessonComplete" path=".lessonComplete"
+ *
+ *
+ * ----------------XDoclet Tags--------------------
+ */
+public class LessonCompleteActivityAction extends ActivityAction {
+
+ //---------------------------------------------------------------------
+ // Instance variables
+ //---------------------------------------------------------------------
+
+ /**
+ * 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.
+ */
+ public ActionForward execute(ActionMapping mapping,
+ ActionForm actionForm,
+ HttpServletRequest request,
+ HttpServletResponse response)
+ {
+
+ setupProgressString(actionForm, request);
+ return mapping.findForward("lessonComplete");
+ }
+}
\ No newline at end of file
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LoadToolActivityAction.java
===================================================================
diff -u -r29e550368d14fc56c421abeabad9215d043fa77e -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LoadToolActivityAction.java (.../LoadToolActivityAction.java) (revision 29e550368d14fc56c421abeabad9215d043fa77e)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/LoadToolActivityAction.java (.../LoadToolActivityAction.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -41,7 +41,8 @@
/**
* Action class to forward the user to a Tool using an intermediate loading page. Can handle
- * regular tools + grouping and gates (system tools)
+ * 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:
*
@@ -63,6 +64,8 @@
HttpServletRequest request,
HttpServletResponse response)
{
+ setupProgressString(actionForm, request);
+
ActivityForm form = (ActivityForm)actionForm;
ActivityMapping actionMappings = LearnerServiceProxy.getActivityMapping(this.getServlet().getServletContext());
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java
===================================================================
diff -u -r656dbb791ab57da2b9333c23220ea29eb59a7d6b -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java (.../ActivityMapping.java) (revision 656dbb791ab57da2b9333c23220ea29eb59a7d6b)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMapping.java (.../ActivityMapping.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -118,9 +118,6 @@
{
ActionForward actionForward = null;
- String activitiesURL = getProgressUrlParamString(progress);
-
- // TODO: lesson complete client request to clear frames
if (progress.isLessonComplete())
{
// If lesson complete forward to lesson complete action. This action will
@@ -172,50 +169,6 @@
return actionForward;
}
- /**
- * NOTE: not decided to use method for LDEV-90
- * @param progress
- * @return
- */
- private String getProgressUrlParamString(LearnerProgress progress) {
- StringBuffer activitiesURL = new StringBuffer();
- Activity current;
- Set attemptedSet = progress.getAttemptedActivities();
- Iterator iter = attemptedSet.iterator();
- boolean first = true;
- while(iter.hasNext()){
- current = (Activity) iter.next();
- if(first){
- activitiesURL.append("attempted=");
- first = false;
- }else
- activitiesURL.append("_");
- activitiesURL.append(current.getActivityId());
- }
- Set completedSet = progress.getCompletedActivities();
- first = true;
- iter = completedSet.iterator();
- while(iter.hasNext()){
- current = (Activity) iter.next();
- if(first){
- if(activitiesURL.length() != 0)
- activitiesURL.append("&");
- activitiesURL.append("completed=");
- first = false;
- }else
- activitiesURL.append("_");
- activitiesURL.append(current.getActivityId());
- }
- current = progress.getCurrentActivity();
- if(current != null){
- if(activitiesURL.length() != 0)
- activitiesURL.append("&");
- activitiesURL.append("current=");
- activitiesURL.append(current.getActivityId());
- }
- return activitiesURL.toString();
- }
-
/**
* Generates an ActivityURL for an Activity using it's progress. The URL is for
* the client and so includes hostname etc.
@@ -273,7 +226,7 @@
true);
activityURL = URLEncoder.encode(activityURL, "UTF-8");
activityURL = redirectURL + "?url=" + activityURL;
- }
+ }
}
}
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java
===================================================================
diff -u -r656dbb791ab57da2b9333c23220ea29eb59a7d6b -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java (.../ActivityMappingStrategy.java) (revision 656dbb791ab57da2b9333c23220ea29eb59a7d6b)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/util/ActivityMappingStrategy.java (.../ActivityMappingStrategy.java) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -67,7 +67,7 @@
* Returns the struts action for displaying lesson complete.
*/
protected String getLessonCompleteAction() {
- return "/lessonComplete.do";
+ return "/LessonComplete.do";
}
}
Index: lams_learning/web/WEB-INF/struts/struts-config.xml
===================================================================
diff -u -rdf5800a31c32417e062928bfca21c1b2c2ed1472 -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision df5800a31c32417e062928bfca21c1b2c2ed1472)
+++ lams_learning/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -14,14 +14,14 @@
-
+
@@ -55,9 +55,9 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -173,54 +258,6 @@
/>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: lams_learning/web/lessonComplete.jsp
===================================================================
diff -u -r66f147e9d94ea10fa2c2cea70a78d6479096ddc7 -r5aff7aa069793bc34e60b304e69e9e9fceb996f5
--- lams_learning/web/lessonComplete.jsp (.../lessonComplete.jsp) (revision 66f147e9d94ea10fa2c2cea70a78d6479096ddc7)
+++ lams_learning/web/lessonComplete.jsp (.../lessonComplete.jsp) (revision 5aff7aa069793bc34e60b304e69e9e9fceb996f5)
@@ -24,8 +24,12 @@
<%@ taglib uri="tags-html" prefix="html"%>
<%@ taglib uri="tags-core" prefix="c"%>
<%@ taglib uri="tags-fmt" prefix="fmt" %>
+<%@ taglib uri="tags-lams" prefix="lams" %>