diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..adbc3b6 Binary files /dev/null and b/.DS_Store differ diff --git a/adlcp_rootv1p2.xsd b/adlcp_rootv1p2.xsd new file mode 100755 index 0000000..f33b38d --- /dev/null +++ b/adlcp_rootv1p2.xsd @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/css/style.css b/css/style.css new file mode 100644 index 0000000..269949b --- /dev/null +++ b/css/style.css @@ -0,0 +1,5 @@ + +h1 { + font-family: Arial, Helvetica, sans-serif; + color: darkgray; +} \ No newline at end of file diff --git a/ims_xml.xsd b/ims_xml.xsd new file mode 100755 index 0000000..ba4226c --- /dev/null +++ b/ims_xml.xsd @@ -0,0 +1 @@ + In namespace-aware XML processors, the "xml" prefix is bound to the namespace name http://www.w3.org/XML/1998/namespace. Do not reference this file in XML instances Schawn Thropp: Changed the uriReference type to string type Refers to universal XML 1.0 lang attribute Refers to XML Base: http://www.w3.org/TR/xmlbase diff --git a/imscp_rootv1p1p2.xsd b/imscp_rootv1p1p2.xsd new file mode 100755 index 0000000..f8bc522 --- /dev/null +++ b/imscp_rootv1p1p2.xsd @@ -0,0 +1,345 @@ + + + + + + + + + + + + + + + DRAFT XSD for IMS Content Packaging version 1.1 DRAFT + Copyright (c) 2001 IMS GLC, Inc. + 2000-04-21, Adjustments by T.D. Wason from CP 1.0. + 2001-02-22, T.D.Wason: Modify for 2000-10-24 XML-Schema version. Modified to support extension. + 2001-03-12, T.D.Wason: Change filename, target and meta-data namespaces and meta-data fielname. Add meta-data to itemType, fileType and organizationType. + Do not define namespaces for xml in XML instances generated from this xsd. + Imports IMS meta-data xsd, lower case element names. + This XSD provides a reference to the IMS meta-data root element as imsmd:record + If the IMS meta-data is to be used in the XML instance then the instance must define an IMS meta-data prefix with a namespace. The meta-data targetNamespace should be used. + 2001-03-20, Thor Anderson: Remove manifestref, change resourceref back to identifierref, change manifest back to contained by manifest. --Tom Wason: manifest may contain _none_ or more manifests. + 2001-04-13 Tom Wason: corrected attirbute name structure. Was misnamed type. + 2001-05-14 Schawn Thropp: Made all complexType extensible with the group.any + Added the anyAttribute to all complexTypes. Changed the href attribute on the fileType and resourceType to xsd:string + Changed the maxLength of the href, identifierref, parameters, structure attributes to match the Information model. + 2001-07-25 Schawn Thropp: Changed the namespace for the Schema of Schemas to the 5/2/2001 W3C XML Schema + Recommendation. attributeGroup attr.imsmd deleted, was not used anywhere. Any attribute declarations that have + use = "default" changed to use="optional" - attr.structure.req. + Any attribute declarations that have value="somevalue" changed to default="somevalue", + attr.structure.req (hierarchical). Removed references to IMS MD Version 1.1. + Modified attribute group "attr.resourcetype.req" to change use from optional + to required to match the information model. As a result the default value also needed to be removed + Name change for XSD. Changed to match version of CP Spec + + + + Inclusions and Imports + + + + + + Attribute Declarations + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + element groups + + + + + Any namespaced element from any namespace may be included within an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/imsmanifest.xml b/imsmanifest.xml new file mode 100755 index 0000000..fd58d91 --- /dev/null +++ b/imsmanifest.xml @@ -0,0 +1,41 @@ + + + + + + + ADL SCORM + 1.2 + + + + Golf Explained - Run-time Basic Calls + + Golf Explained + + + + + + + + + + + + diff --git a/imsmd_rootv1p2p1.xsd b/imsmd_rootv1p2p1.xsd new file mode 100755 index 0000000..d8a7869 --- /dev/null +++ b/imsmd_rootv1p2p1.xsd @@ -0,0 +1,573 @@ + + + + + + + + + + + 2001-04-26 T.D.Wason. IMS meta-data 1.2 XML-Schema. + 2001-06-07 S.E.Thropp. Changed the multiplicity on all elements to match the + Final 1.2 Binding Specification. + Changed all elements that use the langstringType to a multiplicy of 1 or more + Changed centity in the contribute element to have a multiplicity of 0 or more. + Changed the requirement element to have a multiplicity of 0 or more. + 2001-07-25 Schawn Thropp. Updates to bring the XSD up to speed with the W3C + XML Schema Recommendation. The following changes were made: Change the + namespace to reference the 5/2/2001 W3C XML Schema Recommendation,the base + type for the durtimeType, simpleType, was changed from timeDuration to duration. + Any attribute declarations that have use="default" had to change to use="optional" + - attr.type. Any attribute declarations that have value ="somevalue" had to change + to default = "somevalue" - attr.type (URI) + 2001-09-04 Schawn Thropp + Changed the targetNamespace and namespace of schema to reflect version change + + + + + + + + + + + + + + + + + + + + Any namespaced element from any namespace may be used for an "any" element. The namespace for the imported element must be defined in the instance, and the schema must be imported. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/index.html b/index.html new file mode 100644 index 0000000..f05bc12 --- /dev/null +++ b/index.html @@ -0,0 +1,24 @@ + + + + + + + + SCORM Template + + + + + + + + +

