Index: lams_gradebook/web/releaseLessonMarks5.jsp
===================================================================
diff -u -r6582c67f62fe86aeb15f5b7e21b54a82952ec3d3 -rfb376f561c06d7864cf72bd93bc9711fc903659b
--- lams_gradebook/web/releaseLessonMarks5.jsp (.../releaseLessonMarks5.jsp) (revision 6582c67f62fe86aeb15f5b7e21b54a82952ec3d3)
+++ lams_gradebook/web/releaseLessonMarks5.jsp (.../releaseLessonMarks5.jsp) (revision fb376f561c06d7864cf72bd93bc9711fc903659b)
@@ -92,7 +92,7 @@
// release/hide marks
function toggleMarksRelease() {
- if (confirm(marksReleased ? "
" : "
")) {
+ showConfirm(marksReleased ? "
" : "
", function() {
releaseMarksAlertBox.hide();
$.ajax({
@@ -112,7 +112,7 @@
}
}
});
- }
+ });
}
function sendReleaseMarksEmails(){
@@ -134,26 +134,24 @@
return;
}
- if (!confirm('
'.replace('[COUNT_PLACEHOLDER]', finalList.length))){
- return;
- }
-
- $.ajax({
- 'url' : '
gradebook/gradebookMonitoring/sendReleaseMarksEmails.do',
- 'data' : {
- 'lessonID' : releaseMarksLessonID,
- 'includedLearners' : JSON.stringify(finalList)
- },
- 'dataType' : 'text',
- 'cache' : false,
- 'success' : function(response) {
- if (response == 'success') {
- releaseMarksAlertBox.removeClass('alert-danger').addClass('alert-success').text('Emails were sent').show();
- return;
- }
+ showConfirm('
'.replace('[COUNT_PLACEHOLDER]', finalList.length), function() {
+ $.ajax({
+ 'url' : '
gradebook/gradebookMonitoring/sendReleaseMarksEmails.do',
+ 'data' : {
+ 'lessonID' : releaseMarksLessonID,
+ 'includedLearners' : JSON.stringify(finalList)
+ },
+ 'dataType' : 'text',
+ 'cache' : false,
+ 'success' : function(response) {
+ if (response == 'success') {
+ releaseMarksAlertBox.removeClass('alert-danger').addClass('alert-success').text('Emails were sent').show();
+ return;
+ }
- releaseMarksAlertBox.removeClass('alert-success').addClass('alert-danger').text('There was a problem with sending emails: ' + response).show();
- }
+ releaseMarksAlertBox.removeClass('alert-success').addClass('alert-danger').text('There was a problem with sending emails: ' + response).show();
+ }
+ });
});
}
Index: lams_monitoring/web/includes/javascript/monitorLesson5.js
===================================================================
diff -u -rcf4a7775152af5ea73a54b304a785d7cd0b40ddf -rfb376f561c06d7864cf72bd93bc9711fc903659b
--- lams_monitoring/web/includes/javascript/monitorLesson5.js (.../monitorLesson5.js) (revision cf4a7775152af5ea73a54b304a785d7cd0b40ddf)
+++ lams_monitoring/web/includes/javascript/monitorLesson5.js (.../monitorLesson5.js) (revision fb376f561c06d7864cf72bd93bc9711fc903659b)
@@ -340,11 +340,11 @@
//'remove' is chosen
case 7:
- if (confirm(LABELS.LESSON_REMOVE_ALERT)){
- if (confirm(LABELS.LESSON_REMOVE_DOUBLECHECK_ALERT)) {
+ showConfirm(LABELS.LESSON_REMOVE_ALERT, function() {
+ showConfirm(LABELS.LESSON_REMOVE_DOUBLECHECK_ALERT, function() {
method = "removeLesson";
- }
- }
+ });
+ });
break;
}
@@ -980,7 +980,7 @@
}
function sendProgressEmail() {
- if ( confirm(LABELS.PROGRESS_EMAIL_SEND_NOW_QUESTION) ) {
+ showConfirm(LABELS.PROGRESS_EMAIL_SEND_NOW_QUESTION, function() {
$.ajax({
dataType : 'json',
url : LAMS_URL + 'monitoring/emailProgress/sendLessonProgressEmail.do',
@@ -991,12 +991,12 @@
},
success : function(response) {
if ( response.error || ! response.sent > 0 )
- alert(LABELS.PROGRESS_EMAIL_SEND_FAILED+"\n"+(response.error ? response.error : ""));
+ showToast(LABELS.PROGRESS_EMAIL_SEND_FAILED+"\n"+(response.error ? response.error : ""));
else
- alert(LABELS.PROGRESS_EMAIL_SUCCESS.replace('[0]',response.sent));
+ showToast(LABELS.PROGRESS_EMAIL_SUCCESS.replace('[0]',response.sent));
}
});
- }
+ });
}
function addEmailProgressDate() {
@@ -1609,53 +1609,54 @@
if (isEndLesson) {
- executeForceComplete = currentActivityId && confirm(LABELS.FORCE_COMPLETE_END_LESSON_CONFIRM
- .replace('[0]', learnerNames));
- } else {
- var targetActivityId = +targetActivity.attr('id');
- if (currentActivityId != targetActivityId) {
- var targetActivityName = targetActivity.hasClass('svg-activity-gate') ? "Gate" : targetActivity.find('.svg-activity-title-label').text(),
- moveBackwards = currentActivityId == null;
-
- // check if target activity is before current activity
- if (currentActivityId) {
- $.ajax({
- dataType : 'text',
- url : LAMS_URL + 'monitoring/monitoring/isActivityPreceding.do',
- async : false,
- cache : false,
- data : {
- 'activityA' : targetActivityId,
- 'activityB' : currentActivityId
- },
- success : function(response) {
- moveBackwards = response == 'true';
- }
- });
- }
-
- // check if the target activity was found or we are moving the learner from end of lesson
- if (moveBackwards) {
- // move the learner backwards
- var msgString = LABELS.FORCE_COMPLETE_REMOVE_CONTENT
- .replace('[0]', learnerNames).replace('[1]', targetActivityName);
- $('#forceBackwardsMsg', '#forceBackwardsDialog').html(msgString);
- $('#forceBackwardsDialog').data({
- 'learners' : learners,
- 'currentActivityId' : currentActivityId,
- 'activityId': targetActivityId});
- $('#forceBackwardsDialog').modal('show');
- return;
- } else {
- // move the learner forward
- executeForceComplete = confirm(LABELS.FORCE_COMPLETE_ACTIVITY_CONFIRM
- .replace('[0]', learnerNames).replace('[1]', targetActivityName));
- }
+ if (currentActivityId) {
+ showConfirm(LABELS.FORCE_COMPLETE_END_LESSON_CONFIRM.replace('[0]', learnerNames), function() {
+ forceCompleteExecute(moveAll ? null : learners, moveAll ? currentActivityId : null, targetActivityId, false);
+ });
}
+ return;
}
- if (executeForceComplete) {
- forceCompleteExecute(moveAll ? null : learners, moveAll ? currentActivityId : null, targetActivityId, false);
+ var targetActivityId = +targetActivity.attr('id');
+ if (currentActivityId != targetActivityId) {
+ var targetActivityName = targetActivity.hasClass('svg-activity-gate') ? "Gate" : targetActivity.find('.svg-activity-title-label').text(),
+ moveBackwards = currentActivityId == null;
+
+ // check if target activity is before current activity
+ if (currentActivityId) {
+ $.ajax({
+ dataType : 'text',
+ url : LAMS_URL + 'monitoring/monitoring/isActivityPreceding.do',
+ async : false,
+ cache : false,
+ data : {
+ 'activityA' : targetActivityId,
+ 'activityB' : currentActivityId
+ },
+ success : function(response) {
+ moveBackwards = response == 'true';
+ }
+ });
+ }
+
+ // check if the target activity was found or we are moving the learner from end of lesson
+ if (moveBackwards) {
+ // move the learner backwards
+ var msgString = LABELS.FORCE_COMPLETE_REMOVE_CONTENT
+ .replace('[0]', learnerNames).replace('[1]', targetActivityName);
+ $('#forceBackwardsMsg', '#forceBackwardsDialog').html(msgString);
+ $('#forceBackwardsDialog').data({
+ 'learners' : learners,
+ 'currentActivityId' : currentActivityId,
+ 'activityId': targetActivityId});
+ $('#forceBackwardsDialog').modal('show');
+ return;
+ }
+
+ // move the learner forward
+ showConfirm(LABELS.FORCE_COMPLETE_ACTIVITY_CONFIRM.replace('[0]', learnerNames).replace('[1]', targetActivityName), function() {
+ forceCompleteExecute(moveAll ? null : learners, moveAll ? currentActivityId : null, targetActivityId, false);
+ });
}
}
@@ -1691,7 +1692,7 @@
data : data,
success : function(response) {
// inform user of result
- alert(response);
+ showToast(response);
// progress changed, show it to monitor
refreshMonitor();
@@ -2223,7 +2224,7 @@
* Adds all learners to the class.
*/
function addAllLearners(){
- if (confirm(LABELS.CLASS_ADD_ALL_CONFIRM)) {
+ showConfirm(LABELS.CLASS_ADD_ALL_CONFIRM, function() {
$.ajax({
url : LAMS_URL + 'monitoring/monitoring/addAllOrganisationLearnersToLesson.do',
type : 'POST',
@@ -2232,18 +2233,18 @@
'lessonID' : lessonId
},
success : function(){
- alert(LABELS.CLASS_ADD_ALL_SUCCESS);
+ showToast(LABELS.CLASS_ADD_ALL_SUCCESS);
$('#classDialog').modal('hide');
}
});
- }
+ });
}
/**
* Opens Authoring for live edit.
*/
function openLiveEdit(){
- if (confirm(LABELS.LIVE_EDIT_CONFIRM)) {
+ showConfirm(LABELS.LIVE_EDIT_CONFIRM, function() {
$.ajax({
dataType : 'text',
url : LAMS_URL + 'monitoring/monitoring/startLiveEdit.do',
@@ -2254,13 +2255,13 @@
},
success : function(response) {
if (response) {
- alert(response);
+ showToast(response);
} else {
openAuthoring(ldId, lessonId);
}
}
});
- }
+ });
}
/**
@@ -2977,6 +2978,22 @@
toast.show();
}
+function showConfirm(body, callback) {
+ let dialog = $('#confirmationDialog');
+ $('.modal-body', dialog).html(body);
+
+ $("#confirmationDialogConfirmButton").off('click').on("click", function(){
+ callback(true);
+ dialog.modal('hide');
+ });
+
+ $("#confirmationDialogCancelButton").off('click').on("click", function(){
+ dialog.modal('hide');
+ });
+
+ dialog.modal('show');
+}
+
/**
* Works as dblclick for mobile devices.
*/
Index: lams_monitoring/web/monitor5.jsp
===================================================================
diff -u -rcf4a7775152af5ea73a54b304a785d7cd0b40ddf -rfb376f561c06d7864cf72bd93bc9711fc903659b
--- lams_monitoring/web/monitor5.jsp (.../monitor5.jsp) (revision cf4a7775152af5ea73a54b304a785d7cd0b40ddf)
+++ lams_monitoring/web/monitor5.jsp (.../monitor5.jsp) (revision fb376f561c06d7864cf72bd93bc9711fc903659b)
@@ -646,20 +646,20 @@
-
+
-
+
-
+
-
-
+
+
@@ -700,6 +700,22 @@