Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -rf5ecfff973a3f012627ce14d2e1d21d5e5e4366f -re10da332d88104fe61b1f646b8bcac22bbfd15f0 --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision f5ecfff973a3f012627ce14d2e1d21d5e5e4366f) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision e10da332d88104fe61b1f646b8bcac22bbfd15f0) @@ -1,10 +1,7 @@ <%@ include file="/common/taglibs.jsp"%> + - - - - <fmt:message key="label.learning.title" /> @@ -22,18 +19,11 @@ + + - - - - - - - - - @@ -126,12 +116,14 @@ } //boolean to indicate whether ok dialog is still ON so that autosave can't be run - var isWaitingForConfirmation = ${not finishedLock && assessment.timeLimit > 0 && empty param.secondsLeft}; + var isWaitingForConfirmation = ${isTimeLimitEnabled && sessionMap.isTimeLimitNotLaunched}; - + //timelimit feature + $(document).ready(function(){ - if (${empty param.secondsLeft}) { - //show confirmation dialog + //show timelimit-start-dialog in order to start countdown + if (${sessionMap.isTimeLimitNotLaunched}) { + $.blockUI({ message: $('#timelimit-start-dialog'), css: { width: '325px', height: '120px'}, @@ -140,6 +132,15 @@ //once OK button pressed start countdown $('#timelimit-start-ok').click(function() { + + //store date when user has started activity with time limit + $.ajax({ + async: true, + url: '', + data: 'sessionMapID=${sessionMapID}', + type: 'post' + }); + $.unblockUI(); displayCountdown(); isWaitingForConfirmation = false; @@ -168,7 +169,7 @@ }); $('#countdown').countdown({ - until: '+${secondsLeft}S', + until: '+${secondsLeft}S', format: 'hMS', compact: true, onTick: function(periods) { @@ -254,36 +255,23 @@ if (!validateAnswers()) { return; } - - var secondsLeft = 0; - if (${not finishedLock && assessment.timeLimit > 0}) { - var times = $("#countdown").countdown('getTimes'); - secondsLeft = times[4]*3600 + times[5]*60 + times[6]; - } + var myForm = $("#answers"); - myForm.attr("action", "" + pageNumber + "&secondsLeft=" + secondsLeft); + myForm.attr("action", "" + pageNumber); myForm.submit(); } function submitAll(isTimelimitExpired){ - var secondsLeft = 0; - //only if time limit is not expired if (!isTimelimitExpired) { - if (!validateAnswers()) { return; } - - if (${not finishedLock && assessment.timeLimit > 0}) { - var times = $("#countdown").countdown('getTimes'); - secondsLeft = times[4]*3600 + times[5]*60 + times[6]; - } } var myForm = $("#answers"); - myForm.attr("action", "&secondsLeft=" + secondsLeft + "&isTimelimitExpired=" + isTimelimitExpired); + myForm.attr("action", "&isTimelimitExpired=" + isTimelimitExpired); myForm.submit(); } @@ -325,12 +313,12 @@ var orderingArea = "#orderingArea" + questionUid; var url = ""; $(orderingArea).load( - url, - { - questionUid: questionUid, - optionIndex: idx, - sessionMapID: "${sessionMapID}" - } + url, + { + questionUid: questionUid, + optionIndex: idx, + sessionMapID: "${sessionMapID}" + } ); } @@ -339,15 +327,14 @@ } function checkLeaderProgress() { - $.ajax({ async: false, url: '', data: 'toolSessionID=${toolSessionID}', dataType: 'json', type: 'post', success: function (json) { - if (json.isLeaderResponseFinalized) { + if (json.isPageRefreshRequested) { location.reload(); } } @@ -654,10 +641,9 @@ - + - +