Index: lams_central/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -r314c964157e7eefb28c24d94cdb798c2fcc640e7 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 314c964157e7eefb28c24d94cdb798c2fcc640e7)
+++ lams_central/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -335,7 +335,7 @@
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
-label.tab.conditions.timelimit.desc =Set the number of days the lesson will be available to learners. After this period the lesson will no longer be shown. If the time should count from the moment the learner starts the lesson, select the option for individual time limit.
+label.tab.conditions.timelimit.desc =Set the number of days the lesson will be available to learners. After this period the lesson will no longer be shown. If the time should count from the moment the learner starts the lesson, select the option for individual time limit. If you are scheduling the lesson end on the Advanced tab then you can only set an individual time limit.
label.tab.conditions.timelimit.days =Number days:
label.tab.conditions.timelimit.individual =Is this time limit for each individual?
label.tab.conditions.enable =Enable
@@ -811,5 +811,8 @@
authoring.tbl.desc.question=These questions are for iRA and tRA. Click "Create Question" to add more questions.
authoring.tbl.desc.ae=State the questions for AE. Click "Create Question" to add more questions.
-
+label.start=Start:
+label.end=End:
+error.lesson.with.scheduled.end.only.have.individual.limits=Lessons with a scheduled end date can only have individual time limits, not a lesson time limit.
+error.lesson.end.date.must.be.after.start.date=Scheduled end date must be after the start date.
#======= End labels: Exported 750 labels for en AU =====
Index: lams_central/conf/language/lams/ApplicationResources_en_AU.properties
===================================================================
diff -u -r314c964157e7eefb28c24d94cdb798c2fcc640e7 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision 314c964157e7eefb28c24d94cdb798c2fcc640e7)
+++ lams_central/conf/language/lams/ApplicationResources_en_AU.properties (.../ApplicationResources_en_AU.properties) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -335,7 +335,7 @@
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
-label.tab.conditions.timelimit.desc =Set the number of days the lesson will be available to learners. After this period the lesson will no longer be shown. If the time should count from the moment the learner starts the lesson, select the option for individual time limit.
+label.tab.conditions.timelimit.desc =Set the number of days the lesson will be available to learners. After this period the lesson will no longer be shown. If the time should count from the moment the learner starts the lesson, select the option for individual time limit. If you are scheduling the lesson end on the Advanced tab then you can only set an individual time limit.
label.tab.conditions.timelimit.days =Number days:
label.tab.conditions.timelimit.individual =Is this time limit for each individual?
label.tab.conditions.enable =Enable
Index: lams_central/web/addLesson.jsp
===================================================================
diff -u -r81d937bb6b9380b64f53e9feb482514c6b6a42b1 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision 81d937bb6b9380b64f53e9feb482514c6b6a42b1)
+++ lams_central/web/addLesson.jsp (.../addLesson.jsp) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -249,7 +249,15 @@
-
+
+
+
+
+
+
+
+
+
@@ -273,6 +281,7 @@
+
Index: lams_central/web/css/addLesson.scss
===================================================================
diff -u -r4583983b64efe1d91fbb47cdde6a759a6a30e859 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_central/web/css/addLesson.scss (.../addLesson.scss) (revision 4583983b64efe1d91fbb47cdde6a759a6a30e859)
+++ lams_central/web/css/addLesson.scss (.../addLesson.scss) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -184,8 +184,8 @@
margin-bottom: 15px;
}
-#schedulingDatetimeField {
- margin: 0px 0px 10px 50px;
+
+#scheduleStartTime, #scheduleEndTime, #schedulingError, #timelimitError {
display: none;
}
Index: lams_central/web/includes/javascript/addLesson.js
===================================================================
diff -u -r917cdcbcb307b39b90b65f7b97a5b5f7863d7c5b -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision 917cdcbcb307b39b90b65f7b97a5b5f7863d7c5b)
+++ lams_central/web/includes/javascript/addLesson.js (.../addLesson.js) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -230,9 +230,11 @@
$('#schedulingEnableField').change(function(){
if ($(this).is(':checked')) {
- $('#schedulingDatetimeField').show('slow');
+ $('#scheduleStartTime').show('slow');
+ $('#scheduleEndTime').show('slow');
} else {
- $('#schedulingDatetimeField').hide('slow');
+ $('#scheduleStartTime').hide('slow');
+ $('#scheduleEndTime').hide('slow');
}
});
@@ -242,17 +244,44 @@
$('#schedulingEnableField, #precedingLessonEnableField, ' +
'#timeLimitEnableField, #timeLimitIndividualField').prop('checked', false).change();
$('#schedulingDatetimeField').val(null);
+ $('#schedulingEndDatetimeField').val(null);
}
$('#schedulingEnableField, #precedingLessonEnableField, #timeLimitEnableField, #timeLimitIndividualField,' +
- '#precedingLessonIdField, #schedulingDatetimeField').prop('disabled', !checked);
+ '#precedingLessonIdField, #schedulingDatetimeField, #schedulingEndDatetimeField').prop('disabled', !checked);
});
$('#schedulingDatetimeField').datetimepicker({
'minDate' : 0
});
+ $('#schedulingEndDatetimeField').datetimepicker({
+ 'minDate' : 0
+ });
+
+
+ $('#schedulingEndDatetimeField').change(function(){
+ if ( $('#schedulingEndDatetimeField').val() == "" ) {
+ $('#timeLimitIndividualField').prop('disabled', false);
+ } else {
+ checkScheduleDate();
+ }
+ });
+
+ $('#schedulingDatetimeField').change(function(){
+ checkScheduleDate();
+ });
}
+function checkScheduleDate() {
+ var startDate = $('#schedulingDatetimeField').val() > "" ? Date.parse($('#schedulingDatetimeField').val()) : 0;
+ var endDate = $('#schedulingEndDatetimeField').val() > "" ? Date.parse($('#schedulingEndDatetimeField').val()) : 0;
+ if ( endDate - startDate ) {
+ $("#schedulingError").css("display","block");
+ } else {
+ $("#schedulingError").css("display","none");
+ }
+}
+
function initConditionsTab(){
$('#precedingLessonEnableField').change(function(){
if ($(this).is(':checked')) {
@@ -271,6 +300,10 @@
$('#timeLimitEnableField').change(function(){
if ($(this).is(':checked')) {
$('#timeLimitDiv').show('slow');
+ if ( $('#schedulingEndDatetimeField').val() > "" ) {
+ $('#timeLimitIndividualField').prop('checked', true);
+ $('#timeLimitIndividualField').prop('disabled', true);
+ }
} else {
$('#timeLimitDiv').hide('slow');
}
@@ -332,6 +365,16 @@
return;
}
$('#monitorsField').val(monitors);
+
+ if ( $("#schedulingEnableField").is(':checked') && $("#timeLimitEnableField").is(':checked') ) {
+ if ( $('#schedulingEndDatetimeField').val() > "" && $("#schedulingEnableField").is(':checked') && ! $("#timeLimitIndividualField").is(':checked') ) {
+ $("#timelimitError").css("display","block");
+ doSelectTab(4);
+ return;
+ } else {
+ $("#timelimitError").css("display","none");
+ }
+ }
if ($('#splitLearnersField').is(':checked')) {
var maxLearnerCount = $('#selected-learners div.draggableItem').length,
Index: lams_monitoring/conf/language/lams/ApplicationResources.properties
===================================================================
diff -u -ra14a32057cf83e427491328fb3105324d4a9c7c6 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision a14a32057cf83e427491328fb3105324d4a9c7c6)
+++ lams_monitoring/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -469,4 +469,8 @@
label.seconds=Seconds
label.reset=Reset
label.time.is.expired=Time has expired.
+
+lesson.end=End:
+error.lesson.end.date.must.be.after.start.date=Scheduled end date must be after the start date.
+
#======= End labels: Exported 451 labels for en AU =====
Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java
===================================================================
diff -u -ra41ad55b200a8af4eedbbbd22a9169c12a96133c -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision a41ad55b200a8af4eedbbbd22a9169c12a96133c)
+++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -279,9 +279,18 @@
boolean imEnable = WebUtil.readBooleanParam(request, "imEnable", false);
Integer splitNumberLessons = WebUtil.readIntParam(request, "splitNumberLessons", true);
boolean schedulingEnable = WebUtil.readBooleanParam(request, "schedulingEnable", false);
- Date schedulingDatetime = schedulingEnable
- ? MonitoringAction.LESSON_SCHEDULING_DATETIME_FORMAT.parse(request.getParameter("schedulingDatetime"))
- : null;
+ Date schedulingDatetime = null;
+ Date schedulingEndDatetime = null;
+ if ( schedulingEnable ) {
+ String dateString = request.getParameter("schedulingDatetime");
+ if ( dateString != null && dateString.length() > 0 ) {
+ schedulingDatetime = MonitoringAction.LESSON_SCHEDULING_DATETIME_FORMAT.parse(dateString);
+ }
+ dateString = request.getParameter("schedulingEndDatetime");
+ if ( dateString != null && dateString.length() > 0 ) {
+ schedulingEndDatetime = MonitoringAction.LESSON_SCHEDULING_DATETIME_FORMAT.parse(dateString);
+ }
+ }
boolean forceRestart = WebUtil.readBooleanParam(request, "forceRestart", false);
boolean allowRestart = WebUtil.readBooleanParam(request, "allowRestart", false);
@@ -369,10 +378,14 @@
getMonitoringService().startLessonOnSchedule(lesson.getLessonId(), schedulingDatetime, userId);
}
+ // monitor has given an end date/time for the lesson
+ if (schedulingEndDatetime != null) {
+ getMonitoringService().finishLessonOnSchedule(lesson.getLessonId(), schedulingEndDatetime, userId);
// if lesson should finish in few days, set it here
- if (timeLimitLesson != null) {
+ } else if (timeLimitLesson != null) {
getMonitoringService().finishLessonOnSchedule(lesson.getLessonId(), timeLimitLesson, userId);
}
+
} catch (SecurityException e) {
try {
response.sendError(HttpServletResponse.SC_FORBIDDEN, "User is not a monitor in the lesson");
Index: lams_monitoring/web/includes/javascript/monitorLesson.js
===================================================================
diff -u -rd9e422c64e6e7f3b311e250aa896cb7e09e92098 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision d9e422c64e6e7f3b311e250aa896cb7e09e92098)
+++ lams_monitoring/web/includes/javascript/monitorLesson.js (.../monitorLesson.js) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -219,6 +219,8 @@
switch (state) {
//'disable' is chosen
case 4:
+ $('#lessonScheduler').show();
+ $('#lessonStartApply').hide();
$('#lessonDisableApply').show();
$('#lessonStateApply').hide();
break;
@@ -233,6 +235,7 @@
* Apply the lesson state change and update widgets.
*/
function changeLessonState(){
+
var method = null;
//state chosen in the dropdown menu
@@ -278,7 +281,11 @@
function scheduleDisableLesson() {
var date = $('#disableDatetimeField').val();
if (date) {
- applyStateChange(4, "suspendLesson", date);
+ if ( checkScheduleDate(lessonStartDate, date) ) {
+ applyStateChange(4, "suspendLesson", date);
+ } else {
+ alert(LABELS.LESSON_ERROR_START_END_DATE);
+ }
} else {
alert(LABELS.LESSON_ERROR_SCHEDULE_DATE);
}
@@ -288,13 +295,13 @@
applyStateChange(4, "suspendLesson");
}
-function applyStateChange(state, method, lessonEndDate) {
+function applyStateChange(state, method, newLessonEndDate) {
var params = {
'method' : method,
'lessonID' : lessonId,
};
- if ( lessonEndDate ) {
- params.lessonEndDate = lessonEndDate;
+ if ( newLessonEndDate ) {
+ params.lessonEndDate = newLessonEndDate;
}
$.ajax({
@@ -308,6 +315,9 @@
} else {
refreshMonitor('lesson');
}
+ if ( newLessonEndDate ) {
+ lessonEndDate = newLessonEndDate;
+ }
}
});
}
@@ -368,7 +378,9 @@
selectField.children('option:not([value="-1"])').remove();
switch (lessonStateId) {
case 3:
- $(' ').attr('value', 4).text(LABELS.LESSON_STATE_ACTION_DISABLE).appendTo(selectField);
+ if ( ! ( lessonEndDate && lessonEndDate > "") ) {
+ $(' ').attr('value', 4).text(LABELS.LESSON_STATE_ACTION_DISABLE).appendTo(selectField);
+ }
$(' ').attr('value', 6).text(LABELS.LESSON_STATE_ACTION_ARCHIVE).appendTo(selectField);
$(' ').attr('value', 7).text(LABELS.LESSON_STATE_ACTION_REMOVE).appendTo(selectField);
break;
@@ -396,6 +408,11 @@
//created but not started lesson
case 1:
scheduleControls.css('display','inline');
+ if ( response.finishDate ) {
+ lessonFinishDateSpan.text(LABELS.LESSON_FINISH.replace("%0",response.finishDate)).css('display','inline');
+ $("#scheduleDisableLessonButton").html(LABELS.RESCHEDULE);
+ $("#disableLessonButton").css('display', 'none');
+ }
startDateField.hide();
lessonFinishDateSpan.hide();
lessonStateChanger.hide();
@@ -404,19 +421,31 @@
case 2:
scheduleControls.css('display','inline');
startDateField.text(LABELS.LESSON_START.replace("%0",response.startDate)).add('#startLessonButton').css('display','inline');
- lessonFinishDateSpan.hide();
+ $("#scheduleLessonButton").html(LABELS.RESCHEDULE);
+ if ( response.finishDate ) {
+ lessonFinishDateSpan.text(LABELS.LESSON_FINISH.replace("%0",response.finishDate)).css('display','block');
+ $("#scheduleDisableLessonButton").html(LABELS.RESCHEDULE);
+ $("#disableLessonButton").css('display', 'none');
+ } else {
+ lessonFinishDateSpan.css('display','none');
+ }
lessonStateChanger.hide();
break;
//started lesson
default:
- scheduleControls.hide();
- startDateField.text(response.startDate).hide();
if ( response.finishDate ) {
+ scheduleControls.css('display','inline');
+ $("#lessonStartApply").css('display','none');
lessonFinishDateSpan.text(LABELS.LESSON_FINISH.replace("%0",response.finishDate)).css('display','inline');
+ $("#scheduleDisableLessonButton").html(LABELS.RESCHEDULE);
+ $("#disableLessonButton").css('display', 'none');
} else {
+ scheduleControls.css('display','none');
+ startDateField.text(response.startDate).hide();
+ $("#scheduleDisableLessonButton").html(LABELS.SCHEDULE);
lessonFinishDateSpan.text("").css('display','none');
}
- disableDateSpan.hide();
+
lessonStateChanger.css('display','inline');
stateLabel.attr('title',response.startDate);
break;
@@ -435,22 +464,33 @@
updatePresenceAvailableCount();
}
+function checkScheduleDate(startDateString, endDateString) {
+ var startDate = startDateString && startDateString > "" ? Date.parse(startDateString) : 0;
+ var endDate = endDateString && endDateString > "" ? Date.parse(endDateString) : 0;
+ return ( endDate > startDate );
+}
function scheduleLesson(){
+
var date = $('#scheduleDatetimeField').val();
if (date) {
- $.ajax({
- url : LAMS_URL + 'monitoring/monitoring.do',
- cache : false,
- data : {
- 'method' : 'startOnScheduleLesson',
- 'lessonID' : lessonId,
- 'lessonStartDate' : date
- },
- success : function() {
- refreshMonitor('lesson');
- }
- });
+ if ( checkScheduleDate (date, lessonEndDate) ) {
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring.do',
+ cache : false,
+ data : {
+ 'method' : 'startOnScheduleLesson',
+ 'lessonID' : lessonId,
+ 'lessonStartDate' : date
+ },
+ success : function() {
+ lessonStartDate = date;
+ refreshMonitor('lesson');
+ }
+ });
+ } else {
+ alert(LABELS.LESSON_ERROR_START_END_DATE);
+ }
} else {
alert(LABELS.LESSON_ERROR_SCHEDULE_DATE);
}
Index: lams_monitoring/web/monitor.jsp
===================================================================
diff -u -r11ac1475f859b3700e3888217237914eca524387 -ra4002ee13a835e74c08e3d657494f1c97b531013
--- lams_monitoring/web/monitor.jsp (.../monitor.jsp) (revision 11ac1475f859b3700e3888217237914eca524387)
+++ lams_monitoring/web/monitor.jsp (.../monitor.jsp) (revision a4002ee13a835e74c08e3d657494f1c97b531013)
@@ -52,6 +52,8 @@
ldId = ${lesson.learningDesignID},
lessonStateId = ${lesson.lessonStateID},
createDateTimeStr = '${lesson.createDateTimeStr}',
+ lessonStartDate = '${lesson.scheduleStartDate}',
+ lessonEndDate = '${lesson.scheduleEndDate}',
// settings for progress bar
isHorizontalBar = true,
hasContentFrame = false,
@@ -205,9 +207,13 @@
LESSON_ACTIVITY_SCORES_ENABLE_ALERT : decoderDiv.html(' ').text(),
- LESSON_ACTIVITY_SCORES_DISABLE_ALERT : decoderDiv.html(' ').text()
+ LESSON_ACTIVITY_SCORES_DISABLE_ALERT : decoderDiv.html(' ').text(),
+
+ RESCHEDULE : decoderDiv.html(' ').text(),
+
+ LESSON_ERROR_START_END_DATE : decoderDiv.html(' ').text()
}
-
+
$(document).ready(function(){
initLessonTab();
initSequenceTab();
@@ -322,29 +328,46 @@
-
-
+
+