From: Vincent Vanwaelscappel Date: Mon, 13 Dec 2021 10:47:47 +0000 (+0100) Subject: wip #4907 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=756b37a4f27a5ff57333476f74d6226471d73a91;p=hf-scorm-package.git wip #4907 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..13f55da --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/_doc/*.idlk diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/HF_Scorm_Package.iml b/.idea/HF_Scorm_Package.iml new file mode 100644 index 0000000..d6ebd48 --- /dev/null +++ b/.idea/HF_Scorm_Package.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/deployment.xml b/.idea/deployment.xml new file mode 100644 index 0000000..4921b12 --- /dev/null +++ b/.idea/deployment.xml @@ -0,0 +1,308 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Building_a_Positive_Culture.xml b/.idea/libraries/Building_a_Positive_Culture.xml new file mode 100644 index 0000000..4255dd5 --- /dev/null +++ b/.idea/libraries/Building_a_Positive_Culture.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/libraries/LMSTest.xml b/.idea/libraries/LMSTest.xml new file mode 100644 index 0000000..dcae1c5 --- /dev/null +++ b/.idea/libraries/LMSTest.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..0a76216 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0b684d0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/data.js b/data.js new file mode 100644 index 0000000..661e3d8 --- /dev/null +++ b/data.js @@ -0,0 +1,46 @@ +const DATA = { + "title": "Title of the project", + "modules": [ + { + "id": 0, + "title": "Title of the module", + "type": "IN", + "path": "IN/HF_IN_PositiveCulture_v1_UK EN_outlined.pdf", + "mandatory": true + }, + { + "id": 1, + "title": "Title of the module", + "type": "AN", + "path": "AN/HF_AN_038_Building a positive culture_UK EN.mp4", + "mandatory": true + }, + { + "id": 2, + "title": "Title of the module", + "type": "VI", + "path": "Ti5/TI5_100_Positive-Culture_UK EN.mp4", + "mandatory": true + }, + { + "id": 3, + "title": "Title of the module", + "type": "FB", + "path": "FB/index.html", + "mandatory": true + }, + { + "id": 4, + "title": "Title of the module", + "type": "QZ", + "path": "QZ/index.html", + "mandatory": true, + "lock": [ + 0, + 1, + 2, + 3 + ] + } + ] +}; \ No newline at end of file diff --git a/data.json b/data.json deleted file mode 100644 index d51ccdc..0000000 --- a/data.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "title": "Title of the project", - "modules": [ - { - "id": 0, - "title": "Title of the module", - "type": "IN", - "path": "IN/HF_IN_PositiveCulture_v1_UK EN_outlined.pdf", - "mandatory": true - }, - { - "id": 1, - "title": "Title of the module", - "type": "AN", - "path": "AN/HF_AN_038_Building a positive culture_UK EN.mp4", - "mandatory": true - }, - { - "id": 2, - "title": "Title of the module", - "type": "VI", - "path": "Ti5/TI5_100_Positive-Culture_UK EN.mp4", - "mandatory": true - }, - { - "id": 3, - "title": "Title of the module", - "type": "FB", - "path": "FB/index.html", - "mandatory": true - }, - { - "id": 4, - "title": "Title of the module", - "type": "QZ", - "path": "QZ/index.html", - "mandatory": true, - "lock": [ - 0, - 1, - 2, - 3 - ] - } - ] -} \ No newline at end of file diff --git a/index.html b/index.html index f8e09a2..d79e1df 100644 --- a/index.html +++ b/index.html @@ -1,14 +1,14 @@ - - HF SCORM Multiple Package + + HF SCORM Multiple Package + - - + \ No newline at end of file diff --git a/js/main.js b/js/main.js deleted file mode 100644 index 85f6222..0000000 --- a/js/main.js +++ /dev/null @@ -1,25 +0,0 @@ -(function (global) { - $(function () { - - }); - -})(typeof window === 'undefined' ? this : window); - - -(function (global) { - 'use strict'; - if (!global.console) { - global.console = {}; - } - var con = global.console; - var prop, method; - var dummy = function () { - }; - var properties = ['memory']; - var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + - 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + - 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); - while (prop = properties.pop()) if (!con[prop]) con[prop] = {}; - while (method = methods.pop()) if (typeof con[method] !== 'function') con[method] = dummy; - // Using `this` for web workers & supports Browserify / Webpack. -})(typeof window === 'undefined' ? this : window); \ No newline at end of file diff --git a/js/scorm.js b/js/scorm.js deleted file mode 100644 index ef2eaf5..0000000 --- a/js/scorm.js +++ /dev/null @@ -1,65 +0,0 @@ -SCORM = true; - -function initScormEvents() { - SCORM = doLMSInitialize(); - var defaultState = {q: 1}; - if (!SCORM) { - // No SCORM, we init at question 1 - $(document).trigger('quizinit', defaultState); - return false; - } - $(window).on('unload', function () { - doLMSFinish(); - }); - - var currentStatus = getScormValue('cmi.core.lesson_status'); - if (currentStatus != 'passed' || currentStatus != 'completed') { - setScormValue('cmi.core.lesson_status', 'incomplete'); - } - - var savedState = getScormValue('cmi.core.lesson_location'); - try { - if (savedState == '') { - savedState = defaultState; - } else { - savedState = JSON.parse(savedState); - } - $(document).trigger('quizinit', savedState); - } catch (err) { - console.error(err); - } - - return true; -} - -function setSCORMLocation(location) { - return setScormValue('cmi.core.lesson_location', JSON.stringify(location)); -} - -function setSCORMScore(score, max, min) { - if (min === undefined) { - min = 0; - } - - setScormValue('cmi.core.score.raw', score); - setScormValue('cmi.core.score.min', min); - setScormValue('cmi.core.score.max', max); -} - - -function getScormValue(elementName) { - if (!SCORM) { - return null; - } - var result = String(doLMSGetValue(elementName)); - return result; -} - -function setScormValue(elementName, value) { - if (!SCORM) { - return; - } - var result = doLMSSetValue(elementName, value); - doLMSCommit(); - return result; -} \ No newline at end of file diff --git a/js/scormpackage.js b/js/scormpackage.js new file mode 100644 index 0000000..a6ddeff --- /dev/null +++ b/js/scormpackage.js @@ -0,0 +1,91 @@ +(function (global) { + $(function () { + + }); + +})(typeof window === 'undefined' ? this : window); + + +(function (global) { + 'use strict'; + if (!global.console) { + global.console = {}; + } + var con = global.console; + var prop, method; + var dummy = function () { + }; + var properties = ['memory']; + var methods = ('assert,clear,count,debug,dir,dirxml,error,exception,group,' + + 'groupCollapsed,groupEnd,info,log,markTimeline,profile,profiles,profileEnd,' + + 'show,table,time,timeEnd,timeline,timelineEnd,timeStamp,trace,warn').split(','); + while (prop = properties.pop()) if (!con[prop]) con[prop] = {}; + while (method = methods.pop()) if (typeof con[method] !== 'function') con[method] = dummy; + // Using `this` for web workers & supports Browserify / Webpack. +})(typeof window === 'undefined' ? this : window); + +SCORM = true; + +function initScormEvents() { + SCORM = doLMSInitialize(); + var defaultState = {q: 1}; + if (!SCORM) { + // No SCORM, we init at question 1 + $(document).trigger('quizinit', defaultState); + return false; + } + $(window).on('unload', function () { + doLMSFinish(); + }); + + var currentStatus = getScormValue('cmi.core.lesson_status'); + if (currentStatus != 'passed' || currentStatus != 'completed') { + setScormValue('cmi.core.lesson_status', 'incomplete'); + } + + var savedState = getScormValue('cmi.core.lesson_location'); + try { + if (savedState == '') { + savedState = defaultState; + } else { + savedState = JSON.parse(savedState); + } + $(document).trigger('quizinit', savedState); + } catch (err) { + console.error(err); + } + + return true; +} + +function setSCORMLocation(location) { + return setScormValue('cmi.core.lesson_location', JSON.stringify(location)); +} + +function setSCORMScore(score, max, min) { + if (min === undefined) { + min = 0; + } + + setScormValue('cmi.core.score.raw', score); + setScormValue('cmi.core.score.min', min); + setScormValue('cmi.core.score.max', max); +} + + +function getScormValue(elementName) { + if (!SCORM) { + return null; + } + var result = String(doLMSGetValue(elementName)); + return result; +} + +function setScormValue(elementName, value) { + if (!SCORM) { + return; + } + var result = doLMSSetValue(elementName, value); + doLMSCommit(); + return result; +} \ No newline at end of file