fcad-core-dragon 2.0.0-beta.0 → 2.0.0-beta.2
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.
- package/{.eslintrc.js → .eslintrc.cjs} +13 -18
- package/README.md +1 -1
- package/bk.scss +117 -0
- package/package.json +22 -40
- package/src/$locales/en.json +57 -19
- package/src/$locales/fr.json +66 -28
- package/src/components/AppBase.vue +790 -376
- package/src/components/AppBaseButton.vue +33 -5
- package/src/components/AppBaseErrorDisplay.vue +62 -25
- package/src/components/AppBaseModule.vue +831 -754
- package/src/components/AppBasePage.vue +60 -74
- package/src/components/AppCompAudio.vue +266 -0
- package/src/components/AppCompBranchButtons.vue +79 -89
- package/src/components/AppCompButtonProgress.vue +35 -61
- package/src/components/AppCompCarousel.vue +160 -249
- package/src/components/AppCompInputCheckBox.vue +9 -3
- package/src/components/AppCompInputDropdown.vue +2 -4
- package/src/components/AppCompInputRadio.vue +8 -15
- package/src/components/AppCompInputTextTable.vue +15 -12
- package/src/components/AppCompInputTextToFillDropdown.vue +16 -14
- package/src/components/AppCompInputTextToFillText.vue +2 -2
- package/src/components/AppCompJauge.vue +14 -3
- package/src/components/AppCompMenu.vue +284 -85
- package/src/components/AppCompMenuItem.vue +67 -92
- package/src/components/AppCompNavigation.vue +945 -0
- package/src/components/AppCompNoteCall.vue +141 -0
- package/src/components/AppCompNoteCredit.vue +267 -0
- package/src/components/AppCompPlayBar.vue +1122 -1391
- package/src/components/AppCompPlayBarProgress.vue +73 -0
- package/src/components/AppCompPopUp.vue +195 -135
- package/src/components/AppCompPopover.vue +27 -0
- package/src/components/AppCompQuiz.vue +90 -113
- package/src/components/AppCompQuizRecall.vue +277 -0
- package/src/components/AppCompSVG.vue +335 -0
- package/src/components/AppCompSettingsMenu.vue +7 -8
- package/src/components/AppCompTableOfContent.vue +264 -88
- package/src/components/AppCompTranscript.vue +19 -0
- package/src/components/AppCompVideoPlayer.vue +380 -0
- package/src/components/BaseModule.vue +37 -114
- package/src/main.js +130 -85
- package/src/mixins/$mediaMixins.js +827 -0
- package/src/mixins/$pageMixins.js +149 -115
- package/src/mixins/$quizMixins.js +12 -26
- package/src/mixins/timerMixin.js +39 -16
- package/src/module/store.js +218 -78
- package/src/module/xapi/ADL.js +90 -53
- package/src/module/xapi/Crypto/Hasher.js +8 -8
- package/src/module/xapi/Crypto/WordArray.js +6 -6
- package/src/module/xapi/Crypto/algorithms/BufferedBlockAlgorithm.js +4 -4
- package/src/module/xapi/Crypto/algorithms/C_algo.js +14 -18
- package/src/module/xapi/Crypto/algorithms/HMAC.js +1 -1
- package/src/module/xapi/Crypto/algorithms/SHA1.js +1 -1
- package/src/module/xapi/Crypto/encoders/Base.js +7 -7
- package/src/module/xapi/Crypto/encoders/Base64.js +3 -3
- package/src/module/xapi/Crypto/encoders/Hex.js +4 -3
- package/src/module/xapi/Crypto/encoders/Latin1.js +3 -3
- package/src/module/xapi/Crypto/encoders/Utf8.js +3 -3
- package/src/module/xapi/Statement/index.js +1 -1
- package/src/module/xapi/launch.js +10 -10
- package/src/module/xapi/utils.js +17 -17
- package/src/module/xapi/wrapper.js +127 -54
- package/src/module/xapi/xapiStatement.js +29 -29
- package/src/plugins/gsap.js +4 -1
- package/src/plugins/helper.js +58 -24
- package/src/plugins/i18n.js +23 -10
- package/src/plugins/idb.js +1 -0
- package/src/plugins/scorm.js +14 -14
- package/src/public/index.html +1 -1
- package/src/router/index.js +40 -0
- package/src/router/routes.js +317 -0
- package/src/shared/generalfuncs.js +91 -9
- package/src/shared/validators.js +959 -0
- package/.prettierrc.js +0 -5
- package/babel.config.js +0 -3
- package/src/components/AppBaseDragChoice.vue +0 -91
- package/src/components/AppBaseDropZone.vue +0 -112
- package/src/components/AppCompDragAndDrop.vue +0 -339
- package/src/components/AppCompInputAssociation.vue +0 -332
- package/src/components/AppCompMediaPlayer.vue +0 -365
- package/src/components/AppCompNavigationFull.vue +0 -1791
- package/src/components/AppCompToolTip.vue +0 -94
- package/src/plugins/timeManager.js +0 -77
- package/src/routes.js +0 -734
- package/vue.config.js +0 -83
|
@@ -64,7 +64,7 @@ export function xapiStatement(ADL) {
|
|
|
64
64
|
* "result": {
|
|
65
65
|
* "An optional property that represents a measured outcome related to the Statement in which it is included."}}
|
|
66
66
|
*/
|
|
67
|
-
var XAPIStatement = function(actor, verb, object, context, result) {
|
|
67
|
+
var XAPIStatement = function (actor, verb, object, context, result) {
|
|
68
68
|
// initialize
|
|
69
69
|
|
|
70
70
|
// if first arg is an xapi statement, parse
|
|
@@ -122,12 +122,12 @@ export function xapiStatement(ADL) {
|
|
|
122
122
|
this.context = context
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
this.generateId = function() {
|
|
125
|
+
this.generateId = function () {
|
|
126
126
|
this.id = ADL.ruuid()
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
XAPIStatement.prototype.toString = function() {
|
|
130
|
+
XAPIStatement.prototype.toString = function () {
|
|
131
131
|
return (
|
|
132
132
|
this.actor.toString() +
|
|
133
133
|
' ' +
|
|
@@ -139,7 +139,7 @@ export function xapiStatement(ADL) {
|
|
|
139
139
|
)
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
-
XAPIStatement.prototype.isValid = function() {
|
|
142
|
+
XAPIStatement.prototype.isValid = function () {
|
|
143
143
|
return (
|
|
144
144
|
this.actor &&
|
|
145
145
|
this.actor.isValid() &&
|
|
@@ -152,30 +152,30 @@ export function xapiStatement(ADL) {
|
|
|
152
152
|
)
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
XAPIStatement.prototype.generateRegistration = function() {
|
|
155
|
+
XAPIStatement.prototype.generateRegistration = function () {
|
|
156
156
|
_getobj(this, 'context').registration = ADL.ruuid()
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
-
XAPIStatement.prototype.addParentActivity = function(activity) {
|
|
159
|
+
XAPIStatement.prototype.addParentActivity = function (activity) {
|
|
160
160
|
_getobj(this, 'context.contextActivities.parent[]').push(
|
|
161
161
|
new Activity(activity)
|
|
162
162
|
)
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
XAPIStatement.prototype.addGroupingActivity = function(activity) {
|
|
165
|
+
XAPIStatement.prototype.addGroupingActivity = function (activity) {
|
|
166
166
|
_getobj(this, 'context.contextActivities.grouping[]').push(
|
|
167
167
|
new Activity(activity)
|
|
168
168
|
)
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
-
XAPIStatement.prototype.addOtherContextActivity = function(activity) {
|
|
171
|
+
XAPIStatement.prototype.addOtherContextActivity = function (activity) {
|
|
172
172
|
_getobj(this, 'context.contextActivities.other[]').push(
|
|
173
173
|
new Activity(activity)
|
|
174
174
|
)
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
///////////////////////////////////////////////////////////////
|
|
178
|
-
XAPIStatement.prototype._setActor = function(email, name, objectType) {
|
|
178
|
+
XAPIStatement.prototype._setActor = function (email, name, objectType) {
|
|
179
179
|
let actor = {
|
|
180
180
|
mbox: 'mailto:' + email,
|
|
181
181
|
name: name,
|
|
@@ -190,13 +190,13 @@ export function xapiStatement(ADL) {
|
|
|
190
190
|
* @Params {String | Object} verb
|
|
191
191
|
*
|
|
192
192
|
*/
|
|
193
|
-
XAPIStatement.prototype._setVerb = function(verb) {
|
|
193
|
+
XAPIStatement.prototype._setVerb = function (verb) {
|
|
194
194
|
if (verb instanceof Verb) this.verb = verb
|
|
195
195
|
else if (verbs[verb]) this.verb = verbs[verb]
|
|
196
196
|
else this.verb = new Verb(verb)
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
XAPIStatement.prototype._setObject = function(object) {
|
|
199
|
+
XAPIStatement.prototype._setObject = function (object) {
|
|
200
200
|
if (object.objectType === 'Activity' || !object.objectType) {
|
|
201
201
|
if (object instanceof Activity) this.object = object
|
|
202
202
|
else this.object = new Activity(object)
|
|
@@ -215,7 +215,7 @@ export function xapiStatement(ADL) {
|
|
|
215
215
|
} else this.object = null
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
XAPIStatement.prototype._setResultScore = function(
|
|
218
|
+
XAPIStatement.prototype._setResultScore = function (
|
|
219
219
|
score,
|
|
220
220
|
scoreScale,
|
|
221
221
|
scoreMin,
|
|
@@ -230,7 +230,7 @@ export function xapiStatement(ADL) {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
-
XAPIStatement.prototype._setResultKey = function(key, value) {
|
|
233
|
+
XAPIStatement.prototype._setResultKey = function (key, value) {
|
|
234
234
|
if (!this.result) this.result = {} //define the result key
|
|
235
235
|
//define the extra keys of the result
|
|
236
236
|
if (key == 'success') this.result.success = value
|
|
@@ -240,7 +240,7 @@ export function xapiStatement(ADL) {
|
|
|
240
240
|
else if (key == 'completion') this.result.completion = value
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
XAPIStatement.prototype._setContext = function(context) {
|
|
243
|
+
XAPIStatement.prototype._setContext = function (context) {
|
|
244
244
|
if (typeof context !== 'object') throw 'this not a valid context'
|
|
245
245
|
if (!this.context)
|
|
246
246
|
Object.defineProperty(this, 'context', { value: {}, writable: true })
|
|
@@ -259,7 +259,7 @@ export function xapiStatement(ADL) {
|
|
|
259
259
|
* See (https://github.com/adlnet/xAPI-Spec/blob/master/xAPI.md#inversefunctional)
|
|
260
260
|
* @param {string} [name] The natural-language name of the agent
|
|
261
261
|
*/
|
|
262
|
-
var Agent = function(identifier, name) {
|
|
262
|
+
var Agent = function (identifier, name) {
|
|
263
263
|
this.objectType = 'Agent'
|
|
264
264
|
this.name = name
|
|
265
265
|
|
|
@@ -284,7 +284,7 @@ export function xapiStatement(ADL) {
|
|
|
284
284
|
this.account = identifier
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
Agent.prototype.toString = function() {
|
|
287
|
+
Agent.prototype.toString = function () {
|
|
288
288
|
return (
|
|
289
289
|
this.name ||
|
|
290
290
|
this.mbox ||
|
|
@@ -293,7 +293,7 @@ export function xapiStatement(ADL) {
|
|
|
293
293
|
this.account.name
|
|
294
294
|
)
|
|
295
295
|
}
|
|
296
|
-
Agent.prototype.isValid = function() {
|
|
296
|
+
Agent.prototype.isValid = function () {
|
|
297
297
|
return (
|
|
298
298
|
this.mbox ||
|
|
299
299
|
this.mbox_sha1sum ||
|
|
@@ -309,7 +309,7 @@ export function xapiStatement(ADL) {
|
|
|
309
309
|
* @param {string} [members] An array of Agents describing the membership of the group
|
|
310
310
|
* @param {string} [name] The natural-language name of the agent
|
|
311
311
|
*/
|
|
312
|
-
var Group = function(identifier, members, name) {
|
|
312
|
+
var Group = function (identifier, members, name) {
|
|
313
313
|
Agent.call(this, identifier, name)
|
|
314
314
|
this.member = members
|
|
315
315
|
this.objectType = 'Group'
|
|
@@ -321,7 +321,7 @@ export function xapiStatement(ADL) {
|
|
|
321
321
|
* @param {string} id The IRI of the action taken
|
|
322
322
|
* @param {string} [description] An English-language description, or a Language Map
|
|
323
323
|
*/
|
|
324
|
-
var Verb = function(id, description) {
|
|
324
|
+
var Verb = function (id, description) {
|
|
325
325
|
// if passed a verb object then copy and return
|
|
326
326
|
if (id && id.id) {
|
|
327
327
|
for (var i in id) {
|
|
@@ -340,12 +340,12 @@ export function xapiStatement(ADL) {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
|
-
Verb.prototype.toString = function() {
|
|
343
|
+
Verb.prototype.toString = function () {
|
|
344
344
|
if (this.display && (this.display['en-US'] || this.display['en']))
|
|
345
345
|
return this.display['en-US'] || this.display['en']
|
|
346
346
|
else return this.id
|
|
347
347
|
}
|
|
348
|
-
Verb.prototype.isValid = function() {
|
|
348
|
+
Verb.prototype.isValid = function () {
|
|
349
349
|
return this.id
|
|
350
350
|
}
|
|
351
351
|
|
|
@@ -355,7 +355,7 @@ export function xapiStatement(ADL) {
|
|
|
355
355
|
* @param {string} name An English-language identifier for the activity, or a Language Map
|
|
356
356
|
* @param {string} description An English-language description of the activity, or a Language Map
|
|
357
357
|
*/
|
|
358
|
-
var Activity = function(id, name, description) {
|
|
358
|
+
var Activity = function (id, name, description) {
|
|
359
359
|
// if first arg is activity, copy everything over
|
|
360
360
|
if (id && id.id) {
|
|
361
361
|
var act = id
|
|
@@ -379,7 +379,7 @@ export function xapiStatement(ADL) {
|
|
|
379
379
|
else if (description) this.definition.description = description
|
|
380
380
|
}
|
|
381
381
|
}
|
|
382
|
-
Activity.prototype.toString = function() {
|
|
382
|
+
Activity.prototype.toString = function () {
|
|
383
383
|
if (
|
|
384
384
|
this.definition &&
|
|
385
385
|
this.definition.name &&
|
|
@@ -388,7 +388,7 @@ export function xapiStatement(ADL) {
|
|
|
388
388
|
return this.definition.name['en-US'] || this.definition.name['en']
|
|
389
389
|
else return this.id
|
|
390
390
|
}
|
|
391
|
-
Activity.prototype.isValid = function() {
|
|
391
|
+
Activity.prototype.isValid = function () {
|
|
392
392
|
return this.id && (!this.objectType || this.objectType === 'Activity')
|
|
393
393
|
}
|
|
394
394
|
|
|
@@ -396,7 +396,7 @@ export function xapiStatement(ADL) {
|
|
|
396
396
|
* An object that refers to a separate statement
|
|
397
397
|
* @param {string} id The UUID of another xAPI statement
|
|
398
398
|
*/
|
|
399
|
-
var StatementRef = function(id) {
|
|
399
|
+
var StatementRef = function (id) {
|
|
400
400
|
if (id && id.id) {
|
|
401
401
|
for (var i in id) {
|
|
402
402
|
this[i] = id[i]
|
|
@@ -406,10 +406,10 @@ export function xapiStatement(ADL) {
|
|
|
406
406
|
this.id = id
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
|
-
StatementRef.prototype.toString = function() {
|
|
409
|
+
StatementRef.prototype.toString = function () {
|
|
410
410
|
return 'statement(' + this.id + ')'
|
|
411
411
|
}
|
|
412
|
-
StatementRef.prototype.isValid = function() {
|
|
412
|
+
StatementRef.prototype.isValid = function () {
|
|
413
413
|
return this.id && this.objectType && this.objectType === 'StatementRef'
|
|
414
414
|
}
|
|
415
415
|
|
|
@@ -420,7 +420,7 @@ export function xapiStatement(ADL) {
|
|
|
420
420
|
* @param {string} verb The Verb for the action described by the statement
|
|
421
421
|
* @param {string} object The receiver of the action. An Agent, Group, Activity, or StatementRef
|
|
422
422
|
*/
|
|
423
|
-
var SubStatement = function(actor, verb, object) {
|
|
423
|
+
var SubStatement = function (actor, verb, object) {
|
|
424
424
|
XAPIStatement.call(this, actor, verb, object)
|
|
425
425
|
this.objectType = 'SubStatement'
|
|
426
426
|
|
|
@@ -430,7 +430,7 @@ export function xapiStatement(ADL) {
|
|
|
430
430
|
delete this.authority
|
|
431
431
|
}
|
|
432
432
|
SubStatement.prototype = new XAPIStatement()
|
|
433
|
-
SubStatement.prototype.toString = function() {
|
|
433
|
+
SubStatement.prototype.toString = function () {
|
|
434
434
|
return '"' + SubStatement.prototype.prototype.toString.call(this) + '"'
|
|
435
435
|
}
|
|
436
436
|
|
package/src/plugins/gsap.js
CHANGED
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import gsap from 'gsap'
|
|
8
8
|
import { MotionPathPlugin } from 'gsap/MotionPathPlugin'
|
|
9
|
-
gsap
|
|
9
|
+
import { ScrollTrigger } from 'gsap/ScrollTrigger'
|
|
10
|
+
import { Flip } from 'gsap/Flip'
|
|
11
|
+
|
|
12
|
+
gsap.registerPlugin(MotionPathPlugin, ScrollTrigger, Flip)
|
|
10
13
|
export default function GsapPlugin(Vue, name) {
|
|
11
14
|
Object.defineProperty(Vue.prototype, name, {
|
|
12
15
|
value: gsap
|
package/src/plugins/helper.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import routes from '../routes'
|
|
1
|
+
import routes from '../router/routes'
|
|
2
2
|
import store from '../module/store'
|
|
3
|
+
import { name as fcadName, version as fcadVersion } from '../../package.json'
|
|
3
4
|
|
|
4
5
|
import axios from 'axios'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const locale_fr = require('../$locales/fr.json')
|
|
7
|
+
import locale_en from '../$locales/en.json'
|
|
8
|
+
import locale_fr from '../$locales/fr.json'
|
|
9
9
|
|
|
10
10
|
export default function helper(Vue, name) {
|
|
11
11
|
Object.defineProperty(Vue.prototype, name, {
|
|
12
12
|
value: {
|
|
13
|
-
|
|
13
|
+
/***
|
|
14
14
|
* @description: helper to get the collection of routes of activies from vue-Router.
|
|
15
15
|
* @note If need more info from the router , use directly the vue-router
|
|
16
16
|
* @param {String} ID [optional] - ID of an activity (ex: A01).
|
|
@@ -19,7 +19,7 @@ export default function helper(Vue, name) {
|
|
|
19
19
|
*/
|
|
20
20
|
getRoutesFromVueRouter: (ID) => {
|
|
21
21
|
//let all_routes
|
|
22
|
-
let { children: all_routes, meta } =
|
|
22
|
+
let { children: all_routes, meta } = routes[1].children[0]
|
|
23
23
|
|
|
24
24
|
if (ID) {
|
|
25
25
|
let f = all_routes.find((route) => route.meta.id === ID)
|
|
@@ -31,14 +31,52 @@ export default function helper(Vue, name) {
|
|
|
31
31
|
|
|
32
32
|
return { all_routes, meta }
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
/** @description: helper to get the build timestamp. Useful for QA
|
|
35
|
+
*
|
|
36
|
+
*/
|
|
37
|
+
getBuildTime() {
|
|
38
|
+
return document.documentElement.dataset.buildTime
|
|
39
|
+
},
|
|
40
|
+
/**
|
|
41
|
+
* @description: helper to get the FCAD version full string. Useful for QA
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
getFcadVersionString() {
|
|
45
|
+
return `${fcadName} v${fcadVersion}`
|
|
46
|
+
},
|
|
47
|
+
/** @description: helper to get the FCAD version number. Useful for QA
|
|
48
|
+
*
|
|
49
|
+
*/
|
|
50
|
+
getFcadVersion() {
|
|
51
|
+
return `${fcadVersion}`
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @description: helper to get App setting information from the store.
|
|
56
|
+
* @param {String} sName - a key of specific value from the settings
|
|
57
|
+
* ex: 'specification' to return the specification of the app: xapi |scorm
|
|
58
|
+
* @return {Object|null} -
|
|
59
|
+
*/
|
|
60
|
+
getSettingsFromStore(sName = null) {
|
|
61
|
+
if (
|
|
62
|
+
!store.state.appConfigs ||
|
|
63
|
+
store.state.appConfigs[sName] == undefined
|
|
64
|
+
)
|
|
65
|
+
return null
|
|
66
|
+
|
|
67
|
+
if (sName) return store.state.appConfigs[sName]
|
|
68
|
+
else return store.state.appConfigs
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @description: helper to get the menu information from the store.
|
|
35
73
|
*
|
|
36
74
|
*/
|
|
37
75
|
getMenuInfoFromStore() {
|
|
38
76
|
if (store.state.menuSetting) return store.state.menuSetting
|
|
39
77
|
else return null
|
|
40
78
|
},
|
|
41
|
-
|
|
79
|
+
/***
|
|
42
80
|
* @description Method to return a myme time of a document
|
|
43
81
|
* @param {String} aType extension of the document exemple: doc , pdf ect...
|
|
44
82
|
* @return {String} mime
|
|
@@ -73,7 +111,7 @@ export default function helper(Vue, name) {
|
|
|
73
111
|
}
|
|
74
112
|
return mimeType
|
|
75
113
|
},
|
|
76
|
-
|
|
114
|
+
/***
|
|
77
115
|
* @description method to download a file.
|
|
78
116
|
* @param {String} filePath url of the file to download
|
|
79
117
|
* @param {String} outputName 'the default name for the download file'
|
|
@@ -84,7 +122,7 @@ export default function helper(Vue, name) {
|
|
|
84
122
|
* - case 1: the file is in the public folder of your project. Use full path ex: downloadFile('./public/
|
|
85
123
|
* myfile')
|
|
86
124
|
* - case 2: file is in another folder in a src of your project. Use relative path. File is handle as webpack
|
|
87
|
-
* module requirement with method require(). ex: downloadFile(require('@/accets/another_folder
|
|
125
|
+
* module requirement with method require(). ex: downloadFile(require('@/accets/another_folder/** myfile'))
|
|
88
126
|
*
|
|
89
127
|
*/
|
|
90
128
|
async downloadFile(filepath, outputName) {
|
|
@@ -115,7 +153,7 @@ export default function helper(Vue, name) {
|
|
|
115
153
|
console.error('DOWNLOAD ERROR: 💥', err)
|
|
116
154
|
}
|
|
117
155
|
},
|
|
118
|
-
|
|
156
|
+
/***
|
|
119
157
|
* @description - helper methode to retrive a word from a local file.
|
|
120
158
|
* @param {String} key - key of the word to retrive ex: 'a.b.c'
|
|
121
159
|
* @return {String } - return the value of the key ex: 'hello world' if exist or the key ('a.b.c')
|
|
@@ -138,7 +176,7 @@ export default function helper(Vue, name) {
|
|
|
138
176
|
return value
|
|
139
177
|
},
|
|
140
178
|
|
|
141
|
-
|
|
179
|
+
/***
|
|
142
180
|
* @description: Insert line break opportunities into a URL
|
|
143
181
|
* @param {String} url - original url string to formate
|
|
144
182
|
* @credit - https://css-tricks.com/better-line-breaks-for-long-urls/
|
|
@@ -164,7 +202,7 @@ export default function helper(Vue, name) {
|
|
|
164
202
|
|
|
165
203
|
return formatted
|
|
166
204
|
},
|
|
167
|
-
|
|
205
|
+
/***
|
|
168
206
|
* @description: Creates the right url and id for the next lesson, depending on the environment (projets/campus)
|
|
169
207
|
* Works with full url (ex: https://projets...) or a partial url (ex: 109-101-MQ-60-TP/M1Intro/index.php) set in app.
|
|
170
208
|
* When working locally, uses the projets.cegepadistance.ca environment
|
|
@@ -173,7 +211,7 @@ export default function helper(Vue, name) {
|
|
|
173
211
|
*/
|
|
174
212
|
getNextLessonEnv(linkedResource) {
|
|
175
213
|
let courseLocation, host, courseId
|
|
176
|
-
|
|
214
|
+
/**ID*/
|
|
177
215
|
if (linkedResource.id.startsWith('http')) {
|
|
178
216
|
courseId = linkedResource.id.split('lrs-xapi/')[1]
|
|
179
217
|
} else {
|
|
@@ -183,7 +221,7 @@ export default function helper(Vue, name) {
|
|
|
183
221
|
}
|
|
184
222
|
}
|
|
185
223
|
|
|
186
|
-
|
|
224
|
+
/**URL*/
|
|
187
225
|
//If the value is a complete url, split and keep the end only ex: 109-101-MQ-60-TP/M1Intro/index.php
|
|
188
226
|
if (linkedResource.url.startsWith('http')) {
|
|
189
227
|
courseLocation = linkedResource.url.split('lrs-xapi/')[1]
|
|
@@ -194,10 +232,9 @@ export default function helper(Vue, name) {
|
|
|
194
232
|
}
|
|
195
233
|
}
|
|
196
234
|
|
|
197
|
-
host =
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
: 'projets.cegepadistance.ca'
|
|
235
|
+
host = import.meta.env.PROD
|
|
236
|
+
? window.location.host
|
|
237
|
+
: 'projets.cegepadistance.ca'
|
|
201
238
|
|
|
202
239
|
linkedResource.id = `https://${host}/lrs-xapi/${courseId}`
|
|
203
240
|
linkedResource.url = `https://${host}/lrs-xapi/${courseLocation}`
|
|
@@ -210,30 +247,27 @@ export default function helper(Vue, name) {
|
|
|
210
247
|
return [...map][map.size - 1]
|
|
211
248
|
},
|
|
212
249
|
|
|
213
|
-
|
|
250
|
+
/***
|
|
214
251
|
* Method to format Time to ISOS String
|
|
215
252
|
* @param {String} T - time Iso Time
|
|
216
253
|
* @return {String} - time PT Format
|
|
217
254
|
*/
|
|
218
255
|
|
|
219
256
|
formatToISOSTime(t) {
|
|
220
|
-
console.log('My TIME : ', t)
|
|
221
257
|
if (!t) return
|
|
222
258
|
let regex = new RegExp(':', 'gm')
|
|
223
259
|
let T = !regex.test(t) ? this.formatTime(t) : t
|
|
224
260
|
|
|
225
261
|
// let timeStr = `PT${t}S`
|
|
226
|
-
console.log('TEST---', T, T.match(regex))
|
|
227
262
|
|
|
228
263
|
let timeStr =
|
|
229
264
|
T.match(regex).length > 1
|
|
230
265
|
? `PT${T.split(':')[0]}H${T.split(':')[1]}M${T.split(':')[2]}S`
|
|
231
266
|
: `PT00H${T.split(':')[0]}M${T.split(':')[1]}S`
|
|
232
|
-
console.log('ISO TIME: ', timeStr)
|
|
233
267
|
|
|
234
268
|
return timeStr
|
|
235
269
|
},
|
|
236
|
-
|
|
270
|
+
/***
|
|
237
271
|
* Method to format Time to ISOS String
|
|
238
272
|
* @param {String} T - time Iso Time
|
|
239
273
|
* @return {String} - time PT Format
|
package/src/plugins/i18n.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import _ from 'lodash'
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Merge locales message in project.
|
|
3
5
|
* @summary To merge the locales dictionnary of this library with the locales that user will create
|
|
4
6
|
* @param {Object} i18n - vue-i18n internalization object.
|
|
5
7
|
*/
|
|
6
8
|
export default function mergeLocales(i18n) {
|
|
7
|
-
const deep =
|
|
9
|
+
//const deep = import('lodash') // provide deep merge of Object cf: https://attacomsian.com/blog/javascript-merge-objects
|
|
8
10
|
|
|
9
11
|
/* I18n internal methods for mutating messages property
|
|
10
12
|
* mergeLocaleMessage: ƒ mergeLocaleMessage(locale, message)// will merge message with new message object. But does not do a deep merge of object
|
|
@@ -12,20 +14,31 @@ export default function mergeLocales(i18n) {
|
|
|
12
14
|
*/
|
|
13
15
|
|
|
14
16
|
// This library locales files
|
|
15
|
-
const thisLocales = require.context(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
)
|
|
17
|
+
// const thisLocales = require.context(
|
|
18
|
+
// '../$locales',
|
|
19
|
+
// true,
|
|
20
|
+
// /[A-Za-z0-9-_,\s]+\.json$/i
|
|
21
|
+
// )
|
|
20
22
|
|
|
21
|
-
thisLocales.
|
|
22
|
-
|
|
23
|
+
const thisLocales = import.meta.glob('../$locales/*.json', { eager: true })
|
|
24
|
+
for (const path in thisLocales) {
|
|
25
|
+
const matched = path.match(/([A-Za-z0-9-_]+)\./i)
|
|
23
26
|
if (matched && matched.length > 1) {
|
|
24
27
|
const locale = matched[1]
|
|
25
28
|
// Using lodash to deeply merge objects
|
|
26
|
-
const mergedMessages =
|
|
29
|
+
const mergedMessages = _.merge(i18n.messages[locale], thisLocales[path])
|
|
27
30
|
// Since merLocalMessage will do a shallow merge of the object. We will use setLocalMessage to replace the message with new message object
|
|
28
31
|
i18n.setLocaleMessage(locale, mergedMessages)
|
|
29
32
|
}
|
|
30
|
-
}
|
|
33
|
+
}
|
|
34
|
+
// thisLocales.keys().forEach((key) => {
|
|
35
|
+
// const matched = key.match(/([A-Za-z0-9-_]+)\./i)
|
|
36
|
+
// if (matched && matched.length > 1) {
|
|
37
|
+
// const locale = matched[1]
|
|
38
|
+
// // Using lodash to deeply merge objects
|
|
39
|
+
// const mergedMessages = deep.merge(i18n.messages[locale], thisLocales(key))
|
|
40
|
+
// // Since merLocalMessage will do a shallow merge of the object. We will use setLocalMessage to replace the message with new message object
|
|
41
|
+
// i18n.setLocaleMessage(locale, mergedMessages)
|
|
42
|
+
// }
|
|
43
|
+
// })
|
|
31
44
|
}
|
package/src/plugins/idb.js
CHANGED
package/src/plugins/scorm.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
export const scormPlugin = {
|
|
7
|
-
install: function(Vue) {
|
|
7
|
+
install: function (Vue) {
|
|
8
8
|
{
|
|
9
9
|
Vue.prototype.$scorm = {
|
|
10
10
|
nFindAPITries: 0,
|
|
@@ -41,7 +41,7 @@ export const scormPlugin = {
|
|
|
41
41
|
// value to the win parameter passed in, based on the number of
|
|
42
42
|
// parents. At the end of the function call, the win variable will be
|
|
43
43
|
// set to the upper most parent in the chain of parents.
|
|
44
|
-
ScanForAPI: function(win) {
|
|
44
|
+
ScanForAPI: function (win) {
|
|
45
45
|
while (win.API == null && win.parent != null && win.parent != win) {
|
|
46
46
|
this.nFindAPITries++
|
|
47
47
|
if (this.nFindAPITries > this.maxTries) {
|
|
@@ -60,7 +60,7 @@ export const scormPlugin = {
|
|
|
60
60
|
// function then checks to see if there are any opener windows. If
|
|
61
61
|
// the window has an opener, the function begins to look for the
|
|
62
62
|
// this.API Instance in the opener window.
|
|
63
|
-
GetAPI: function(win) {
|
|
63
|
+
GetAPI: function (win) {
|
|
64
64
|
if (win.parent != null && win.parent != win) {
|
|
65
65
|
this.API = this.ScanForAPI(win.parent)
|
|
66
66
|
}
|
|
@@ -70,7 +70,7 @@ export const scormPlugin = {
|
|
|
70
70
|
},
|
|
71
71
|
|
|
72
72
|
// Initalize
|
|
73
|
-
Initialize: function() {
|
|
73
|
+
Initialize: function () {
|
|
74
74
|
let result
|
|
75
75
|
|
|
76
76
|
this.GetAPI(window)
|
|
@@ -104,7 +104,7 @@ export const scormPlugin = {
|
|
|
104
104
|
this.initialized = true
|
|
105
105
|
},
|
|
106
106
|
//Termitate the communication with the LMS
|
|
107
|
-
Finish: function(finalState) {
|
|
107
|
+
Finish: function (finalState) {
|
|
108
108
|
let result
|
|
109
109
|
//Don't terminate if we haven't initialized or if we've already terminated
|
|
110
110
|
if (this.initialized === false || this.terminateCalled === true) {
|
|
@@ -144,7 +144,7 @@ export const scormPlugin = {
|
|
|
144
144
|
//There are situations where a GetValue call is expected to have an error
|
|
145
145
|
//and should not alert the user.
|
|
146
146
|
|
|
147
|
-
GetValue: function(element, checkError) {
|
|
147
|
+
GetValue: function (element, checkError) {
|
|
148
148
|
let result
|
|
149
149
|
|
|
150
150
|
if (this.initialized == false || this.terminateCalled == true) {
|
|
@@ -179,7 +179,7 @@ export const scormPlugin = {
|
|
|
179
179
|
return result
|
|
180
180
|
},
|
|
181
181
|
|
|
182
|
-
SetValue: function(element, value) {
|
|
182
|
+
SetValue: function (element, value) {
|
|
183
183
|
let result
|
|
184
184
|
|
|
185
185
|
if (this.initialized == false || this.terminateCalled == true) {
|
|
@@ -209,7 +209,7 @@ export const scormPlugin = {
|
|
|
209
209
|
}
|
|
210
210
|
},
|
|
211
211
|
|
|
212
|
-
Commit: function() {
|
|
212
|
+
Commit: function () {
|
|
213
213
|
let result
|
|
214
214
|
|
|
215
215
|
result = this.API.LMSCommit('')
|
|
@@ -235,7 +235,7 @@ export const scormPlugin = {
|
|
|
235
235
|
}
|
|
236
236
|
},
|
|
237
237
|
//==================== CUSTOME METHODS =============================
|
|
238
|
-
checkForError: function() {
|
|
238
|
+
checkForError: function () {
|
|
239
239
|
let error_type = null
|
|
240
240
|
let errorNumber = this.API.LMSGetLastError()
|
|
241
241
|
if (errorNumber !== '' || errorNumber !== '0') {
|
|
@@ -249,24 +249,24 @@ export const scormPlugin = {
|
|
|
249
249
|
} else return error_type
|
|
250
250
|
},
|
|
251
251
|
|
|
252
|
-
formateMsg: function(msg, data) {
|
|
252
|
+
formateMsg: function (msg, data) {
|
|
253
253
|
msg.replace('$@errorDescription', data)
|
|
254
254
|
},
|
|
255
255
|
|
|
256
|
-
getScormStatus: function() {
|
|
256
|
+
getScormStatus: function () {
|
|
257
257
|
return this.initialized
|
|
258
258
|
},
|
|
259
259
|
|
|
260
|
-
getScormAPI: function() {
|
|
260
|
+
getScormAPI: function () {
|
|
261
261
|
return this.API
|
|
262
262
|
},
|
|
263
263
|
|
|
264
|
-
setCompletionStatus: function(newStatus) {
|
|
264
|
+
setCompletionStatus: function (newStatus) {
|
|
265
265
|
this.API.RunTimeData.CompletionStatus = newStatus
|
|
266
266
|
this.Commit()
|
|
267
267
|
},
|
|
268
268
|
|
|
269
|
-
setSucessStatus: function(newStatus) {
|
|
269
|
+
setSucessStatus: function (newStatus) {
|
|
270
270
|
this.API.RunTimeData.SuccessStatus = newStatus
|
|
271
271
|
this.Commit()
|
|
272
272
|
},
|
package/src/public/index.html
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import Vue from 'vue'
|
|
2
|
+
import VueRouter from 'vue-router'
|
|
3
|
+
import routes from './routes'
|
|
4
|
+
|
|
5
|
+
Vue.use(VueRouter)
|
|
6
|
+
|
|
7
|
+
const router = new VueRouter({
|
|
8
|
+
base: import.meta.env.BASE_URL,
|
|
9
|
+
routes,
|
|
10
|
+
scrollBehavior(to, from, savedPosition) {
|
|
11
|
+
if (to.hash) {
|
|
12
|
+
from, savedPosition
|
|
13
|
+
return {
|
|
14
|
+
selector: to.hash
|
|
15
|
+
// , offset: { x: 0, y: 10 }
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
router.beforeResolve((to, from, next) => {
|
|
22
|
+
const noNavigationToMenu =
|
|
23
|
+
Vue.prototype.$helper.getSettingsFromStore('no_menu')
|
|
24
|
+
|
|
25
|
+
Vue.prototype.$bus.$emit('update-route-history', from)
|
|
26
|
+
Vue.prototype.$bus.$emit('update-content', to, from, next)
|
|
27
|
+
|
|
28
|
+
if (noNavigationToMenu && to.name == 'menu') {
|
|
29
|
+
const r = Vue.prototype.$helper.getRoutesFromVueRouter() //This return all the routes defined for the module
|
|
30
|
+
let safeRoute = r.meta.children[0] //get the first navigable route from the module routes
|
|
31
|
+
|
|
32
|
+
return next({
|
|
33
|
+
name: safeRoute._namedRoute // redirect to safety route //
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return next(true)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
export default router
|