Index: lams_build/lib/lams/lams-central.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams-central.jar,v diff -u -r1.76 -r1.77 Binary files differ Index: lams_build/lib/lams/lams.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v diff -u -r1.399 -r1.400 Binary files differ Index: lams_central/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_central/conf/language/lams/ApplicationResources.properties,v diff -u -r1.131 -r1.132 --- lams_central/conf/language/lams/ApplicationResources.properties 10 Oct 2013 21:48:31 -0000 1.131 +++ lams_central/conf/language/lams/ApplicationResources.properties 27 Jan 2014 13:21:02 -0000 1.132 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java,v diff -u -r1.56 -r1.57 --- lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java 3 Dec 2013 20:30:00 -0000 1.56 +++ lams_central/src/java/org/lamsfoundation/lams/web/HomeAction.java 27 Jan 2014 13:21:02 -0000 1.57 @@ -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 =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/addLesson.jsp,v diff -u -r1.13 -r1.14 --- lams_central/web/addLesson.jsp 21 Mar 2013 09:37:06 -0000 1.13 +++ lams_central/web/addLesson.jsp 27 Jan 2014 13:21:01 -0000 1.14 @@ -185,6 +185,7 @@

+



@@ -202,7 +203,7 @@ - +
Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml,v diff -u -r1.46 -r1.47 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml 19 Mar 2012 20:51:50 -0000 1.46 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/lesson/Lesson.hbm.xml 27 Jan 2014 13:21:03 -0000 1.47 @@ -76,6 +76,9 @@ + + Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040023.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040023.sql,v diff -u Binary files differ Index: lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java,v diff -u -r1.44 -r1.45 --- lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java 10 Dec 2013 17:06:59 -0000 1.44 +++ lams_common/src/java/org/lamsfoundation/lams/lesson/Lesson.java 27 Jan 2014 13:21:03 -0000 1.45 @@ -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