Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -rd0f4c3bdd871e236755472c8443c337b2b96e48c -r330b0d5f8fa4a8deb6d7454f92bdbd289e89cb82 --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision d0f4c3bdd871e236755472c8443c337b2b96e48c) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 330b0d5f8fa4a8deb6d7454f92bdbd289e89cb82) @@ -112,34 +112,36 @@ }); } - initWebsocket('assessmentTimeLimit${sessionMap.assessment.contentId}', - ''.replace('http', 'ws') - + 'learningWebsocket?toolContentID=${sessionMap.assessment.contentId}', - function (e) { - // read JSON object - var input = JSON.parse(e.data); + + initWebsocket('assessmentTimeLimit${sessionMap.assessment.contentId}', + ''.replace('http', 'ws') + 'learningWebsocket?toolContentID=${sessionMap.assessment.contentId}', + function (e) { + // read JSON object + var input = JSON.parse(e.data); + + if (input.clearTimer == true) { + // teacher stopped the timer, destroy it + $('#countdown').countdown('destroy').remove(); + } else { + // teacher updated the timer + var secondsLeft = +input.secondsLeft, + counterInitialised = $('#countdown').length > 0; + + if (counterInitialised) { + // just set the new time + $('#countdown').countdown('option', 'until', secondsLeft + 'S'); + } else { + // initialise the timer + displayCountdown(secondsLeft); + } + } + + // reset ping timer + websocketPing('assessmentTimeLimit${sessionMap.assessment.contentId}', true); + } + ); + - if (input.clearTimer == true) { - // teacher stopped the timer, destroy it - $('#countdown').countdown('destroy').remove(); - } else { - // teacher updated the timer - var secondsLeft = +input.secondsLeft, - counterInitialised = $('#countdown').length > 0; - - if (counterInitialised) { - // just set the new time - $('#countdown').countdown('option', 'until', secondsLeft + 'S'); - } else { - // initialise the timer - displayCountdown(secondsLeft); - } - } - - // reset ping timer - websocketPing('assessmentTimeLimit${sessionMap.assessment.contentId}', true); - }); - //autocomplete for VSA $('.ui-autocomplete-input').each(function(){ $(this).autocomplete({ @@ -207,7 +209,6 @@ left: '', right: '0%', opacity: '.8', - width: '230px', cursor: 'default', border: 'none' } @@ -232,11 +233,11 @@ var hours = $("#countdown").countdown('getTimes')[4]; var minutes = $("#countdown").countdown('getTimes')[5]; if (screenCountdown.data("hours") != hours || screenCountdown.data("minutes") != minutes) { - var timeLeftText = " "; + var timeLeftText = " "; if (hours > 0) { - timeLeftText += hours + " "; + timeLeftText += hours + " "; } - timeLeftText += minutes + " "; + timeLeftText += minutes + " "; screenCountdown.html(timeLeftText); screenCountdown.data("hours", hours); @@ -269,13 +270,14 @@ //autosave feature - var autosaveInterval = ${isLeadershipEnabled and isUserLeader ? 10000 : 30000}; // 30 or 10 seconds interval + var autosaveInterval = ${isLeadershipEnabled and isUserLeader ? 10000 : 30000}, // 30 or 10 seconds interval + autosaveWindowId = new Date().getTime(); // all we need for this ID is to be unique function learnerAutosave(isCommand){ // isCommand means that the autosave was triggered by force complete or another command websocket message // in this case do not check multiple tabs open, just autosave if (!isCommand) { - let shouldAutosave = preventLearnerAutosaveFromMultipleTabs(autosaveInterval); + let shouldAutosave = preventLearnerAutosaveFromMultipleTabs(autosaveWindowId, autosaveInterval); if (!shouldAutosave) { return; } @@ -349,9 +351,9 @@ // validate only if time limit is not expired // otherwise confirm with learner that he wants to submit if (!isTimelimitExpired && (!validateAnswers() - || (!isResubmitAllowed && - !confirm("")))) { - return; + || (!isResubmitAllowed && + !confirm("")))) { + return; } disableButtons(); @@ -616,10 +618,13 @@ -
- -
+ +
+ +
+
+ <%@ include file="parts/paging.jsp"%>