Index: lams_learning/conf/language/ApplicationResources.properties
===================================================================
diff -u -rd61e53f3f98df777cb3006fe79f844214d40d073 -r57e83f8443e586e862dae836429599459eade2c0
--- lams_learning/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision d61e53f3f98df777cb3006fe79f844214d40d073)
+++ lams_learning/conf/language/ApplicationResources.properties (.../ApplicationResources.properties) (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -10,6 +10,16 @@
message.activity.options.activityCount=You must complete at least {0} of these {1} activities.
message.activity.options.note=Note: Once you finish any of the above activities you can revisit them by using the progress bar on the left.
+label.synch.gate.title=Synch Gate
+label.synch.gate.message=You have stopped at a gate. You cannot continue until all of your group/class reach this point.
+label.permission.gate.title=Permission Gate
+label.permission.gate.message=You have stopped at a gate. You cannot continue until the gate is opened in monitoring.
+label.schedule.gate.title=Schedule Gate
+label.schedule.gate.open.message=Schedule Gate will be opened at:
+label.schedule.gate.close.message=Schedule Gate will be closed at:
+label.gate.waiting.learners={0} out of {1} are waiting in front of the gate.
+label.gate.refresh.message=Click Next if you are told that the gate is open. This page will refresh automatically in 1 minute.
+label.gate.next.button=Next
label.activity.options.choose=Choose
label.activity.finish=Finish
Index: lams_learning/conf/xdoclet/struts-forms.xml
===================================================================
diff -u -rfc085e0eda6c46d659c5b98f9ee9e29f495af042 -r57e83f8443e586e862dae836429599459eade2c0
--- lams_learning/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision fc085e0eda6c46d659c5b98f9ee9e29f495af042)
+++ lams_learning/conf/xdoclet/struts-forms.xml (.../struts-forms.xml) (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -1,2 +1,12 @@
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java
===================================================================
diff -u -r0977a832c3e57655f1031778702ce6ea0e122985 -r57e83f8443e586e862dae836429599459eade2c0
--- lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision 0977a832c3e57655f1031778702ce6ea0e122985)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/ILearnerService.java (.../ILearnerService.java) (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -123,14 +123,14 @@
* engine to calculate the next activity in the learning design. This
* process might be triggerred by system controlled the activity, such as
* grouping and gate. This method should be used when we don't have an activity
- * that is already part of the Hibernate session.
+ * or a lesson that is already part of the Hibernate session.
*
* @param learner the learner who are running this activity in the design.
* @param activity the activity is being run.
- * @param lesson the lesson this learner is currently in.
+ * @param lesson id the lesson this learner is currently in.
* @return the url for next activity.
*/
- public String completeActivity(User learner,Long activityId,Lesson lesson);
+ public String completeActivity(User learner,Long activityId,Long lessonId);
/**
* Complete the activity in the progress engine and delegate to the progress
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java
===================================================================
diff -u -r0977a832c3e57655f1031778702ce6ea0e122985 -r57e83f8443e586e862dae836429599459eade2c0
--- lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 0977a832c3e57655f1031778702ce6ea0e122985)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/service/LearnerService.java (.../LearnerService.java) (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -334,15 +334,16 @@
}
/**
- * @see org.lamsfoundation.lams.learning.service.ILearnerService#completeActivity(org.lamsfoundation.lams.usermanagement.User, java.lang.Long, org.lamsfoundation.lams.lesson.Lesson)
+ * @see org.lamsfoundation.lams.learning.service.ILearnerService#completeActivity(org.lamsfoundation.lams.usermanagement.User, java.lang.Long, java.lang.Long)
*/
- public String completeActivity(User learner,Long activityId,Lesson lesson) {
+ public String completeActivity(User learner,Long activityId,Long lessonId) {
Activity activity = getActivity(activityId);
+ Lesson lesson = getLesson(lessonId);
return completeActivity(learner, activity,lesson);
}
/**
- * @see org.lamsfoundation.lams.learning.service.ILearnerService#completeActivity(org.lamsfoundation.lams.usermanagement.User, org.lamsfoundation.lams.learningdesign.Activity, org.lamsfoundation.lams.lesson.Lesson)
+ * @see org.lamsfoundation.lams.learning.service.ILearnerService#completeActivity(org.lamsfoundation.lams.usermanagement.User, org.lamsfoundation.lams.learningdesign.Activity,org.lamsfoundation.lams.lesson.Lesson )
*/
public String completeActivity(User learner,Activity activity,Lesson lesson)
{
Index: lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java
===================================================================
diff -u -r0977a832c3e57655f1031778702ce6ea0e122985 -r57e83f8443e586e862dae836429599459eade2c0
--- lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision 0977a832c3e57655f1031778702ce6ea0e122985)
+++ lams_learning/src/java/org/lamsfoundation/lams/learning/web/action/GateAction.java (.../GateAction.java) (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -31,17 +31,19 @@
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.action.DynaActionForm;
import org.lamsfoundation.lams.learning.service.ILearnerService;
import org.lamsfoundation.lams.learning.service.LearnerServiceException;
import org.lamsfoundation.lams.learning.service.LearnerServiceProxy;
import org.lamsfoundation.lams.learning.web.util.LearningWebUtil;
import org.lamsfoundation.lams.learning.web.util.LessonLearnerDataManager;
import org.lamsfoundation.lams.learningdesign.Activity;
-import org.lamsfoundation.lams.learningdesign.GateActivity;
+import org.lamsfoundation.lams.learningdesign.PermissionGateActivity;
+import org.lamsfoundation.lams.learningdesign.ScheduleGateActivity;
+import org.lamsfoundation.lams.learningdesign.SynchGateActivity;
import org.lamsfoundation.lams.lesson.LearnerProgress;
import org.lamsfoundation.lams.web.action.LamsDispatchAction;
@@ -62,15 +64,18 @@
*
* ----------------XDoclet Tags--------------------
*
- * @struts:action path="/gate"
+ * @struts:action name="GateForm"
+ * path="/gate"
* parameter="method"
* validate="false"
* @struts.action-exception key="error.system.learner" scope="request"
* type="org.lamsfoundation.lams.learning.service.LearnerServiceException"
* path=".systemError"
* handler="org.lamsfoundation.lams.learning.util.CustomStrutsExceptionHandler"
*
- * @struts:action-forward name="waiting" path=".gateWaiting"
+ * @struts:action-forward name="permissionGate" path=".permissionGate"
+ * @struts:action-forward name="scheduleGate" path=".scheduleGate"
+ * @struts:action-forward name="synchGate" path=".synchGate"
* ----------------XDoclet Tags--------------------
*/
public class GateAction extends LamsDispatchAction
@@ -79,12 +84,14 @@
//---------------------------------------------------------------------
// Instance variables
//---------------------------------------------------------------------
- private static Logger log = Logger.getLogger(GateAction.class);
+ // private static Logger log = Logger.getLogger(GateAction.class);
//---------------------------------------------------------------------
// Class level constants - Struts forward
//---------------------------------------------------------------------
- private static final String WAITING = "waiting";
+ private static final String VIEW_PERMISSION_GATE = "permissionGate";
+ private static final String VIEW_SCHEDULE_GATE = "scheduleGate";
+ private static final String VIEW_SYNCH_GATE = "synchGate";
//---------------------------------------------------------------------
// Struts Dispatch Method
@@ -120,26 +127,29 @@
boolean gateOpen = learnerService.knockGate(learnerProgress.getNextActivity().getActivityId(),
learnerProgress.getUser(),
currentLessonLearners);
- //if the gate is open, let the learner go to the next activity ( updating the cached learner progress on the way )
+ // if the gate is open, let the learner go to the next activity ( updating the cached learner progress on the way )
+ // pass only the ids in to completeActivity, so that the service level looks up the objects.
+ // if we reuse our cached entries, hibernate may throw session errors (if the objects are CGLIB entities).
if(gateOpen)
{
String nextActivityUrl = learnerService.completeActivity(learnerProgress.getUser(),
learnerProgress.getNextActivity().getActivityId(),
- learnerProgress.getLesson());
+ learnerProgress.getLesson().getLessonId());
// get the update
LearningWebUtil.setLearnerProgress(learnerService.getProgressById(learnerProgress.getLearnerProgressId()));
response.sendRedirect(nextActivityUrl);
return null;
}
//if the gate is closed, ask the learner to wait ( updating the cached learner progress on the way )
else {
- LearningWebUtil.setLearnerProgress(learnerService.getProgressById(learnerProgress.getLearnerProgressId()));
- return mapping.findForward(WAITING);
+ learnerProgress = learnerService.getProgressById(learnerProgress.getLearnerProgressId());
+ LearningWebUtil.setLearnerProgress(learnerProgress);
+ return findViewByGateType(mapping, (DynaActionForm)form, learnerProgress.getCurrentActivity());
}
}
//---------------------------------------------------------------------
- // Helper method
+ // Helper methods
//---------------------------------------------------------------------
/**
* @param learnerProgress
@@ -163,5 +173,104 @@
private boolean isNextActivityValid(LearnerProgress learnerProgress)
{
return learnerProgress.getNextActivity()!=null&&(learnerProgress.getNextActivity().isGateActivity());
- }
+ }
+
+ /**
+ * Dispatch view the according to the gate type.
+ *
+ * @param mapping An ActionMapping class that will be used by the Action
+ * class to tell the ActionServlet where to send the end-user.
+ * @param gateForm The ActionForm class that will contain any data submitted
+ * by the end-user via a form.
+ * @param permissionGate the gate acitivty object
+ * @return An ActionForward class that will be returned to the ActionServlet
+ * indicating where the user is to go next.
+ */
+ private ActionForward findViewByGateType(ActionMapping mapping,
+ DynaActionForm gateForm,
+ Activity gate)
+ {
+ //dispatch the view according to the type of the gate.
+ if ( gate != null ) {
+ if(gate.isSynchGate())
+ return viewSynchGate(mapping,gateForm,(SynchGateActivity)gate);
+ else if(gate.isScheduleGate())
+ return viewScheduleGate(mapping,gateForm,(ScheduleGateActivity)gate);
+ else if(gate.isPermissionGate())
+ return viewPermissionGate(mapping,gateForm,(PermissionGateActivity)gate);
+ else
+ throw new LearnerServiceException("Invalid gate activity. " +
+ "gate id ["+gate.getActivityId()+"] - the type ["+
+ gate.getActivityTypeId()+"] is not a gate type");
+ } else {
+ throw new LearnerServiceException("Gate activity missing. " +
+ "gate id ["+gate.getActivityId()+"]");
+ }
+ }
+
+ /**
+ * Set up the form attributes specific to the permission gate and navigate
+ * to the permission gate view.
+ * @param mapping An ActionMapping class that will be used by the Action
+ * class to tell the ActionServlet where to send the end-user.
+ * @param gateForm The ActionForm class that will contain any data submitted
+ * by the end-user via a form.
+ * @param permissionGate the gate acitivty object
+ * @return An ActionForward class that will be returned to the ActionServlet
+ * indicating where the user is to go next.
+ */
+ private ActionForward viewPermissionGate(ActionMapping mapping,
+ DynaActionForm gateForm,
+ PermissionGateActivity permissionGate)
+ {
+ gateForm.set("gate",permissionGate);
+ gateForm.set("waitingLearners",new Integer(permissionGate.getWaitingLearners().size()));
+ return mapping.findForward(VIEW_PERMISSION_GATE);
+ }
+
+ /**
+ * Set up the form attributes specific to the schedule gate and navigate
+ * to the schedule gate view.
+ *
+ * @param mapping An ActionMapping class that will be used by the Action
+ * class to tell the ActionServlet where to send the end-user.
+ * @param gateForm The ActionForm class that will contain any data submitted
+ * by the end-user via a form.
+ * @param permissionGate the gate acitivty object
+ * @return An ActionForward class that will be returned to the ActionServlet
+ * indicating where the user is to go next.
+ */
+ private ActionForward viewScheduleGate(ActionMapping mapping,
+ DynaActionForm gateForm,
+ ScheduleGateActivity scheduleGate)
+ {
+ gateForm.set("gate",scheduleGate);
+ gateForm.set("waitingLearners",new Integer(scheduleGate.getWaitingLearners().size()));
+ gateForm.set("startingTime",scheduleGate.getGateStartDateTime());
+ gateForm.set("endingTime",scheduleGate.getGateEndDateTime());
+
+ return mapping.findForward(VIEW_SCHEDULE_GATE);
+ }
+
+ /**
+ * Set up the form attributes specific to the synch gate and navigate
+ * to the synch gate view.
+ *
+ * @param mapping An ActionMapping class that will be used by the Action
+ * class to tell the ActionServlet where to send the end-user.
+ * @param gateForm The ActionForm class that will contain any data submitted
+ * by the end-user via a form.
+ * @param permissionGate the gate acitivty object
+ * @return An ActionForward class that will be returned to the ActionServlet
+ * indicating where the user is to go next.
+ */
+ private ActionForward viewSynchGate(ActionMapping mapping,
+ DynaActionForm gateForm,
+ SynchGateActivity synchgate)
+ {
+ gateForm.set("gate",synchgate);
+ gateForm.set("waitingLearners",new Integer(synchgate.getWaitingLearners().size()));
+ return mapping.findForward(VIEW_SYNCH_GATE);
+ }
+
}
Index: lams_learning/web/WEB-INF/struts/struts-config.xml
===================================================================
diff -u -r058624bba137d9124eed6784321dbecc72a12550 -r57e83f8443e586e862dae836429599459eade2c0
--- lams_learning/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 058624bba137d9124eed6784321dbecc72a12550)
+++ lams_learning/web/WEB-INF/struts/struts-config.xml (.../struts-config.xml) (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -28,6 +28,16 @@
+
+
+
+
+
+
+
+
+
+
@@ -47,6 +57,8 @@
+
+
+
+
+
+
+
+
+
@@ -89,10 +96,14 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_learning/web/gate/gateNext.jsp
===================================================================
diff -u
--- lams_learning/web/gate/gateNext.jsp (revision 0)
+++ lams_learning/web/gate/gateNext.jsp (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Fisheye: Tag 57e83f8443e586e862dae836429599459eade2c0 refers to a dead (removed) revision in file `lams_learning/web/gate/gateWaiting.jsp'.
Fisheye: No comparison available. Pass `N' to diff?
Index: lams_learning/web/gate/permissionGateContent.jsp
===================================================================
diff -u
--- lams_learning/web/gate/permissionGateContent.jsp (revision 0)
+++ lams_learning/web/gate/permissionGateContent.jsp (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -0,0 +1,33 @@
+ <%--
+ 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 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
+ --%>
+
+ <%@ 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" %>
+
+
+
+
+
+
+
Index: lams_learning/web/gate/scheduleGateContent.jsp
===================================================================
diff -u
--- lams_learning/web/gate/scheduleGateContent.jsp (revision 0)
+++ lams_learning/web/gate/scheduleGateContent.jsp (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -0,0 +1,39 @@
+<%--
+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 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
+--%>
+
+<%@ 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" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: lams_learning/web/gate/synchGateContent.jsp
===================================================================
diff -u
--- lams_learning/web/gate/synchGateContent.jsp (revision 0)
+++ lams_learning/web/gate/synchGateContent.jsp (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -0,0 +1,46 @@
+<%--
+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 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
+--%>
+
+<%@ 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" %>
+
+
Index: lams_learning/web/layout/gateLayout.jsp
===================================================================
diff -u
--- lams_learning/web/layout/gateLayout.jsp (revision 0)
+++ lams_learning/web/layout/gateLayout.jsp (revision 57e83f8443e586e862dae836429599459eade2c0)
@@ -0,0 +1,52 @@
+<%--
+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 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
+--%>
+
+<%@ 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-tiles" prefix="tiles"%>
+<%@ taglib uri="tags-core" prefix="c"%>
+<%@ taglib uri="tags-lams" prefix="lams" %>
+<%@ taglib uri="tags-fmt" prefix="fmt" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+