-
Notifications
You must be signed in to change notification settings - Fork 4
/
TinLauncher.js
87 lines (63 loc) · 2.7 KB
/
TinLauncher.js
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
/*
=============COPYRIGHT============
Tin Statement Sender - An I-Did-This prototype for Tin Can API 0.95
Copyright (C) 2012 Andrew Downes
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
<http://www.gnu.org/licenses/>.
*/
/*============DOCUMENT READY==============*/
$(function(){
//Set Up LRS
//Add one blank LRS to the page by default
appendLRS();
//When the user clicks '+LRS', append an extra LRS
$('#lrsLrsAdd').click(appendLRS);
$('#lrsLrsRemove').click({elementId: 'lrs', propertyClass: 'lrs', minimum:1},removeProperty);
getLRSFromQueryString();
//Set up Actor
appendAgent('actorAgent');
//send statement
$('#sendStatement').click(launchCaptivate);
});
/*============END DOCUMENT READY==============*/
/*============SEND STATEMENT==============*/
function launchCaptivate()
{
//lrs=[{"endpoint":"https://YourSiteAddress.waxlrs.com/TCAPI/","login":"YourBasicLogin","pass":"YourBasicPassword"},{"endpoint":"https://cloud.scorm.com/ScormEngineInterface/TCAPI/YourApplicationID/","login":"YourApplicationID","pass":"CorrespondingSecretKey"},{"endpoint":"https://cloud.scorm.com/ScormEngineInterface/TCAPI/public/","login":"","pass":""},{"endpoint":"https://watershed.ws/tc","login":"","pass":""}]
var launchLink = 'tin-can-can.htm?lrs=[';
//LRS
var LRSArray = $('#lrs').find('.lrs');
LRSArray.each(function(index){
launchLink += '{';
launchLink += '"endpoint":"' + $(this).find('.endpoint').val() +'",';
launchLink += '"login":"' + $(this).find('.basicLogin').val() +'",';
launchLink += '"pass":"' + $(this).find('.basicPass').val() +'"';
launchLink += '}';
if (index < (LRSArray.length - 1))
{
launchLink += ',';
}
});
launchLink += ']&actor={';
//Actor
launchLink += '"name":"' + $('#actor').find('.agent:first').find('.name').val() +'",';
if ($('#actor').find('.functionalIdentifierType') == 'account')
{
launchLink += '"acccount": {';
launchLink += '"name":"' + $('#actor').find('.agent:first').find('.accountName').val() +'",';
launchLink += '"homePage":"' + $('#actor').find('.agent:first').find('.accountHomePage').val() +'",';
launchLink += '}';
}
else
{
launchLink +='"' + $('#actor').find('.agent:first').find('.functionalIdentifierType').val() +'":"' + $('#actor').find('.agent:first').find('.functionalIdentifier').val() + '"';
}
launchLink += '}';
window.open(launchLink);
}