From 4245ceb1e9de63c00f1193f2237044ec244bd001 Mon Sep 17 00:00:00 2001 From: Paul Steven Date: Tue, 28 Nov 2023 12:06:05 +0000 Subject: [PATCH 1/3] Add conditional for course error messages --- js/scorm/wrapper.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/scorm/wrapper.js b/js/scorm/wrapper.js index 5821aff9..19bfa940 100644 --- a/js/scorm/wrapper.js +++ b/js/scorm/wrapper.js @@ -547,7 +547,9 @@ class ScormWrapper { if (!Adapt.course) return; const config = Adapt.course.get('_spoor'); - const messages = Object.assign({}, ScormError.defaultMessages, config && config._messages); + const defaultMessages = ScormError.defaultMessages; + const configMessages = config?.['_messages'] || {}; + const messages = Object.assign({}, defaultMessages, configMessages); const message = Handlebars.compile(messages[error.name])(error.data); switch (error.name) { From 71cc07bfe128a4e5a1c2009030e73f43afbc614b Mon Sep 17 00:00:00 2001 From: Paul Steven Date: Tue, 12 Dec 2023 21:40:11 +0000 Subject: [PATCH 2/3] Check for 'elfh_spoor' presence --- js/scorm/wrapper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/scorm/wrapper.js b/js/scorm/wrapper.js index 704289b6..e667e120 100644 --- a/js/scorm/wrapper.js +++ b/js/scorm/wrapper.js @@ -548,7 +548,7 @@ class ScormWrapper { // if the value being set is an empty string, ensure it displays in the error as '' if (error.data.value === '') error.data.value = '\'\''; } - const config = Adapt.course.get('_spoor'); + const config = Adapt.course.get('_elfh_spoor') || {}; const defaultMessages = ScormError.defaultMessages; const configMessages = config?.['_messages'] || {}; const messages = Object.assign({}, defaultMessages, configMessages); From 9f2922d42f488823d0cd84e65bc7986152052701 Mon Sep 17 00:00:00 2001 From: Paul Steven Date: Tue, 12 Dec 2023 21:43:18 +0000 Subject: [PATCH 3/3] Use correct _spoor reference --- js/scorm/wrapper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/scorm/wrapper.js b/js/scorm/wrapper.js index e667e120..515994c0 100644 --- a/js/scorm/wrapper.js +++ b/js/scorm/wrapper.js @@ -548,7 +548,7 @@ class ScormWrapper { // if the value being set is an empty string, ensure it displays in the error as '' if (error.data.value === '') error.data.value = '\'\''; } - const config = Adapt.course.get('_elfh_spoor') || {}; + const config = Adapt.course.get('_spoor') || {}; const defaultMessages = ScormError.defaultMessages; const configMessages = config?.['_messages'] || {}; const messages = Object.assign({}, defaultMessages, configMessages);