Index: lams_admin/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_admin/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_admin/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_central/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_central/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_central/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_gradebook/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_gradebook/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_gradebook/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_learning/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_learning/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_learning/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_monitoring/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_monitoring/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_monitoring/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_assessment/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r7a3aa5518ce9e15deaf5f29aecfbf4573a900b34 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_assessment/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 7a3aa5518ce9e15deaf5f29aecfbf4573a900b34) +++ lams_tool_assessment/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -448,3 +448,4 @@ label.learning.matching.pairs.possible = Possible answers: label.learning.matching.pairs.chosen = Chosen: label.learning.disclose.tip = When you finish the activity the teacher may disclose your answers to other students. +label.prevent.learner.autosave.mutliple.tabs = You seem to have two LAMS learner tabs open. Please close one of them. Otherwise your work may not be autosaved correctly. \ No newline at end of file Index: lams_tool_assessment/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_assessment/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_assessment/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -rb98f30903ddbc02662891534c9e5e1dee75c64ce -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision b98f30903ddbc02662891534c9e5e1dee75c64ce) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -183,12 +183,7 @@ }); return totalSelected; } - - //boolean to indicate whether ok dialog is still ON so that autosave can't be run - // var isWaitingForConfirmation = ${isTimeLimitEnabled && sessionMap.isTimeLimitNotLaunched}; - - // TIME LIMIT // websocket needs pinging and reconnection feature in case it fails @@ -312,8 +307,18 @@ //autosave feature - - function learnerAutosave(){ + var autosaveInterval = ${isLeadershipEnabled and isUserLeader ? 10000 : 30000}; // 30 or 10 seconds interval + + 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); + if (!shouldAutosave) { + return; + } + } + if (typeof CodeMirror != 'undefined') { $('.CodeMirror').each(function(){ this.CodeMirror.save(); @@ -349,7 +354,6 @@ error : onLearnerAutosaveError }); } - var autosaveInterval = ${isLeadershipEnabled and isUserLeader ? 10000 : 30000}; // 30 or 10 seconds interval window.setInterval(learnerAutosave, autosaveInterval); function onLearnerAutosaveError() { Index: lams_tool_chat/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_chat/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_chat/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_daco/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_daco/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_daco/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_doku/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_doku/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_doku/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_forum/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_forum/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_forum/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_gmap/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_gmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_gmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_images/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_images/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_images/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_imscc/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_imscc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_imscc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_lamc/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r0b845931db55d90f0dcabc0b33cce5c7df688153 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 0b845931db55d90f0dcabc0b33cce5c7df688153) +++ lams_tool_lamc/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -244,3 +244,4 @@ admin.hide.titles = Hide question titles for learners label.question.bank = Question bank label.title = Question title +label.prevent.learner.autosave.mutliple.tabs = You seem to have two LAMS learner tabs open. Please close one of them. Otherwise your work may not be autosaved correctly. \ No newline at end of file Index: lams_tool_lamc/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_lamc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_lamc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_lamc/web/learning/AnswersContent.jsp =================================================================== diff -u -r02ce40b60524aa33d326fbda824dcd43f566ab94 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_lamc/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 02ce40b60524aa33d326fbda824dcd43f566ab94) +++ lams_tool_lamc/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -39,7 +39,16 @@ var interval = "30000"; // = 30 seconds window.setInterval(learnerAutosave, interval); - function learnerAutosave(){ + 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(interval); + if (!shouldAutosave) { + return; + } + } + //ajax form submit $('#mcLearningForm').ajaxSubmit({ url: "" + new Date().getTime(), Index: lams_tool_laqa/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r17c1c66c8b90a74a919b1c099c55c1e34bc3b7b9 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 17c1c66c8b90a74a919b1c099c55c1e34bc3b7b9) +++ lams_tool_laqa/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -228,3 +228,4 @@ label.monitoring.leader.successfully.changed = Leader changed label.monitoring.leader.not.changed = Leader was not changed label.answer.required = Require answer? +label.prevent.learner.autosave.mutliple.tabs = You seem to have two LAMS learner tabs open. Please close one of them. Otherwise your work may not be autosaved correctly. \ No newline at end of file Index: lams_tool_laqa/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_laqa/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_laqa/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_laqa/web/learning/AnswersContent.jsp =================================================================== diff -u -rf86004309489cb81f283d1962b481b4bbb3facd6 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision f86004309489cb81f283d1962b481b4bbb3facd6) +++ lams_tool_laqa/web/learning/AnswersContent.jsp (.../AnswersContent.jsp) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -121,7 +121,16 @@ var interval = "30000"; // = 30 seconds window.setInterval(learnerAutosave, interval); - function learnerAutosave(){ + 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(interval); + if (!shouldAutosave) { + return; + } + } + //fire onchange event for textareas/ckeditors if (${generalLearnerFlowDTO.allowRichEditor}) { for ( instance in CKEDITOR.instances ) { Index: lams_tool_larsrc/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_larsrc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_larsrc/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_leader/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_leader/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_leader/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_mindmap/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_mindmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_mindmap/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_nb/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_nb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_nb/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_notebook/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_notebook/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_notebook/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_pixlr/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_pixlr/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_pixlr/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_preview/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_preview/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_preview/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_sbmt/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_sbmt/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_sbmt/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_scratchie/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r6f0f844e82f555e8dc0df6916226fac35a2a7c36 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 6f0f844e82f555e8dc0df6916226fac35a2a7c36) +++ lams_tool_scratchie/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -315,3 +315,4 @@ label.authoring.advanced.discussion = Enable discussion sentiment voting label.authoring.advanced.discussion.tooltip = When enabled, in TBL monitoring, teachers are able to start instant polls for each burning question to assess the students' understanding. label.vsa.allocate.button = Allocate VSAs +label.prevent.learner.autosave.mutliple.tabs = You seem to have two LAMS learner tabs open. Please close one of them. Otherwise your work may not be autosaved correctly. \ No newline at end of file Index: lams_tool_scratchie/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_scratchie/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_scratchie/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_scratchie/web/pages/learning/learning.jsp =================================================================== diff -u -r137d3a0efe5f3bc0899247bc22e7c1d79a198bc8 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_scratchie/web/pages/learning/learning.jsp (.../learning.jsp) (revision 137d3a0efe5f3bc0899247bc22e7c1d79a198bc8) +++ lams_tool_scratchie/web/pages/learning/learning.jsp (.../learning.jsp) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -440,7 +440,16 @@ var autosaveInterval = "60000"; // 60 seconds interval window.setInterval(learnerAutosave, autosaveInterval); - function learnerAutosave(){ + 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); + if (!shouldAutosave) { + return; + } + } + //ajax form submit $('#burning-questions').ajaxSubmit({ url: "learning/autosaveBurningQuestions.do?sessionMapID=${sessionMapID}&date=" + new Date().getTime(), Index: lams_tool_scribe/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_scribe/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_scribe/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_spreadsheet/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_spreadsheet/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_spreadsheet/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_survey/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_survey/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_survey/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_task/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_task/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_task/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_vote/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_vote/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_vote/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_whiteboard/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rb2465c44eb8658d26f5e434027f0ba838e10aa8b -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_whiteboard/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision b2465c44eb8658d26f5e434027f0ba838e10aa8b) +++ lams_tool_whiteboard/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_wiki/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_wiki/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_wiki/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_tool_zoom/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_zoom/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_tool_zoom/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message); Index: lams_www/web/WEB-INF/tags/Page.tag =================================================================== diff -u -rafa594dcd224f2a81243b912213fe8332ef589f0 -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_www/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision afa594dcd224f2a81243b912213fe8332ef589f0) +++ lams_www/web/WEB-INF/tags/Page.tag (.../Page.tag) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -180,6 +180,19 @@ $('#sidebar').show(); } + function preventLearnerAutosaveFromMultipleTabs(autosaveInterval) { + let currentTime = new Date().getTime(), + lamsAutosaveTimestamp = +localStorage.getItem('lamsAutosaveTimestamp'); + // check if autosave does not happen too often + if (autosaveInterval > 0 && lamsAutosaveTimestamp && lamsAutosaveTimestamp + +autosaveInterval - 200 > currentTime) { + // this label is required only in tool which implement autosave + alert(''); + return false; + } + localStorage.setItem('lamsAutosaveTimestamp', currentTime); + return true; + } + function initCommandWebsocket(){ commandWebsocketInitTime = Date.now(); // it is not an obvious place to init the websocket, but we need lesson ID @@ -212,7 +225,7 @@ if (command.message === 'autosave') { // the name of this function is same in all tools if (typeof learnerAutosave == 'function') { - learnerAutosave(); + learnerAutosave(true); } } else { alert(command.message);