Index: lams_build/lib/lams/lams-central.jar
===================================================================
diff -u -re923dff715d473f8bb19d3593f1419662544111c -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
Binary files differ
Index: lams_build/lib/lams/lams.jar
===================================================================
diff -u -r883c4cc054a636dc8017da1b244b89bdaf0ff974 -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
Binary files differ
Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r5e102916c1178fdb7ff492a28456d12227c4a030 -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 5e102916c1178fdb7ff492a28456d12227c4a030)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision c9aead8dc4d1f820cff644f7973adf5072a1bcf7)
@@ -397,6 +397,7 @@
label.tab.advanced.field.split.number =No. learners per lesson
label.tab.advanced.field.scheduling =Enable scheduling
label.tab.advanced.split.desc =[0] instances of this lesson will be created and approximately [1] will be allocated to each lesson
+label.tab.advanced.field.restart =Students always start from the first activity
label.tab.conditions.dependencies =Dependencies
label.tab.conditions.dependencies.desc =Select a lesson that learners will need to complete before they can see the lesson you are about to create.
label.tab.conditions.timelimit =Time limitations
Index: lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java
===================================================================
diff -u -ree35ce3afcea957fc919c15fb254ae593cdb44c2 -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
--- lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision ee35ce3afcea957fc919c15fb254ae593cdb44c2)
+++ lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java (.../HomeAction.java) (revision c9aead8dc4d1f820cff644f7973adf5072a1bcf7)
@@ -182,6 +182,12 @@
if (!lesson.isLessonAccessibleForLearner()) {
return displayMessage(mapping, req, "error.lesson.not.accessible.for.learners");
}
+
+ if (lesson.getLearnerRestart()) {
+ // start the lesson from the beginning each time
+ getLessonService().removeLearnerProgress(lessonId, user.getUserID());
+ }
+
String learnerURL = Configuration.get(ConfigurationKeys.SERVER_URL) + "learning/main.jsp";
Index: lams_central/web/addLesson.jsp
===================================================================
diff -u -r8a6945700087134d2cebe7582998199fbad7e029 -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
--- lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision 8a6945700087134d2cebe7582998199fbad7e029)
+++ lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision c9aead8dc4d1f820cff644f7973adf5072a1bcf7)
@@ -185,6 +185,7 @@
Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml
===================================================================
diff -u -r27a9e58b46446d891cf6b081e8fb6fb6f6294e2e -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
--- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml (.../Lesson.hbm.xml) (revision 27a9e58b46446d891cf6b081e8fb6fb6f6294e2e)
+++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml (.../Lesson.hbm.xml) (revision c9aead8dc4d1f820cff644f7973adf5072a1bcf7)
@@ -76,6 +76,9 @@
+
+
Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040023.sql
===================================================================
diff -u
--- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040023.sql (revision 0)
+++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040023.sql (revision c9aead8dc4d1f820cff644f7973adf5072a1bcf7)
@@ -0,0 +1,13 @@
+-- Turn off autocommit, so nothing is committed if there is an error
+
+SET AUTOCOMMIT = 0;
+SET FOREIGN_KEY_CHECKS=0;
+
+-- LDEV-3170 Force restart from beginning of lesson for learners
+
+ALTER TABLE lams_lesson ADD COLUMN learner_restart TINYINT(1) DEFAULT 0;
+
+-- If there were no errors, commit and restore autocommit to on
+SET FOREIGN_KEY_CHECKS=0;
+COMMIT;
+SET AUTOCOMMIT = 1;
Index: lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java
===================================================================
diff -u -r8e1ed196bfc1c28860729d8b0a23878bb3ecf1e7 -rc9aead8dc4d1f820cff644f7973adf5072a1bcf7
--- lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java (.../Lesson.java) (revision 8e1ed196bfc1c28860729d8b0a23878bb3ecf1e7)
+++ lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java (.../Lesson.java) (revision c9aead8dc4d1f820cff644f7973adf5072a1bcf7)
@@ -27,7 +27,6 @@
import java.util.HashSet;
import java.util.Set;
-import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -75,10 +74,10 @@
public static final Integer ARCHIVED_STATE = new Integer(6);
/** The state for lesssons that are removed and never can be accessed again */
public static final Integer REMOVED_STATE = new Integer(7);
-
- //---------------------------------------------------------------------
+
+ // ---------------------------------------------------------------------
// attributes
- //---------------------------------------------------------------------
+ // ---------------------------------------------------------------------
/** identifier field */
private Long lessonId;
@@ -87,7 +86,7 @@
/** persistent field */
private String lessonName;
-
+
/** persistent field */
private Date createDateTime;
@@ -99,13 +98,13 @@
/** nullable persistent field */
private Date scheduleStartDate;
-
+
/** nullable persistent field */
- private Date scheduleEndDate;
-
+ private Date scheduleEndDate;
+
/** nullable persistent field */
- private Integer scheduledNumberDaysToLessonFinish;
-
+ private Integer scheduledNumberDaysToLessonFinish;
+
/** persistent field */
private User user;
@@ -126,16 +125,16 @@
/** persistent field */
private Set learnerProgresses;
-
+
/** persistent field */
private Set
gradebookUserLessons;
-
+
/** Persistent field. Defaults to FALSE if not set to anything by a constructor parameter. */
private Boolean enableLessonIntro;
-
+
/** persistent field */
private String lessonDescription;
-
+
/** Persistent field. Defaults to FALSE if not set to anything by a constructor parameter. */
private Boolean displayDesignImage;
@@ -159,20 +158,25 @@
/** Persistent field. Defaults to FALSE if not set to anything by a constructor parameter. */
private Boolean marksReleased;
-
+
/**
+ * Should Learner start the lesson from the beginning each time he enters it.
+ */
+ private Boolean learnerRestart;
+
+ /**
* For lesson conditional release
*/
private Set precedingLessons;
private Set succeedingLessons;
-
- //---------------------------------------------------------------------
+
+ // ---------------------------------------------------------------------
// constructors
- //---------------------------------------------------------------------
+ // ---------------------------------------------------------------------
/** default constructor */
public Lesson() {
}
-
+
/**
* Minimum constructor that initialize the lesson data. It doesn't include organization and class information. Chain
* constructor pattern implementation.
@@ -181,44 +185,46 @@
Integer previousLessonStateId, LearningDesign learningDesign, Set learnerProgresses,
Boolean enableLessonIntro, Boolean displayDesignImage, Boolean learnerExportAvailable,
Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled,
- Boolean enableLessonNotifications, Integer scheduledNumberDaysTolessonFinish) {
+ Boolean enableLessonNotifications, Boolean learnerRestart, Integer scheduledNumberDaysTolessonFinish) {
this(null, name, description, createDateTime, null, null, user, lessonStateId, previousLessonStateId,
enableLessonIntro, displayDesignImage, learnerExportAvailable, false, learningDesign, null, null,
learnerProgresses, learnerPresenceAvailable, learnerImAvailable, liveEditEnabled,
- enableLessonNotifications, scheduledNumberDaysTolessonFinish);
+ enableLessonNotifications, learnerRestart, scheduledNumberDaysTolessonFinish);
}
-
+
/** full constructor */
public Lesson(Long lessonId, String name, String description, Date createDateTime, Date startDateTime,
Date endDateTime, User user, Integer lessonStateId, Integer previousLessonStateId,
Boolean enableLessonIntro, Boolean displayDesignImage, Boolean learnerExportAvailable,
Boolean lockedForEdit, LearningDesign learningDesign, LessonClass lessonClass, Organisation organisation,
Set learnerProgresses, Boolean learnerPresenceAvailable, Boolean learnerImAvailable,
- Boolean liveEditEnabled, Boolean enableLessonNotifications, Integer scheduledNumberDaysToLessonFinish) {
- this.lessonId = lessonId;
- this.lessonName = name;
- this.lessonDescription = description;
- this.createDateTime = createDateTime;
- this.startDateTime = startDateTime;
- this.endDateTime = endDateTime;
- this.user = user;
- this.lessonStateId = lessonStateId;
- this.previousLessonStateId = previousLessonStateId;
- this.enableLessonIntro = enableLessonIntro != null ? enableLessonIntro : Boolean.FALSE;
- this.displayDesignImage = displayDesignImage != null ? displayDesignImage : Boolean.FALSE;
- this.learnerExportAvailable = learnerExportAvailable != null ? learnerExportAvailable : Boolean.FALSE;
- this.learnerPresenceAvailable = learnerPresenceAvailable != null ? learnerPresenceAvailable : Boolean.FALSE;
- this.learnerImAvailable = learnerImAvailable != null ? learnerImAvailable : Boolean.FALSE;
- this.lockedForEdit = false;
- this.learningDesign = learningDesign;
- this.lessonClass = lessonClass;
- this.organisation = organisation;
- this.learnerProgresses = learnerProgresses;
- this.liveEditEnabled = liveEditEnabled;
- this.enableLessonNotifications = enableLessonNotifications;
- this.gradebookUserLessons = new HashSet();
- this.marksReleased = false;
- this.scheduledNumberDaysToLessonFinish = scheduledNumberDaysToLessonFinish;
+ Boolean liveEditEnabled, Boolean enableLessonNotifications, Boolean learnerRestart,
+ Integer scheduledNumberDaysToLessonFinish) {
+ this.lessonId = lessonId;
+ this.lessonName = name;
+ this.lessonDescription = description;
+ this.createDateTime = createDateTime;
+ this.startDateTime = startDateTime;
+ this.endDateTime = endDateTime;
+ this.user = user;
+ this.lessonStateId = lessonStateId;
+ this.previousLessonStateId = previousLessonStateId;
+ this.enableLessonIntro = enableLessonIntro != null ? enableLessonIntro : Boolean.FALSE;
+ this.displayDesignImage = displayDesignImage != null ? displayDesignImage : Boolean.FALSE;
+ this.learnerExportAvailable = learnerExportAvailable != null ? learnerExportAvailable : Boolean.FALSE;
+ this.learnerPresenceAvailable = learnerPresenceAvailable != null ? learnerPresenceAvailable : Boolean.FALSE;
+ this.learnerImAvailable = learnerImAvailable != null ? learnerImAvailable : Boolean.FALSE;
+ this.lockedForEdit = false;
+ this.learningDesign = learningDesign;
+ this.lessonClass = lessonClass;
+ this.organisation = organisation;
+ this.learnerProgresses = learnerProgresses;
+ this.liveEditEnabled = liveEditEnabled;
+ this.enableLessonNotifications = enableLessonNotifications;
+ this.learnerRestart = learnerRestart;
+ this.gradebookUserLessons = new HashSet();
+ this.marksReleased = false;
+ this.scheduledNumberDaysToLessonFinish = scheduledNumberDaysToLessonFinish;
}
/**
@@ -233,35 +239,14 @@
* the learning design that this lesson is based on.
* @return the lesson created.
*/
- public static Lesson createNewLessonWithoutClass(String lessonName,
- String lessonDescription,
- User user,
- LearningDesign ld,
- Boolean enableLessonIntro,
- Boolean displayDesignImage,
- Boolean learnerExportAvailable,
- Boolean learnerPresenceAvailable,
- Boolean learnerImAvailable,
- Boolean liveEditEnabled,
- Boolean enableLessonNotifications,
- Integer scheduledNumberDaysToLessonFinish)
- {
- return new Lesson(lessonName,
- lessonDescription,
- new Date(System.currentTimeMillis()),
- user,
- Lesson.CREATED,
- null,
- ld,
- new HashSet(),
- enableLessonIntro,
- displayDesignImage,
- learnerExportAvailable,
- learnerPresenceAvailable,
- learnerImAvailable,
- liveEditEnabled,
- enableLessonNotifications,
- scheduledNumberDaysToLessonFinish);
+ public static Lesson createNewLessonWithoutClass(String lessonName, String lessonDescription, User user,
+ LearningDesign ld, Boolean enableLessonIntro, Boolean displayDesignImage, Boolean learnerExportAvailable,
+ Boolean learnerPresenceAvailable, Boolean learnerImAvailable, Boolean liveEditEnabled,
+ Boolean enableLessonNotifications, Boolean learnerRestart, Integer scheduledNumberDaysToLessonFinish) {
+ return new Lesson(lessonName, lessonDescription, new Date(System.currentTimeMillis()), user, Lesson.CREATED,
+ null, ld, new HashSet(), enableLessonIntro, displayDesignImage, learnerExportAvailable,
+ learnerPresenceAvailable, learnerImAvailable, liveEditEnabled, enableLessonNotifications,
+ learnerRestart, scheduledNumberDaysToLessonFinish);
}
// ---------------------------------------------------------------------
@@ -417,7 +402,7 @@
public void setPreviousLessonStateId(Integer previousLessonStateId) {
this.previousLessonStateId = previousLessonStateId;
}
-
+
public Boolean isEnableLessonIntro() {
return enableLessonIntro;
}
@@ -491,11 +476,11 @@
}
public LessonClass getLessonClass() {
- return this.lessonClass;
+ return this.lessonClass;
}
public void setLessonClass(LessonClass lessonClass) {
- this.lessonClass = lessonClass;
+ this.lessonClass = lessonClass;
}
public Organisation getOrganisation() {
@@ -507,29 +492,31 @@
}
public Set getLearnerProgresses() {
- return this.learnerProgresses;
+ return this.learnerProgresses;
}
public void setLearnerProgresses(Set learnerProgresses) {
- this.learnerProgresses = learnerProgresses;
+ this.learnerProgresses = learnerProgresses;
}
-
+ @Override
public String toString() {
- return new ToStringBuilder(this)
- .append("lessonId", getLessonId())
- .toString();
+ return new ToStringBuilder(this).append("lessonId", getLessonId()).toString();
}
+ @Override
public boolean equals(Object other) {
- if ((this == other))
+ if ((this == other)) {
return true;
- if (!(other instanceof Lesson))
+ }
+ if (!(other instanceof Lesson)) {
return false;
+ }
Lesson castOther = (Lesson) other;
return new EqualsBuilder().append(this.getLessonId(), castOther.getLessonId()).isEquals();
}
+ @Override
public int hashCode() {
return new HashCodeBuilder().append(getLessonId()).toHashCode();
}
@@ -563,7 +550,7 @@
/** Is this lesson a preview lesson? ie is it attached to a preview learning design? */
public boolean isPreviewLesson() {
Integer copyTypeID = getLearningDesign().getCopyTypeID();
- return (copyTypeID != null && LearningDesign.COPY_TYPE_PREVIEW == copyTypeID.intValue());
+ return ((copyTypeID != null) && (LearningDesign.COPY_TYPE_PREVIEW == copyTypeID.intValue()));
}
/**
@@ -575,16 +562,17 @@
}
private boolean isStarted(Integer stateId) {
- return (stateId != null && (stateId.equals(STARTED_STATE) || stateId.equals(FINISHED_STATE)
- || stateId.equals(ARCHIVED_STATE) || stateId.equals(REMOVED_STATE)));
+ return ((stateId != null) && (stateId.equals(Lesson.STARTED_STATE) || stateId.equals(Lesson.FINISHED_STATE)
+ || stateId.equals(Lesson.ARCHIVED_STATE) || stateId.equals(Lesson.REMOVED_STATE)));
}
-
+
/**
* Checks whether learners are allowed to access the lesson based on its state. As they can only access Started or
* Finished lessons.
*/
public boolean isLessonAccessibleForLearner() {
- return (lessonStateId != null && (lessonStateId.equals(STARTED_STATE) || lessonStateId.equals(FINISHED_STATE)));
+ return ((lessonStateId != null) && (lessonStateId.equals(Lesson.STARTED_STATE) || lessonStateId
+ .equals(Lesson.FINISHED_STATE)));
}
public Set getGradebookUserLessons() {
@@ -603,6 +591,14 @@
this.marksReleased = marksReleased;
}
+ public Boolean getLearnerRestart() {
+ return learnerRestart;
+ }
+
+ public void setLearnerRestart(Boolean learnerRestart) {
+ this.learnerRestart = learnerRestart;
+ }
+
public Set getPrecedingLessons() {
return precedingLessons;
}
@@ -618,4 +614,4 @@
public void setSucceedingLessons(Set succeedingLessons) {
this.succeedingLessons = succeedingLessons;
}
-}
+}
\ No newline at end of file