Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_assessment/web/pages/learning/learning.jsp,v diff -u -r1.44 -r1.45 --- lams_tool_assessment/web/pages/learning/learning.jsp 30 Sep 2016 11:53:41 -0000 1.44 +++ lams_tool_assessment/web/pages/learning/learning.jsp 2 Dec 2016 16:13:52 -0000 1.45 @@ -1,10 +1,7 @@ <%@ include file="/common/taglibs.jsp"%> + - - - - <fmt:message key="label.learning.title" /> @@ -22,18 +19,11 @@ + + - - - - - - - - - @@ -127,12 +117,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: { @@ -147,6 +139,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; @@ -261,36 +262,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(); } @@ -332,12 +320,12 @@ var orderingArea = "#orderingArea" + questionUid; var url = ""; $(orderingArea).load( - url, - { - questionUid: questionUid, - optionIndex: idx, - sessionMapID: "${sessionMapID}" - } + url, + { + questionUid: questionUid, + optionIndex: idx, + sessionMapID: "${sessionMapID}" + } ); } @@ -346,15 +334,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(); } }