Index: lams_central/web/css/components.css
===================================================================
diff -u -r84204c571e0ab10c9006730dc413cebec8a66167 -rab9c4c312eb687a2b58efc563dc1b824087548e3
--- lams_central/web/css/components.css (.../components.css) (revision 84204c571e0ab10c9006730dc413cebec8a66167)
+++ lams_central/web/css/components.css (.../components.css) (revision ab9c4c312eb687a2b58efc563dc1b824087548e3)
@@ -273,10 +273,11 @@
align-items: flex-start;
flex-direction: column;
transition: all .3s ease;
+ transform: translateX(-7rem);
}
.component-sidebar.active {
- transform: translateX(-7rem);
+ transform: translateX(0);
}
.component-sidebar .component-menu-btn a {
Index: lams_monitoring/web/css/components-monitoring-responsive.css
===================================================================
diff -u -r989f22a0c998fff45aabca43d753612f0d8e4358 -rab9c4c312eb687a2b58efc563dc1b824087548e3
--- lams_monitoring/web/css/components-monitoring-responsive.css (.../components-monitoring-responsive.css) (revision 989f22a0c998fff45aabca43d753612f0d8e4358)
+++ lams_monitoring/web/css/components-monitoring-responsive.css (.../components-monitoring-responsive.css) (revision ab9c4c312eb687a2b58efc563dc1b824087548e3)
@@ -3,7 +3,7 @@
}
.hidden-xs {
- display: block !important;
+ display: initial !important;
}
@media ( max-width : 1200px) {
Index: lams_monitoring/web/css/components-monitoring.css
===================================================================
diff -u -r84204c571e0ab10c9006730dc413cebec8a66167 -rab9c4c312eb687a2b58efc563dc1b824087548e3
--- lams_monitoring/web/css/components-monitoring.css (.../components-monitoring.css) (revision 84204c571e0ab10c9006730dc413cebec8a66167)
+++ lams_monitoring/web/css/components-monitoring.css (.../components-monitoring.css) (revision ab9c4c312eb687a2b58efc563dc1b824087548e3)
@@ -38,19 +38,69 @@
.monitoring-page-content {
min-height: 100%;
- padding: 2rem 4.8rem 2rem 11.8rem;
+ padding: 2rem 4.8rem 2rem 4.8rem;
transition: all .3s ease;
+ vertical-align: top;
+ text-align: center;
}
.monitoring-page-content.active {
- padding-left: 4.8rem;
+ padding-left: 11.8rem;
}
-.monitoring-page-content {
- vertical-align: top;
- text-align: center;
+.component-sidebar {
+ align-items: center;
}
+.component-sidebar .lams-logo {
+ width: 3.6rem;
+}
+
+.component-sidebar.active.expanded {
+ width: 30rem;
+}
+
+.component-sidebar.active.expanded ~ .monitoring-page-content.active {
+ padding-left: 30.8rem;
+}
+
+.component-sidebar .component-menu {
+ width: 100%;
+ display: flex;
+ justify-content: flex-start;
+}
+
+.component-sidebar .component-menu-btn {
+ width: 3.6rem;
+ height: 100%;
+}
+
+.component-sidebar #edit-lesson-btn {
+ margin-bottom: 1.5rem;
+}
+
+.component-sidebar .lesson-properties {
+ width: 0;
+ height: 100%;
+ padding-left: 2rem;
+ overflow: hidden;
+ text-align: left;
+ transition: all .3s ease;
+}
+
+.component-sidebar .lesson-properties.active {
+ width: 100%;
+}
+
+.component-sidebar .lesson-properties #gradebookOnCompleteButton {
+ margin-top: 1rem;
+}
+
+.component-sidebar .lesson-properties .btn {
+ display: block;
+ margin-top: .5rem;
+}
+
.monitoring-page-content .monitoring-layout-element {
display: inline-block;
max-width: 80%;
Index: lams_monitoring/web/includes/javascript/monitorLesson5.js
===================================================================
diff -u -r84204c571e0ab10c9006730dc413cebec8a66167 -rab9c4c312eb687a2b58efc563dc1b824087548e3
--- lams_monitoring/web/includes/javascript/monitorLesson5.js (.../monitorLesson5.js) (revision 84204c571e0ab10c9006730dc413cebec8a66167)
+++ lams_monitoring/web/includes/javascript/monitorLesson5.js (.../monitorLesson5.js) (revision ab9c4c312eb687a2b58efc563dc1b824087548e3)
@@ -1,18 +1,19 @@
// ********** GLOBAL VARIABLES **********
// copy of lesson SVG so it does no need to be fetched every time
-let originalSequenceCanvas = null,
- // DIV container for lesson SVG
- // it gets accessed so many times it's worth to cache it here
+var originalSequenceCanvas = null,
+// DIV container for lesson SVG
+// it gets accessed so many times it's worth to cache it here
sequenceCanvas = $('#sequenceCanvas'),
- // switch between SVG original size and fit-to-sreen (enlarge/shrink)
+// switch between SVG original size and fit-to-sreen (enlarge/shrink)
learningDesignSvgFitScreen = false,
// info box show timeout
sequenceInfoTimeout = 8000,
- // which learner was selected in the search box
+// which learner was selected in the search box
sequenceSearchedLearner = null,
- // for synchronisation purposes
+// for synchronisation purposes
sequenceRefreshInProgress = false,
- //auto refresh all tabs every 30 seconds
+
+//auto refresh all tabs every 30 seconds
autoRefreshInterval = 30 * 1000,
autoRefreshIntervalObject = null,
// when user is doing something, do not auto refresh
@@ -25,26 +26,336 @@
// popup window size
popupWidth = 1280,
popupHeight = 720,
-
+
gateOpenIconPath = 'images/svg/gateOpen.svg',
gateOpenIconData = null;
-function refreshMonitor(tabName, isAuto){
- if (autoRefreshIntervalObject && !isAuto) {
- clearInterval(autoRefreshIntervalObject);
- autoRefreshIntervalObject = null;
+
+
+//********** LESSON TAB FUNCTIONS **********
+
+/**
+ * Sets up lesson tab.
+ */
+function initLessonTab(){
+ // sets presence availability. buttons may be temporarily disable by the tour.
+ $('#presenceButton').click(function(){
+ var checked = $(this).toggleClass('btn-success').hasClass('btn-success');
+ var data = {
+ 'presenceAvailable' : checked,
+ 'lessonID' : lessonId
+ };
+ data[csrfTokenName] = csrfTokenValue;
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/presenceAvailable.do',
+ type : 'POST',
+ cache : false,
+ data : data,
+ success : function() {
+ updatePresenceAvailableCount();
+ if (checked) {
+ $('#imButton').show();
+ $('#imButton').prop('disabled', false);
+ alert(LABELS.LESSON_PRESENCE_ENABLE_ALERT);
+ } else {
+ $('#imButton').removeClass('btn-success').hide();
+ alert(LABELS.LESSON_PRESENCE_DISABLE_ALERT);
+ }
+ }
+ });
+ });
+
+ // sets instant messaging availability
+ $('#imButton').click(function(){
+ var checked = $(this).toggleClass('btn-success').hasClass('btn-success');
+ var data = {
+ 'presenceImAvailable' : checked,
+ 'lessonID' : lessonId
+ };
+ data[csrfTokenName] = csrfTokenValue;
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/presenceImAvailable.do',
+ type : 'POST',
+ cache : false,
+ data : data,
+ success : function() {
+ if (checked) {
+ $('#openImButton').show();
+ $('#openImButton').prop('disabled', false);
+ alert(LABELS.LESSON_IM_ENABLE_ALERT);
+ } else {
+ $('#openImButton').hide();
+ alert(LABELS.LESSON_IM_DISABLE_ALERT);
+ }
+ }
+ });
+ });
+
+ $('#openImButton').click(openChatWindow);
+
+/*
+ //turn to inline mode for x-editable.js
+ $.fn.editable.defaults.mode = 'inline';
+ // do not cancel on clicking outside of box
+ $.fn.editable.defaults.onblur = 'ignore';
+ //enable renaming of lesson title
+ $('#lesson-name-strong').editable({
+ type: 'text',
+ pk: lessonId,
+ url: LAMS_URL + 'monitoring/monitoring/renameLesson.do?' + $("#csrf-form", window.parent.document).serialize(),
+ validate: function(value) {
+ //close editing area on validation failure
+ if (!value.trim()) {
+ $('.editable-open').editableContainer('hide', 'cancel');
+ return 'Can not be empty!';
+ }
+ },
+ //assume server response: 200 Ok {status: 'error', msg: 'field cannot be empty!'}
+ success: function(response, newValue) {
+ if(response.status == 'error') {
+ return response.msg; //msg will be shown in editable form
+ }
+ }
+ //hide and show pencil on showing and hiding editing widget
+ }).on('shown', function(e, editable) {
+ $(this).nextAll('i.fa-pencil').hide();
+ }).on('hidden', function(e, reason) {
+ $(this).nextAll('i.fa-pencil').show();
+ });
+ */
+ // sets up calendar for schedule date choice
+ $('#scheduleDatetimeField').datetimepicker({
+ 'minDate' : 0
+ });
+ // sets up calendar for schedule date choice
+ $('#disableDatetimeField').datetimepicker({
+ 'minDate' : 0
+ });
+
+ // sets up dialog for editing class
+ var classDialog = showDialog('classDialog',{
+ 'autoOpen' : false,
+ 'width' : 950,
+ 'title' : LABELS.LESSON_EDIT_CLASS,
+ 'resizable' : true,
+ 'open' : function(){
+ autoRefreshBlocked = true;
+ },
+ 'close' : function(){
+ autoRefreshBlocked = false;
+ refreshMonitor();
+ }
+ }, false);
+
+ $('.modal-body', classDialog).empty().append($('#classDialogContents').show());
+
+ // search for users in the organisation with the term the Monitor entered
+ $('.dialogSearchPhrase', classDialog).autocomplete({
+ 'source' : LAMS_URL + "monitoring/monitoring/autocomplete.do?scope=organisation&lessonID=" + lessonId,
+ 'delay' : 700,
+ 'select' : function(event, ui){
+ var phraseField = $(this),
+ dialog = $('#classDialog');
+ // learner's ID in ui.item.value is not used here
+ phraseField.val(ui.item.label);
+ // show the "clear search phrase" button
+ $('.dialogSearchPhraseClear', dialog).css('visibility', 'visible');
+ // reset to page 1
+ dialog.data('LearnerAjaxProperties').data.pageNumber = 1;
+ showClassDialog('Learner');
+ return false;
+ }
+ })
+ // run the real search when the Monitor presses Enter
+ .keypress(function(e){
+ if (e.which == 13) {
+ var phraseField = $(this),
+ dialog = $('#classDialog');
+
+ phraseField.autocomplete("close");
+ if (phraseField.val()) {
+ $('.dialogSearchPhraseClear', dialog).css('visibility', 'visible');
+ }
+ // reset to page 1
+ dialog.data('LearnerAjaxProperties').pageNumber = 1;
+ showClassDialog('Learner');
+ }
+ });
+
+ var emailProgressDialog = showDialog('emailProgressDialog',{
+ 'autoOpen' : false,
+ 'height' : 500,
+ 'width' : 510,
+ 'title' : LABELS.PROGRESS_EMAIL_TITLE,
+ 'resizable' : true,
+ 'open' : function(){
+ autoRefreshBlocked = true;
+ },
+ 'close' : function(){
+ autoRefreshBlocked = false;
+ }
+ }, false);
+ $('.modal-body', emailProgressDialog).empty().append($('#emailProgressDialogContents').show());
+ //initialize datetimepicker
+ $("#emaildatePicker").datetimepicker();
+
+ // sets gradebook on complete functionality
+ $('#gradebookOnCompleteButton').click(function(){
+ var checked = $(this).toggleClass('btn-success').hasClass('btn-success');
+ var data = {
+ 'gradebookOnComplete' : checked,
+ 'lessonID' : lessonId
+ };
+ data[csrfTokenName] = csrfTokenValue;
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/gradebookOnComplete.do',
+ type : 'POST',
+ cache : false,
+ data : data,
+ success : function() {
+ if (checked) {
+ alert(LABELS.LESSON_ACTIVITY_SCORES_ENABLE_ALERT);
+ } else {
+ alert(LABELS.LESSON_ACTIVITY_SCORES_DISABLE_ALERT);
+ }
+ }
+ });
+ });
+
+
+}
+
+/**
+ * Shows all learners in the lesson class.
+ */
+function showLessonLearnersDialog() {
+ var ajaxProperties = {
+ url : LAMS_URL + 'monitoring/monitoring/getLessonLearners.do',
+ data : {
+ 'lessonID' : lessonId
+ }
+ };
+
+ showLearnerGroupDialog(ajaxProperties, LABELS.LESSON_GROUP_DIALOG_CLASS, true, false, false, true);
+}
+
+/**
+ * Lesson state field changed but the apply button not yet pressed
+ */
+function lessonStateFieldChanged() {
+
+ //state chosen in the dropdown menu
+ var state = +$('#lessonStateField').val();
+ switch (state) {
+ //'disable' is chosen
+ case 4:
+ $('#lessonScheduler').show();
+ $('#lessonStartApply').hide();
+ $('#lessonStateApply').hide();
+ $("#scheduleDisableLessonButton").html(LABELS.SCHEDULE);
+ $("#scheduleDisableLessonButton").css('display', 'inline'); // must be inline or it will be wrong size
+ $("#disableLessonButton").show();
+ $('#lessonDisableApply').show();
+ break;
+ default:
+ $('#lessonDisableApply').hide();
+ $('#lessonStateApply').show();
+ break;
}
+}
- if (!autoRefreshIntervalObject) {
- autoRefreshIntervalObject = setInterval(function(){
- // refreshMonitor(null, true);
- }, autoRefreshInterval);
+/**
+ * Apply the lesson state change and update widgets.
+ */
+function changeLessonState(){
+ var method = null;
+
+ //state chosen in the dropdown menu
+ var state = +$('#lessonStateField').val();
+ switch (state) {
+
+ //'activate' is chosen
+ case 3:
+ switch (lessonStateId) {
+ case 4: //SUSPENDED
+ method = "unsuspendLesson";
+ break;
+ case 6: //ARCHIVED
+ method = "unarchiveLesson";
+ break;
+ }
+ break;
+
+
+ //'disable' is handled by scheduleDisableLesson, disableLesson
+ // case 4:
+
+ //'archive' is chosen
+ case 6:
+ method = "archiveLesson";
+ break;
+
+ //'remove' is chosen
+ case 7:
+ if (confirm(LABELS.LESSON_REMOVE_ALERT)){
+ if (confirm(LABELS.LESSON_REMOVE_DOUBLECHECK_ALERT)) {
+ method = "removeLesson";
+ }
+ }
+ break;
}
- updateLessonTab();
- updateSequenceTab();
+ if (method) {
+ applyStateChange(state, method)
+ }
}
+function scheduleDisableLesson() {
+ var date = $('#disableDatetimeField').val();
+ if (date) {
+ if ( checkScheduleDate(lessonStartDate, date) ) {
+ applyStateChange(4, "suspendLesson", date);
+ } else {
+ alert(LABELS.LESSON_ERROR_START_END_DATE);
+ }
+ } else {
+ alert(LABELS.LESSON_ERROR_SCHEDULE_DATE);
+ }
+}
+
+function disableLesson() {
+ applyStateChange(4, "suspendLesson");
+}
+
+function applyStateChange(state, method, newLessonEndDate) {
+ var params = {
+ 'lessonID' : lessonId
+ };
+ params[csrfTokenName] = csrfTokenValue;
+
+ if (newLessonEndDate) {
+ params.lessonEndDate = newLessonEndDate;
+ }
+
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/' + method + ".do",
+ data: params,
+ type: "POST",
+ cache : false,
+ success: function() {
+ if (state == 7) {
+ // user chose to finish the lesson, close monitoring and refresh the lesson list
+ closeMonitorLessonDialog(true);
+ } else {
+ refreshMonitor('lesson');
+ }
+ if ( state == 4 ) {
+ lessonEndDate = newLessonEndDate;
+ }
+ }
+ });
+}
+
/**
* Updates widgets in lesson tab according to response sent to refreshMonitor()
*/
@@ -58,17 +369,258 @@
},
success : function(response) {
+ // update lesson state label
+ lessonStateId = +response.lessonStateID;
+ var label = null,
+ labelColour = 'warning';
+ switch (lessonStateId) {
+ case 1:
+ label = LABELS.LESSON_STATE_CREATED;
+ labelColour = 'warning';
+ break;
+ case 2:
+ label = LABELS.LESSON_STATE_SCHEDULED;
+ labelColour = 'warning';
+ break;
+ case 3:
+ label = LABELS.LESSON_STATE_STARTED;
+ labelColour = 'success';
+ break;
+ case 4:
+ label = LABELS.LESSON_STATE_SUSPENDED;
+ labelColour = 'danger';
+ break;
+ case 5:
+ label = LABELS.LESSON_STATE_FINISHED;
+ labelColour = 'danger';
+ break;
+ case 6:
+ label = LABELS.LESSON_STATE_ARCHIVED;
+ labelColour = 'danger';
+ break;
+ case 7:
+ label = LABELS.LESSON_STATE_REMOVED;
+ labelColour = 'danger';
+ break;
+ }
+ $('#lessonStateLabel').attr('class', 'label label-' + labelColour).html(label + ' ');
+
+ // update available options in change state dropdown menu
+ var selectField = $('#lessonStateField');
+ // remove all except "Select status" option
+ selectField.children('option:not([value="-1"])').remove();
+ switch (lessonStateId) {
+ case 3:
+ 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;
+ case 4:
+ $('').attr('value', 3).text(LABELS.LESSON_STATE_ACTION_ACTIVATE).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;
+ case 5:
+ break;
+ case 6:
+ $('').attr('value', 3).text(LABELS.LESSON_STATE_ACTION_ACTIVATE).appendTo(selectField);
+ $('').attr('value', 7).text(LABELS.LESSON_STATE_ACTION_REMOVE).appendTo(selectField);
+ break;
+ }
+
+ // show/remove widgets for lesson scheduling
+ var scheduleControls = $('#scheduleDatetimeField, #scheduleLessonButton, #startLessonButton, #lessonScheduler, #scheduleDisableLessonButton, #disableLessonButton'),
+ startDateField = $('#lessonStartDateSpan'),
+ lessonFinishDateSpan = $('#lessonFinishDateSpan'),
+ disableDateSpan = $('#lessonDisableApply'),
+ lessonStateChanger = $('#lessonStateChanger'),
+ stateLabel = $('#lessonStateLabel');
+ switch (lessonStateId) {
+ //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();
+ break;
+ //scheduled lesson
+ case 2:
+ scheduleControls.css('display','inline');
+ startDateField.text(LABELS.LESSON_START.replace("%0",response.startDate)).add('#startLessonButton').css('display','inline');
+ $("#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:
+ startDateField.text("").css('display','none'); // we may have just started the lesson and needed to clear the scheduled date message
+ 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);
+ } else {
+ scheduleControls.css('display','none');
+ $("#scheduleDisableLessonButton").html(LABELS.SCHEDULE);
+ lessonFinishDateSpan.text("").css('display','none');
+ }
+
+ lessonStateChanger.css('display','inline');
+ stateLabel.attr('title',response.startDate);
+ break;
+ }
+
updateContributeActivities(response.contributeActivities);
+ $('#lesson-name-strong').html(response.lessonName);
+ $('#lesson-instructions').html(response.lessonInstructions);
}
});
-
drawChart('pie', 'chartDiv',
- LAMS_URL + 'monitoring/monitoring/getLessonChartData.do?lessonID=' + lessonId,
- true);
+ LAMS_URL + 'monitoring/monitoring/getLessonChartData.do?lessonID=' + lessonId,
+ true);
+
+ updatePresenceAvailableCount();
}
+function checkScheduleDate(startDateString, endDateString) {
+ var startDate = startDateString && startDateString > "" ? Date.parse(startDateString) : 0;
+ var endDate = endDateString && endDateString > "" ? Date.parse(endDateString) : 0;
+ return ( endDate == 0 || startDate < endDate );
+}
+function scheduleLesson(){
+ var date = $('#scheduleDatetimeField').val();
+ if (date) {
+ if ( checkScheduleDate (date, lessonEndDate) ) {
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/startOnScheduleLesson.do',
+ cache : false,
+ data : {
+ '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);
+ }
+}
+
+
+function startLesson(){
+ var data = {
+ 'lessonID': lessonId
+ };
+ data[csrfTokenName] = csrfTokenValue;
+ $.ajax({
+ dataType : 'text',
+ url : LAMS_URL + 'monitoring/monitoring/startLesson.do',
+ data : data,
+ cache : false,
+ type : 'POST',
+ success : function() {
+ refreshMonitor('lesson');
+ }
+ });
+}
+
+
+/**
+ * Stringifies user IDs who were selected in Edit Class dialog.
+ */
+function getSelectedClassUserList(containerId) {
+ var list = [];
+ $('#' + containerId).children('div.dialogListItem').each(function(){
+ if ($('input:checked', this).length > 0){
+ list.push($(this).attr('userId'));
+ }
+ });
+ return list;
+}
+
+
+function openChatWindow(){
+ // variables are set in JSP page
+ window.open(LAMS_URL + 'learning/presenceChat.jsp?lessonID=' + lessonId
+ + '&presenceEnabledPatch=true&presenceImEnabled=true&presenceShown=true&createDateTime='
+ + createDateTimeStr
+ ,'Chat'
+ ,'width=650,height=350,resizable=no,scrollbars=no,status=no,menubar=no,toolbar=no');
+}
+
+function showEmailDialog(userId){
+
+ //check whether current window is a top level one (otherwise it's an iframe or popup)
+ var isTopLevelWindow = window.top == window.self;
+ //calculate width and height based on the dimensions of the window to which dialog is added
+ var dialogWindow = isTopLevelWindow ? $(window) : $(window.parent);
+
+ var dialog = showDialog("dialogEmail", {
+ 'autoOpen' : true,
+ 'height' : Math.max(380, Math.min(700, dialogWindow.height() - 30)),
+ 'width' : Math.max(380, Math.min(700, dialogWindow.width() - 60)),
+ 'modal' : true,
+ 'resizable' : true,
+ 'title' : LABELS.EMAIL_TITLE,
+ //dialog needs to be added to a top level window to avoid boundary limitations of the interim iframe
+ "isCreateInParentWindow" : !isTopLevelWindow,
+ 'open' : function(){
+ autoRefreshBlocked = true;
+ var dialog = $(this);
+ // load contents after opening the dialog
+ $('iframe', dialog).attr('src',
+ LAMS_URL + 'emailUser/composeMail.do?lessonID=' + lessonId
+ + '&userID=' + userId);
+ },
+ 'close' : function(){
+ autoRefreshBlocked = false;
+ $(this).remove();
+ }
+ }, false, true);
+}
+
+
+function updatePresenceAvailableCount(){
+ var checked = $('#presenceButton').hasClass('btn-success'),
+ counter = $('#presenceCounter');
+ if (checked) {
+ $.ajax({
+ dataType : 'text',
+ url : LAMS_URL + 'learning/learner/getPresenceChatActiveUserCount.do?',
+ cache : false,
+ data : {
+ 'lessonID' : lessonId
+ },
+ success : function(result) {
+ counter.text(result).show();
+ }
+ });
+ } else {
+ counter.hide();
+ }
+}
+
+
function updateContributeActivities(contributeActivities) {
let requiredTasksPanel = $('#required-tasks'),
requiredTasksContent = $('#required-tasks-content', requiredTasksPanel);
@@ -153,7 +705,194 @@
}
}
+/**
+ * Set up when the progress emails should be sent to monitors
+ */
+function configureProgressEmail(){
+ fillEmailProgress();
+ $('#emailProgressDialog').modal('show');
+}
+/**
+ * Adds/removes date to the set of progress report emailing dates
+ */
+function editEmailProgressDate(dateCheckbox){
+ var dateid = dateCheckbox.parent().attr('dateid'),
+ add = dateCheckbox.is(':checked');
+ var data = {
+ 'lessonID' : lessonId,
+ 'id' : dateid,
+ 'add' : add
+ };
+ data[csrfTokenName] = csrfTokenValue;
+ $.ajax({
+ url : LAMS_URL + 'monitoring/emailProgress/updateEmailProgressDate.do',
+ type : 'POST',
+ cache : false,
+ data : data,
+ success : function( dateObj ) {
+ dateCheckbox.parent().attr('dateid', dateObj.id);
+ dateCheckbox.parent().attr('datems', dateObj.ms);
+ dateCheckbox.parent().children().last().html(dateObj.date);
+ }
+ });
+}
+
+/**
+ * Fills the dates from the server for the email progress
+ */
+function fillEmailProgress() {
+ var dialog = $('#emailProgressDialog'),
+ table = $('#emailProgressDialogTable', dialog),
+ list = $('.dialogList', table).empty(),
+ dates = null;
+ ajaxProperties = dialog.data('ajaxProperties'),
+ dates = null;
+
+ if (!ajaxProperties) {
+ // initialise ajax config
+ ajaxProperties = {
+ dataType : 'json',
+ url : LAMS_URL + 'monitoring/emailProgress/getEmailProgressDates.do',
+ cache : false,
+ async : false,
+ data : {
+ 'lessonID' : lessonId
+ }};
+ dialog.data('ajaxProperties', ajaxProperties);
+ }
+
+ ajaxProperties.success = function(response) {
+ dates = response.dates;
+ }
+
+ $.ajax(ajaxProperties);
+
+ $.each(dates, function(dateIndex, date) {
+ addCheckbox(date, list, true);
+ });
+
+ colorDialogList(table);
+}
+
+function addCheckbox(dateObj, list, checked) {
+ // check for an existing matching date
+ var alreadyExists = false;
+ var existingDivs = $("div", list);
+ $.each(existingDivs, function(divIndex, div) {
+ if ( div.getAttribute('dateid') == dateObj.id ) {
+ alreadyExists = true;
+ return false;
+ }
+ });
+ if ( alreadyExists )
+ return;
+
+ // does not exist so add to list
+ var checkbox = $('').attr({
+ 'type' : 'checkbox'
+ }).change(function(){
+ editEmailProgressDate($(this));
+ }),
+
+ dateString = $('').html(dateObj.date),
+
+ dateDiv = $('
').attr({
+ 'dateid' : dateObj.id,
+ 'datems' : dateObj.ms
+ })
+ .addClass('dialogListItem')
+ .append(dateString)
+ .prepend(checkbox)
+ .appendTo(list);
+
+ checkbox.prop('checked', checked);
+ return checkbox;
+}
+
+function sendProgressEmail() {
+ if ( confirm(LABELS.PROGRESS_EMAIL_SEND_NOW_QUESTION) ) {
+ $.ajax({
+ dataType : 'json',
+ url : LAMS_URL + 'monitoring/emailProgress/sendLessonProgressEmail.do',
+ cache : false,
+ data : {
+ 'lessonID' : lessonId
+ },
+ success : function(response) {
+ if ( response.error || ! response.sent > 0 )
+ alert(LABELS.PROGRESS_EMAIL_SEND_FAILED+"\n"+(response.error ? response.error : ""));
+ else
+ alert(LABELS.PROGRESS_EMAIL_SUCCESS.replace('[0]',response.sent));
+ }
+ });
+ }
+}
+
+function addEmailProgressDate() {
+ var table = $('#emailProgressDialogTable', '#emailProgressDialog'),
+ list = $('.dialogList', table),
+ newDateMS = $('#emaildatePicker').datetimepicker('getDate');
+
+ if ( newDateMS != null ) {
+ if ( newDateMS.getTime() < Date.now() ) {
+ alert(LABELS.ERROR_DATE_IN_PAST);
+ } else {
+ var dateObj = { id: newDateMS.getTime(), date: getEmailDateString(newDateMS)},
+ checkbox = addCheckbox(dateObj, list, true);
+ editEmailProgressDate(checkbox); // update back end
+ addEmailProgressSeries(false, table);
+ }
+ } else {
+ alert(LABELS.PROGRESS_SELECT_DATE_FIRST);
+ }
+}
+
+
+
+function getEmailDateString(date) {
+ return date.toLocaleDateString('en', {year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', hour12: false });
+}
+
+function addEmailProgressSeries(forceQuestion, table) {
+ if ( ! table ) {
+ table = $('#emailProgressDialogTable', '#emailProgressDialog');
+ }
+ var list = $('.dialogList', table),
+ items = $('.dialogListItem', list);
+
+ if ( forceQuestion && items.length < 2 ) {
+ alert(LABELS.PROGRESS_ENTER_TWO_DATES_FIRST);
+ } else if ( items.length == 2 || forceQuestion ) {
+ var numDates = prompt(LABELS.PROGRESS_EMAIL_GENERATE_ONE+"\n\n"+LABELS.PROGRESS_EMAIL_GENERATE_TWO);
+ if ( numDates > 0 ) {
+ var dates=[];
+ var maxDate = 0;
+ items.each( function() {
+ var nextDate = $(this).attr('dateid');
+ dates.push($(this).attr('dateid'));
+ if ( maxDate < nextDate )
+ maxDate = nextDate;
+ });
+ if ( dates[1] < dates[0] ) {
+ var swap = dates[1];
+ dates[1] = dates[0];
+ dates[0] = swap;
+ }
+ var diff = dates[1] - dates[0];
+ if ( diff > 0 ) {
+ var genDateMS = maxDate;
+ for (var i = 0; i < numDates; i++) {
+ genDateMS = +genDateMS + +diff;
+ var genDateObj = { id: genDateMS, date: getEmailDateString(new Date(genDateMS))};
+ var checkbox = addCheckbox(genDateObj, list, false);
+ }
+ }
+ }
+ }
+ colorDialogList(table);
+}
+
function openGateNow(activityId) {
var data = {
'activityId' : activityId
@@ -169,7 +908,25 @@
});
}
+function closeGate(activityId) {
+ var data = {
+ 'activityId' : activityId
+ };
+ data[csrfTokenName] = csrfTokenValue;
+ $.ajax({
+ 'type' : 'post',
+ 'url' : LAMS_URL + 'monitoring/gate/closeGate.do',
+ 'data' : data,
+ 'success' : function(){
+ updateLessonTab();
+ }
+ });
+}
+//********** SEQUENCE TAB FUNCTIONS **********
+/**
+ * Sets up the sequence tab.
+ */
function initSequenceTab(){
var learnerGroupDialogContents = $('#learnerGroupDialogContents');
$('#learnerGroupDialogForceCompleteButton, #learnerGroupDialogForceCompleteAllButton', learnerGroupDialogContents).click(function() {
@@ -402,6 +1159,31 @@
canvasFitScreen(learningDesignSvgFitScreen, true);
}
+function showIntroductionDialog(lessonId) {
+
+ showDialog('introductionDialog', {
+ 'height' : 450,
+ 'width' : Math.max(380, Math.min(800, $(window).width() - 60)),
+ 'resizable' : false,
+ 'title' : LABELS.LESSON_INTRODUCTION,
+ 'open' : function(){
+ $('iframe', this).attr('src', LAMS_URL + 'editLessonIntro/edit.do?lessonID='+lessonId);
+ $('iframe', this).css('height', '360px');
+ autoRefreshBlocked = true;
+ },
+ 'close' : function(){
+ closeIntroductionDialog()
+ }
+ }, false);
+}
+
+function closeIntroductionDialog() {
+ autoRefreshBlocked = false;
+ $('#introductionDialog').remove();
+}
+/**
+ * Updates learner progress in sequence tab according to respose sent to refreshMonitor()
+ */
function updateSequenceTab() {
if (sequenceRefreshInProgress) {
return;
@@ -547,8 +1329,6 @@
});
}
-
-
function updateLiveEdit() {
if ( liveEditEnabled ) {
if ( lockedForEdit ) {
@@ -577,8 +1357,7 @@
$("#liveEditWarning").hide();
}
}
-
-
+
function loadLearningDesignSVG() {
var exit = false;
// fetch SVG just once, since it is immutable
@@ -1146,10 +1925,190 @@
'width' : +group.data('width'),
'height': +group.data('height'),
}
+
}
/**
+ * Shows where the searched learner is.
+ */
+function highlightSearchedLearner(icon) {
+ // show the "clear" button
+ $('#sequenceSearchPhraseClear').css('visibility', 'visible');
+
+ // border and z-index are manipulated via CSS
+ icon.addClass('learner-searched');
+
+ toggleInterval = setInterval(function(){
+ icon.toggle();
+ }, 500);
+
+ setTimeout(function(){
+ clearInterval(toggleInterval);
+ //if the search box was cleared during blinking, act accordingly
+ if (!sequenceSearchedLearner) {
+ icon.removeClass('learner-searched');
+ }
+ }, 3000);
+}
+
+
+/**
+ * Cancels the performed search.
+ */
+function sequenceClearSearchPhrase(refresh){
+ $('#sequenceSearchPhrase').val('');
+ $('#sequenceSearchPhraseClear').css('visibility', 'hidden');
+ $('#sequenceSearchedLearnerHighlighter').hide();
+ sequenceSearchedLearner = null;
+ if (refresh) {
+ updateSequenceTab();
+ }
+}
+
+
+/**
+ * Shows Edit Class dialog for class manipulation.
+ */
+function showClassDialog(role){
+ // fetch available and already participating learners and monitors
+ if (!role) {
+ // first time show, fill both lists
+ fillClassList('Learner', false);
+ fillClassList('Monitor', true);
+
+ $('#classDialog').modal('show');
+ } else {
+ // refresh after page shift or search
+ fillClassList(role, role.toLowerCase() == 'monitor');
+ }
+}
+
+
+/**
+ * Fills class member list with user information.
+ */
+function fillClassList(role, disableCreator) {
+ var dialog = $('#classDialog'),
+ table = $('#class' + role + 'Table', dialog),
+ list = $('.dialogList', table).empty(),
+ searchPhrase = role == 'Learner' ? $('.dialogSearchPhrase', table).val().trim() : null,
+ ajaxProperties = dialog.data(role + 'AjaxProperties'),
+ users = null,
+ userCount = null;
+
+ if (!ajaxProperties) {
+ // initialise ajax config
+ ajaxProperties = {
+ dataType : 'json',
+ url : LAMS_URL + 'monitoring/monitoring/getClassMembers.do',
+ cache : false,
+ async : false,
+ data : {
+ 'lessonID' : lessonId,
+ 'role' : role.toUpperCase(),
+ 'pageNumber' : 1,
+ 'orderAscending' : true
+ }
+ };
+
+ dialog.data(role + 'AjaxProperties', ajaxProperties);
+ }
+
+ // add properties for this call only
+ if (!searchPhrase){
+ searchPhrase = null;
+ }
+ ajaxProperties.data.searchPhrase = searchPhrase;
+ ajaxProperties.success = function(response) {
+ users = response.users;
+ userCount = response.userCount;
+}
+
+ $.ajax(ajaxProperties);
+
+ // hide unnecessary controls
+ togglePagingCells(table, ajaxProperties.data.pageNumber, Math.ceil(userCount / 10));
+
+ $.each(users, function(userIndex, user) {
+ var checkbox = $('').attr({
+ 'type' : 'checkbox'
+ }).change(function(){
+ editClassMember($(this));
+ }),
+
+ userDiv = $('').attr({
+ 'userId' : user.id
+ })
+ .addClass('dialogListItem')
+ .html(getLearnerDisplayName(user))
+ .prepend(checkbox)
+ .appendTo(list);
+
+ if (user.classMember) {
+ checkbox.prop('checked', 'checked');
+ if (user.readonly) {
+ // user creator must not be deselected
+ checkbox.attr('disabled', 'disabled');
+ }
+ }
+
+ if (disableCreator && user.lessonCreator) {
+ userDiv.addClass('dialogListItemDisabled');
+ } else {
+ userDiv.click(function(event){
+ if (event.target == this && !checkbox.is(':disabled')) {
+ checkbox.prop('checked', checkbox.is(':checked') ? null : 'checked');
+ checkbox.change();
+ }
+ })
+ }
+ });
+
+ colorDialogList(table);
+}
+
+/**
+ * Adds/removes a Learner/Monitor to/from the class.
+ */
+function editClassMember(userCheckbox){
+ var data={
+ 'lessonID' : lessonId,
+ 'userID' : userCheckbox.parent().attr('userId'),
+ 'role' : userCheckbox.closest('table').is('#classMonitorTable') ? 'MONITOR' : 'LEARNER',
+ 'add' : userCheckbox.is(':checked')
+ };
+ data[csrfTokenName] = csrfTokenValue;
+
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/updateLessonClass.do',
+ type : 'POST',
+ cache : false,
+ data : data
+ });
+}
+
+/**
+ * Adds all learners to the class.
+ */
+function addAllLearners(){
+ if (confirm(LABELS.CLASS_ADD_ALL_CONFIRM)) {
+ $.ajax({
+ url : LAMS_URL + 'monitoring/monitoring/addAllOrganisationLearnersToLesson.do',
+ type : 'POST',
+ cache : false,
+ data : {
+ 'lessonID' : lessonId
+ },
+ success : function(){
+ alert(LABELS.CLASS_ADD_ALL_SUCCESS);
+ $('#classDialog').modal('hide');
+ }
+ });
+ }
+}
+
+/**
* Opens Authoring for live edit.
*/
function openLiveEdit(){
@@ -1174,7 +2133,6 @@
}
}
-
/**
* Adjusts sequence canvas (SVG) based on space available in the dialog.
*/
@@ -1225,8 +2183,210 @@
}
}
+//********** COMMON FUNCTIONS **********
+function isAutoRefreshBlocked(){
+ return autoRefreshBlocked || $('#learnerGroupDialog').hasClass('in');
+}
+
/**
+ * Updates all changeable elements of monitoring screen.
+ */
+function refreshMonitor(tabName, isAuto){
+ if (autoRefreshIntervalObject && !isAuto) {
+ clearInterval(autoRefreshIntervalObject);
+ autoRefreshIntervalObject = null;
+ }
+
+ if (!autoRefreshIntervalObject) {
+ autoRefreshIntervalObject = setInterval(function(){
+ if (!isAutoRefreshBlocked()) {
+ refreshMonitor(null, true);
+ }
+ }, autoRefreshInterval);
+ }
+
+ if (!tabName) {
+ // update Lesson tab widgets (state, number of learners etc.)
+ updateLessonTab();
+ // update learner progress in Sequence tab
+ updateSequenceTab();
+ // update learner progress in Learners tab
+ // loadLearnerProgressPage();
+ } else if (tabName == 'lesson') {
+ updateLessonTab();
+ } else if (tabName == 'sequence'){
+ updateLessonTab();
+ updateSequenceTab();
+ } else if (tabName == 'learners'){
+ updateLessonTab();
+ // updateLearnersTab();
+ } else if (tabName == 'gradebook'){
+ // updateGradebookTab();
+ }
+}
+
+
+/**
+ * Tells parent document to close this Monitor dialog.
+ */
+function closeMonitorLessonDialog(refresh) {
+ //check method is available in order to avoid JS errors (as it's not available from integrations)
+ if (typeof window.parent.closeDialog === "function") {
+ window.parent.closeDialog('dialogMonitorLesson' + lessonId, refresh);
+ }
+}
+
+/**
+ * Show a dialog with user list and optional Force Complete and View Learner buttons.
+ */
+function showLearnerGroupDialog(ajaxProperties, dialogTitle, allowSearch, allowForceComplete, allowView, allowEmail) {
+ var learnerGroupDialog = $('#learnerGroupDialog'),
+ learnerGroupList = $('.dialogList', learnerGroupDialog).empty(),
+ // no parameters provided? just work on what we saved
+ isRefresh = ajaxProperties == null,
+ learners = null,
+ learnerCount = null;
+
+ if (isRefresh) {
+ // ajax and other properties were saved when the dialog was opened
+ ajaxProperties = learnerGroupDialog.data('ajaxProperties');
+ allowForceComplete = learnerGroupDialog.data('allowForceComplete');
+ allowView = learnerGroupDialog.data('allowView');
+ allowEmail = learnerGroupDialog.data('allowEmail');
+ allowSearch = $('#learnerGroupSearchRow', learnerGroupDialog).is(':visible');
+ } else {
+ // add few standard properties to ones provided by method calls
+ ajaxProperties = $.extend(true, ajaxProperties, {
+ dataType : 'json',
+ cache : false,
+ async : false,
+ data : {
+ 'pageNumber' : 1,
+ 'orderAscending' : true
+ }
+ });
+
+ $('#learnerGroupSearchRow', learnerGroupDialog).css('display', allowSearch ? 'table-row' : 'none');
+ }
+
+ var pageNumber = ajaxProperties.data.pageNumber;
+
+ // set values for current variable instances
+ ajaxProperties.success = function(response) {
+ learners = response.learners;
+ learnerCount = response.learnerCount;
+ };
+
+ var searchPhrase = allowSearch ? $('.dialogSearchPhrase', learnerGroupDialog).val().trim() : null;
+ ajaxProperties.data.searchPhrase = searchPhrase;
+
+ // make the call
+ $.ajax(ajaxProperties);
+
+ // did all users already drift away to an another activity or there was an error?
+ // close the dialog and refresh the main screen
+ if (!learnerCount && !searchPhrase) {
+ if (isRefresh) {
+ learnerGroupDialog.modal('hide');
+ }
+ updateSequenceTab();
+ return;
+ }
+
+ // did some users already drift away to an another activity?
+ // move back until you get a page with any users
+ var maxPageNumber = Math.ceil(learnerCount / 10);
+ if (maxPageNumber > 0 && pageNumber > maxPageNumber) {
+ shiftLearnerGroupList(-1);
+ return;
+ }
+
+ // hide unnecessary controls
+ togglePagingCells(learnerGroupDialog, pageNumber, maxPageNumber);
+
+ $.each(learners, function(learnerIndex, learner) {
+ var viewUrl = allowView ? LAMS_URL + 'monitoring/monitoring/getLearnerActivityURL.do?userID='
+ + learner.id + '&activityID=' + ajaxProperties.data.activityID + '&lessonID=' + lessonId
+ : null,
+ learnerDiv = $('').attr({
+ 'userId' : learner.id,
+ 'viewUrl' : viewUrl
+ })
+ .addClass('dialogListItem')
+ .appendTo(learnerGroupList),
+ portraitDiv = $('').attr({
+ 'id': 'user-'+learner.id,
+ })
+ .addClass('roffset5')
+ .appendTo(learnerDiv);
+ addPortrait( portraitDiv, learner.portraitId, learner.id, 'small', true, LAMS_URL );
+ $('').html(getLearnerDisplayName(learner))
+ .addClass('portrait-sm-lineheight')
+ .appendTo(learnerDiv);
+
+ if (allowForceComplete || allowView || allowEmail) {
+ learnerDiv.click(function(event){
+ // select the learner
+ var learnerDiv = $(this),
+ selectedSiblings = learnerDiv.siblings('div.dialogListItem.dialogListItemSelected');
+ // enable buttons
+ $('button.learnerGroupDialogSelectableButton', learnerGroupDialog).prop('disabled', false);
+
+ if (allowForceComplete && (event.metaKey || event.ctrlKey)) {
+ var isSelected = learnerDiv.hasClass('dialogListItemSelected');
+ if (isSelected) {
+ // do not un-select last learner
+ if (selectedSiblings.length > 0) {
+ learnerDiv.removeClass('dialogListItemSelected')
+ }
+ } else {
+ learnerDiv.addClass('dialogListItemSelected');
+ }
+ if (selectedSiblings.length + (isSelected ? 0 : 1) > 1) {
+ // disable view button - only one learner can be viewed and multiple are selected
+ $('button#learnerGroupDialogViewButton', learnerGroupDialog).prop('disabled', true);
+ }
+ } else {
+ learnerDiv.addClass('dialogListItemSelected');
+ // un-select other learners
+ selectedSiblings.removeClass('dialogListItemSelected');
+ }
+ });
+ if (allowView){
+ dblTap(learnerDiv, function(){
+ // same as clicking View Learner button
+ openPopUp(viewUrl, "LearnActivity", popupHeight, popupWidth, true);
+ });
+ }
+ }
+ });
+
+ colorDialogList(learnerGroupDialog);
+
+ if (!isRefresh) {
+ // show buttons and labels depending on parameters
+ $('span#learnerGroupMultiSelectLabel, button#learnerGroupDialogForceCompleteButton', learnerGroupDialog)
+ .css('display', allowForceComplete ? 'inline' : 'none');
+ $('button#learnerGroupDialogViewButton', learnerGroupDialog)
+ .css('display', allowView ? 'inline' : 'none');
+ $('button#learnerGroupDialogEmailButton', learnerGroupDialog)
+ .css('display', allowEmail ? 'inline' : 'none');
+
+ $('.modal-title', learnerGroupDialog).text(dialogTitle);
+ learnerGroupDialog.data({
+ // save properties for refresh
+ 'ajaxProperties' : ajaxProperties,
+ 'allowForceComplete' : allowForceComplete,
+ 'allowView' : allowView,
+ 'allowEmail' : allowEmail
+ })
+ .modal('show');
+ }
+}
+
+
+/**
* Formats learner name.
*/
function getLearnerDisplayName(learner, raw) {
@@ -1252,6 +2412,7 @@
.replace(/'/g, "'");
}
+
/**
* Change order of learner sorting in group dialog.
*/
@@ -1271,25 +2432,100 @@
ajaxProperties.data.orderAscending = orderAscending;
// refresh the list
showLearnerGroupDialog();
-}
+ }
+
+/**
+ * Change order of learner sorting in Edit Class dialog.
+ */
+function sortClassList(role) {
+ var classDialog = $('#classDialog'),
+ table = $('#class' + role + 'Table', classDialog),
+ sortIcon = $('td.sortCell span', table),
+ ajaxProperties = classDialog.data(role + 'AjaxProperties'),
+ // reverse current order after click
+ orderAscending = !ajaxProperties.data.orderAscending;
+
+ if (orderAscending) {
+ sortIcon.removeClass('ui-icon-triangle-1-s').addClass('ui-icon-triangle-1-n');
+ } else {
+ sortIcon.removeClass('ui-icon-triangle-1-n').addClass('ui-icon-triangle-1-s');
+ }
-function openPopUp(url, title, h, w, status, forceNewWindow) {
+ ajaxProperties.data.orderAscending = orderAscending;
+ // refresh the list
+ showClassDialog(role);
+}
- var width = screen.width;
- var height = screen.height;
+/**
+ * Colours a list of users
+ */
+function colorDialogList(parent) {
+ $('.dialogList div.dialogListItem', parent).each(function(userIndex, userDiv){
+ // every odd learner has different background
+ $(userDiv).css('background-color', userIndex % 2 ? '#f5f5f5' : 'inherit');
+ });
+}
- var left = ((width / 2) - (w / 2));
- var top = ((height / 2) - (h / 2));
+/**
+* Change page in the group dialog.
+*/
+function shiftLearnerGroupList(shift) {
+ var learnerGroupDialog = $('#learnerGroupDialog'),
+ ajaxProperties = learnerGroupDialog.data('ajaxProperties'),
+ pageNumber = ajaxProperties.data.pageNumber + shift;
+ if (pageNumber < 0) {
+ pageNumber = 1;
+ }
+ ajaxProperties.data.pageNumber = pageNumber;
+ // refresh the dialog with new parameters
+ showLearnerGroupDialog();
+}
- if (forceNewWindow) {
- // opens a new window rather than loading content to existing one
- title += new Date().getTime();
+/**
+* Change page in the Edit Class dialog.
+*/
+function shiftClassList(role, shift) {
+ var classDialog = $('#classDialog'),
+ ajaxProperties = classDialog.data(role + 'AjaxProperties'),
+ pageNumber = ajaxProperties.data.pageNumber + shift;
+ if (pageNumber < 0) {
+ pageNumber = 1;
}
+ ajaxProperties.data.pageNumber = pageNumber;
+ // refresh the dialog with new parameters
+ showClassDialog(role);
+}
- window.open(url, title, "HEIGHT=" + h + ",WIDTH=" + w
- + ",resizable=yes,scrollbars=yes,status=" + status
- + ",menubar=no, toolbar=no"
- + ",top=" + top + ",left=" + left);
+
+/**
+ * Hides/shows paging controls
+ */
+function togglePagingCells(parent, pageNumber, maxPageNumber) {
+ if (pageNumber + 10 <= maxPageNumber) {
+ $('td.pagePlus10Cell', parent).css('visibility', 'visible');
+ } else {
+ $('td.pagePlus10Cell', parent).css('visibility', 'hidden');
+ }
+ if (pageNumber - 10 < 1) {
+ $('td.pageMinus10Cell', parent).css('visibility', 'hidden');
+ } else {
+ $('td.pageMinus10Cell', parent).css('visibility', 'visible');
+ }
+ if (pageNumber + 1 <= maxPageNumber) {
+ $('td.pagePlus1Cell', parent).css('visibility', 'visible');
+ } else {
+ $('td.pagePlus1Cell', parent).css('visibility', 'hidden');
+ }
+ if (pageNumber - 1 < 1) {
+ $('td.pageMinus1Cell', parent).css('visibility', 'hidden');
+ } else {
+ $('td.pageMinus1Cell', parent).css('visibility', 'visible');
+ }
+ if (maxPageNumber < 2) {
+ $('td.pageCell', parent).css('visibility', 'hidden');
+ } else {
+ $('td.pageCell', parent).css('visibility', 'visible').text(pageNumber + ' / ' + maxPageNumber);
+ }
}
/**
@@ -1320,4 +2556,4 @@
lastTapTarget = event.currentTarget;
});
-}
\ No newline at end of file
+}
Index: lams_monitoring/web/monitor5.jsp
===================================================================
diff -u -r84204c571e0ab10c9006730dc413cebec8a66167 -rab9c4c312eb687a2b58efc563dc1b824087548e3
--- lams_monitoring/web/monitor5.jsp (.../monitor5.jsp) (revision 84204c571e0ab10c9006730dc413cebec8a66167)
+++ lams_monitoring/web/monitor5.jsp (.../monitor5.jsp) (revision ab9c4c312eb687a2b58efc563dc1b824087548e3)
@@ -12,10 +12,15 @@
+
+<%-- --%>
+<%-- --%>
+
+<%-- --%>
@@ -28,6 +33,10 @@
var lessonId = ${lesson.lessonID},
userId = '',
ldId = ${lesson.learningDesignID},
+ lessonStateId = ${lesson.lessonStateID},
+ createDateTimeStr = '${lesson.createDateTimeStr}',
+ lessonStartDate = '${lesson.scheduleStartDate}',
+ lessonEndDate = '${lesson.scheduleEndDate}',
liveEditEnabled = ${enableLiveEdit && lesson.liveEditEnabled},
LAMS_URL = '',
csrfToken = ' : ',
@@ -207,25 +216,207 @@
$(this).toggleClass('active');
$('.component-sidebar, .monitoring-page-content').toggleClass('active');
});
+
+ $('#edit-lesson-btn').click(function(){
+ $('.lesson-properties').toggleClass('active');
+ $('.component-sidebar').toggleClass('expanded');
+ });
+ initLessonTab();
initSequenceTab();
refreshMonitor();
});
-