This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 57
/
index.html
420 lines (382 loc) · 20.9 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tin Can Prototypes</title>
<link rel="stylesheet" href="css/base.css">
<link rel="stylesheet" href="css/skeleton.css">
<link rel="stylesheet" href="css/layout.css">
<style type="text/css">
.tclogo {float:right;margin-left:20px;}
.clear {clear:both;}
h2 {margin:10px 0;}
#topLinks a { font-size:0.7em; }
a,a:visited {color:#39648F; text-decoration:none;}
a:hover,a:focus {color:#754737; text-decoration:none;}
.prototypeDiv {margin:25px 0;}
input[type="text"], input[type="password"], input[type="email"] {display:inline;}
li {margin:0 0 2px 5px;list-style:disc inside none;}
.configInfo {diplay:none;}
.configInfo .info {font-size:.9em;}
.configInfo .settings {margin: 0 0 10px 15px;}
.configInfo .settings span {font-weight:bold;}
.configInfo .settings .label {text-align:left;padding:0 10px;}
.infoDiv {border:1px dotted;padding:5px;}
.rounded {-webkit-border-radius: 4px;-moz-border-radius: 4px;border-radius: 4px;}
.warning {font-weight:bold; color:red;}
.cssButton {
background-color:#39648f;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
border:1px solid #39648f;
display:inline-block;
color:#ffffff;
font:"HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size:16px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
margin: 0 5px 0 0;
}
.cssButton:visited {
background-color:#39648f;
-moz-border-radius:3px;
-webkit-border-radius:3px;
border-radius:3px;
border:1px solid #39648f;
display:inline-block;
color:#ffffff;
font:"HelveticaNeue", "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size:16px;
font-weight:bold;
padding:6px 24px;
text-decoration:none;
}
.cssButton:hover {
background-color:#729fcc;
color:#ffffff;
}
.cssButton:active {
position:relative;
top:1px;
}
</style>
<script src="scripts/jquery-1.6.2.min.js"></script>
<script src="scripts/base64.js"></script>
<script src="config.js"></script>
<script src="GolfExample_TCAPI/scripts/TinCanJS/build/tincan.js"></script>
<script type="text/javascript">
/*
* Make JSON safe for IE6
* https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/JSON#Browser_compatibility
*/
if (! window.JSON) {
window.JSON = {
parse: function (sJSON) {
/*jslint evil: true */
return eval("(" + sJSON + ")");
},
stringify: function (vContent) {
var sOutput = "",
nId,
sProp
;
if (vContent instanceof Object) {
if (vContent.constructor === Array) {
for (nId = 0; nId < vContent.length; nId += 1) {
sOutput += this.stringify(vContent[nId]) + ",";
}
return "[" + sOutput.substr(0, sOutput.length - 1) + "]";
}
if (vContent.toString !== Object.prototype.toString) { return "\"" + vContent.toString().replace(/"/g, "\\$&") + "\""; }
for (sProp in vContent) {
if (vContent.hasOwnProperty(sProp)) {
sOutput += "\"" + sProp.replace(/"/g, "\\$&") + "\":" + this.stringify(vContent[sProp]) + ",";
}
}
return "{" + sOutput.substr(0, sOutput.length - 1) + "}";
}
return typeof vContent === "string" ? "\"" + vContent.replace(/"/g, "\\$&") + "\"" : String(vContent);
}
};
}
/* Set up TinCanJS */
var tincan = new TinCan (
{
recordStores: [
{
endpoint: Config.endpoint,
username: Config.authUser,
password: Config.authPassword,
allowFail: false
}
]
}
),
PrototypesLauncher = {};
PrototypesLauncher.Activity = {
id: "http://id.tincanapi.com/activity/tincan-prototypes/launcher",
definition: {
type: "http://id.tincanapi.com/activitytype/lms",
name: {
"en-US": "Tin Can Prototypes Launcher"
},
description: {
"en-US": "A tool for launching the Tin Can prototypes. Simulates the role of an LMS in launching experiences."
}
}
};
PrototypesLauncher.context = {
contextActivities: {
grouping: [
{
id: "http://id.tincanapi.com/activity/tincan-prototypes"
}
],
category: [
{
id: "http://id.tincanapi.com/recipe/tincan-prototypes/launcher/1",
definition: {
type: "http://id.tincanapi.com/activitytype/recipe"
}
},
{
id: "http://id.tincanapi.com/activity/tincan-prototypes/launcher-template",
definition: {
type: "http://id.tincanapi.com/activitytype/source",
name: {
"en-US": "Tin Can Launcher Template"
},
description: {
"en-US": "A launch tool based on the Tin Can launch prototypes."
}
}
}
]
}
};
tincan.sendStatement(
{
actor: {
name: Config.actor.name,
mbox: Config.actor.mbox
},
verb: {
id: "http://adlnet.gov/expapi/verbs/experienced",
display: {
"en-US": "experienced"
}
},
object: PrototypesLauncher.Activity,
context: {
registration: Config.registration,
contextActivities: PrototypesLauncher.context.contextActivities
}
},
function (err, xhr) {}
);
$(document).ready(function () {
var PROTOTYPE_SHOW_CONFIG_INFO = true;
var PROTOTYPE_DEFAULT_NAME = Config.actor.name;
var PROTOTYPE_DEFAULT_MBOX = Config.actor.mbox;
var PROTOTYPE_ENDPOINT = Config.endpoint;
var PROTOTYPE_AUTH = 'Basic ' + Base64.encode(Config.authUser + ':' + Config.authPassword);
var PROTOTYPE_REGISTRATION = Config.registration || TinCan.Utils.getUUID();
$('#tc_nameInput_golf').val(PROTOTYPE_DEFAULT_NAME);
$('#tc_emailInput_golf').val(PROTOTYPE_DEFAULT_MBOX.replace('mailto:',''));
$('#tc_nameInput_loc').val(PROTOTYPE_DEFAULT_NAME);
$('#tc_emailInput_loc').val(PROTOTYPE_DEFAULT_MBOX.replace('mailto:',''));
$('.refreshRegistration').click(function(){
PROTOTYPE_REGISTRATION = TinCan.Utils.getUUID();
$('#defRegistration').text(PROTOTYPE_REGISTRATION);
return false;
});
$('.resetRegistration').click(function(){
PROTOTYPE_REGISTRATION = Config.registration || TinCan.Utils.getUUID();
$('#defRegistration').text(PROTOTYPE_REGISTRATION);
});
$('#golfExampleLaunch').click(function(){
var em = $("#tc_emailInput_golf").val();
var mbox = (em.indexOf('mailto:') == 0) ? em : 'mailto:' + em;
var nm = $("#tc_nameInput_golf").val();
var actor = {'mbox' : mbox, 'name' : nm};
sendLaunchedStatement(actor, "http://id.tincanapi.com/activity/tincan-prototypes/golf-example", PROTOTYPE_REGISTRATION);
$(this).attr('href',$(this).attr('data-baseref')
+ "endpoint=" + encodeURIComponent(PROTOTYPE_ENDPOINT)
+ "&auth=" + encodeURIComponent(PROTOTYPE_AUTH)
+ "&actor=" +encodeURIComponent(JSON.stringify(actor))
+ "®istration=" +encodeURIComponent(PROTOTYPE_REGISTRATION));
return true;
});
$('#jsExampleLaunch').click(function(){
var actor = Config.actor;
var em = actor.mbox;
var mbox = (em.indexOf('mailto:') == 0) ? em : 'mailto:' + em;
actor.mbox = mbox;
sendLaunchedStatement(actor, "http://id.tincanapi.com/activity/tincan-prototypes/tetris", PROTOTYPE_REGISTRATION);
$(this).attr('href',$(this).attr('data-baseref')
+ "endpoint=" + encodeURIComponent(PROTOTYPE_ENDPOINT)
+ "&auth=" + encodeURIComponent(PROTOTYPE_AUTH)
+ "&actor=" +encodeURIComponent(JSON.stringify(actor))
+ "®istration=" +encodeURIComponent(PROTOTYPE_REGISTRATION));
return true;
});
$('#locatorExampleLaunch').click(function(){
var em = $("#tc_emailInput_loc").val();
var nm = $("#tc_nameInput_loc").val();
var mbox = (em.indexOf('mailto:') == 0) ? em : 'mailto:' + em;
var actor = {'mbox' : mbox, 'name' : nm};
sendLaunchedStatement(actor, "http://id.tincanapi.com/activity/tincan-prototypes/nashville-museums-tour", PROTOTYPE_REGISTRATION);
$(this).attr('href',$(this).attr('data-baseref')
+ "endpoint=" + encodeURIComponent(PROTOTYPE_ENDPOINT)
+ "&auth=" + encodeURIComponent(PROTOTYPE_AUTH)
+ "&actor=" +encodeURIComponent(JSON.stringify(actor))
+ "®istration=" +encodeURIComponent(PROTOTYPE_REGISTRATION));
return true;
});
if (PROTOTYPE_SHOW_CONFIG_INFO){
$('.configInfo').show();
$('#defEndpoint').text(PROTOTYPE_ENDPOINT);
$('#defAuth').text(PROTOTYPE_AUTH);
$('#defActorName').text(PROTOTYPE_DEFAULT_NAME);
$('#defActorMbox').text(PROTOTYPE_DEFAULT_MBOX);
$('#defRegistration').text(PROTOTYPE_REGISTRATION);
}
});
function sendLaunchedStatement (actor, activityId, registration) {
tincan.sendStatement(
{
actor: actor,
verb: {
id: "http://adlnet.gov/expapi/verbs/launched",
display: {
"en-US": "launched"
}
},
object: {
id: activityId
},
context: {
registration: registration,
contextActivities: PrototypesLauncher.context.contextActivities
}
},
function (err, xhr) {}
);
}
</script>
</head>
<body>
<div id="topLinks" style="text-align:center; width:100%;font-size:200%;margin:15px;"><a href="http://tincanapi.com/">Tin Can Home</a> <a href="/LRS/usage">Build Your Own</a></div>
<div class="container">
<div class="tclogo"><a target="_blank" href="http://tincanapi.com/"><img src="GolfExample_TCAPI/img/tincan-300x176.png"/></a></div>
<h1>Tin Can Prototypes</h1>
<div>
You have reached the main launching page for Tin Can prototypes. From this page, you can launch the different sites/courses set up to report to the LRS.
<br>
<br>
</div>
<br class="clear">
<div class="configInfo infoDiv rounded">
<h4>Prototype Configuration Settings</h4>
<div class="info">
The default prototype settings are as follows. To change these settings, you must change the values in the config.js file at the top level of this Tin Can Prototypes folder.
<br>
</div>
<table class="settings">
<tr><td class="label">endpoint: </td><td><span id="defEndpoint"></span></td></tr>
<tr><td class="label">auth: </td><td><span id="defAuth"></span></td></tr>
<tr><td class="label">Default actor name: </td><td><span id="defActorName"></span></td></tr>
<tr><td class="label">Default actor mbox: </td><td><span id="defActorMbox"></span></td></tr>
<tr><td class="label">Default registration: </td><td><span id="defRegistration"></span></td></tr>
</table>
<div class="info">
To generate and use a new registration UUID, click <a href="#" class="refreshRegistration">New Registration</a> below. This will cause all of the prototypes to launch as a new attempt rather than using existing State data. Click <a href="#" class="resetRegistration">Reset</a> to reset registration to the original configuration value.
</div>
<a href="#" class="cssButton refreshRegistration">New Registration</a><a href="#" class="cssButton resetRegistration">Reset</a>
</div>
<div class="prototypeDiv">
<h2 class="">Report Sample</h2>
<ul>
<li>A report page displaying different types of reports and information that can be generated with information stored in the LRS.</li>
<li>The data reported is actual data generated by the prototypes below.</li>
</ul>
<a target="_blank" href="ReportSample/index.html" class="cssButton">View Report</a>
<br>
<br>
<hr>
</div>
<div class="prototypeDiv">
<h2 class="">Statement Viewer</h2>
<ul>
<li>An application for displaying Tin Can statements using the query API.</li>
<li>The data reported is actual data generated by the prototypes below.</li>
</ul>
<a target="_blank" href="StatementViewer/index.html" class="cssButton">Statement Viewer</a>
<br>
<br>
<hr>
</div>
<div class="prototypeDiv">
<h2>Golf Example</h2>
<ul>
<li>Records each time the course is launched with an attempt.(Uses LRS single statement puts.)</li>
<li>Keeps track of the progress of a learner and provides for a returning learner to resume progress.(Uses LRS state get/put calls.)</li>
<li>Records the learner question responses and overall score from the end of course assessment.(Uses LRS single and multi-statement puts/posts.) </li>
<li>Records course completion.(Uses LRS single statement put with score reporting.)</li>
</ul>
<span class="warning">WARNING: Name and email will appear in the LRS viewer. Use default or made-up names & email if you don't want yours to appear.</span>
<br>
<br>
Name: <input type="text" id="tc_nameInput_golf">
Email: <input type="text" id="tc_emailInput_golf">
<br>
<a class="cssButton" id="golfExampleLaunch" target="_blank" data-baseref="GolfExample_TCAPI/index.html?" href="GolfExample_TCAPI/index.html?" >Launch Golf Example</a>
<br>
<br>
<hr>
</div>
<div class="prototypeDiv">
<h2>Js Tetris</h2>
<ul>
<li>Allows the player to optionally report tetris game data back to the LRS.</li>
<li>When enabled, reports when a player starts a new game of tetris.(Uses LRS single statement puts.)</li>
<li>When enabled, reports when a player achieves a new level.(Uses LRS single statement puts.)</li>
<li>When enabled, reports when a player's game is over, reporting score, levels completed,lines completed, etc.(Uses LRS single statement puts.)</li>
<li>When enabled, reports when a player achieves a top 15 high score.(Uses LRS activity profile puts.)</li>
<li>Reports the top 15 high scores achieved by all reporting players.(Uses LRS activity profile gets.)</li>
</ul>
<span class="warning">WARNING: Name and email will appear in the LRS viewer. Use default or made-up names & email if you don't want yours to appear.</span>
<br>
<br>
<a id="jsExampleLaunch" href="" target="_blank" data-baseref="JsTetris_TCAPI/tetris.html?" class="cssButton">Launch Js Tetris</a>
<br>
<br>
<hr>
</div>
<div class="prototypeDiv">
<h2>Locator Example</h2>
<ul>
<li>Requires a browser/device that allows location tracking.</li>
<li>Reports to the LRS when a user is at a specified geographic location and selects to "Save Location". (Uses LRS single statement puts with context.)</li>
<li>Reports completion to the LRS when a user has visited and saved all of the specified locations in the course. (Uses LRS single statement puts with context.)</li>
<li style="{font-weight:bold;}">For testing purposes, this example has a "cheat" such that by pressing '?' on the page, the finder will identify you as being at one of the placemarks. Pressing '?' again will disable this "cheat".</li>
</ul>
<span class="warning">WARNING: Name and email will appear in the LRS viewer. Make up names & email if you don't want yours to appear.</span>
<br>
<br>
If you or somebody using the email address below has already visited all of the locations, be sure to start a <a href="#" class="refreshRegistration">New Registration</a> before launching the activity.</div><br/>
Name: <input type="text" id="tc_nameInput_loc">
Email: <input type="text" id="tc_emailInput_loc">
<br>
<a id="locatorExampleLaunch" target="_blank" data-baseref="Locator_TCAPI/index.html?" href="Locator_TCAPI/index.html?" class="cssButton">Launch Locator Example</a>
<br>
<br>
</div>
</div>
</div>
</body>
</html>