Index: lams_tool_scratchie/web/pages/learning/learning.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_tool_scratchie/web/pages/learning/learning.jsp,v diff -u -r1.18.2.9 -r1.18.2.10 --- lams_tool_scratchie/web/pages/learning/learning.jsp 7 Nov 2016 16:52:32 -0000 1.18.2.9 +++ lams_tool_scratchie/web/pages/learning/learning.jsp 6 Dec 2016 09:02:25 -0000 1.18.2.10 @@ -69,20 +69,38 @@ } //time limit feature - + $(document).ready(function(){ - //show confirmation dialog - $.blockUI({ - message: $('#timelimit-start-dialog'), - css: { width: '325px', height: '120px'}, - overlayCSS: { opacity: '.98'} - }); + + //show timelimit-start-dialog in order to start countdown + if (${isTimeLimitNotLaunched}) { - //once OK button pressed start countdown - $('#timelimit-start-ok').click(function() { - $.unblockUI(); - displayCountdown(); - }); + //show confirmation dialog + $.blockUI({ + message: $('#timelimit-start-dialog'), + css: { width: '325px', height: '120px'}, + overlayCSS: { opacity: '.98'} + }); + + //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(); + }); + + } else { + displayCountdown(); + } + }); function displayCountdown(){ @@ -103,14 +121,14 @@ }); $('#countdown').countdown({ - until: '+${scratchie.timeLimit * 60}S', + until: '+${secondsLeft}S', format: 'hMS', compact: true, onTick: function(periods) { //check for 30 seconds if ((periods[4] == 0) && (periods[5] == 0) && (periods[6] <= 30)) { $('#countdown').css('color', '#FF3333'); - } + } }, onExpiry: function(periods) { $.blockUI({ message: '

' });