Skip to content

Commit

Permalink
Show a warning when no LMS is connected
Browse files Browse the repository at this point in the history
Fixes numbas#529. There is now a variable Numbas.storage.lmsConnected telling us
whether a true SCORM connection to an LMS exists.

The front page uses this variable to show a warning message explaining that
marks and answers are not saved when there is no SCORM connection.
  • Loading branch information
georgestagg committed Apr 26, 2018
1 parent aa13b74 commit 64e7a6b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions locales/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"exam.failed": "Failed",
"exam.review header": "Review: ",
"frontpage.start": "Start",
"frontpage.scorm.lms not connected": "This exam is running in standalone mode. Your answers and marks will not be saved!",
"suspend.paused header": "Paused",
"suspend.exam suspended": "The Exam has been suspended. Press <em>Resume</em> to continue.",
"suspend.you can resume": "You will be able to resume this session the next time you start this activity.",
Expand Down
2 changes: 2 additions & 0 deletions runtime/scripts/scorm-storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ var scorm = Numbas.storage.scorm = {};
*/
var SCORMStorage = scorm.SCORMStorage = function()
{
Numbas.storage.lmsConnected = true;
if(!pipwerks.SCORM.init())
{
var errorCode = pipwerks.SCORM.debug.getCode();
if(errorCode) {
throw(new Numbas.Error(R('scorm.error initialising',{message: pipwerks.SCORM.debug.getInfo(errorCode)})));
}
Numbas.storage.lmsConnected = false;
//if the pretend LMS extension is loaded, we can start that up
if(Numbas.storage.PretendLMS)
{
Expand Down
1 change: 1 addition & 0 deletions themes/default/templates/frontpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ <h1 data-bind="html: exam.settings.name"></h1>
</tr>
</table>
<div id="intro" class="alert col-sm-6 col-sm-offset-3" data-bind="visible: exam.hasIntro, latex: exam.introMessage" localise-data-jme-context-description="exam.introduction"></div>
<div id="standalone-warning" class="alert alert-info col-sm-6 col-sm-offset-3" data-bind="visible: !Numbas.storage.lmsConnected" data-localise="frontpage.scorm.lms not connected"></div>
<div class="info-buttons col-sm-6 col-sm-offset-3">
<button class="btn btn-primary" id="startBtn" data-bind="click: Numbas.controls.beginExam" data-localise="frontpage.start"></button>
</div>

0 comments on commit 64e7a6b

Please sign in to comment.