-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #114 from adaptlearning/ABU-1130
allow the authoring tool to suppress SCORM errors when previewing
- Loading branch information
Showing
4 changed files
with
97 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,98 +1,103 @@ | ||
define([ | ||
'coreJS/adapt', | ||
'./scorm', | ||
'./adapt-stateful-session', | ||
'./adapt-offlineStorage-scorm' | ||
'coreJS/adapt', | ||
'./scorm', | ||
'./adapt-stateful-session', | ||
'./adapt-offlineStorage-scorm' | ||
], function(Adapt, scorm, adaptStatefulSession) { | ||
|
||
//SCORM session manager | ||
//SCORM session manager | ||
|
||
var Spoor = _.extend({ | ||
var Spoor = _.extend({ | ||
|
||
_config: null, | ||
_config: null, | ||
|
||
//Session Begin | ||
//Session Begin | ||
|
||
initialize: function() { | ||
this.listenToOnce(Adapt, "configModel:dataLoaded", this.onConfigLoaded); | ||
this.listenToOnce(Adapt, "app:dataReady", this.onDataReady); | ||
}, | ||
initialize: function() { | ||
this.listenToOnce(Adapt, "configModel:dataLoaded", this.onConfigLoaded); | ||
this.listenToOnce(Adapt, "app:dataReady", this.onDataReady); | ||
}, | ||
|
||
onConfigLoaded: function() { | ||
if (!this.checkConfig()) return; | ||
onConfigLoaded: function() { | ||
if (!this.checkConfig()) return; | ||
|
||
this.configureAdvancedSettings(); | ||
this.configureAdvancedSettings(); | ||
|
||
scorm.initialize(); | ||
scorm.initialize(); | ||
|
||
this.setupEventListeners(); | ||
}, | ||
this.setupEventListeners(); | ||
}, | ||
|
||
onDataReady: function() { | ||
adaptStatefulSession.initialize(); | ||
}, | ||
onDataReady: function() { | ||
adaptStatefulSession.initialize(); | ||
}, | ||
|
||
checkConfig: function() { | ||
this._config = Adapt.config.has('_spoor') | ||
? Adapt.config.get('_spoor') | ||
: false; | ||
checkConfig: function() { | ||
this._config = Adapt.config.has('_spoor') | ||
? Adapt.config.get('_spoor') | ||
: false; | ||
|
||
if (this._config && this._config._isEnabled !== false) return true; | ||
return false; | ||
}, | ||
if (this._config && this._config._isEnabled !== false) return true; | ||
return false; | ||
}, | ||
|
||
configureAdvancedSettings: function() { | ||
if(this._config._advancedSettings) { | ||
var settings = this._config._advancedSettings; | ||
configureAdvancedSettings: function() { | ||
if(this._config._advancedSettings) { | ||
var settings = this._config._advancedSettings; | ||
|
||
if(settings._showDebugWindow) scorm.showDebugWindow(); | ||
if(settings._showDebugWindow) scorm.showDebugWindow(); | ||
|
||
scorm.setVersion(settings._scormVersion || "1.2"); | ||
scorm.setVersion(settings._scormVersion || "1.2"); | ||
|
||
if(settings.hasOwnProperty("_suppressErrors")) { | ||
scorm.suppressErrors = settings._suppressErrors; | ||
} | ||
if(settings.hasOwnProperty("_suppressErrors")) { | ||
scorm.suppressErrors = settings._suppressErrors; | ||
} | ||
|
||
if(settings.hasOwnProperty("_commitOnStatusChange")) { | ||
scorm.commitOnStatusChange = settings._commitOnStatusChange; | ||
} | ||
if(settings.hasOwnProperty("_commitOnStatusChange")) { | ||
scorm.commitOnStatusChange = settings._commitOnStatusChange; | ||
} | ||
|
||
if(settings.hasOwnProperty("_timedCommitFrequency")) { | ||
scorm.timedCommitFrequency = settings._timedCommitFrequency; | ||
} | ||
if(settings.hasOwnProperty("_timedCommitFrequency")) { | ||
scorm.timedCommitFrequency = settings._timedCommitFrequency; | ||
} | ||
|
||
if(settings.hasOwnProperty("_maxCommitRetries")) { | ||
scorm.maxCommitRetries = settings._maxCommitRetries; | ||
} | ||
if(settings.hasOwnProperty("_maxCommitRetries")) { | ||
scorm.maxCommitRetries = settings._maxCommitRetries; | ||
} | ||
|
||
if(settings.hasOwnProperty("_commitRetryDelay")) { | ||
scorm.commitRetryDelay = settings._commitRetryDelay; | ||
} | ||
} else { | ||
/** | ||
if(settings.hasOwnProperty("_commitRetryDelay")) { | ||
scorm.commitRetryDelay = settings._commitRetryDelay; | ||
} | ||
} else { | ||
/** | ||
* force use of SCORM 1.2 by default - some LMSes (SABA/Kallidus for instance) present both APIs to the SCO and, if given the choice, | ||
* the pipwerks code will automatically select the SCORM 2004 API - which can lead to unexpected behaviour. | ||
*/ | ||
scorm.setVersion("1.2"); | ||
} | ||
}, | ||
scorm.setVersion("1.2"); | ||
} | ||
|
||
setupEventListeners: function() { | ||
this._onWindowUnload = _.bind(this.onWindowUnload, this); | ||
$(window).on('unload', this._onWindowUnload); | ||
}, | ||
/** | ||
* suppress SCORM errors if 'nolmserrors' is found in the querystring | ||
*/ | ||
if(window.location.search.indexOf('nolmserrors') != -1) scorm.suppressErrors = true; | ||
}, | ||
|
||
//Session End | ||
setupEventListeners: function() { | ||
this._onWindowUnload = _.bind(this.onWindowUnload, this); | ||
$(window).on('unload', this._onWindowUnload); | ||
}, | ||
|
||
onWindowUnload: function() { | ||
scorm.finish(); | ||
//Session End | ||
|
||
$(window).off('unload', this._onWindowUnload); | ||
} | ||
|
||
}, Backbone.Events); | ||
onWindowUnload: function() { | ||
scorm.finish(); | ||
|
||
Spoor.initialize(); | ||
$(window).off('unload', this._onWindowUnload); | ||
} | ||
|
||
}, Backbone.Events); | ||
|
||
Spoor.initialize(); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!--[if IE]><![endif]--> | ||
<!doctype html> | ||
<!--[if IE 7 ]><html id="adapt" class="ie ie7 no-js" lang="en"><![endif]--> | ||
<!--[if IE 8 ]><html id="adapt" class="ie ie8 no-js" lang="en"><![endif]--> | ||
<!--[if IE 9 ]><html id="adapt" class="ie ie9 no-js" lang="en"><![endif]--> | ||
<!--[if gt IE 9]><!--><html id="adapt" class="no-js" lang="en"><!--<![endif]--> | ||
<head> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"> | ||
<meta content="utf-8" http-equiv="encoding"> | ||
<title></title> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> | ||
<link href="adapt/css/adapt.css" type="text/css" rel="stylesheet"/> | ||
<script src="libraries/modernizr.js" type="text/javascript" language="javascript"></script> | ||
<script src="adapt/js/scriptLoader.js" type="text/javascript" language="javascript"></script> | ||
</head> | ||
|
||
<body> | ||
<button id="accessibility-toggle" class="base button a11y-ignore-focus" role="button" ></button> | ||
<span id="accessibility-instructions" class="aria-label" role="region" tabindex="0"></span> | ||
<div id="wrapper"> | ||
</div> | ||
</body> | ||
</html> |