diff --git a/_sources/lectures/TWP50/TWP50_1_en.rst b/_sources/lectures/TWP50/TWP50_1_en.rst
index 72dea04b2e..7463f8716f 100644
--- a/_sources/lectures/TWP50/TWP50_1_en.rst
+++ b/_sources/lectures/TWP50/TWP50_1_en.rst
@@ -1,4 +1,10 @@
-Introduction to a Graphical User Interface
+.. raw:: html
+ :file: ../_static/APIWrapper.js
+
+.. raw:: html
+ :file: ../_static/SCORMFunctions.js
+
+|Introduction to a Graphical User Interface
===========================================
+ In programming, just writing code is not enough.
@@ -39,7 +45,6 @@ Playing Audio
:language: python3
:python3_interpreter: brython
-
from browser import document, html
url_audio = "" # Add a link of an audio to play it
@@ -58,7 +63,6 @@ Playing Audio
from browser import document, html, timer
-
def create_element(url_audio, audio_name):
print(f"Creating the audio element {url_audio}")
document <= html.AUDIO(id=audio_name, src=url_audio)
@@ -101,3 +105,10 @@ Playing Audio
:width: 10.688cm
:align: center
:alt:
+
+.. raw:: html
+
+
diff --git a/_sources/lectures/TWP52_en.rst b/_sources/lectures/TWP52_en.rst
index e19079513c..13ba5d525d 100644
--- a/_sources/lectures/TWP52_en.rst
+++ b/_sources/lectures/TWP52_en.rst
@@ -304,9 +304,6 @@ Review
+ RadioButton()
+ OptionMenu()
-
-
-
.. disqus::
:shortname: pyzombis
:identifier: lecture19
diff --git a/_static/APIWrapper.js b/_static/APIWrapper.js
new file mode 100644
index 0000000000..b37d2f2daa
--- /dev/null
+++ b/_static/APIWrapper.js
@@ -0,0 +1,59 @@
+// SCORM API Wrapper
+var findAPITries = 0;
+var API = null;
+
+function findAPI(win) {
+ while ((win.API == null) && (win.parent != null) && (win.parent != win)) {
+ findAPITries++;
+ if (findAPITries > 7) {
+ return null;
+ }
+ win = win.parent;
+ }
+ return win.API;
+}
+
+function getAPI() {
+ var theAPI = findAPI(window);
+ if ((theAPI == null) && (window.opener != null) && (typeof(window.opener) != "undefined")) {
+ theAPI = findAPI(window.opener);
+ }
+ if (theAPI == null) {
+ alert("Unable to find an API adapter");
+ }
+ return theAPI;
+}
+
+function initializeAPI() {
+ API = getAPI();
+ if (API != null) {
+ API.LMSInitialize("");
+ }
+}
+
+function terminateAPI() {
+ if (API != null) {
+ API.LMSFinish("");
+ }
+}
+
+function setProgress(progress) {
+ if (API != null) {
+ API.LMSSetValue("cmi.core.lesson_status", progress);
+ API.LMSCommit("");
+ }
+}
+
+function setSuspendData(data) {
+ if (API != null) {
+ API.LMSSetValue("cmi.suspend_data", data);
+ API.LMSCommit("");
+ }
+}
+
+function getSuspendData() {
+ if (API != null) {
+ return API.LMSGetValue("cmi.suspend_data");
+ }
+ return "";
+}
diff --git a/_static/SCORMFunctions.js b/_static/SCORMFunctions.js
new file mode 100644
index 0000000000..30f1f62fa8
--- /dev/null
+++ b/_static/SCORMFunctions.js
@@ -0,0 +1,62 @@
+// SCORM Functions
+
+function loadPage() {
+ initializeAPI();
+ console.log("SCORM API initialized.");
+}
+
+function unloadPage() {
+ saveTextBoxData(); // Save data when the page is unloaded
+ terminateAPI();
+ console.log("SCORM API terminated.");
+}
+
+function loadChapter(chapter) {
+ loadPage();
+
+ var suspendData = getSuspendData();
+ if (suspendData) {
+ console.log("Suspend data retrieved:", suspendData);
+ // Restore the text data in the textbox
+ document.getElementById("chapter-textbox").value = suspendData;
+ }
+
+ var completionStatus = API.LMSGetValue("cmi.core.lesson_status");
+
+ if (completionStatus === "completed") {
+ document.getElementById("completion-status").innerText = "This chapter has been completed.";
+ document.getElementById("complete-button").style.display = "none";
+ } else {
+ document.getElementById("completion-status").innerText = "This chapter has not been completed.";
+ document.getElementById("reset-button").style.display = "none";
+ }
+}
+
+function completeChapter(chapter) {
+ setProgress("completed");
+ alert(chapter + " completed! Progress recorded.");
+ document.getElementById("completion-status").innerText = "This chapter has been completed.";
+ document.getElementById("complete-button").style.display = "none";
+ document.getElementById("reset-button").style.display = "block";
+
+ // Optionally save some suspend data when the chapter is completed
+ setSuspendData(document.getElementById("chapter-textbox").value);
+}
+
+function resetChapter(chapter) {
+ setProgress("incomplete");
+ alert(chapter + " reset to incomplete.");
+ document.getElementById("completion-status").innerText = "This chapter has not been completed.";
+ document.getElementById("complete-button").style.display = "block";
+ document.getElementById("reset-button").style.display = "none";
+
+ // Clear the suspend data if the chapter is reset
+ setSuspendData("");
+ document.getElementById("chapter-textbox").value = ""; // Clear the textbox as well
+}
+
+function saveTextBoxData() {
+ // Save the current state of the textbox into suspend data
+ var textBoxData = document.getElementById("chapter-textbox").value;
+ setSuspendData(textBoxData);
+}
diff --git a/_templates/layout.html b/_templates/layout.html
index 00a8807a4f..68b4225437 100644
--- a/_templates/layout.html
+++ b/_templates/layout.html
@@ -275,6 +275,8 @@
{% endraw %}
{% endif %}
+
+
{% endblock %}
{# Silence the sidebar's, relbar's #}
diff --git a/imsmanifest.xml b/imsmanifest.xml
new file mode 100644
index 0000000000..62324c50e9
--- /dev/null
+++ b/imsmanifest.xml
@@ -0,0 +1,28 @@
+
+
+ ADL SCORM
+ 1.2
+ metadata.xml
+
+
+
+ Your Course Title
+ -
+ TWP50_1_en
+
+
+
+
+
+
+
+
+
+
+
+