Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Iss975 #1206

Open
wants to merge 338 commits into
base: iss975
Choose a base branch
from
Open

Iss975 #1206

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
338 commits
Select commit Hold shift + click to select a range
cd5fcb1
Toggle Button
Jul 12, 2023
464a24d
Toggle Button
Jul 12, 2023
55db51a
Toggle Button
Jul 12, 2023
be1b34d
Toggle Button
Jul 12, 2023
ea715d1
Toggle Button with Text
Jul 12, 2023
d0cf96b
Toggle Button with Text
Jul 12, 2023
7b9956f
Toggle Button with Text
Jul 12, 2023
5983747
Toggle Button without Text
Jul 12, 2023
bcb00d5
Clickme Button Style
Jul 12, 2023
324c421
Clickme Button Style
Jul 12, 2023
3da2a6f
Clickme Button Style
Jul 12, 2023
aff289c
Clickme Button Style
Jul 12, 2023
23b1281
Clickme Button Style
Jul 12, 2023
6203f96
Clickme Button Style
Jul 12, 2023
a74e820
Clickme Button Style
Jul 12, 2023
f24e1a8
Toggle Button Style
Jul 12, 2023
103b4eb
Toggle Button Style
Jul 12, 2023
c1bcf01
Toggle Button Style
Jul 12, 2023
9a9d591
Toggle Button Style
Jul 12, 2023
a1bf0a0
Toggle Button Style
Jul 12, 2023
2478352
Toggle Button Style
Jul 13, 2023
e5403d6
Toggle Button Style
Jul 13, 2023
d436e83
Toggle Button Style
Jul 13, 2023
632fbf4
Toggle Button Style
Jul 13, 2023
2413694
Toggle Button Style
Jul 13, 2023
9492c8f
Changed class-name's and add some comments to boolean.class
Jul 16, 2023
c33e825
Added displaystyle and buttontiles to install.xml and upgrade.php
Jul 30, 2023
3664d2a
Changed version number in upgrade.php
Jul 30, 2023
0b44869
Comment out displaytype and buttontitles
Jul 30, 2023
1fe84fe
Set displaystyle and buttontitles before mustverify in DB
Jul 30, 2023
9d499d4
Add displaytype/buttontiles to DB after checkanswertype
Jul 30, 2023
56a3113
Version number updated of DB
Jul 30, 2023
515659b
Version number updated of DB again, because does not apply the change
Jul 30, 2023
171d63e
Changed displaystyle type to int
Jul 30, 2023
2454655
Back to ld versionnumber 20230421
Jul 30, 2023
2c20034
Comment out Iframe
Jul 31, 2023
d9ab340
Checkbox for saving state of adaptbutton
Aug 3, 2023
c9a265d
comment out 'is_clicked' variable in adaptbutton
Aug 3, 2023
3c50224
add console.log for test
Aug 3, 2023
89e7096
fixed error: SyntaxError: Expected ';'
Aug 3, 2023
9570f62
fix error: checkbox after clicked button setting true
Aug 3, 2023
c3c1574
fix error: setting const for checkbox-elem
Aug 3, 2023
104a8c5
deleting number in checkbox-button var
Aug 3, 2023
1e8cd71
setting checkbox true after button onclick
Aug 3, 2023
ea8c20d
setting visibility: hidden in checkbox
Aug 3, 2023
7ea7fb0
switching position of button and input
Aug 3, 2023
2c14ed1
fix error: missed point in onclick
Aug 3, 2023
9c88293
fix error DOM
Aug 3, 2023
5413aec
change postion of onclick
Aug 3, 2023
5cb4354
fix error: forgetting ';'
Aug 3, 2023
530ab66
count how many times button was clicked
Aug 3, 2023
69c89c6
id changed to number-adaptbutton
Aug 3, 2023
9bc581e
Button state saved in ans1
Aug 5, 2023
d60b767
Forget semicolon
Aug 5, 2023
5c6aeec
Button state saved in ans1 in a iframe
Aug 5, 2023
5f60b6f
Debuggen: comment out button
Aug 6, 2023
8408efe
Debuggen: setting output for testing
Aug 6, 2023
2d5a6b9
Debuggen: without iframe
Aug 6, 2023
80d6866
Output 'true' in function
Aug 6, 2023
deecdd4
'newline' in function
Aug 6, 2023
9ee48ce
script type module
Aug 6, 2023
249ef44
console.log id of input
Aug 6, 2023
b986f73
debug: console.log in request_access_to_input
Aug 6, 2023
a5e00f8
trying it again with an iframe
Aug 7, 2023
72224b9
Debug: problem with stackjsiframe link
Aug 7, 2023
ddaaf4b
address input via onclick
Aug 7, 2023
b3363da
update version
Aug 7, 2023
83d8a9a
update version to current date 2023080700
Aug 7, 2023
d72feaf
save displaytype and buttontitles in input question
Aug 9, 2023
ef68d58
function get displaytype options
Aug 9, 2023
2354bd2
created setting for displaytype
Aug 9, 2023
cc07eaf
created setting for displaytype
Aug 9, 2023
a2eeea6
created an input.md and string in qtype_stack for displaytype
Aug 9, 2023
2621d66
created an input.md and string in qtype_stack for buttontitles
Aug 9, 2023
d9d3fdf
Adding x and y to the db via questiontype.php
Aug 9, 2023
f999ace
Adding displaytype and buttontitles as params to inputdata
Aug 9, 2023
a6bdcfb
Adding displaytype and buttontitles in moodle-xml
Aug 9, 2023
bb34260
formform displaytype and buttontitles for moodle-xml if missing
Aug 9, 2023
00fb231
adding displaytype and buttontitles to backup qtype stack
Aug 9, 2023
f556f3e
adding displaytype and buttontitles to factory class
Aug 9, 2023
64114e5
changing the default of displaytype
Aug 9, 2023
25ffa5e
changing the default of displaytype
Aug 9, 2023
4777396
upgrade the version
Aug 9, 2023
ddb7781
adding displaytype and buttontitles to param default of boolean
Aug 9, 2023
34286d0
Corrected: Spelling of the attributes
Aug 9, 2023
53f3c89
console.log for displayType and buttonTitles
Aug 10, 2023
78b93f6
forget ';'
Aug 10, 2023
4539fd7
console.log wasnt a string
Aug 10, 2023
3abafab
switching the displaystyles
Aug 10, 2023
675048c
add default style to switch
Aug 10, 2023
ee874c2
hide select menu for togglebutton to debug
Aug 10, 2023
2bacfd2
add class and style to the div parent of toggel-button
Aug 10, 2023
203ef87
remove class of label input
Aug 10, 2023
4c15736
add a class of label input
Aug 10, 2023
3bcbb98
changed the string for onclick
Aug 10, 2023
6dab7a4
back to previous string
Aug 10, 2023
fb6a38f
back to previous string
Aug 10, 2023
8179d53
changed the html_writer
Aug 10, 2023
7599ad0
trying to give the toggle-button a text
Aug 10, 2023
7b273ed
get buttontitles and set it
Aug 10, 2023
9774b3c
try to center button wit input in style
Aug 10, 2023
a13b7a2
new transform value for centering
Aug 10, 2023
15e5b91
new value in input
Aug 13, 2023
6cdf5f4
wrong code in jsxgraph
Aug 13, 2023
c6baccb
test qaid print in console
Aug 13, 2023
e024ed2
without config.php
Aug 13, 2023
18f4166
correting path of config.php
Aug 13, 2023
db15f42
correct path of config.php
Aug 13, 2023
7dc3d8a
correct path of vle_specific.php
Aug 13, 2023
197f13e
comment out the use of question_engine_data_mapper
Aug 13, 2023
6f8a626
trying access to input with dispatch
Aug 16, 2023
ea66ecb
delete the config for button-iframe
Aug 16, 2023
3432b4f
new config for ifram-button
Aug 16, 2023
430fa97
debug: missing )
Aug 16, 2023
80a81f1
debug: switched ) and }
Aug 16, 2023
d5949a1
linebreaks and new config for iframe-button
Aug 17, 2023
4b785a7
minimize stackjsiframe with button config
Aug 17, 2023
f45a737
changed comment for button var
Aug 17, 2023
c61575c
link to not minifyed iframe
Aug 17, 2023
ea567e1
changing the button id
Aug 17, 2023
f5c7d71
toggle-button with text
Aug 20, 2023
13bedbd
toggle-button width
Aug 20, 2023
d64fff1
toggle-button without dropdown, click me button dropdown disabled
Aug 20, 2023
01124fe
click me select new style
Aug 20, 2023
9ffc7ca
click me select style background und text color
Aug 20, 2023
96c5a0b
click me select style background color white
Aug 20, 2023
eea9fb4
custom-select background-color
Aug 20, 2023
e5be8f1
try override custom-select background-color
Aug 20, 2023
e7257d2
just hide the select
Aug 20, 2023
5490818
just hide the select
Aug 20, 2023
527b731
NA style for toggle
Aug 20, 2023
c67bd0a
toggle button checking classList
Aug 20, 2023
8bd6e16
toggle button style new background color if NA
Aug 20, 2023
a3aa0e4
lighter color for background
Aug 20, 2023
0b4fb8a
new style for NA clickme button
Aug 20, 2023
923f7b2
forgetting quotation marks
Aug 20, 2023
dd124ec
clickme without extra script
Aug 20, 2023
5f4e085
some sorting
Aug 20, 2023
1db89e4
Testing if stackjsvle takes changes
Aug 20, 2023
7f1b8f0
correct var buttons event
Aug 22, 2023
a934425
value true if button clicked in iframe
Aug 22, 2023
b6ddb8c
changed corslink
Aug 22, 2023
21ff52d
request button in request input
Aug 22, 2023
14f4a05
delet debug console log
Aug 22, 2023
5378296
button with toggle_visibility
Aug 22, 2023
5b24064
hide false and show true
Aug 22, 2023
cd8eada
try with counting button clicks
Aug 22, 2023
fd8868a
var counter
Aug 22, 2023
78a8ba5
button iframe finished
Aug 22, 2023
c4d308b
button iframe button listener
Aug 22, 2023
27d80c9
Auswahl and Matrix in Input type selection
Aug 24, 2023
1bb8548
displaytype just for boolean
Aug 24, 2023
3e96589
typo in auswahltype
Aug 24, 2023
d402490
delet the classes of the options for auswahla and
Aug 29, 2023
1127fd1
also delet radio because of errors
Aug 29, 2023
108cc8a
add auswahl.class.php for input
Aug 29, 2023
1dc7dad
add matrix.class for input
Aug 29, 2023
94530a2
comment out matrix string
Aug 29, 2023
231d478
protected ddltype select
Aug 30, 2023
14d96c6
dynamic ddltype
Aug 30, 2023
e4d39bf
new ddltype
Aug 30, 2023
0def995
if for check if button was already clicked
Aug 30, 2023
366deb3
add function for hide/show
Aug 30, 2023
30a4f97
function for get ddltype or ddldisplay
Aug 30, 2023
3b7f0f2
error if save_state is not set
Aug 30, 2023
4c07b97
auswahl.class with option radio,checkbox,dropdown
Aug 30, 2023
3fec7ad
debug: not find key
Aug 30, 2023
3f8619a
echo for debug
Aug 30, 2023
9aaa2d9
echo ddltype for debug
Aug 30, 2023
f029c80
error output ddletype
Aug 30, 2023
342fdcd
same name for all radio options
Sep 5, 2023
7305966
adding the params to input, comment out errorexcep
Sep 5, 2023
4129e9b
do nothing if checkbox has '' as a key
Sep 5, 2023
6c54fc7
not check key also for type
Sep 5, 2023
3451224
output name of key in error
Sep 5, 2023
58785cc
comment out change nul value of key
Sep 5, 2023
4b5ae2a
check if key_order happens before get_input
Sep 5, 2023
90ab7d7
check if key_order orders for checkbox
Sep 5, 2023
e93b3d3
check if var istpassiert is still true
Sep 5, 2023
cdf80a8
check if istpassiert
Sep 5, 2023
42c8dd2
check if if condition array_key istpassiert
Sep 5, 2023
0c18f04
catch key 0 in checkbox
Sep 5, 2023
11c4805
stack_exception not for checkbox
Sep 5, 2023
94f376e
Key_order for content
Sep 5, 2023
5eb3508
again: stack_exception not for checkbox
Sep 5, 2023
775e56e
added some functions for var matrix
Sep 5, 2023
ad908ca
Matrix with var
Sep 12, 2023
8cbb63d
if for fix size
Sep 12, 2023
2861832
completed class matrix for fixed or variable size
Sep 12, 2023
89f004c
changed attribute name auswahl to choice
Sep 26, 2023
21c4a75
rename inputtype auswahl to choice
Sep 26, 2023
b676234
hide some options if its input choice
Sep 26, 2023
58948a9
add the new types to input.md doc
Sep 26, 2023
c9f8add
finished adaptblock with iframe
Sep 26, 2023
d5362aa
finished boolean,matrix and choice class
Sep 26, 2023
6deef3c
also version number
Sep 26, 2023
2ce9338
Merge branch 'dev' into truefalsebutton
Oct 10, 2023
c82a616
issue foreach in 102
Oct 11, 2023
74dcd75
issue with foreach in is_blank
Oct 11, 2023
8b75bea
merge matrix row and padrow 182
Oct 11, 2023
7dcd719
Merge branch 'dev' into adaptblock
Oct 11, 2023
31d6cad
add 'qtype_stack/stackjsvle' to define
Oct 13, 2023
9de449f
Merge branch 'adaptblock' into truefalsebutton
Oct 13, 2023
98571ce
add readonly attrib to the diffrent displaytypes
Oct 13, 2023
7e3f4c1
delete string for old input classes
Oct 16, 2023
75ef700
button displays what has been pressed
Oct 23, 2023
6746be7
error with no-answer class
Oct 23, 2023
7ecb35b
script without CData
Oct 24, 2023
43336b7
html_writer tag for script
Oct 24, 2023
55488be
onclick without function
Oct 24, 2023
469ef39
new id for button
Oct 24, 2023
1286685
adapt new changes to toogle button
Oct 24, 2023
deff7c4
typo in getElement
Oct 24, 2023
c4a5d1e
if button is disabled it should not be hoverable
Oct 24, 2023
7fae01f
fix wrong id for toggle button
Oct 24, 2023
a833b37
new changes for toggle button
Oct 24, 2023
dcd83b6
issue no-anser class still not removed
Oct 24, 2023
8442d62
togglebutton checked selected value
Oct 24, 2023
83739d1
new documentation for adaptblock and matrixclass
Oct 24, 2023
2686416
adaptauto with multi ids
Oct 31, 2023
211045e
Merge branch 'truefalsebutton' into adaptblock
Nov 7, 2023
cb8a451
little iframe for adaptauto
Nov 7, 2023
effc3ef
adaptauto doc (with multi ids)
Nov 7, 2023
c5a2704
little iframe for adaptauto (doesnt work)
Nov 7, 2023
ee5fd43
test: outside of iframe block
Nov 7, 2023
57c67f5
add script to test
Nov 7, 2023
b2c7cbc
script in block for test
Nov 7, 2023
fe3d42d
test
Nov 8, 2023
a90621c
new adaptauto doc
Nov 8, 2023
520b6d8
new test with iframe
Nov 8, 2023
d1d37da
adaptauto multi ids
Nov 14, 2023
caabcd1
correct ids
Nov 14, 2023
63adcf6
new default for buttontitles
Nov 15, 2023
4356eef
adaptbutton with iframe counter and new adaptauto iframe
Nov 15, 2023
45c9ad5
Merge branch 'adaptblock' of https://gitlab.ruhr-uni-bochum.de/kallwm…
Nov 15, 2023
74b7e2d
changed postprocess func for adapt blocks
Nov 24, 2023
3724d63
some changes in adaptauto
Nov 24, 2023
bc76d68
get request to input
Nov 24, 2023
23c2a9e
new test adaptautonew
Nov 24, 2023
6302120
new adaptauto
Nov 24, 2023
ff56a1d
Merge branch 'devrub' into adaptblock
Apr 28, 2024
7ceb894
update adaptbutton with new button iframe
Apr 28, 2024
72ccece
Documentaion to resolve issue #1202: factor list and unary minus.
sangwinc Jun 7, 2024
cea7bd2
Update the docs.
sangwinc Jun 7, 2024
5666f3f
Clarify the status of the windows option in the docs.
sangwinc Jun 3, 2024
cf5a15f
Update Languages.md
anst-i Jun 11, 2024
b1201d5
Code tidy.
sangwinc Jun 11, 2024
34ba8c9
Merge remote-tracking branch 'origin/dev' into dev
sangwinc Jun 12, 2024
711dd4f
Merge branch 'dev' of https://github.com/m-r-k/moodle-qtype_stack int…
Jun 16, 2024
c1cadfc
Merge remote-tracking branch 'adapt-external/adaptblock' into iss975
Jun 16, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
36 changes: 36 additions & 0 deletions amd/build/stackjsvle.min.js~devrub
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
* A javascript module to handle separation of author sourced scripts into
* IFRAMES. All such scripts will have limited access to the actual document
* on the VLE side and this script represents the VLE side endpoint for
* message handling needed to give that access. When porting STACK onto VLEs
* one needs to map this script to do the following:
*
* 1. Ensure that searches for target elements/inputs are limited to questions
* or their feedback and do not return any elements outside them.
*
* 2. Map any identifiers needed to identify inputs by name.
*
* 3. Any change handling related to input value modifications through this
* logic gets connected to any such handling on the VLE side.
*
*
* This script is intenttionally ordered so that the VLE specific bits should
* be at the top.
*
*
* This script assumes the following:
*
* 1. Each relevant IFRAME has an `id`-attribute that will be told to this
* script.
*
* 2. Each such IFRAME exists within the question content itself, so that
* one can traverse up the DOM tree from that IFRAME to find the border of
* the question.
*
* @module qtype_stack/stackjsvle
* @copyright 2023 Aalto University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("qtype_stack/stackjsvle",["core_filters/events"],(function(CustomEvents){let IFRAMES={},INPUTS={},INPUTS_INPUT_EVENT={},DISABLE_CHANGES=!1;function vle_get_element(id){let candidate=document.getElementById(id),iter=candidate;for(;iter&&!iter.classList.contains("formulation")&&!iter.classList.contains("outcome");)iter=iter.parentElement;return iter&&(iter.classList.contains("formulation")||iter.classList.contains("outcome"))?candidate:null}function vle_get_input_element(name,srciframe,outside){void 0===outside&&(outside=!0);let iter=document.getElementById(srciframe);for(;iter&&!iter.classList.contains("formulation")&&!iter.classList.contains("outcome");)iter=iter.parentElement;if(iter&&(iter.classList.contains("formulation")||iter.classList.contains("outcome"))){let possible=iter.querySelector('input[id$="_'+name+'"]');if(null!==possible)return possible;if(possible=iter.querySelector('textarea[id$="_'+name+'"]'),null!==possible)return possible;if(possible=iter.querySelector('input[id$="_'+name+'_1"][type=radio]'),null!==possible)return possible;if(possible=iter.querySelector('input[id$="_'+name+'_1"][type=checkbox]'),null!==possible)return possible;if(possible=iter.querySelector('select[id$="_'+name+'"]'),null!==possible)return possible}if(!outside)return null;let possible=document.querySelector('.formulation input[id$="_'+name+'"]');return null!==possible?possible:(possible=document.querySelector('.formulation textarea[id$="_'+name+'"]'),null!==possible?possible:(possible=document.querySelector('.formulation input[id$="_'+name+'_1"][type=radio]'),null!==possible?possible:(possible=document.querySelector('.formulation input[id$="_'+name+'_1"][type=checkbox]'),null!==possible?possible:(possible=document.querySelector('.formulation select[id$="_'+name+'"]'),null!==possible?possible:(possible=document.querySelector('.outcome input[id$="_'+name+'"]'),null!==possible?possible:(possible=document.querySelector('.outcome textarea[id$="_'+name+'"]'),null!==possible||(possible=document.querySelector('.outcome select[id$="_'+name+'"]')),possible))))))}function vle_get_others_of_same_input_group(input){return"radio"===input.type?document.querySelectorAll(".formulation input[name="+CSS.escape(input.name)+"]"):input.name.startsWith("q")&&input.name.indexOf(":")>-1&&input.name.endsWith("_1")?document.querySelectorAll(".formulation input[name^="+CSS.escape(input.name.substring(0,input.name.length-1))+"]"):document.querySelectorAll(".formulation input[name="+CSS.escape(input.name)+"]")}function vle_get_submit_button(srciframe){let iter=document.getElementById(srciframe);for(;iter&&!iter.classList.contains("formulation");)iter=iter.parentElement;if(iter&&iter.classList.contains("formulation")){return iter.querySelector('input[id$="-submit"][type=submit]')}return null}function vle_update_input(inputelement){const c=new Event("change");inputelement.dispatchEvent(c);const i=new Event("input");if(inputelement.dispatchEvent(i),"radio"===inputelement.type||"checkbox"===inputelement.type){const k=new Event("click");inputelement.dispatchEvent(k)}}function vle_update_dom(modifiedsubtreerootelement){CustomEvents.notifyFilterContentUpdated(modifiedsubtreerootelement)}function is_evil_attribute(name,value){const lcname=name.toLowerCase();if(lcname.startsWith("on"))return!0;if("src"===lcname||lcname.endsWith("href")){const lcvalue=value.replace(/\s+/g,"").toLowerCase();if(lcvalue.includes("javascript:")||lcvalue.includes("data:text"))return!0}return!1}return window.addEventListener("message",(e=>{if(!("string"==typeof e.data||e.data instanceof String))return;let msg=null;try{msg=JSON.parse(e.data)}catch(e){return}if(!("version"in msg)||!msg.version.startsWith("STACK-JS"))return;if(!("src"in msg&&"type"in msg&&msg.src in IFRAMES))return;let element=null,input=null,response={version:"STACK-JS:1.3.0"};switch(msg.type){case"register-input-listener":if(input=vle_get_input_element(msg.name,msg.src,!msg["limit-to-question"]),null===input)return response.type="error",response.msg='Failed to connect to input: "'+msg.name+'"',response.tgt=msg.src,void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*");if(response.type="initial-input",response.name=msg.name,response.tgt=msg.src,"select"===input.nodeName.toLowerCase()?(response.value=input.value,response["input-type"]="select",response["input-readonly"]=input.hasAttribute("disabled")):"textarea"===input.nodeName.toLowerCase()?(response.value=input.value,response["input-type"]="textarea",response["input-readonly"]=input.hasAttribute("disabled")):"checkbox"===input.type?(response.value=input.checked,response["input-type"]="checkbox",response["input-readonly"]=input.hasAttribute("disabled")):(response.value=input.value,response["input-type"]=input.type,response["input-readonly"]=input.hasAttribute("readonly")),"radio"===input.type){response["input-readonly"]=input.hasAttribute("disabled"),response.value="";for(let inp of document.querySelectorAll("input[type=radio][name="+CSS.escape(input.name)+"]"))inp.checked&&(response.value=inp.value)}if(input.id in INPUTS){if(msg.src in INPUTS[input.id])return;if("radio"!==input.type)INPUTS[input.id].push(msg.src);else{let radgroup=document.querySelectorAll("input[type=radio][name="+CSS.escape(input.name)+"]");for(let inp of radgroup)INPUTS[inp.id].push(msg.src)}}else{if("radio"!==input.type)INPUTS[input.id]=[msg.src];else{let radgroup=document.querySelectorAll("input[type=radio][name="+CSS.escape(input.name)+"]");for(let inp of radgroup)INPUTS[inp.id]=[msg.src]}if("radio"!==input.type)input.addEventListener("change",(()=>{if(DISABLE_CHANGES)return;let resp={version:"STACK-JS:1.0.0",type:"changed-input",name:msg.name};"checkbox"===input.type?resp.value=input.checked:resp.value=input.value;for(let tgt of INPUTS[input.id])resp.tgt=tgt,IFRAMES[tgt].contentWindow.postMessage(JSON.stringify(resp),"*")}));else{document.querySelectorAll("input[type=radio][name="+CSS.escape(input.name)+"]").forEach((inp=>{inp.addEventListener("change",(()=>{if(DISABLE_CHANGES)return;let resp={version:"STACK-JS:1.0.0",type:"changed-input",name:msg.name};if(inp.checked){resp.value=inp.value;for(let tgt of INPUTS[inp.id])resp.tgt=tgt,IFRAMES[tgt].contentWindow.postMessage(JSON.stringify(resp),"*")}}))}))}}if("track-input"in msg&&msg["track-input"]&&"radio"!==input.type)if(input.id in INPUTS_INPUT_EVENT){if(msg.src in INPUTS_INPUT_EVENT[input.id])return;INPUTS_INPUT_EVENT[input.id].push(msg.src)}else INPUTS_INPUT_EVENT[input.id]=[msg.src],input.addEventListener("input",(()=>{if(DISABLE_CHANGES)return;let resp={version:"STACK-JS:1.0.0",type:"changed-input",name:msg.name};"checkbox"===input.type?resp.value=input.checked:resp.value=input.value;for(let tgt of INPUTS_INPUT_EVENT[input.id])resp.tgt=tgt,IFRAMES[tgt].contentWindow.postMessage(JSON.stringify(resp),"*")}));msg.src in INPUTS[input.id]||IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*");break;case"changed-input":if(input=vle_get_input_element(msg.name,msg.src),null===input){const ret={version:"STACK-JS:1.0.0",type:"error",msg:'Failed to modify input: "'+msg.name+'"',tgt:msg.src};return void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(ret),"*")}DISABLE_CHANGES=!0,"checkbox"===input.type?input.checked=msg.value:input.value=msg.value,vle_update_input(input),DISABLE_CHANGES=!1,response.type="changed-input",response.name=msg.name,response.value=msg.value;for(let tgt of INPUTS[input.id])tgt!==msg.src&&(response.tgt=tgt,IFRAMES[tgt].contentWindow.postMessage(JSON.stringify(response),"*"));break;case"clear-input":if(input=vle_get_input_element(msg.name,msg.src),"select"===input.nodeName.toLowerCase()){-1!==input.selectedIndex&&(input.selectedIndex=-1,vle_update_input(input));for(var i=0;i<input.options.length;i++)input.options[i].hasAttribute("selected")&&(input.options[i].removeAttribute("selected"),vle_update_input(input)),""===input.options[i].value&&(input.options[i].selected=!0,vle_update_input(input))}else if("textarea"===input.nodeName.toLowerCase())""!==input.value&&(input.value="",vle_update_input(input));else if("checkbox"===input.type)for(let inp of vle_get_others_of_same_input_group(input))inp.checked=!1,vle_update_input(inp);else if("radio"===input.type)for(let inp of vle_get_others_of_same_input_group(input))inp.checked=""===inp.value,vle_update_input(inp);else""!==input.value&&(input.value="",vle_update_input(input));vle_update_input(input);break;case"register-button-listener":if(element=vle_get_element(msg.target),null===element){const ret={version:"STACK-JS:1.2.0",type:"error",msg:'Failed to find element: "'+msg.target+'"',tgt:msg.src};return void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(ret),"*")}element.addEventListener("click",(event=>{let resp={version:"STACK-JS:1.2.0",type:"button-click",name:msg.target,tgt:msg.src};IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(resp),"*"),event.preventDefault()}));break;case"toggle-visibility":if(element=vle_get_element(msg.target),null===element){const ret={version:"STACK-JS:1.0.0",type:"error",msg:'Failed to find element: "'+msg.target+'"',tgt:msg.src};return void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(ret),"*")}"show"===msg.set?(element.style.display="block",vle_update_dom(element)):"hide"===msg.set&&(element.style.display="none");break;case"change-content":if(element=vle_get_element(msg.target),null===element)return response.type="error",response.msg='Failed to find element: "'+msg.target+'"',response.tgt=msg.src,void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*");element.innerHTML=function(src){let doc=(new DOMParser).parseFromString(src,"text/html");for(let el of doc.querySelectorAll("script, style"))el.remove();for(let el of doc.querySelectorAll("*"))for(let{name:name,value:value}of el.attributes)is_evil_attribute(name,value)&&el.removeAttribute(name);return doc.body}(msg.content).innerHTML,vle_update_dom(element);break;case"get-content":element=vle_get_element(msg.target),response.type="xfer-content",response.tgt=msg.src,response.target=msg.target,response.content=null,null!==element&&(response.content=element.innerHTML),IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*");break;case"resize-frame":element=IFRAMES[msg.src].parentElement,element.style.width=msg.width,element.style.height=msg.height,IFRAMES[msg.src].style.width="100%",IFRAMES[msg.src].style.height="100%",vle_update_dom(element);break;case"ping":return response.type="ping",response.tgt=msg.src,void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*");case"query-submit-button":return response.type="submit-button-info",response.tgt=msg.src,input=vle_get_submit_button(msg.src),null===input||input.hasAttribute("hidden")?response.value=null:response.value=input.value,void IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*");case"enable-submit-button":return input=vle_get_submit_button(msg.src),void(null!==input?msg.enabled?input.removeAttribute("disabled"):input.disabled=!0:(response.type="error",response.msg="Could not find matching submit button for this question.",response.tgt=msg.src,IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*")));case"relabel-submit-button":return input=vle_get_submit_button(msg.src),void(null!==input?input.value=msg.name:(response.type="error",response.msg="Could not find matching submit button for this question.",response.tgt=msg.src,IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*")));case"submit-button-info":case"initial-input":case"error":break;default:response.type="error",response.msg='Unknown message-type: "'+msg.type+'"',response.tgt=msg.src,IFRAMES[msg.src].contentWindow.postMessage(JSON.stringify(response),"*")}})),{create_iframe(iframeid,content,targetdivid,title,scrolling,evil){const frm=document.createElement("iframe");frm.id=iframeid,frm.style.width="100%",frm.style.height="100%",frm.style.border=0,!1===scrolling?(frm.scrolling="no",frm.style.overflow="hidden"):frm.scrolling="yes",frm.title=title,frm.referrerpolicy="no-referrer",evil||(frm.sandbox="allow-scripts allow-downloads"),frm.srcdoc=content,document.getElementById(targetdivid).replaceChildren(frm),IFRAMES[iframeid]=frm}}}));

//# sourceMappingURL=stackjsvle.min.js.map
3 changes: 2 additions & 1 deletion backup/moodle2/backup_qtype_stack_plugin.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ protected function define_question_plugin_structure() {
[
'name', 'type', 'tans', 'boxsize', 'strictsyntax', 'insertstars',
'syntaxhint', 'syntaxattribute', 'forbidwords', 'allowwords', 'forbidfloat', 'requirelowestterms',
'checkanswertype', 'mustverify', 'showvalidation', 'options',
'displaytype', 'choicetype', 'matrixsize', 'buttontitles','checkanswertype', 'mustverify', 'showvalidation', 'options',
]);

$stackprts = new backup_nested_element('stackprts');
Expand Down Expand Up @@ -152,3 +152,4 @@ public static function get_qtype_fileareas() {
];
}
}

Loading
Loading