Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -r0144e9d0f7fc574a887933024183a8a9049bc414 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
Binary files differ
Index: lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java
===================================================================
diff -u -r0144e9d0f7fc574a887933024183a8a9049bc414 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 0144e9d0f7fc574a887933024183a8a9049bc414)
+++ lams_central/src/java/org/lamsfoundation/lams/authoring/ObjectExtractor.java (.../ObjectExtractor.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -1481,21 +1481,23 @@
private void parseAnnotations(JSONArray annotationList) throws ObjectExtractorException, JSONException {
Set
Title:
-
+
+
Type:
-
+
+
+
+ Delay:
+
+
+ days
+
+
+ hours
+
+
+ minutes
+
+
+
Index: lams_central/web/css/authoring.css
===================================================================
diff -u -r9fb16007bc803d29180994effaed30ebb0a2e561 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_central/web/css/authoring.css (.../authoring.css) (revision 9fb16007bc803d29180994effaed30ebb0a2e561)
+++ lams_central/web/css/authoring.css (.../authoring.css) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -43,6 +43,10 @@
width: 40px;
}
+tr.propertiesContentRowGateSchedule input.spinner {
+ width: 30px;
+}
+
input.propertiesContentFieldTitle {
width: 98%;
}
Index: lams_central/web/includes/javascript/authoring/authoringActivity.js
===================================================================
diff -u -r0144e9d0f7fc574a887933024183a8a9049bc414 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414)
+++ lams_central/web/includes/javascript/authoring/authoringActivity.js (.../authoringActivity.js) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -79,10 +79,19 @@
/**
* Constructor for a Gate Activity.
*/
- GateActivity : function(id, uiid, x, y, gateType) {
+ GateActivity : function(id, uiid, x, y, gateType, startTimeOffset, gateActivityCompletionBased) {
this.id = +id;
this.uiid = +uiid || ++layout.ld.maxUIID;
this.gateType = gateType || 'permission';
+ if (gateType == 'schedule') {
+ var day = 24*60;
+ this.offsetDay = Math.floor(startTimeOffset/day);
+ startTimeOffset -= this.offsetDay * day;
+ this.offsetHour = Math.floor(startTimeOffset/60);
+ this.offsetMinute = startTimeOffset - this.offsetHour * 60;
+
+ this.gateActivityCompletionBased = gateActivityCompletionBased;
+ };
this.transitions = {
'from' : [],
'to' : []
Index: lams_central/web/includes/javascript/authoring/authoringGeneral.js
===================================================================
diff -u -r0144e9d0f7fc574a887933024183a8a9049bc414 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414)
+++ lams_central/web/includes/javascript/authoring/authoringGeneral.js (.../authoringGeneral.js) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -517,7 +517,9 @@
activityData.activityUIID,
activityData.xCoord,
activityData.yCoord,
- gateType);
+ gateType,
+ activityData.gateStartTimeOffset,
+ activityData.gateActivityCompletionBased);
break;
// Parallel Activity
@@ -1009,6 +1011,9 @@
'activityTypeID' : activityTypeID,
'orderID' : activity.orderID,
'defaultActivityUIID' : activity.defaultActivityUIID,
+ 'gateStartTimeOffset' : activity.gateType == 'schedule' ?
+ activity.offsetDay*24*60 + activity.offsetHour*60 + activity.offsetMinute : null,
+ 'gateActivityCompletionBased' : activity.gateActivityCompletionBased,
'gradebookToolOutputDefinitionName' : null,
'helpText' : null,
Index: lams_central/web/includes/javascript/authoring/authoringProperty.js
===================================================================
diff -u -r0144e9d0f7fc574a887933024183a8a9049bc414 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 0144e9d0f7fc574a887933024183a8a9049bc414)
+++ lams_central/web/includes/javascript/authoring/authoringProperty.js (.../authoringProperty.js) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -326,8 +326,9 @@
.show().data('parentObject', activity);
$('.propertiesContentFieldTitle', content).val(activity.title);
$('.propertiesContentFieldGateType', content).val(activity.gateType);
-
- $('input, select', content).change(function(){
+
+ // make onChange function a local variable, because it's used several times
+ var changeFunction = function(){
// extract changed properties and redraw the activity
var content = $(this).closest('.dialogContainer'),
activity = content.data('parentObject'),
@@ -338,13 +339,56 @@
redrawNeeded = true;
}
activity.gateType = $('.propertiesContentFieldGateType', content).val();
+ if (activity.gateType == 'schedule') {
+ $(".propertiesContentRowGateSchedule").show();
+ activity.offsetDay = +$('.propertiesContentFieldOffsetDay', content).val();
+ activity.offsetHour = +$('.propertiesContentFieldOffsetHour', content).val();
+ activity.offsetMinute = +$('.propertiesContentFieldOffsetMinute', content).val();
+ activity.gateActivityCompletionBased = $('.propertiesContentFieldActivityCompletionBased').is(':checked');
+ } else {
+ $(".propertiesContentRowGateSchedule").hide();
+ }
if (redrawNeeded) {
activity.draw();
ActivityLib.addSelectEffect(activity, true);
}
- });
+ };
+
+ // create groups/learners spinners
+ $('.propertiesContentFieldOffsetDay', content).spinner({
+ 'min' : 0,
+ 'max' : 364
+ }).spinner('value', activity.offsetDay || 0)
+ .on('spinchange', changeFunction);
+
+ $('.propertiesContentFieldOffsetHour', content).spinner({
+ 'min' : 0,
+ 'max' : 23
+ }).spinner('value', activity.offsetHour || 0)
+ .on('spinchange', changeFunction);
+
+ $('.propertiesContentFieldOffsetMinute', content).spinner({
+ 'min' : 0,
+ 'max' : 59
+ }).spinner('value', activity.offsetMinute || 0)
+ .on('spinchange', changeFunction);
+
+ $('.propertiesContentFieldActivityCompletionBased', content)
+ .attr('checked', activity.gateActivityCompletionBased? 'checked' : null);
+
+ $('input, select', content).change(changeFunction);
+ changeFunction.call(content);
}
+
+ if (activity.transitions.to.length == 0){
+ $('.propertiesContentFieldActivityCompletionBased', content)
+ .attr('checked', null)
+ .attr('disabled', 'disabled');
+ } else {
+ $('.propertiesContentFieldActivityCompletionBased', content)
+ .attr('disabled', null);
+ }
},
Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml
===================================================================
diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml (.../Activity.hbm.xml) (revision c135649b64e98c9233da20bdcfb7689598116314)
+++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/learningdesign/Activity.hbm.xml (.../Activity.hbm.xml) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -263,6 +263,7 @@
true
+
+ Since learner finished previous activity?
+
+
+
+
+
* Returns the gate open time for a particular lesson according to the s ettings done by the author.
@@ -208,31 +219,30 @@
*
* Note: the time will also be translated against server timezone.
*
- * @param lessonStartTime
+ * @param referenceTime
* the start time of the lesson. this should be the server local time. the UTC time is only used for
* persistent.
*
* @return the server local date time that the gate will be opened.
*/
- public Date getLessonGateOpenTime(Date lessonStartTime) {
+ public Date getGateOpenTime(Date referenceTime) {
Calendar openTime = new GregorianCalendar(TimeZone.getDefault());
- openTime.setTime(lessonStartTime);
+ openTime.setTime(referenceTime);
// compute the real opening time based on the lesson start time.
if (isScheduledByStartTimeOffset()) {
openTime.add(Calendar.MINUTE, getGateStartTimeOffset().intValue());
- this.setGateStartDateTime(openTime.getTime());
- }
-
- else if (isScheduledByStartDateTime())
+ if (!Boolean.TRUE.equals(gateActivityCompletionBased)) {
+ this.setGateStartDateTime(openTime.getTime());
+ }
+ } else if (isScheduledByStartDateTime()) {
openTime.setTime(getGateStartDateTime());
-
+ }
/**
* else throw new ActivityBehaviorException("No way of scheduling has " +
* "been setup - this usually should be done at authoring " +
* "interface. Fail to calculate gate open time for lesson.");
*/
return openTime.getTime();
-
}
/**
@@ -247,17 +257,16 @@
*
* Note: the time will also be translated against proper timezone.
*
- * @param lessonStartTime
+ * @param referenceTime
*
* @return the date time that the gate will be closed.
*/
- public Date getLessonGateCloseTime(Date lessonStartTime) {
+ public Date getGateCloseTime(Date referenceTime) {
Calendar closeTime = new GregorianCalendar(TimeZone.getDefault());
- closeTime.setTime(lessonStartTime);
+ closeTime.setTime(referenceTime);
// compute the real opening time based on the
if (isScheduledByEndTimeOffset()) {
closeTime.add(Calendar.MINUTE, getGateEndTimeOffset().intValue());
- this.setGateEndDateTime(closeTime.getTime());
} else if (isScheduledByEndDateTime())
closeTime.setTime(getGateEndDateTime());
/**
@@ -361,5 +370,4 @@
public boolean isScheduled() {
return isScheduledByTimeOffset() || isScheduledByDateTime();
}
-
-}
+}
\ No newline at end of file
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java
===================================================================
diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision c135649b64e98c9233da20bdcfb7689598116314)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/AuthoringActivityDTO.java (.../AuthoringActivityDTO.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -179,6 +179,8 @@
private Date gateStartDateTime;
private Date gateEndDateTime;
+
+ private Boolean gateActivityCompletionBased;
private Boolean applyGrouping;
@@ -463,6 +465,7 @@
gateStartTimeOffset = activity.getGateStartTimeOffset();
gateEndDateTime = activity.getGateEndDateTime();
gateEndTimeOffset = activity.getGateEndTimeOffset();
+ gateActivityCompletionBased = activity.getGateActivityCompletionBased();
}
/*******************************************************************************************************************
@@ -567,6 +570,14 @@
return gateStartTimeOffset;
}
+ public Boolean getGateActivityCompletionBased() {
+ return gateActivityCompletionBased;
+ }
+
+ public void setGateActivityCompletionBased(Boolean gateActivityCompletionBased) {
+ this.gateActivityCompletionBased = gateActivityCompletionBased;
+ }
+
/**
* @return Returns the groupingID.
*/
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java
===================================================================
diff -u -rc135649b64e98c9233da20bdcfb7689598116314 -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java (.../LibraryActivityDTO.java) (revision c135649b64e98c9233da20bdcfb7689598116314)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/dto/LibraryActivityDTO.java (.../LibraryActivityDTO.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -98,6 +98,7 @@
private Long gateEndTimeOffset;
private Date gateStartDateTime;
private Date gateEndDateTime;
+ private Boolean gateActivityCompletionBased;
/** Used for I18N the URLS. Does not need to be sent to clients, so no getter exists. */
private String languageCode;
@@ -249,6 +250,7 @@
gateStartTimeOffset = activity.getGateStartTimeOffset();
gateEndDateTime = activity.getGateEndDateTime();
gateEndTimeOffset = activity.getGateEndTimeOffset();
+ gateActivityCompletionBased = activity.getGateActivityCompletionBased();
}
private void addConditionGateActivityAttributes(ConditionGateActivity activity) {
@@ -508,6 +510,10 @@
return gateStartTimeOffset;
}
+ public Boolean getGateActivityCompletionBased() {
+ return gateActivityCompletionBased;
+ }
+
/**
* @return Returns the maxOptions.
*/
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/GateActivityStrategy.java
===================================================================
diff -u -r209087915bc219f430c282ad00e5d1e6462f9b5f -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/GateActivityStrategy.java (.../GateActivityStrategy.java) (revision 209087915bc219f430c282ad00e5d1e6462f9b5f)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/GateActivityStrategy.java (.../GateActivityStrategy.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -48,43 +48,39 @@
//---------------------------------------------------------------------
// Template methods
//---------------------------------------------------------------------
- /**
- * Returns wether we should open the gate or close the gate. It's
- * implementation depends on the type of the gate we are dealing with.
- * Generally, it needs the check up the current gate status. If the gate
- * is already opened, we will keep it open for current learner. Otherwise,
- * we need to validate the open condition for this learner.
- *
- * @param learner the learner who just arrived at the gate.
- * @param activity the gate activity.
- * @param lessonLearners all learners who have started the lesson
- * @return whether we should open it or not.
- */
- public boolean shouldOpenGateFor(User learner, List lessonLearners) {
- gateActivity.addLeaner(learner, false);
+ /**
+ * Returns wether we should open the gate or close the gate. It's implementation depends on the type of the gate we
+ * are dealing with. Generally, it needs the check up the current gate status. If the gate is already opened, we
+ * will keep it open for current learner. Otherwise, we need to validate the open condition for this learner.
+ *
+ * @param learner
+ * the learner who just arrived at the gate.
+ * @param activity
+ * the gate activity.
+ * @param lessonLearners
+ * all learners who have started the lesson
+ * @return whether we should open it or not.
+ */
+ public boolean shouldOpenGateFor(User learner, List lessonLearners) {
+ gateActivity.addLeaner(learner, false);
- if (!gateActivity.getGateOpen().booleanValue()) {
- if (isOpenConditionMet(lessonLearners)) {
- gateActivity.setGateOpen(new Boolean(true));
- //always clear all lists if the gate is opened
- gateActivity.getAllGateUsers().clear();
- gateActivity.getWaitingLearners().clear();
- gateActivity.getAllowedToPassLearners().clear();
- }
- else {
- return gateActivity.getAllowedToPassLearners().contains(learner);
- }
- }
- //always clear all lists if the gate is already opened.
- else {
- gateActivity.getAllGateUsers().clear();
- gateActivity.getWaitingLearners().clear();
- gateActivity.getAllowedToPassLearners().clear();
- }
- return gateActivity.getGateOpen().booleanValue();
+ boolean isOpen = gateActivity.getGateOpen().booleanValue();
+
+ if (!isOpen) {
+ if (isOpenConditionMet(lessonLearners)) {
+ gateActivity.setGateOpen(new Boolean(true));
+ } else {
+ return gateActivity.getAllowedToPassLearners().contains(learner);
+ }
}
- //---------------------------------------------------------------------
+ gateActivity.getAllGateUsers().clear();
+ gateActivity.getWaitingLearners().clear();
+ gateActivity.getAllowedToPassLearners().clear();
+ return isOpen;
+ }
+
+ // ---------------------------------------------------------------------
// Abstract methods
//---------------------------------------------------------------------
/**
Index: lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/ScheduleGateActivityStrategy.java
===================================================================
diff -u -r08950e1090443c3423a3d1c587416a2fccd8bbdf -r88e98be30293b57a81d4a8a6e5cdaf5c62e97883
--- lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/ScheduleGateActivityStrategy.java (.../ScheduleGateActivityStrategy.java) (revision 08950e1090443c3423a3d1c587416a2fccd8bbdf)
+++ lams_common/src/java/org/lamsfoundation/lams/learningdesign/strategy/ScheduleGateActivityStrategy.java (.../ScheduleGateActivityStrategy.java) (revision 88e98be30293b57a81d4a8a6e5cdaf5c62e97883)
@@ -23,54 +23,92 @@
package org.lamsfoundation.lams.learningdesign.strategy;
import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.List;
+import java.util.Set;
+import java.util.TimeZone;
+import org.lamsfoundation.lams.learningdesign.Activity;
import org.lamsfoundation.lams.learningdesign.ContributionTypes;
import org.lamsfoundation.lams.learningdesign.GateActivity;
+import org.lamsfoundation.lams.learningdesign.ScheduleGateActivity;
+import org.lamsfoundation.lams.lesson.CompletedActivityProgress;
+import org.lamsfoundation.lams.lesson.LearnerProgress;
+import org.lamsfoundation.lams.usermanagement.User;
-
/**
- * Activity strategy that deals with the calculation specific to schedule gate
- * activity. The major part of this strategy will be overiding the methods that
- * defined in the abstract level.
+ * Activity strategy that deals with the calculation specific to schedule gate activity. The major part of this strategy
+ * will be overiding the methods that defined in the abstract level.
*
* @author Jacky Fang
- * @since 2005-4-6
+ * @since 2005-4-6
* @version 1.1
*
*/
-public class ScheduleGateActivityStrategy extends GateActivityStrategy
-{
- public ScheduleGateActivityStrategy(GateActivity gateActivity) {
- super(gateActivity);
- }
+public class ScheduleGateActivityStrategy extends GateActivityStrategy {
+ public ScheduleGateActivityStrategy(GateActivity gateActivity) {
+ super(gateActivity);
+ }
-
- //---------------------------------------------------------------------
+ // ---------------------------------------------------------------------
// Overriden methods
- //---------------------------------------------------------------------
+ // ---------------------------------------------------------------------
/**
- * @see org.lamsfoundation.lams.learningdesign.strategy.GateActivityStrategy#setUpContributionType(org.lamsfoundation.lams.learningdesign.Activity, java.util.ArrayList)
+ * @see org.lamsfoundation.lams.learningdesign.strategy.GateActivityStrategy#setUpContributionType(org.lamsfoundation.lams.learningdesign.Activity,
+ * java.util.ArrayList)
*/
- protected void setUpContributionType(ArrayList
+
<%@ include file="gateInfo.jsp" %>
-
-