Index: lams_monitoring/web/tblmonitor/tblmonitor.jsp =================================================================== diff -u -r8fec6246571ad1c7a6f6aae450f07b1f52bd19c4 -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_monitoring/web/tblmonitor/tblmonitor.jsp (.../tblmonitor.jsp) (revision 8fec6246571ad1c7a6f6aae450f07b1f52bd19c4) +++ lams_monitoring/web/tblmonitor/tblmonitor.jsp (.../tblmonitor.jsp) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -93,6 +93,11 @@ return; } + // if there is a timer running, destroy it before loading a new page + var counter = $('#absolute-time-limit-counter'); + if (counter.length > 0) { + counter.countdown('destroy'); + } // no need to refresh soon if we are loading new tab anyway restartRefreshInterval(); Index: lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/TblMonitoringController.java =================================================================== diff -u -re2571e1eb04af477c8bcee954fd9203887041c6b -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/TblMonitoringController.java (.../TblMonitoringController.java) (revision e2571e1eb04af477c8bcee954fd9203887041c6b) +++ lams_tool_assessment/src/java/org/lamsfoundation/lams/tool/assessment/web/controller/TblMonitoringController.java (.../TblMonitoringController.java) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -109,6 +109,9 @@ request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentId); request.setAttribute("groupsInAnsweredQuestionsChart", assessment.isUseSelectLeaderToolOuput()); + request.setAttribute("assessment", assessment); + request.setAttribute("isTbl", true); + return "pages/tblmonitoring/iraAssessmentStudentChoices"; } @@ -249,6 +252,9 @@ request.setAttribute("questionDtos", tblQuestionDtos); request.setAttribute(AttributeNames.PARAM_TOOL_CONTENT_ID, toolContentId); request.setAttribute("groupsInAnsweredQuestionsChart", assessment.isUseSelectLeaderToolOuput()); + request.setAttribute("assessment", assessment); + request.setAttribute("isTbl", true); + return "pages/tblmonitoring/assessmentStudentChoices"; } Index: lams_tool_assessment/web/pages/monitoring/monitoring.jsp =================================================================== diff -u -rf5bcf9323324eb4d5add901d9e7a23c33050533a -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_tool_assessment/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision f5bcf9323324eb4d5add901d9e7a23c33050533a) +++ lams_tool_assessment/web/pages/monitoring/monitoring.jsp (.../monitoring.jsp) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -22,19 +22,7 @@ .ui-jqdialog.ui-jqgrid-bootstrap .ui-jqdialog-titlebar, .ui-jqgrid.ui-jqgrid-bootstrap .ui-jqgrid-caption { background-color: #f5f5f5; } - - .countdown-timeout { - color: #FF3333 !important; - } - #time-limit-table th { - vertical-align: middle; - } - - #time-limit-table td.centered { - text-align: center; - } - #completion-charts-container > div { padding: 5rem 2rem; } Index: lams_tool_assessment/web/pages/monitoring/parts/timeLimit.jsp =================================================================== diff -u -ra96bbfd64a27a16ef8c7064ca3569835bb6bc1b6 -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_tool_assessment/web/pages/monitoring/parts/timeLimit.jsp (.../timeLimit.jsp) (revision a96bbfd64a27a16ef8c7064ca3569835bb6bc1b6) +++ lams_tool_assessment/web/pages/monitoring/parts/timeLimit.jsp (.../timeLimit.jsp) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -1,192 +1,555 @@ <%@ include file="/common/taglibs.jsp"%> -
-
-
- - - -
+ - - -
+ + + + + +
+ + +
+ + + +
+
+ + +
+ + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

+

+
+ ${assessment.relativeTimeLimit}  + + +
+ +
+
+ +
+
+ + + + + + + + + + +
+
+
+

+

+
+
+ +
+
+ +
+
+ + + + + + + + + + +
+
+
+
+

+