Simple SCORM Template

+

your name here...

+ + + + + + diff --git a/js/.DS_Store b/js/.DS_Store new file mode 100644 index 0000000..8f1abc3 Binary files /dev/null and b/js/.DS_Store differ diff --git a/js/scormfunctions.js b/js/scormfunctions.js new file mode 100755 index 0000000..aa38be9 --- /dev/null +++ b/js/scormfunctions.js @@ -0,0 +1,205 @@ +/* +Source code created by Rustici Software, LLC is licensed under a +Creative Commons Attribution 3.0 United States License +(http://creativecommons.org/licenses/by/3.0/us/) + +Want to make SCORM easy? See our solutions at http://www.scorm.com. + +This example provides for the bare minimum SCORM run-time calls. +It will demonstrate using the API discovery algorithm to find the +SCORM API and then calling Initialize and Terminate when the page +loads and unloads respectively. This example also demonstrates +some basic SCORM error handling. +*/ + + +//Include the standard ADL-supplied API discovery algorithm + + +/////////////////////////////////////////// +//Begin ADL-provided API discovery algorithm +/////////////////////////////////////////// +var findAPITries = 0; + +function findAPI(win) +{ + // Check to see if the window (win) contains the API + // if the window (win) does not contain the API and + // the window (win) has a parent window and the parent window + // is not the same as the window (win) + while ( (win.API == null) && + (win.parent != null) && + (win.parent != win) ) + { + // increment the number of findAPITries + findAPITries++; + + // Note: 7 is an arbitrary number, but should be more than sufficient + if (findAPITries > 7) + { + alert("Error finding API -- too deeply nested."); + return null; + } + + // set the variable that represents the window being + // being searched to be the parent of the current window + // then search for the API again + win = win.parent; + } + return win.API; +} + +function getAPI() +{ + // start by looking for the API in the current window + var theAPI = findAPI(window); + + // if the API is null (could not be found in the current window) + // and the current window has an opener window + if ( (theAPI == null) && + (window.opener != null) && + (typeof(window.opener) != "undefined") ) + { + // try to find the API in the current window�s opener + theAPI = findAPI(window.opener); + } + // if the API has not been found + if (theAPI == null) + { + // Alert the user that the API Adapter could not be found + alert("Unable to find an API adapter"); + } + return theAPI; +} + + +/////////////////////////////////////////// +//End ADL-provided API discovery algorithm +/////////////////////////////////////////// + + +//Create function handlers for the loading and unloading of the page + + +//Constants +var SCORM_TRUE = "true"; +var SCORM_FALSE = "false"; +var SCORM_NO_ERROR = "0"; + +//Since the Unload handler will be called twice, from both the onunload +//and onbeforeunload events, ensure that we only call LMSFinish once. +var finishCalled = false; + +//Track whether or not we successfully initialized. +var initialized = false; + +var API = null; + +function ScormProcessInitialize(){ + var result; + + API = getAPI(); + + if (API == null){ + alert("ERROR - Could not establish a connection with the LMS.\n\nYour results may not be recorded."); + return; + } + + result = API.LMSInitialize(""); + + if (result == SCORM_FALSE){ + var errorNumber = API.LMSGetLastError(); + var errorString = API.LMSGetErrorString(errorNumber); + var diagnostic = API.LMSGetDiagnostic(errorNumber); + + var errorDescription = "Number: " + errorNumber + "\nDescription: " + errorString + "\nDiagnostic: " + diagnostic; + + alert("Error - Could not initialize communication with the LMS.\n\nYour results may not be recorded.\n\n" + errorDescription); + return; + } + + initialized = true; +} + +function ScormProcessFinish(){ + + var result; + + //Don't terminate if we haven't initialized or if we've already terminated + if (initialized == false || finishCalled == true){return;} + + result = API.LMSFinish(""); + + finishCalled = true; + + if (result == SCORM_FALSE){ + var errorNumber = API.LMSGetLastError(); + var errorString = API.LMSGetErrorString(errorNumber); + var diagnostic = API.LMSGetDiagnostic(errorNumber); + + var errorDescription = "Number: " + errorNumber + "\nDescription: " + errorString + "\nDiagnostic: " + diagnostic; + + alert("Error - Could not terminate communication with the LMS.\n\nYour results may not be recorded.\n\n" + errorDescription); + return; + } +} + + +/* +The onload and onunload event handlers are assigned in launchpage.html because more processing needs to +occur at these times in this example. +*/ +//window.onload = ScormProcessInitialize; +//window.onunload = ScormProcessTerminate; +//window.onbeforeunload = ScormProcessTerminate; + + +function ScormProcessGetValue(element){ + + var result; + + if (initialized == false || finishCalled == true){return;} + + result = API.LMSGetValue(element); + + if (result == ""){ + + var errorNumber = API.LMSGetLastError(); + + if (errorNumber != SCORM_NO_ERROR){ + var errorString = API.LMSGetErrorString(errorNumber); + var diagnostic = API.LMSGetDiagnostic(errorNumber); + + var errorDescription = "Number: " + errorNumber + "\nDescription: " + errorString + "\nDiagnostic: " + diagnostic; + + alert("Error - Could not retrieve a value from the LMS.\n\n" + errorDescription); + return ""; + } + } + + return result; +} + +function ScormProcessSetValue(element, value) { + + var result; + + if (initialized == false || finishCalled == true){return;} + + result = API.LMSSetValue(element, value) + console.log(result) + console.log('value set') + API.LMSCommit('') + console.log('data committed') + if (result == SCORM_FALSE){ + var errorNumber = API.LMSGetLastError(); + var errorString = API.LMSGetErrorString(errorNumber); + var diagnostic = API.LMSGetDiagnostic(errorNumber); + + var errorDescription = "Number: " + errorNumber + "\nDescription: " + errorString + "\nDiagnostic: " + diagnostic; + + alert("Error - Could not store a value in the LMS.\n\nYour results may not be recorded.\n\n" + errorDescription); + return; + } + +} \ No newline at end of file diff --git a/js/script.js b/js/script.js new file mode 100644 index 0000000..da367ef --- /dev/null +++ b/js/script.js @@ -0,0 +1,45 @@ + +// import {ScormProcessInitialize, ScormProcessFinish, ScormProcessGetValue, ScormProcessSetValue} from './scorm.js' + +document.addEventListener('DOMContentLoaded', event => { + console.log('DOM CONTENT LOADED') + const name = ScormProcessGetValue('cmi.core.student_name') + console.log(name) + document.querySelector('p').innerText = name + document.querySelector('button#update').addEventListener('click', event => { + console.log('UPDATE BUTTON CLICKED') + // ScormProcessSetValue('cmi.core.score.raw', 42) + const score = document.querySelector('input').value + console.log(`score: ${score}`) + ScormProcessSetValue("cmi.core.score.raw", parseInt(score)) + ScormProcessSetValue("cmi.core.score.min", "0") + ScormProcessSetValue("cmi.core.score.max", "100") + }) + document.querySelector('button#end').addEventListener('click', event => { + console.log('END BUTTON CLICKED') + ScormProcessFinish() + }) +}) + +window.addEventListener('load', event => { + console.log('LOAD') + ScormProcessInitialize() + const completionStatus = ScormProcessGetValue("cmi.core.lesson_status") + if (completionStatus == "not attempted") { + console.log('not attempted') + ScormProcessSetValue("cmi.core.lesson_status", "incomplete") + } + // ScormProcessInitialize() +}) + +window.addEventListener('beforeunload', event => { + console.log('BEFOREUNLOAD') + ScormProcessSetValue("cmi.core.exit", "") + ScormProcessFinish() +}) + +window.addEventListener('unload', event => { + console.log('UNLOAD') + ScormProcessSetValue("cmi.core.exit", "") + ScormProcessFinish() +})