diff --git a/js/adapt-contrib-spoor.js b/js/adapt-contrib-spoor.js index 06bb493b..ed156f49 100644 --- a/js/adapt-contrib-spoor.js +++ b/js/adapt-contrib-spoor.js @@ -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(); }); diff --git a/required/imsmanifest.xml b/required/imsmanifest.xml index e50488f4..aeb0ca90 100644 --- a/required/imsmanifest.xml +++ b/required/imsmanifest.xml @@ -24,8 +24,8 @@ - - + + \ No newline at end of file diff --git a/required/main.html b/required/index.html similarity index 100% rename from required/main.html rename to required/index.html diff --git a/required/index_lms.html b/required/index_lms.html new file mode 100644 index 00000000..d48c5a45 --- /dev/null +++ b/required/index_lms.html @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + +
+
+ +