-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimsPciCreator.js
More file actions
101 lines (99 loc) · 3.11 KB
/
imsPciCreator.js
File metadata and controls
101 lines (99 loc) · 3.11 KB
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
/*
This PCI used Wiquid's PCI Generator for TAO platform
@author: Jean-Philippe Rivière - Wiquid - https://www.wiquid.fr
This PCI can be adapted to your needs.
Contact me : jean-philippe.riviere@geogebra.org
A GeoGebra production - Dynamic Mathematics for Everyone, http://www.geogebra.org
@license: This file is subject to the GeoGebra Non-Commercial License Agreement, see http://www.geogebra.org/license. For questions please write us at office@geogebra.org.
*/
define([
'lodash',
'GGBPCI/interaction/creator/widget/Widget',
'tpl!GGBPCI/interaction/creator/tpl/markup'
], function(_, Widget, markupTpl) {
'use strict';
const _typeIdentifier = 'GGBPCI';
return {
/**
* (required) Get the typeIdentifier of the custom interaction
*
* @returns {String}
*/
getTypeIdentifier() {
return _typeIdentifier;
},
/**
* (required) Get the widget prototype
* Used in the renderer
*
* @returns {Object} Widget
*/
getWidget() {
return Widget;
},
/**
* (optional) Get the default properties values of the pci.
* Used on new pci instance creation
*
* @returns {Object}
*/
getDefaultProperties(pci) {
return {
ggbfile: '',
state:'init',
param: {
jptest : 'Bunker',
filename: '',
detachKeyboard: false,
appName: 'classic',
width: 900,
height: 600,
enableShiftDragZoom: true,
showZoomButtons: true,
showFullscreenButton: true,
language: 'en',
country: 'Austria',
showMenuBar: true,
showToolBar: true,
allowStyleBar: false,
enableRightClick: true,
enableUndoRedo: true,
RProcessing: 'None'
},
resp: {
answerSet : true,
data : true
}
};
},
/**
* (optional) Callback to execute on the
* Used on new pci instance creation
*
* @returns {Object}
*/
afterCreate(pci) {
const response = pci.getResponseDeclaration();
response.attributes.cardinality = 'record';
delete response.attributes.baseType;
response.setTemplate('CUSTOM');
},
/**
* (required) Gives the qti pci xml template
*
* @returns {function} handlebar template
*/
getMarkupTemplate() {
return markupTpl;
},
/**
* (optional) Allows passing additional data to xml template
*
* @returns {function} handlebar template
*/
getMarkupData(pci, defaultData) {
defaultData.prompt = pci.data('prompt');
return defaultData;
}
};
});