Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-qtype_stack
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-qtype_stack
Commits
ea53326d
Commit
ea53326d
authored
1 year ago
by
Chris Sangwin
Browse files
Options
Downloads
Patches
Plain Diff
Code tidy.
parent
d4301f3b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
stack/cas/castext2/blocks/parsons.block.php
+20
-20
20 additions, 20 deletions
stack/cas/castext2/blocks/parsons.block.php
with
20 additions
and
20 deletions
stack/cas/castext2/blocks/parsons.block.php
+
20
−
20
View file @
ea53326d
...
...
@@ -45,7 +45,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
$xpars
=
[];
$inputs
=
[];
// From inputname to variable name.
$clone
=
"false"
;
// Whether to have all keys in available list cloned.
$mathjaxversion
=
"2"
;
// MathJax version (either "2" or "3")
$mathjaxversion
=
"2"
;
// MathJax version (either "2" or "3")
.
foreach
(
$this
->
params
as
$key
=>
$value
)
{
if
(
$key
===
'clone'
)
{
$clone
=
$value
;
...
...
@@ -162,10 +162,10 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
stack_cors_link
(
'stacksortable.min.js'
)
.
"';
\n
"
;
$r
->
items
[]
=
new
MP_String
(
$importcode
);
// Add flip orientation listener to the orientation button
// Add flip orientation listener to the orientation button
.
// TODO: automatically set orientation based on device?
$r
->
items
[]
=
new
MP_String
(
'add_orientation_listener("orientation", "usedList", "availableList");'
.
"
\n
"
);
// Add the resize button listener
// Add the resize button listener
.
$r
->
items
[]
=
new
MP_String
(
'document.getElementById("resize").addEventListener(
"click", () => {stack_js.resize_containing_frame("'
.
$width
.
'", get_iframe_height() + "px");});'
.
"
\n
"
);
...
...
@@ -194,7 +194,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
$code
.
=
'var valid;'
.
"
\n
"
;
$code
.
=
'[proofSteps, headers, sortableUserOpts, valid] = preprocess_steps(proofSteps, headers, sortableUserOpts);'
.
"
\n
"
;
// If the author's JSON has invalid format throw an error
// If the author's JSON has invalid format throw an error
.
$code
.
=
'if (valid === false)
{stack_js.display_error("'
.
stack_string
(
'stackBlock_parsons_contents'
)
.
'");}'
.
"
\n
"
;
...
...
@@ -216,17 +216,17 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
$code
.
=
'stackSortable.generate_available();'
.
"
\n
"
;
// Create the Sortable objects.
// First, instantiate with default options first in order to extract all possible options for validation
// First, instantiate with default options first in order to extract all possible options for validation
.
$code
.
=
'var sortableUsed = Sortable.create(usedList);'
.
"
\n
"
;
$code
.
=
'var possibleOptionKeys = Object.keys(sortableUsed.options).concat(SUPPORTED_CALLBACK_FUNCTIONS);'
.
"
\n
"
;
// Now set appropriate options
// Now set appropriate options
.
$code
.
=
'Object.entries(stackSortable.options.used).forEach(([key, val]) => sortableUsed.option(key, val));'
.
"
\n
"
;
$code
.
=
'var sortableAvailable = Sortable.create(availableList, stackSortable.options.available);'
.
"
\n
"
;
// Add the onSort option in order to link up to input and overwrite user onSort if passed
// Add the onSort option in order to link up to input and overwrite user onSort if passed
.
$code
.
=
'sortableUsed.option("onSort", () => {stackSortable.update_state(sortableUsed, sortableAvailable);});'
.
"
\n
"
;
$code
.
=
'sortableAvailable.option("onSort", () => {stackSortable.update_state(sortableUsed, sortableAvailable);});'
.
"
\n
"
;
// Options can now be validated since sortable objects have been instantiated, we throw warnings only
// Options can now be validated since sortable objects have been instantiated, we throw warnings only
.
$code
.
=
'stackSortable.validate_options(
possibleOptionKeys,
"'
.
stack_string
(
'stackBlock_unknown_sortable_option'
)
.
'",
...
...
@@ -247,7 +247,7 @@ class stack_cas_castext2_parsons extends stack_cas_castext2_block {
'MathJax.Hub.Queue(["Typeset", MathJax.Hub]);'
:
'var mathJaxPromise = MathJax.typesetPromise();'
;
// Resize the outer iframe if the author does not pre-define width. Method depends on MathJax 2 or MathJax 3
// Resize the outer iframe if the author does not pre-define width. Method depends on MathJax 2 or MathJax 3
.
if
(
!
$existsuserheight
)
{
$code
.
=
(
$mathjaxversion
===
"2"
)
?
'MathJax.Hub.Queue(() => {stack_js.resize_containing_frame("'
.
$width
.
'", get_iframe_height() + "px");})'
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment