├── Instructions.md
├── README.md
└── Steps
├── RosesFinal.zip
└── RosesOriginal.zip
/Instructions.md:
--------------------------------------------------------------------------------
1 |
2 | # Starting from SCORM: A Developer's Guide
3 |
4 | ## Purpose
5 | This session includes an overview of the SCORM to TLA Roadmap as well as a hands-on workshop where an existing SCORM course is updated to track data using xAPI. In this tutorial you will learn:
6 |
7 | 1. the SCORM to xAPI phases and how to determine the best fit for your organization
8 | 2. general information about the xAPI SCORM Profile and its intended use
9 | 3. what the SCORM-to-xAPI wrapper file is, and how to use it to convert SCOs to xAPI-enabled SCOs
10 | 4. examples of new functionality enabled by applying xAPI to a traditional SCORM course
11 |
12 | This example uses the [xAPI SCORM Profile](https://github.com/adlnet/xAPI-SCORM-Profile/blob/master/xapi-scorm-profile.md) for xAPI vocabulary and some minor behaviors. If you are following these steps on your own, we strongly recommend that you read the [xAPI SCORM Profile](https://github.com/adlnet/xAPI-SCORM-Profile/blob/master/xapi-scorm-profile.md) (then read it again), before continuing.
13 |
14 | ## Step by Step Instructions
15 |
16 |
17 | ### Step 1 - Setup
18 | ---
19 | In this step, we’ll examine the SCORM course to be used during this workshop and look at several resources that will be used in this demonstration.
20 |
21 | Get the required resources:
22 |
23 | * [RosesOriginal.zip](https://github.com/adlnet/Starting-from-SCORM-A-Developers-Guide/blob/master/Steps/RosesOriginal.zip?raw=true)
24 | * [RosesFinal.zip](https://github.com/adlnet/Starting-from-SCORM-A-Developers-Guide/blob/master/Steps/RosesFinal.zip?raw=true) - This is the course with the changes already completed.
25 |
26 | Extract “RosesOriginal.zip” to a local directory on your computer. This will be our starting place for the hands-on workshop.
27 |
28 | In the "RosesOriginal".zip" directory structure, examine the following files:
29 |
30 | * imsmanifest.xml - to see the complete list of SCOs in the course
31 | * Assessments/assess_q1.html - to see the typical SCORM calls made for questions in this course
32 | * Introduction_To_Roses/Introduction.html - to see typical non-question content in this course
33 | * PostTest/Posttest.html - to see the final assessment SCORM logic
34 | * [(SCORM 2004) APIWrapper.js](https://raw.githubusercontent.com/adlnet/SCORM-to-xAPI-Wrapper/master/SCORM2004/APIWrapper.js) - The new SCORM Wrapper containing integration points for the conversion code
35 | * [SCORMToXAPIFunctions.js](https://github.com/adlnet/SCORM-to-xAPI-Wrapper/blob/master/SCORMToXAPIFunctions.js) - Contains all of the code required to map SCORM data model elements to xAPI statements
36 | * [xapiwrapper.min.js](https://raw.githubusercontent.com/adlnet/xAPIWrapper/master/dist/xapiwrapper.min.js) - Obscures complexities of the xAPI and includes the ADL core verbs
37 |
38 | Note: If you have access to an LMS and would like to import your course steps into the LMS, please do so. To import, zip up all course files (so that the imsmanifest.xml is at the root of the zip), and use your LMS import functionality to upload the course.
39 | *This is not required to complete the workshop but without an LMS, viewing the results of the conversion are not possible.*
40 |
41 | *Workshop Demonstration - Show the original SCORM Course running in an LMS and view SCORM results (and the lack of any xAPI statements in a statement viewer)*
42 |
43 |
44 | ### Step 2 - Examining JavaScript Files Used for Communication
45 | ---
46 | In this step, we will add some resources and make simple changes to enable the tracking of many SCORM Data Model elements via the xAPI (in addition to the original SCORM tracking).
47 |
48 | Verify the following files listed below are in the "/Shared/JavaScript" directory where you extracted "RosesOriginal.zip"
49 |
50 | * xapiwrapper.min.js - This file will be used to abstract the complexity of the xAPI web service components.
51 | * SCORMToXAPIFunctions.js - This file contains the functionality to convert SCORM data and behaviors to xAPI.
52 | * APIWrapper.js - This final implements the SCORM API functionality and is commonly used in SCORM courses. Note that you will likely be replacing the existing file. It is important to keep the name "APIWrapper.js". If you are not using the "Roses" example and your course does not use the APIWrapper.js file, additional details will be included below to assist with a custom integration.
53 |
54 | Next, we'll examine the SCORMToXAPIFunction.js to get an overview of some of the complexities abstracted by the file.
55 |
56 | Finally, we'll examine the updated APIWrapper.js file to see how the conversion functions are integrated into the exising APIWrapper.js file.
57 |
58 |
59 | ### Step 3 - Update SCOs
60 | ---
61 | Next, add the following code in the <head> sections of each SCO in your course. SCO launch files can be identified by looking at the imsmanifest.xml file at the root of the SCORM package. Resource elements with adlcp:scormtype set to "sco" should contain the complete list of SCOs in the course. In this solution, each SCO will be an xAPI 'activity' with associated 'statements'. Paste the following code before the <script> tag that references the existing APIWrapper.js file. This will include the basic xAPI functionality as well as the SCORM to xAPI conversion functions.
62 |
63 | ``` javascript
64 |
65 |
66 | ```
67 |
68 | *Be sure that the path in the src attribute above points to the location of the minified xapiwrapper.min.js and SCORMToXAPIFunctions.js file. This location assumes that one directory up from the SCO location, that there is a Shared/JavaScript directory with your JavaScript files.*
69 |
70 | The complete list of Roses Course SCO launch files for this step is included below:
71 |
72 | * /Assessments/assess_q1.html
73 | * /Assessments/assess_q2.html
74 | * /Assessments/assess_q3.html
75 | * /Assessments/assess_q4.html
76 | * /Color_Symbolism/Color_Symbolism.html
77 | * /Dead_Heading/Dead_Heading.html
78 | * /Hybrids/Rose_Hybrids.html
79 | * /Introduction_To_Roses/Introduction.html
80 | * /PostTest/Posttest.html
81 | * /Pruning/Pruning.html
82 | * /Shearing/Shearing.html
83 | * /Styles_Of_Floristry/Styles_Of_Floristry.html
84 | * /What_Is_A_Rose/What_Is_A_Rose.html
85 |
86 |
87 | ### Step 4 - Initializing Data
88 | The demonstration requires initialization of xAPI-required configuration data in the Roses Course. For each SCO, the following information is required:
89 |
90 | * LRS endpoint - The LRS location where data should be sent for each SCO
91 | * LRS user - The xAPI "authority" to be used when sending statements from the course.
92 | * LRS password - The password associated with the LRS user authority.
93 | * Course ID - The IRI of the entire course activity. This will be used as context to group statements.
94 | * LMS Home Page - The home page of the LMS hosting the course. This will be used as part of the actor "account" object.
95 | * SCORM Version - The conversion wrapper supports both SCORM Version 1.2 and SCORM 2004 but must be configured appropriately when instantiated.
96 | * Activity ID - The IRI of the SCO activity. This will be used as the object of most statements.
97 | * Grouping Context Activity - A context activity, added to all statements, that can be used to identify a synchronous workshop involving this exercise
98 |
99 | *Initializing Data Using imsmanifest.xml*
100 |
101 | In the imsmanifest.xml file, identify `- ` tags associated with SCOs that are to be converted. Create a json object like the example below that includes configuration values of the items in the list above. Include this object in the `` element for the items that reference SCOs. The `` tag value is used to initialize the `cmi.launch_data` SCORM Data Model element and can be used at run-time to set the necessary xAPI configuration values. The following is an example JSON configuration object:
102 |
103 | ``` json
104 | {
105 | "lrs":{
106 | "endpoint":"https://lrs.adlnet.gov/xapi/",
107 | "user":"xapi-workshop",
108 | "password":"password1234"
109 | },
110 | "courseId":"http://adlnet.gov/courses/roses",
111 | "lmsHomePage":"http://lms.adlnet.gov",
112 | "isScorm2004":true,
113 | "activityId":"http://adlnet.gov/courses/roses/posttest",
114 | "groupingContextActivity":{
115 | "definition": {
116 | "name": {
117 | "en-US": "My Workshop"
118 | },
119 | "description": {
120 | "en-US": "My Workshop happening in Nov"
121 | }
122 | },
123 | "id": "http://adlnet.gov/event/xapiworkshop/myworkshop",
124 | "objectType": "Activity"
125 | }
126 | }
127 | ```
128 |
129 | Remember that the `activityId` should change each time this object is used to identify a unique activity. For the purposes of the Roses course, the following list provides the activity IDs that should be used for this exercise:
130 |
131 | * "http://adlnet.gov/courses/roses/q1"
132 | * "http://adlnet.gov/courses/roses/q2"
133 | * "http://adlnet.gov/courses/roses/q3"
134 | * "http://adlnet.gov/courses/roses/q4"
135 | * "http://adlnet.gov/courses/roses/symbolism"
136 | * "http://adlnet.gov/courses/roses/deadheading"
137 | * "http://adlnet.gov/courses/roses/hybrids"
138 | * "http://adlnet.gov/courses/roses/introduction"
139 | * "http://adlnet.gov/courses/roses/posttest"
140 | * "http://adlnet.gov/courses/roses/pruning"
141 | * "http://adlnet.gov/courses/roses/shearing"
142 | * "http://adlnet.gov/courses/roses/styles"
143 | * "http://adlnet.gov/courses/roses/what"
144 |
145 | For information on the imsmanifest.xml file, `
- ` tags and ``, see the [SCORM on ADLNet.gov](https://www.adlnet.gov/adl-research/scorm/).
146 |
147 | *If you already use `` and the `cmi.launch_data` element, please be sure to modify this approach to handle your existing data AND the JSON object*
148 |
149 | In addition, In order to distinguish this course from the original, change the course title in the imsmanifest.xml file at the root of the course. The code snippet below illustrates the required change:
150 |
151 | ``` xml
152 | ...
153 |
154 |
155 | Roses 101 SCORM 2004 - xAPI-Converted Version
156 |
-
157 | Module1
158 | ...
159 | ```
160 |
161 | Now the course can be imported into your LMS and used to track a subset of SCORM data via the xAPI.
162 |
163 | *Workshop Demonstration - SCORM Course, with added xAPI tracking, in an LMS*
164 |
165 | ### Step 5 - Extra Credit
166 | Now that the course is updated to track SCORM data to an LRS, you can access data historically not available to a SCORM SCO. For example, you can get all of the scores associated with the post test and show the learner's score vs. the average of the class.
167 |
168 | In the SCORM to xAPI functions file (/Shared/JavaScript/SCORMToXAPIFunctions.js), add a function to get ALL statements from the LRS based on search/query parameters. The complete function is listed below.
169 |
170 | ``` javascript
171 | // extra credit extension
172 | var GetCompleteStatementListFromLRS = function(search)
173 | {
174 | var result = ADL.XAPIWrapper.getStatements(search);
175 | var statements = result.statements;
176 |
177 | while(result.more && result.more !== "")
178 | {
179 | var res = ADL.XAPIWrapper.getStatements(null, result.more);
180 | var stmts = res.statements;
181 |
182 | statements.push.apply(statements, stmts);
183 |
184 | result = res;
185 | }
186 |
187 | return statements;
188 | }
189 | ```
190 |
191 | Then add a function that returns a custom score object that contains data about the score (the average, total number of scores, and total of the scores). The complete function is listed below.
192 |
193 | ``` javascript
194 | // extra credit extension
195 | var getScoreData = function()
196 | {
197 | // Set up object for score data
198 | var scoreStructure = new Object();
199 | scoreStructure.totalNumberOfScores = 0;
200 | scoreStructure.totalScores = 0;
201 | scoreStructure.average = 0;
202 |
203 |
204 | var search = ADL.XAPIWrapper.searchParams();
205 | search['activity'] = config.activityId;
206 | search['verb'] = ADL.verbs.scored.id;
207 |
208 | var statements = GetCompleteStatementListFromLRS(search);
209 |
210 | for (var i=0; i < statements.length; i++)
211 | {
212 | // figure out the average
213 | if (statements[i].result != undefined)
214 | {
215 | scoreStructure.totalNumberOfScores++;
216 | scoreStructure.totalScores = scoreStructure.totalScores + statements[i].result.score.scaled;
217 | }
218 | }
219 |
220 | scoreStructure.average = scoreStructure.totalScores / scoreStructure.totalNumberOfScores;
221 |
222 | return scoreStructure;
223 | }
224 | ```
225 |
226 | Next update the object return value to include the new public function. Look for the code below and change as follows:
227 |
228 | ``` javascript
229 | ...
230 | return{
231 | initializeAttempt: initializeAttempt,
232 | resumeAttempt: resumeAttempt,
233 | suspendAttempt: suspendAttempt,
234 | terminateAttempt: terminateAttempt,
235 | saveDataValue: saveDataValue,
236 | setScore: setScore,
237 | setComplete: setComplete,
238 | setSuccess: setSuccess,
239 | configureLRS: configureLRS,
240 | getScoreData:getScoreData
241 | }
242 | ...
243 | ```
244 |
245 | Also, in order to distinguish this course from the original, change the course title in the imsmanifest.xml file at the root of the course. The code snippet below illustrates the required change:
246 |
247 | ``` xml
248 | ...
249 |
250 |
251 | Roses 101 SCORM 2004 - xAPI-Converted Version - Extra Credit
252 |
-
253 | Module1
254 | ...
255 | ```
256 |
257 | Finally, report the data by updating the post test (/PostTest/Posttest.html) to call the new getScoreData() function and display the results. Add the following code above the “res.innerHTML = message;” line.
258 |
259 | ``` javascript
260 | // xAPI Extension
261 | var scoreStructure = xapi.getScoreData();
262 | message += "
";
263 | message += "Experience API-Enabled Data:";
264 | message += "
";
265 | message += "Average score is: " + scoreStructure.average;
266 | message += "
";
267 | message += "Total number of scores: " + scoreStructure.totalNumberOfScores;
268 | ```
269 |
270 | ### A Note About Context
271 | The SCORMToXAPIFunction.js file used as part of this example contains additional context activities. This additional context is used for dashboard & reporting session later today.
272 |
273 |
274 | ### View your results with dashboard
275 | By visiting our SCORM chart [page](https://creighton.github.io/itsec2014charts/coursechart.html), you can view learners' activity for this updated course. The LRS Data tab at the top will query the ADL LRS for all statements pertaining to this course so you can view activity attempts and scores per learner. You can also visit our job aid [page](https://creighton.github.io/itsec2014charts/jobaidchart.html) which records learners' activity from our xAPI-enabled Android [app](https://play.google.com/store/apps/details?id=org.adl.roses&hl=en). The code for it is available [here](https://github.com/adlnet/xAPI-Android-Roses).
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Starting from SCORM: A Developer’s Guide
2 |
3 |
4 |
5 | This project was first presented at the ADL xAPI Bootcamp in Alexandria, VA in late 2015. It is now being maintained here to allow others to access this workshop. If you are interested in try the code tutorial, refer to the steps in the [Instructions] (https://github.com/adlnet/Starting-from-SCORM-A-Developers-Guide/blob/master/Instructions.md).
6 |
7 | Instructions in the instructions [file](https://github.com/adlnet/Starting-from-SCORM-A-Developers-Guide/blob/master/Instructions.md)
8 |
9 | #### Facilitator(s)
10 | [Tom Creighton](https://www.linkedin.com/pub/tom-creighton/16/9b7/14), [Jono Poltrack](https://www.linkedin.com/pub/jonathan-poltrack/5/872/321)
11 |
12 | #### Session Description
13 | This session will provide an overview of the [SCORM to TLA Roadmap](http://adlnet.github.io/SCORM-to-TLA-Roadmap/). The roadmap is a phased approach detailing the means to update traditional SCORM content to Experience API (xAPI) (and additional Web services).
14 |
15 | * Participants will update an existing SCORM course using the SCORM to xAPI Wrapper.
16 | * After integration with the original SCORM course, the wrapper tracks SCORM-like data via xAPI statements.
17 | * After integration, an [xAPI statement viewer](http://adlnet.github.io/xapi-statement-viewer/) will be used to examine data stored by the content.
18 |
19 | Time permitting, an Android app which augments data saved by the SCORM course will be demonstrated.
20 |
21 | #### Prerequisites
22 | * Familiarity with Web programming including HTML and JavaScript
23 | * Some experience with SCORM a plus, but not mandatory
24 |
25 | #### What to bring with you
26 | Participants should come with a laptop and a code editor. If you are installing an editor for this session, consider [Sublime Text 3](http://www.sublimetext.com/).
27 |
28 | SCORM courses require an LMS to work properly. To test your course in an LMS, please come with an account to an existing SCORM Conformant LMS (3rd or 4th Ed) account. If you do not have an existing LMS account, consider using a hosted solution: [SCORM Cloud](http://cloud.scorm.com). More advanced users may install a local LMS: [ADL Sample RTE](http://www.adlnet.org/resources/scorm-2004-4th-edition-adl-sample-rte-version-1_1_1/index.html). To see results, without importing the course yourself, you can view the original and converted course in the [hosted version of the xAPI-modified ADL Sample RTE](http://lms.adlnet.gov).
29 |
30 | ## License
31 | Copyright ©2016 Advanced Distributed Learning
32 |
33 | Licensed under the Apache License, Version 2.0 (the "License");
34 | you may not use this file except in compliance with the License.
35 | You may obtain a copy of the License at
36 |
37 | http://www.apache.org/licenses/LICENSE-2.0
38 |
39 | Unless required by applicable law or agreed to in writing, software
40 | distributed under the License is distributed on an "AS IS" BASIS,
41 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
42 | See the License for the specific language governing permissions and
43 | limitations under the License.
44 |
45 |
--------------------------------------------------------------------------------
/Steps/RosesFinal.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adlnet/Starting-from-SCORM-A-Developers-Guide/44d6b47352e10eb7a17410d269c9cb60d8cf6ce4/Steps/RosesFinal.zip
--------------------------------------------------------------------------------
/Steps/RosesOriginal.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/adlnet/Starting-from-SCORM-A-Developers-Guide/44d6b47352e10eb7a17410d269c9cb60d8cf6ce4/Steps/RosesOriginal.zip
--------------------------------------------------------------------------------