+
+
+ + +
+
Index: lams_tool_assessment/web/pages/monitoring/summary.jsp =================================================================== diff -u -r804dca72fa2ac638a9d3e2e66054d82688951c31 -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_tool_assessment/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision 804dca72fa2ac638a9d3e2e66054d82688951c31) +++ lams_tool_assessment/web/pages/monitoring/summary.jsp (.../summary.jsp) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -305,17 +305,6 @@ // trigger the resize when the window first opens so that the grid uses all the space available. setTimeout(function(){ window.dispatchEvent(new Event('resize')); }, 300); - // create counter if absolute time limit is set - if (absoluteTimeLimit) { - updateAbsoluteTimeLimitCounter(); - - // expand time limit panel if absolute time limit is set and not expired - if (absoluteTimeLimit > new Date().getTime() / 1000) { - $('#time-limit-collapse').collapse('show'); - } - } - initInidividualTimeLimitAutocomplete(); - drawCompletionCharts(${assessment.contentId}, ${assessment.useSelectLeaderToolOuput}, true); }); @@ -336,335 +325,6 @@ return downloadFile(url, 'messageArea_Busy', '', 'messageArea', 'btn-disable-on-submit'); }; - - // TIME LIMIT - - // in minutes since learner entered the activity - var relativeTimeLimit = ${assessment.relativeTimeLimit}, - // in seconds since epoch started - absoluteTimeLimit = ${empty assessment.absoluteTimeLimit ? 'null' : assessment.absoluteTimeLimitSeconds}; - - function updateTimeLimit(type, toggle, adjust) { - // relavite time limit set - if (type == 'relative') { - // what is set at the moment on screen, not at server - var displayedRelativeTimeLimit = +$('#relative-time-limit-value').text(); - - // start/stop - if (toggle !== null) { - - if (toggle === false) { - // stop, i.e. set time limit to 0 - relativeTimeLimit = 0; - updateTimeLimitOnServer(); - return; - } - - // start, i.e. set backend time limit to whatever is set on screen - if (toggle === true && displayedRelativeTimeLimit > 0) { - relativeTimeLimit = displayedRelativeTimeLimit; - // when teacher enables relative time limit, absolute one gets disabled - absoluteTimeLimit = null; - updateTimeLimitOnServer(); - } - return; - } - - // no negative time limit is allowed - if (displayedRelativeTimeLimit == 0 && adjust < 0) { - return; - } - - var adjustedRelativeTimeLimit = displayedRelativeTimeLimit + adjust; - // at least one minute is required - // if teacher wants to set less, he should disable the limit or click "finish now" - if (adjustedRelativeTimeLimit < 1) { - adjustedRelativeTimeLimit = 1; - } - - // is time limit already enforced? if so, update the server - if (relativeTimeLimit > 0) { - relativeTimeLimit = adjustedRelativeTimeLimit; - updateTimeLimitOnServer(); - return; - } - - // if time limit is not enforced yet, just update the screen - displayedRelativeTimeLimit = adjustedRelativeTimeLimit; - $('#relative-time-limit-value').text(displayedRelativeTimeLimit); - $('#relative-time-limit-start').prop('disabled', false); - return; - } - - if (type == 'absolute') { - // get existing value on counter, if it is set already - var counter = $('#absolute-time-limit-counter'), - secondsLeft = null; - if (counter.length === 1) { - var periods = counter.countdown('getTimes'); - secondsLeft = $.countdown.periodsToSeconds(periods); - } - - if (toggle !== null) { - - // start/stop - if (toggle === false) { - absoluteTimeLimit = null; - updateAbsoluteTimeLimitCounter(); - return; - } - - // turn on the time limit, if there is any value on counter set already - if (toggle === true && secondsLeft) { - updateAbsoluteTimeLimitCounter(secondsLeft, true); - return; - } - - if (toggle === 'stop') { - absoluteTimeLimit = Math.round(new Date().getTime() / 1000); - updateAbsoluteTimeLimitCounter(); - } - return; - } - - // counter is not set yet and user clicked negative value - if (!secondsLeft && adjust < 0) { - return; - } - - // adjust time - secondsLeft += adjust * 60; - if (secondsLeft < 60) { - secondsLeft = 60; - } - - // is time limit already enforced, update the server - // if time limit is not enforced yet, just update the screen - updateAbsoluteTimeLimitCounter(secondsLeft); - $('#absolute-time-limit-start').prop('disabled', false); - return; - } - - if (type == 'individual') { - // this method is called with updateTimeLimit.call() so we can change meaning of "this" - // and identify row and userUid - var button = $(this), - row = button.closest('.individual-time-limit-row'), - userId = row.data('userId'); - - // disable individual time adjustment - if (toggle === false) { - updateIndividualTimeLimitOnServer('user-' + userId); - return; - } - var existingAdjustment = +$('.individual-time-limit-value', row).text(), - newAdjustment = existingAdjustment + adjust; - - updateIndividualTimeLimitOnServer('user-' + userId, newAdjustment); - return; - } - } - - function updateTimeLimitOnServer() { - - // absolute time limit has higher priority - if (absoluteTimeLimit != null) { - relativeTimeLimit = 0; - } - - $.ajax({ - 'url' : '', - 'type': 'post', - 'cache' : 'false', - 'data': { - 'toolContentID' : '${assessment.contentId}', - 'relativeTimeLimit' : relativeTimeLimit, - 'absoluteTimeLimit' : absoluteTimeLimit, - '' : '' - }, - success : function(){ - // update widgets - $('#relative-time-limit-value').text(relativeTimeLimit); - - if (relativeTimeLimit > 0) { - $('#relative-time-limit-disabled').addClass('hidden'); - $('#relative-time-limit-cancel').removeClass('hidden'); - $('#relative-time-limit-enabled').removeClass('hidden'); - $('#relative-time-limit-start').addClass('hidden'); - } else { - $('#relative-time-limit-disabled').removeClass('hidden'); - $('#relative-time-limit-cancel').addClass('hidden'); - $('#relative-time-limit-enabled').addClass('hidden'); - $('#relative-time-limit-start').removeClass('hidden').prop('disabled', true); - } - - if (absoluteTimeLimit === null) { - // no absolute time limit? destroy the counter - $('#absolute-time-limit-counter').countdown('destroy'); - $('#absolute-time-limit-value').empty(); - - $('#absolute-time-limit-disabled').removeClass('hidden'); - $('#absolute-time-limit-cancel').addClass('hidden'); - $('#absolute-time-limit-enabled').addClass('hidden'); - $('#absolute-time-limit-start').removeClass('hidden').prop('disabled', true); - $('#absolute-time-limit-finish-now').prop('disabled', false); - } else { - $('#absolute-time-limit-disabled').addClass('hidden'); - $('#absolute-time-limit-cancel').removeClass('hidden'); - $('#absolute-time-limit-enabled').removeClass('hidden'); - $('#absolute-time-limit-start').addClass('hidden'); - $('#absolute-time-limit-finish-now').prop('disabled', absoluteTimeLimit <= Math.round(new Date().getTime() / 1000)); - } - } - }); - } - - function updateAbsoluteTimeLimitCounter(secondsLeft, start) { - var now = Math.round(new Date().getTime() / 1000), - // preset means that counter is set just on screen and the time limit is not enforced for learners - preset = start !== true && absoluteTimeLimit == null; - - if (secondsLeft) { - if (!preset) { - // time limit is already enforced on server, so update it there now - absoluteTimeLimit = now + secondsLeft; - updateTimeLimitOnServer(); - } - } else { - if (absoluteTimeLimit == null) { - // disable the counter - updateTimeLimitOnServer(); - return; - } - // counter initialisation on page load or "finish now" - secondsLeft = absoluteTimeLimit - now; - if (secondsLeft <= 0) { - // finish now - updateTimeLimitOnServer(); - } - } - - var counter = $('#absolute-time-limit-counter'); - - if (counter.length == 0) { - counter = $('
').attr('id', 'absolute-time-limit-counter').appendTo('#absolute-time-limit-value') - .countdown({ - until: '+' + secondsLeft +'S', - format: 'hMS', - compact: true, - alwaysExpire : true, - onTick: function(periods) { - // check for 30 seconds or less and display timer in red - var secondsLeft = $.countdown.periodsToSeconds(periods); - if (secondsLeft <= 30) { - counter.addClass('countdown-timeout'); - } else { - counter.removeClass('countdown-timeout'); - } - }, - expiryText : '' - }); - } else { - // if counter is paused, we can not adjust time, so resume it for a moment - counter.countdown('resume'); - counter.countdown('option', 'until', secondsLeft + 'S'); - } - - if (preset) { - counter.countdown('pause'); - $('#absolute-time-limit-start').removeClass('disabled'); - } else { - counter.countdown('resume'); - } - } - - function timeLimitFinishNow(){ - if (confirm('')) { - updateTimeLimit('absolute', 'stop'); - } - } - - - function initInidividualTimeLimitAutocomplete(){ - $('#individual-time-limit-autocomplete').autocomplete({ - 'source' : '?toolContentID=${assessment.contentId}', - 'delay' : 700, - 'minLength' : 3, - 'select' : function(event, ui){ - // user ID or group ID, and default 0 adjustment - updateIndividualTimeLimitOnServer(ui.item.value, 0); - - // clear search field - $(this).val(''); - return false; - }, - 'focus': function() { - // Stop the autocomplete of resetting the value to the selected one - // It puts LAMS user ID instead of user name - event.preventDefault(); - } - }); - - refreshInidividualTimeLimitUsers(); - } - - - function updateIndividualTimeLimitOnServer(itemId, adjustment) { - $.ajax({ - 'url' : '', - 'type': 'post', - 'cache' : 'false', - 'data': { - 'toolContentID' : '${assessment.contentId}', - // itemId can user- or group- - 'itemId' : itemId, - 'adjustment' : adjustment, - '' : '' - }, - success : function(){ - refreshInidividualTimeLimitUsers(); - } - }); - } - - - function refreshInidividualTimeLimitUsers() { - var table = $('#time-limit-table'); - - $.ajax({ - 'url' : '', - 'dataType' : 'json', - 'cache' : 'false', - 'data': { - 'toolContentID' : '${assessment.contentId}' - }, - success : function(users) { - // remove existing users - $('.individual-time-limit-row', table).remove(); - - if (!users) { - return; - } - - var template = $('#individual-time-limit-template-row'), - now = new Date().getTime(); - $.each(users, function(){ - var row = template.clone() - .attr('id', 'individual-time-limit-row-' + this.userId) - .data('userId', this.userId) - .addClass('individual-time-limit-row') - .appendTo(table); - $('.individual-time-limit-user-name', row).text(this.name); - $('.individual-time-limit-value', row).text(this.adjustment); - - row.removeClass('hidden'); - }); - } - }); - } - - // END OF TIME LIMIT - function showChangeLeaderModal(toolSessionId) { $('#change-leader-modals').empty() .load('',{ Index: lams_tool_assessment/web/pages/tblmonitoring/assessmentStudentChoices.jsp =================================================================== diff -u -r8fec6246571ad1c7a6f6aae450f07b1f52bd19c4 -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_tool_assessment/web/pages/tblmonitoring/assessmentStudentChoices.jsp (.../assessmentStudentChoices.jsp) (revision 8fec6246571ad1c7a6f6aae450f07b1f52bd19c4) +++ lams_tool_assessment/web/pages/tblmonitoring/assessmentStudentChoices.jsp (.../assessmentStudentChoices.jsp) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -11,6 +11,9 @@ } + + + @@ -152,3 +155,4 @@
+<%@ include file="/pages/monitoring/parts/timeLimit.jsp"%> Index: lams_tool_assessment/web/pages/tblmonitoring/iraAssessmentStudentChoices.jsp =================================================================== diff -u -re2571e1eb04af477c8bcee954fd9203887041c6b -rdcb841b4b4a04f726fe9f4581e2864c243e18724 --- lams_tool_assessment/web/pages/tblmonitoring/iraAssessmentStudentChoices.jsp (.../iraAssessmentStudentChoices.jsp) (revision e2571e1eb04af477c8bcee954fd9203887041c6b) +++ lams_tool_assessment/web/pages/tblmonitoring/iraAssessmentStudentChoices.jsp (.../iraAssessmentStudentChoices.jsp) (revision dcb841b4b4a04f726fe9f4581e2864c243e18724) @@ -7,9 +7,12 @@ } + + + - +