@citolab/tspci-tao 1.0.1 → 2.0.5
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/LICENSE +674 -0
- package/package.json +14 -21
- package/readme.md +85 -83
- package/release-notes.md +10 -0
- package/src/createPackage.mjs +307 -298
- package/toa_pci_default/imsPciCreator.js +66 -66
- package/toa_pci_default/imsPciCreator.json +41 -41
- package/toa_pci_default/interaction/creator/img/icon.svg +8 -8
- package/toa_pci_default/interaction/creator/tpl/markup.tpl +18 -18
- package/toa_pci_default/interaction/creator/tpl/propertiesForm.tpl +7 -7
- package/toa_pci_default/interaction/creator/widget/Widget.js +14 -14
- package/toa_pci_default/interaction/creator/widget/states/Answer.js +26 -26
- package/toa_pci_default/interaction/creator/widget/states/Correct.js +44 -44
- package/toa_pci_default/interaction/creator/widget/states/Question.js +51 -51
- package/toa_pci_default/interaction/creator/widget/states/states.js +8 -8
- package/types/index.d.ts +17 -17
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
define([
|
|
2
|
-
'lodash',
|
|
3
|
-
'##typeIdentifier##/interaction/creator/widget/Widget',
|
|
4
|
-
'tpl!##typeIdentifier##/interaction/creator/tpl/markup'
|
|
5
|
-
], function(_, Widget, markupTpl){
|
|
6
|
-
|
|
7
|
-
var _typeIdentifier = '##typeIdentifier##';
|
|
8
|
-
|
|
9
|
-
var interactionCreator = {
|
|
10
|
-
/**
|
|
11
|
-
* (required) Get the typeIdentifier of the custom interaction
|
|
12
|
-
*
|
|
13
|
-
* @returns {String}
|
|
14
|
-
*/
|
|
15
|
-
gettypeIdentifier : function(){
|
|
16
|
-
return _typeIdentifier;
|
|
17
|
-
},
|
|
18
|
-
/**
|
|
19
|
-
* (required) Get the widget prototype
|
|
20
|
-
* Used in the renderer
|
|
21
|
-
*
|
|
22
|
-
* @returns {Object} Widget
|
|
23
|
-
*/
|
|
24
|
-
getWidget : function(){
|
|
25
|
-
return Widget;
|
|
26
|
-
},
|
|
27
|
-
/**
|
|
28
|
-
* (optional) Get the default properties values of the pci.
|
|
29
|
-
* Used on new pci instance creation
|
|
30
|
-
*
|
|
31
|
-
* @returns {Object}
|
|
32
|
-
*/
|
|
33
|
-
getDefaultProperties : function(pci){
|
|
34
|
-
return '##__DEFAULT_VALUES__##'
|
|
35
|
-
},
|
|
36
|
-
/**
|
|
37
|
-
* (optional) Callback to execute on the
|
|
38
|
-
* Used on new pci instance creation
|
|
39
|
-
*
|
|
40
|
-
* @returns {Object}
|
|
41
|
-
*/
|
|
42
|
-
afterCreate : function(pci){
|
|
43
|
-
pci.getResponseDeclaration().setTemplate('###_FIRST_SCORING_METHOD_###');
|
|
44
|
-
},
|
|
45
|
-
/**
|
|
46
|
-
* (required) Gives the qti pci xml template
|
|
47
|
-
*
|
|
48
|
-
* @returns {function} handlebar template
|
|
49
|
-
*/
|
|
50
|
-
getMarkupTemplate : function(){
|
|
51
|
-
return markupTpl;
|
|
52
|
-
},
|
|
53
|
-
/**
|
|
54
|
-
* (optional) Allows passing additional data to xml template
|
|
55
|
-
*
|
|
56
|
-
* @returns {function} handlebar template
|
|
57
|
-
*/
|
|
58
|
-
getMarkupData : function(pci, defaultData){
|
|
59
|
-
defaultData.prompt = pci.data('prompt');
|
|
60
|
-
return defaultData;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
//since we assume we are in a tao context, there is no use to expose the a global object for lib registration
|
|
65
|
-
//all libs should be declared here
|
|
66
|
-
return interactionCreator;
|
|
1
|
+
define([
|
|
2
|
+
'lodash',
|
|
3
|
+
'##typeIdentifier##/interaction/creator/widget/Widget',
|
|
4
|
+
'tpl!##typeIdentifier##/interaction/creator/tpl/markup'
|
|
5
|
+
], function(_, Widget, markupTpl){
|
|
6
|
+
|
|
7
|
+
var _typeIdentifier = '##typeIdentifier##';
|
|
8
|
+
|
|
9
|
+
var interactionCreator = {
|
|
10
|
+
/**
|
|
11
|
+
* (required) Get the typeIdentifier of the custom interaction
|
|
12
|
+
*
|
|
13
|
+
* @returns {String}
|
|
14
|
+
*/
|
|
15
|
+
gettypeIdentifier : function(){
|
|
16
|
+
return _typeIdentifier;
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* (required) Get the widget prototype
|
|
20
|
+
* Used in the renderer
|
|
21
|
+
*
|
|
22
|
+
* @returns {Object} Widget
|
|
23
|
+
*/
|
|
24
|
+
getWidget : function(){
|
|
25
|
+
return Widget;
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* (optional) Get the default properties values of the pci.
|
|
29
|
+
* Used on new pci instance creation
|
|
30
|
+
*
|
|
31
|
+
* @returns {Object}
|
|
32
|
+
*/
|
|
33
|
+
getDefaultProperties : function(pci){
|
|
34
|
+
return '##__DEFAULT_VALUES__##'
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* (optional) Callback to execute on the
|
|
38
|
+
* Used on new pci instance creation
|
|
39
|
+
*
|
|
40
|
+
* @returns {Object}
|
|
41
|
+
*/
|
|
42
|
+
afterCreate : function(pci){
|
|
43
|
+
pci.getResponseDeclaration().setTemplate('###_FIRST_SCORING_METHOD_###');
|
|
44
|
+
},
|
|
45
|
+
/**
|
|
46
|
+
* (required) Gives the qti pci xml template
|
|
47
|
+
*
|
|
48
|
+
* @returns {function} handlebar template
|
|
49
|
+
*/
|
|
50
|
+
getMarkupTemplate : function(){
|
|
51
|
+
return markupTpl;
|
|
52
|
+
},
|
|
53
|
+
/**
|
|
54
|
+
* (optional) Allows passing additional data to xml template
|
|
55
|
+
*
|
|
56
|
+
* @returns {function} handlebar template
|
|
57
|
+
*/
|
|
58
|
+
getMarkupData : function(pci, defaultData){
|
|
59
|
+
defaultData.prompt = pci.data('prompt');
|
|
60
|
+
return defaultData;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//since we assume we are in a tao context, there is no use to expose the a global object for lib registration
|
|
65
|
+
//all libs should be declared here
|
|
66
|
+
return interactionCreator;
|
|
67
67
|
});
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
"model" : "IMSPCI",
|
|
3
|
-
"typeIdentifier": "##typeIdentifier##",
|
|
4
|
-
"label": "##label##",
|
|
5
|
-
"short": "##short##",
|
|
6
|
-
"description": "##description##",
|
|
7
|
-
"version": "##version##",
|
|
8
|
-
"author": "Citolab",
|
|
9
|
-
"email": "getinspiredbycitolab@gmail.com",
|
|
10
|
-
"tags": [
|
|
11
|
-
"pci"
|
|
12
|
-
],
|
|
13
|
-
"response": {
|
|
14
|
-
"baseType": "string",
|
|
15
|
-
"cardinality": "single"
|
|
16
|
-
},
|
|
17
|
-
"runtime" : {
|
|
18
|
-
"hook" : "interaction/runtime/js/index.js",
|
|
19
|
-
"modules" : {
|
|
20
|
-
"##typeIdentifier##/interaction/runtime/js/index" : [
|
|
21
|
-
"interaction/runtime/js/index.js"
|
|
22
|
-
]
|
|
23
|
-
},
|
|
24
|
-
"src" : [
|
|
25
|
-
"./interaction/runtime/js/index.js"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"creator" : {
|
|
29
|
-
"icon": "./interaction/creator/img/icon.svg",
|
|
30
|
-
"hook": "./imsPciCreator.js",
|
|
31
|
-
"src" : [
|
|
32
|
-
"./imsPciCreator.js",
|
|
33
|
-
"./interaction/creator/tpl/markup.tpl",
|
|
34
|
-
"./interaction/creator/tpl/propertiesForm.tpl",
|
|
35
|
-
"./interaction/creator/widget/Widget.js",
|
|
36
|
-
"./interaction/creator/widget/states/Question.js",
|
|
37
|
-
"./interaction/creator/widget/states/Answer.js",
|
|
38
|
-
"./interaction/creator/widget/states/Correct.js",
|
|
39
|
-
"./interaction/creator/widget/states/states.js"
|
|
40
|
-
]
|
|
41
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"model" : "IMSPCI",
|
|
3
|
+
"typeIdentifier": "##typeIdentifier##",
|
|
4
|
+
"label": "##label##",
|
|
5
|
+
"short": "##short##",
|
|
6
|
+
"description": "##description##",
|
|
7
|
+
"version": "##version##",
|
|
8
|
+
"author": "Citolab",
|
|
9
|
+
"email": "getinspiredbycitolab@gmail.com",
|
|
10
|
+
"tags": [
|
|
11
|
+
"pci"
|
|
12
|
+
],
|
|
13
|
+
"response": {
|
|
14
|
+
"baseType": "string",
|
|
15
|
+
"cardinality": "single"
|
|
16
|
+
},
|
|
17
|
+
"runtime" : {
|
|
18
|
+
"hook" : "interaction/runtime/js/index.js",
|
|
19
|
+
"modules" : {
|
|
20
|
+
"##typeIdentifier##/interaction/runtime/js/index" : [
|
|
21
|
+
"interaction/runtime/js/index.js"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
"src" : [
|
|
25
|
+
"./interaction/runtime/js/index.js"
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"creator" : {
|
|
29
|
+
"icon": "./interaction/creator/img/icon.svg",
|
|
30
|
+
"hook": "./imsPciCreator.js",
|
|
31
|
+
"src" : [
|
|
32
|
+
"./imsPciCreator.js",
|
|
33
|
+
"./interaction/creator/tpl/markup.tpl",
|
|
34
|
+
"./interaction/creator/tpl/propertiesForm.tpl",
|
|
35
|
+
"./interaction/creator/widget/Widget.js",
|
|
36
|
+
"./interaction/creator/widget/states/Question.js",
|
|
37
|
+
"./interaction/creator/widget/states/Answer.js",
|
|
38
|
+
"./interaction/creator/widget/states/Correct.js",
|
|
39
|
+
"./interaction/creator/widget/states/states.js"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
42
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
-
<svg xmlns:svg="http://www.w3.org/2000/svg"
|
|
3
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
-
height="28" width="28">
|
|
5
|
-
<g transform="scale(0.88 0.88)">
|
|
6
|
-
<path d="M29.164 10.472c-1.25-0.328-4.189-0.324-8.488-0.438 0.203-0.938 0.25-1.784 0.25-3.286 0-3.588-2.614-6.748-4.926-6.748-1.633 0-2.979 1.335-3 2.977-0.022 2.014-0.645 5.492-4 7.256-0.246 0.13-0.95 0.477-1.053 0.522l0.053 0.045c-0.525-0.453-1.253-0.8-2-0.8h-3c-1.654 0-3 1.346-3 3v16c0 1.654 1.346 3 3 3h3c1.19 0 2.186-0.719 2.668-1.727 0.012 0.004 0.033 0.010 0.047 0.012 0.066 0.018 0.144 0.037 0.239 0.062 0.018 0.005 0.027 0.007 0.046 0.012 0.576 0.143 1.685 0.408 4.055 0.953 0.508 0.116 3.192 0.688 5.972 0.688h5.467c1.666 0 2.867-0.641 3.582-1.928 0.010-0.020 0.24-0.469 0.428-1.076 0.141-0.457 0.193-1.104 0.023-1.76 1.074-0.738 1.42-1.854 1.645-2.58 0.377-1.191 0.264-2.086 0.002-2.727 0.604-0.57 1.119-1.439 1.336-2.766 0.135-0.822-0.010-1.668-0.389-2.372 0.566-0.636 0.824-1.436 0.854-2.176l0.012-0.209c0.007-0.131 0.013-0.212 0.013-0.5 0-1.263-0.875-2.874-2.836-3.434zM7 29c0 0.553-0.447 1-1 1h-3c-0.553 0-1-0.447-1-1v-16c0-0.553 0.447-1 1-1h3c0.553 0 1 0.447 1 1v16zM29.977 14.535c-0.020 0.494-0.227 1.465-1.977 1.465-1.5 0-2 0-2 0-0.277 0-0.5 0.224-0.5 0.5s0.223 0.5 0.5 0.5c0 0 0.438 0 1.938 0s1.697 1.244 1.6 1.844c-0.124 0.746-0.474 2.156-2.163 2.156-1.687 0-2.375 0-2.375 0-0.277 0-0.5 0.223-0.5 0.5 0 0.275 0.223 0.5 0.5 0.5 0 0 1.188 0 1.969 0 1.688 0 1.539 1.287 1.297 2.055-0.319 1.009-0.514 1.945-2.641 1.945-0.719 0-1.631 0-1.631 0-0.277 0-0.5 0.223-0.5 0.5 0 0.275 0.223 0.5 0.5 0.5 0 0 0.693 0 1.568 0 1.094 0 1.145 1.035 1.031 1.406-0.125 0.406-0.273 0.707-0.279 0.721-0.302 0.545-0.789 0.873-1.82 0.873h-5.467c-2.746 0-5.47-0.623-5.54-0.639-4.154-0.957-4.373-1.031-4.634-1.105 0 0-0.846-0.143-0.846-0.881l-0.007-13.812c0-0.469 0.299-0.893 0.794-1.042 0.062-0.024 0.146-0.050 0.206-0.075 4.568-1.892 5.959-6.040 6-9.446 0.006-0.479 0.375-1 1-1 1.057 0 2.926 2.122 2.926 4.748 0 2.371-0.096 2.781-0.926 5.252 10 0 9.93 0.144 10.812 0.375 1.094 0.313 1.188 1.219 1.188 1.531 0 0.343-0.010 0.293-0.023 0.629zM4.5 26c-0.828 0-1.5 0.672-1.5 1.5s0.672 1.5 1.5 1.5 1.5-0.672 1.5-1.5-0.672-1.5-1.5-1.5zM4.5 28c-0.275 0-0.5-0.225-0.5-0.5s0.225-0.5 0.5-0.5 0.5 0.225 0.5 0.5-0.225 0.5-0.5 0.5z"></path>
|
|
7
|
-
</g>
|
|
8
|
-
</svg>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
2
|
+
<svg xmlns:svg="http://www.w3.org/2000/svg"
|
|
3
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
4
|
+
height="28" width="28">
|
|
5
|
+
<g transform="scale(0.88 0.88)">
|
|
6
|
+
<path d="M29.164 10.472c-1.25-0.328-4.189-0.324-8.488-0.438 0.203-0.938 0.25-1.784 0.25-3.286 0-3.588-2.614-6.748-4.926-6.748-1.633 0-2.979 1.335-3 2.977-0.022 2.014-0.645 5.492-4 7.256-0.246 0.13-0.95 0.477-1.053 0.522l0.053 0.045c-0.525-0.453-1.253-0.8-2-0.8h-3c-1.654 0-3 1.346-3 3v16c0 1.654 1.346 3 3 3h3c1.19 0 2.186-0.719 2.668-1.727 0.012 0.004 0.033 0.010 0.047 0.012 0.066 0.018 0.144 0.037 0.239 0.062 0.018 0.005 0.027 0.007 0.046 0.012 0.576 0.143 1.685 0.408 4.055 0.953 0.508 0.116 3.192 0.688 5.972 0.688h5.467c1.666 0 2.867-0.641 3.582-1.928 0.010-0.020 0.24-0.469 0.428-1.076 0.141-0.457 0.193-1.104 0.023-1.76 1.074-0.738 1.42-1.854 1.645-2.58 0.377-1.191 0.264-2.086 0.002-2.727 0.604-0.57 1.119-1.439 1.336-2.766 0.135-0.822-0.010-1.668-0.389-2.372 0.566-0.636 0.824-1.436 0.854-2.176l0.012-0.209c0.007-0.131 0.013-0.212 0.013-0.5 0-1.263-0.875-2.874-2.836-3.434zM7 29c0 0.553-0.447 1-1 1h-3c-0.553 0-1-0.447-1-1v-16c0-0.553 0.447-1 1-1h3c0.553 0 1 0.447 1 1v16zM29.977 14.535c-0.020 0.494-0.227 1.465-1.977 1.465-1.5 0-2 0-2 0-0.277 0-0.5 0.224-0.5 0.5s0.223 0.5 0.5 0.5c0 0 0.438 0 1.938 0s1.697 1.244 1.6 1.844c-0.124 0.746-0.474 2.156-2.163 2.156-1.687 0-2.375 0-2.375 0-0.277 0-0.5 0.223-0.5 0.5 0 0.275 0.223 0.5 0.5 0.5 0 0 1.188 0 1.969 0 1.688 0 1.539 1.287 1.297 2.055-0.319 1.009-0.514 1.945-2.641 1.945-0.719 0-1.631 0-1.631 0-0.277 0-0.5 0.223-0.5 0.5 0 0.275 0.223 0.5 0.5 0.5 0 0 0.693 0 1.568 0 1.094 0 1.145 1.035 1.031 1.406-0.125 0.406-0.273 0.707-0.279 0.721-0.302 0.545-0.789 0.873-1.82 0.873h-5.467c-2.746 0-5.47-0.623-5.54-0.639-4.154-0.957-4.373-1.031-4.634-1.105 0 0-0.846-0.143-0.846-0.881l-0.007-13.812c0-0.469 0.299-0.893 0.794-1.042 0.062-0.024 0.146-0.050 0.206-0.075 4.568-1.892 5.959-6.040 6-9.446 0.006-0.479 0.375-1 1-1 1.057 0 2.926 2.122 2.926 4.748 0 2.371-0.096 2.781-0.926 5.252 10 0 9.93 0.144 10.812 0.375 1.094 0.313 1.188 1.219 1.188 1.531 0 0.343-0.010 0.293-0.023 0.629zM4.5 26c-0.828 0-1.5 0.672-1.5 1.5s0.672 1.5 1.5 1.5 1.5-0.672 1.5-1.5-0.672-1.5-1.5-1.5zM4.5 28c-0.275 0-0.5-0.225-0.5-0.5s0.225-0.5 0.5-0.5 0.5 0.225 0.5 0.5-0.225 0.5-0.5 0.5z"></path>
|
|
7
|
+
</g>
|
|
8
|
+
</svg>
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
<div class="pciInteraction">
|
|
2
|
-
<style>
|
|
3
|
-
.pciInteraction ul.pci{
|
|
4
|
-
list-style-type: none;
|
|
5
|
-
margin: 0 5px;
|
|
6
|
-
padding: 0;
|
|
7
|
-
display: inline-block;
|
|
8
|
-
position: relative;
|
|
9
|
-
top: 7px;
|
|
10
|
-
}
|
|
11
|
-
.pciInteraction ul.pci li{
|
|
12
|
-
float: left;
|
|
13
|
-
text-align: left;
|
|
14
|
-
list-style-type: none;
|
|
15
|
-
}
|
|
16
|
-
</style>
|
|
17
|
-
<div class="prompt">{{{prompt}}}</div>
|
|
18
|
-
<ul class="pci"></ul>
|
|
1
|
+
<div class="pciInteraction">
|
|
2
|
+
<style>
|
|
3
|
+
.pciInteraction ul.pci{
|
|
4
|
+
list-style-type: none;
|
|
5
|
+
margin: 0 5px;
|
|
6
|
+
padding: 0;
|
|
7
|
+
display: inline-block;
|
|
8
|
+
position: relative;
|
|
9
|
+
top: 7px;
|
|
10
|
+
}
|
|
11
|
+
.pciInteraction ul.pci li{
|
|
12
|
+
float: left;
|
|
13
|
+
text-align: left;
|
|
14
|
+
list-style-type: none;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
<div class="prompt">{{{prompt}}}</div>
|
|
18
|
+
<ul class="pci"></ul>
|
|
19
19
|
</div>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<div class="panel">
|
|
2
|
-
<input type="text"
|
|
3
|
-
name="identifier"
|
|
4
|
-
value="{{identifier}}"
|
|
5
|
-
placeholder="e.g. RESPONSE"
|
|
6
|
-
data-validate="$notEmpty; $qtiIdentifier; $availableIdentifier(serial={{serial}});">
|
|
7
|
-
<!-- ##_HTML_CONTROLS_## -->
|
|
1
|
+
<div class="panel">
|
|
2
|
+
<input type="text"
|
|
3
|
+
name="identifier"
|
|
4
|
+
value="{{identifier}}"
|
|
5
|
+
placeholder="e.g. RESPONSE"
|
|
6
|
+
data-validate="$notEmpty; $qtiIdentifier; $availableIdentifier(serial={{serial}});">
|
|
7
|
+
<!-- ##_HTML_CONTROLS_## -->
|
|
8
8
|
</div>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
define([
|
|
2
|
-
'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/Widget',
|
|
3
|
-
'##typeIdentifier##/interaction/creator/widget/states/states'
|
|
4
|
-
], function(Widget, states){
|
|
5
|
-
|
|
6
|
-
var InteractionWidget = Widget.clone();
|
|
7
|
-
|
|
8
|
-
InteractionWidget.initCreator = function(){
|
|
9
|
-
this.registerStates(states);
|
|
10
|
-
|
|
11
|
-
Widget.initCreator.call(this);
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
return InteractionWidget;
|
|
1
|
+
define([
|
|
2
|
+
'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/Widget',
|
|
3
|
+
'##typeIdentifier##/interaction/creator/widget/states/states'
|
|
4
|
+
], function(Widget, states){
|
|
5
|
+
|
|
6
|
+
var InteractionWidget = Widget.clone();
|
|
7
|
+
|
|
8
|
+
InteractionWidget.initCreator = function(){
|
|
9
|
+
this.registerStates(states);
|
|
10
|
+
|
|
11
|
+
Widget.initCreator.call(this);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
return InteractionWidget;
|
|
15
15
|
});
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
define([
|
|
2
|
-
'taoQtiItem/qtiCreator/widgets/states/factory',
|
|
3
|
-
'taoQtiItem/qtiCreator/widgets/interactions/states/Answer',
|
|
4
|
-
'taoQtiItem/qtiCreator/widgets/interactions/helpers/answerState'
|
|
5
|
-
], function(stateFactory, Answer, answerStateHelper){
|
|
6
|
-
|
|
7
|
-
var InteractionStateAnswer = stateFactory.extend(Answer, function(){
|
|
8
|
-
|
|
9
|
-
//forward to one of the available sub state, according to the response processing template
|
|
10
|
-
answerStateHelper.forward(this.widget);
|
|
11
|
-
|
|
12
|
-
}, function(){
|
|
13
|
-
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
InteractionStateAnswer.prototype.initResponseForm = function initResponseForm() {
|
|
17
|
-
answerStateHelper.initResponseForm(
|
|
18
|
-
this.widget,
|
|
19
|
-
{
|
|
20
|
-
rpTemplates: ['###_RD_TEMPLATES_###'],
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
return InteractionStateAnswer;
|
|
26
|
-
});
|
|
1
|
+
define([
|
|
2
|
+
'taoQtiItem/qtiCreator/widgets/states/factory',
|
|
3
|
+
'taoQtiItem/qtiCreator/widgets/interactions/states/Answer',
|
|
4
|
+
'taoQtiItem/qtiCreator/widgets/interactions/helpers/answerState'
|
|
5
|
+
], function(stateFactory, Answer, answerStateHelper){
|
|
6
|
+
|
|
7
|
+
var InteractionStateAnswer = stateFactory.extend(Answer, function(){
|
|
8
|
+
|
|
9
|
+
//forward to one of the available sub state, according to the response processing template
|
|
10
|
+
answerStateHelper.forward(this.widget);
|
|
11
|
+
|
|
12
|
+
}, function(){
|
|
13
|
+
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
InteractionStateAnswer.prototype.initResponseForm = function initResponseForm() {
|
|
17
|
+
answerStateHelper.initResponseForm(
|
|
18
|
+
this.widget,
|
|
19
|
+
{
|
|
20
|
+
rpTemplates: ['###_RD_TEMPLATES_###'],
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return InteractionStateAnswer;
|
|
26
|
+
});
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
define([
|
|
2
|
-
"taoQtiItem/qtiCreator/widgets/states/factory",
|
|
3
|
-
"taoQtiItem/qtiCreator/widgets/interactions/states/Correct",
|
|
4
|
-
"lodash",
|
|
5
|
-
], function (stateFactory, Correct, _) {
|
|
6
|
-
var InteractionStateCorrect = stateFactory.create(
|
|
7
|
-
Correct,
|
|
8
|
-
function () {
|
|
9
|
-
var widget = this.widget;
|
|
10
|
-
var interaction = widget.element;
|
|
11
|
-
var responseDeclaration = interaction.getResponseDeclaration();
|
|
12
|
-
var correct = _.values(responseDeclaration.getCorrect());
|
|
13
|
-
// show correct response in the pci.
|
|
14
|
-
if (correct && typeof correct[0] !== "undefined") {
|
|
15
|
-
interaction?.setResponse && interaction.setResponse({ base: { string: correct[0] } });
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
function () {
|
|
19
|
-
var widget = this.widget;
|
|
20
|
-
var interaction = widget.element;
|
|
21
|
-
var responseDeclaration = interaction.getResponseDeclaration();
|
|
22
|
-
var correct = interaction && interaction.getResponse ? interaction.getResponse() : undefined;
|
|
23
|
-
var correctString = '';
|
|
24
|
-
if (correct !== undefined && correct.base) {
|
|
25
|
-
if (correct.base.string !== null && (correct.base.string !== undefined)) {
|
|
26
|
-
correctString = correct.base.string;
|
|
27
|
-
} else if (correct.base.integer !== null && (correct.base.integer !== undefined)) {
|
|
28
|
-
correctString = correct.base.integer;
|
|
29
|
-
} else if (correct.base.boolean !== null && (correct.base.boolean !== undefined)) {
|
|
30
|
-
correctString = correct.base.boolean;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// getResponse
|
|
35
|
-
// var correct = _.values(responseDeclaration.getCorrect());
|
|
36
|
-
responseDeclaration.setCorrect(correctString);
|
|
37
|
-
|
|
38
|
-
interaction.resetResponse();
|
|
39
|
-
interaction.offPci(".question");
|
|
40
|
-
}
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
return InteractionStateCorrect;
|
|
44
|
-
});
|
|
1
|
+
define([
|
|
2
|
+
"taoQtiItem/qtiCreator/widgets/states/factory",
|
|
3
|
+
"taoQtiItem/qtiCreator/widgets/interactions/states/Correct",
|
|
4
|
+
"lodash",
|
|
5
|
+
], function (stateFactory, Correct, _) {
|
|
6
|
+
var InteractionStateCorrect = stateFactory.create(
|
|
7
|
+
Correct,
|
|
8
|
+
function () {
|
|
9
|
+
var widget = this.widget;
|
|
10
|
+
var interaction = widget.element;
|
|
11
|
+
var responseDeclaration = interaction.getResponseDeclaration();
|
|
12
|
+
var correct = _.values(responseDeclaration.getCorrect());
|
|
13
|
+
// show correct response in the pci.
|
|
14
|
+
if (correct && typeof correct[0] !== "undefined") {
|
|
15
|
+
interaction?.setResponse && interaction.setResponse({ base: { string: correct[0] } });
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
function () {
|
|
19
|
+
var widget = this.widget;
|
|
20
|
+
var interaction = widget.element;
|
|
21
|
+
var responseDeclaration = interaction.getResponseDeclaration();
|
|
22
|
+
var correct = interaction && interaction.getResponse ? interaction.getResponse() : undefined;
|
|
23
|
+
var correctString = '';
|
|
24
|
+
if (correct !== undefined && correct.base) {
|
|
25
|
+
if (correct.base.string !== null && (correct.base.string !== undefined)) {
|
|
26
|
+
correctString = correct.base.string;
|
|
27
|
+
} else if (correct.base.integer !== null && (correct.base.integer !== undefined)) {
|
|
28
|
+
correctString = correct.base.integer;
|
|
29
|
+
} else if (correct.base.boolean !== null && (correct.base.boolean !== undefined)) {
|
|
30
|
+
correctString = correct.base.boolean;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// getResponse
|
|
35
|
+
// var correct = _.values(responseDeclaration.getCorrect());
|
|
36
|
+
responseDeclaration.setCorrect(correctString);
|
|
37
|
+
|
|
38
|
+
interaction.resetResponse();
|
|
39
|
+
interaction.offPci(".question");
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
|
|
43
|
+
return InteractionStateCorrect;
|
|
44
|
+
});
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
define([
|
|
2
|
-
'taoQtiItem/qtiCreator/widgets/states/factory',
|
|
3
|
-
'taoQtiItem/qtiCreator/widgets/interactions/states/Question',
|
|
4
|
-
'taoQtiItem/qtiCreator/widgets/helpers/formElement',
|
|
5
|
-
'tpl!##typeIdentifier##/interaction/creator/tpl/propertiesForm',
|
|
6
|
-
'tpl!taoQtiItem/qtiCreator/tpl/notifications/widgetOverlay'
|
|
7
|
-
], function(stateFactory, Question, formElement, formTpl, overlayTpl){
|
|
8
|
-
;
|
|
9
|
-
var InteractionStateQuestion = stateFactory.extend(Question, function(){
|
|
10
|
-
|
|
11
|
-
//add transparent protective layer
|
|
12
|
-
this.widget.$container.append(overlayTpl());
|
|
13
|
-
|
|
14
|
-
}, function(){
|
|
15
|
-
|
|
16
|
-
//remove transparent protective layer
|
|
17
|
-
this.widget.$container.children('.overlay').remove();
|
|
18
|
-
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
InteractionStateQuestion.prototype.initForm = function(){
|
|
22
|
-
|
|
23
|
-
var _widget = this.widget,
|
|
24
|
-
$form = _widget.$form,
|
|
25
|
-
interaction = _widget.element,
|
|
26
|
-
response = interaction.getResponseDeclaration();
|
|
27
|
-
// ##__DECLARE_VARIABLES__##
|
|
28
|
-
|
|
29
|
-
//render the form using the form template
|
|
30
|
-
$form.html(formTpl({
|
|
31
|
-
serial : response.serial,
|
|
32
|
-
identifier : interaction.attr('responseIdentifier'),
|
|
33
|
-
// ##__SET_VARIABLES__##
|
|
34
|
-
}));
|
|
35
|
-
|
|
36
|
-
//init form javascript
|
|
37
|
-
formElement.initWidget($form);
|
|
38
|
-
|
|
39
|
-
//init data change callbacks
|
|
40
|
-
formElement.setChangeCallbacks($form, interaction, {
|
|
41
|
-
identifier : function(i, value){
|
|
42
|
-
response.id(value);
|
|
43
|
-
interaction.attr('responseIdentifier', value);
|
|
44
|
-
},
|
|
45
|
-
// ##__CALLBACK__##
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
return InteractionStateQuestion;
|
|
51
|
-
});
|
|
1
|
+
define([
|
|
2
|
+
'taoQtiItem/qtiCreator/widgets/states/factory',
|
|
3
|
+
'taoQtiItem/qtiCreator/widgets/interactions/states/Question',
|
|
4
|
+
'taoQtiItem/qtiCreator/widgets/helpers/formElement',
|
|
5
|
+
'tpl!##typeIdentifier##/interaction/creator/tpl/propertiesForm',
|
|
6
|
+
'tpl!taoQtiItem/qtiCreator/tpl/notifications/widgetOverlay'
|
|
7
|
+
], function(stateFactory, Question, formElement, formTpl, overlayTpl){
|
|
8
|
+
;
|
|
9
|
+
var InteractionStateQuestion = stateFactory.extend(Question, function(){
|
|
10
|
+
|
|
11
|
+
//add transparent protective layer
|
|
12
|
+
this.widget.$container.append(overlayTpl());
|
|
13
|
+
|
|
14
|
+
}, function(){
|
|
15
|
+
|
|
16
|
+
//remove transparent protective layer
|
|
17
|
+
this.widget.$container.children('.overlay').remove();
|
|
18
|
+
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
InteractionStateQuestion.prototype.initForm = function(){
|
|
22
|
+
|
|
23
|
+
var _widget = this.widget,
|
|
24
|
+
$form = _widget.$form,
|
|
25
|
+
interaction = _widget.element,
|
|
26
|
+
response = interaction.getResponseDeclaration();
|
|
27
|
+
// ##__DECLARE_VARIABLES__##
|
|
28
|
+
|
|
29
|
+
//render the form using the form template
|
|
30
|
+
$form.html(formTpl({
|
|
31
|
+
serial : response.serial,
|
|
32
|
+
identifier : interaction.attr('responseIdentifier'),
|
|
33
|
+
// ##__SET_VARIABLES__##
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
//init form javascript
|
|
37
|
+
formElement.initWidget($form);
|
|
38
|
+
|
|
39
|
+
//init data change callbacks
|
|
40
|
+
formElement.setChangeCallbacks($form, interaction, {
|
|
41
|
+
identifier : function(i, value){
|
|
42
|
+
response.id(value);
|
|
43
|
+
interaction.attr('responseIdentifier', value);
|
|
44
|
+
},
|
|
45
|
+
// ##__CALLBACK__##
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
return InteractionStateQuestion;
|
|
51
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
define([
|
|
2
|
-
'taoQtiItem/qtiCreator/widgets/states/factory',
|
|
3
|
-
'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/states/states',
|
|
4
|
-
'##typeIdentifier##/interaction/creator/widget/states/Question',
|
|
5
|
-
'##typeIdentifier##/interaction/creator/widget/states/Answer',
|
|
6
|
-
'##typeIdentifier##/interaction/creator/widget/states/Correct'
|
|
7
|
-
], function(factory, states){
|
|
8
|
-
return factory.createBundle(states, arguments, ['map']);
|
|
1
|
+
define([
|
|
2
|
+
'taoQtiItem/qtiCreator/widgets/states/factory',
|
|
3
|
+
'taoQtiItem/qtiCreator/widgets/interactions/customInteraction/states/states',
|
|
4
|
+
'##typeIdentifier##/interaction/creator/widget/states/Question',
|
|
5
|
+
'##typeIdentifier##/interaction/creator/widget/states/Answer',
|
|
6
|
+
'##typeIdentifier##/interaction/creator/widget/states/Correct'
|
|
7
|
+
], function(factory, states){
|
|
8
|
+
return factory.createBundle(states, arguments, ['map']);
|
|
9
9
|
});
|
package/types/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
export interface TAOpci {
|
|
2
|
-
on: (value) => void; // TAO specific
|
|
3
|
-
off: () => void; // else TAO gave a javascript error
|
|
4
|
-
|
|
5
|
-
resetResponse?: () => void;
|
|
6
|
-
setResponse?: (response) => void;
|
|
7
|
-
trigger?: (event: string, value: any) => void;
|
|
8
|
-
// All below are specific to TAO items, looks like we do not have to use them, keeping for ref
|
|
9
|
-
/*
|
|
10
|
-
gettypeIdentifier?: () => string;
|
|
11
|
-
initialize?: (id, dom, config, assetManager) => void;
|
|
12
|
-
trigger?: (event: string, value: any) => void;
|
|
13
|
-
resetResponse?: () => void;
|
|
14
|
-
setResponse?: (response) => void;
|
|
15
|
-
setSerializedState?: (serializedState) => void;
|
|
16
|
-
getSerializedState?: () => string;
|
|
17
|
-
*/
|
|
1
|
+
export interface TAOpci {
|
|
2
|
+
on: (value) => void; // TAO specific
|
|
3
|
+
off: () => void; // else TAO gave a javascript error
|
|
4
|
+
|
|
5
|
+
resetResponse?: () => void;
|
|
6
|
+
setResponse?: (response) => void;
|
|
7
|
+
trigger?: (event: string, value: any) => void;
|
|
8
|
+
// All below are specific to TAO items, looks like we do not have to use them, keeping for ref
|
|
9
|
+
/*
|
|
10
|
+
gettypeIdentifier?: () => string;
|
|
11
|
+
initialize?: (id, dom, config, assetManager) => void;
|
|
12
|
+
trigger?: (event: string, value: any) => void;
|
|
13
|
+
resetResponse?: () => void;
|
|
14
|
+
setResponse?: (response) => void;
|
|
15
|
+
setSerializedState?: (serializedState) => void;
|
|
16
|
+
getSerializedState?: () => string;
|
|
17
|
+
*/
|
|
18
18
|
}
|