scorm_rte 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/scorm_rte/rte.js.erb +11 -34
- data/lib/scorm_rte.rb +1 -0
- data/lib/scorm_rte/errors.rb +3 -0
- data/lib/scorm_rte/lms/controllers/helpers.rb +19 -3
- data/lib/scorm_rte/lms/sco.rb +1 -3
- data/lib/scorm_rte/version.rb +1 -1
- data/lib/tasks/scorm_rte_tasks.rake +12 -4
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d1d0fb89919b551d41d64e5808bbf5fd0ae3d2df
|
4
|
+
data.tar.gz: fa2bf5b4ac2423da5a0f81c27288377d3322a13a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29d682185fdb1cabc04655bc9333aedb59823c4f304c262dbd6c98d39f5ba6d00e95f217aa303c90a4a27778fdc58b53db82a89df9fd81aa7911882cad629713
|
7
|
+
data.tar.gz: 9128b3650991800883ce8613135c5fd326e1710f19133589f09a8891277407cf32541d03d29f08be2498240198c0c85d2b2cb66e5bc1ae39f23560ca8eb0c8c0
|
@@ -2,6 +2,8 @@ function LMSAPI(){
|
|
2
2
|
this.cache = {};
|
3
3
|
// Defined in the LMS, must unique for each instance
|
4
4
|
this.SCOInstanceID = '';
|
5
|
+
this.fetchUrl = '/scorm_rte/fetch';
|
6
|
+
this.createUrl = '/scorm_rte';
|
5
7
|
|
6
8
|
// 1.2
|
7
9
|
this.LMSInitialize=LMSInitialize;
|
@@ -18,7 +20,7 @@ function LMSAPI(){
|
|
18
20
|
this.GetValue=LMSGetValue;
|
19
21
|
this.SetValue=LMSSetValue;
|
20
22
|
this.Commit=LMSCommit;
|
21
|
-
this.
|
23
|
+
this.Terminate=LMSFinish;
|
22
24
|
this.GetLastError=LMSGetLastError;
|
23
25
|
this.GetDiagnostic=LMSGetDiagnostic;
|
24
26
|
this.GetErrorString=LMSGetErrorString;
|
@@ -36,11 +38,7 @@ function LMSAPI(){
|
|
36
38
|
// SCORM RTE Functions - Initialization
|
37
39
|
// ------------------------------------------
|
38
40
|
function LMSInitialize(dummyString) {
|
39
|
-
|
40
|
-
console.log('initialized');
|
41
|
-
console.log(this.cache);
|
42
|
-
|
43
|
-
var url = '/scorm_rte/stores/fetch?sco_instance_id='+this.SCOInstanceID;
|
41
|
+
var url = this.fetchUrl+'?sco_instance_id='+this.SCOInstanceID;
|
44
42
|
var tempCache = {};
|
45
43
|
|
46
44
|
$.ajax({
|
@@ -51,11 +49,7 @@ function LMSAPI(){
|
|
51
49
|
}).done(function( data ) {
|
52
50
|
tempCache = data;
|
53
51
|
});
|
54
|
-
|
55
|
-
// this.cache = JSON.parse(localStorage.getItem('k')) || {}
|
56
52
|
this.cache = tempCache;
|
57
|
-
console.log(this.cache);
|
58
|
-
console.log('***');
|
59
53
|
return "true";
|
60
54
|
}
|
61
55
|
|
@@ -86,7 +80,7 @@ function LMSAPI(){
|
|
86
80
|
});
|
87
81
|
|
88
82
|
// submit to the server for processing
|
89
|
-
var url =
|
83
|
+
var url = this.createUrl;
|
90
84
|
$.ajax({
|
91
85
|
type: "POST",
|
92
86
|
headers: {
|
@@ -99,16 +93,6 @@ function LMSAPI(){
|
|
99
93
|
data: params
|
100
94
|
});
|
101
95
|
|
102
|
-
// process returned data - error condition
|
103
|
-
// if (req.status != 200) {
|
104
|
-
// alert('Problem with AJAX Request in LMSCommit()');
|
105
|
-
// return "false";
|
106
|
-
// }
|
107
|
-
|
108
|
-
// process returned data - OK
|
109
|
-
// else {
|
110
|
-
// return "true";
|
111
|
-
// }
|
112
96
|
return "true";
|
113
97
|
}
|
114
98
|
|
@@ -123,21 +107,12 @@ function LMSAPI(){
|
|
123
107
|
}
|
124
108
|
|
125
109
|
// commit cached values to the database
|
126
|
-
|
127
|
-
|
128
|
-
// console.log('***')
|
129
|
-
// console.log(localStorage.getItem('k'))
|
130
|
-
// localStorage.setItem('k', JSON.stringify(this.cache))
|
131
|
-
console.log(this.cache)
|
132
|
-
// console.log(JSON.parse(localStorage.getItem('k')))
|
133
|
-
// console.log('###')
|
110
|
+
this.LMSCommit(dummyString);
|
134
111
|
|
135
|
-
|
136
|
-
console.log('!! finish !!')
|
137
|
-
/*
|
112
|
+
/*
|
138
113
|
|
139
114
|
// set up request parameters - uses GET method
|
140
|
-
req.open('GET','finish
|
115
|
+
req.open('GET','finish?SCOInstanceID='+this.SCOInstanceID+'&code='+d.getTime(),false);
|
141
116
|
|
142
117
|
// submit to the server for processing
|
143
118
|
req.send(null);
|
@@ -148,7 +123,7 @@ function LMSAPI(){
|
|
148
123
|
return "";
|
149
124
|
}
|
150
125
|
|
151
|
-
|
126
|
+
*/
|
152
127
|
// set finish flag
|
153
128
|
flagFinished = true;
|
154
129
|
// return to calling program
|
@@ -269,5 +244,7 @@ function LMSAPI(){
|
|
269
244
|
|
270
245
|
}
|
271
246
|
|
247
|
+
// 1.2
|
272
248
|
window.API = new LMSAPI();
|
249
|
+
// 2004
|
273
250
|
window.API_1484_11 = new LMSAPI();
|
data/lib/scorm_rte.rb
CHANGED
data/lib/scorm_rte/errors.rb
CHANGED
@@ -8,12 +8,28 @@ module ScormRte
|
|
8
8
|
|
9
9
|
def update_response
|
10
10
|
return unless @_sco
|
11
|
-
txt = "<script type='text/javascript'>"
|
12
|
-
|
13
|
-
|
11
|
+
txt = "<script type='text/javascript'>" +
|
12
|
+
scorm_1_2 +
|
13
|
+
scorm_2004 +
|
14
14
|
'</script>'
|
15
15
|
response.body += txt
|
16
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def scorm_1_2
|
21
|
+
scorm_initialize('API')
|
22
|
+
end
|
23
|
+
|
24
|
+
def scorm_2004
|
25
|
+
scorm_initialize('API_1484_11')
|
26
|
+
end
|
27
|
+
|
28
|
+
def scorm_initialize(api)
|
29
|
+
"window.#{api}.SCOInstanceID='#{@_sco.sco_instance_id}';" \
|
30
|
+
"window.#{api}.fetchUrl='#{scorm_rte.fetch_stores_url}';" \
|
31
|
+
"window.#{api}.createUrl='#{scorm_rte.stores_url}';"
|
32
|
+
end
|
17
33
|
end
|
18
34
|
end
|
19
35
|
end
|
data/lib/scorm_rte/lms/sco.rb
CHANGED
@@ -2,9 +2,7 @@ module ScormRte
|
|
2
2
|
module Lms
|
3
3
|
class Sco
|
4
4
|
def initialize(sco_instance_id: nil)
|
5
|
-
unless sco_instance_id
|
6
|
-
fail NoScoInstanceIdError, 'Always provide a unique SCO intance ID'
|
7
|
-
end
|
5
|
+
fail NoScoInstanceIdError unless sco_instance_id.present?
|
8
6
|
@sco_instance_id = sco_instance_id
|
9
7
|
end
|
10
8
|
|
data/lib/scorm_rte/version.rb
CHANGED
@@ -1,4 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
namespace :scorm_rte do
|
2
|
+
desc "Copies the RTE js from scorm_rte assets to main_app assets"
|
3
|
+
task :copy_rte do
|
4
|
+
app_path = Rails.root.to_s + '/app/assets/javascripts/scorm_rte'
|
5
|
+
engine_path = ScormRte::Engine.root.to_s + '/app/assets/javascripts/scorm_rte/rte.js.erb'
|
6
|
+
|
7
|
+
FileUtils.mkdir_p app_path
|
8
|
+
FileUtils.cp engine_path, app_path
|
9
|
+
|
10
|
+
puts "Copied #{engine_path} to #{app_path}"
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scorm_rte
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- paresharma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.
|
19
|
+
version: '4.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.
|
26
|
+
version: '4.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: sqlite3
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|