Skip to content

Commit

Permalink
Merge branch 'dev-v4.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sangwinc committed Jul 25, 2024
2 parents c8ea383 + 82be8f5 commit 9e57da4
Show file tree
Hide file tree
Showing 137 changed files with 7,394 additions and 972 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,15 @@ jobs:
- php: '8.2'
moodle-branch: 'MOODLE_404_STABLE'
database: 'pgsql'
maxima: 'GCL'
maxima: 'SBCL'
- php: '8.1'
moodle-branch: 'MOODLE_403_STABLE'
database: 'pgsql'
maxima: 'SBCL'
maxima: 'GCL'
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: 'pgsql'
maxima: 'GCL'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
database: 'pgsql'
maxima: 'SBCL'
# Edinburgh is planning to run the setup below for 2023-24.
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
Expand Down
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# STACK 4.6.0
# STACK 4.7.0

STACK is an assessment system for mathematics, science and related disciplines. STACK is a question type for the Moodle learning management system, and also the ILIAS learning management system. STACK has an API for stand-alone integration into other 3rd party systems.

Expand Down
3 changes: 3 additions & 0 deletions adminui/caschat.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@
if ($keyvals->get_valid()) {
$kvcode = $keyvals->compile('test');
$statements = [];
if ($kvcode['blockexternal']) {
$statements[] = new stack_secure_loader($kvcode['blockexternal'], 'caschat', 'blockexternal');
}
if ($kvcode['contextvariables']) {
$statements[] = new stack_secure_loader($kvcode['contextvariables'], 'caschat');
}
Expand Down
2 changes: 1 addition & 1 deletion amd/build/input.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/input.min.js.map

Large diffs are not rendered by default.

30 changes: 25 additions & 5 deletions amd/src/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,9 @@ define([
* @param {String} name the name of the input we are validating.
* @param {Object} input An object representing the input element for this input.
* @param {String} language display language for this attempt.
* @param {Set} validationsInProgress names of inputs being validated for this question.
*/
function StackInput(validationDiv, prefix, qaid, name, input, language) {
function StackInput(validationDiv, prefix, qaid, name, input, language, validationsInProgress) {
/** @type {number} delay between the user stopping typing, and the ajax request being sent. */
var TYPING_DELAY = 1000;

Expand All @@ -67,6 +68,8 @@ define([

/** @type {String} the last value that we sent to be validated. */
var lastValidatedValue = getInputValue();
/** @type {HTMLElement} the 'Check' button for this question if it exists. */
var checkButton = document.getElementById(prefix + '-submit');

/**
* Cancel any typing pause timer.
Expand Down Expand Up @@ -100,6 +103,12 @@ define([
if (getInputValue() === lastValidatedValue) {
cancelTypingDelay();
validationDiv.classList.remove('waiting');
if (checkButton) {
validationsInProgress.delete(name);
if (validationsInProgress.size === 0) {
checkButton.disabled = false;
}
}
}
}

Expand Down Expand Up @@ -230,6 +239,10 @@ define([
function showWaiting() {
removeAllClasses();
validationDiv.classList.add('waiting');
if (checkButton) {
validationsInProgress.add(name);
checkButton.disabled = true;
}
}

/**
Expand All @@ -240,6 +253,12 @@ define([
validationDiv.classList.remove('error');
validationDiv.classList.remove('loading');
validationDiv.classList.remove('waiting');
if (checkButton) {
validationsInProgress.delete(name);
if (validationsInProgress.size === 0) {
checkButton.disabled = false;
}
}
}
}

Expand Down Expand Up @@ -431,6 +450,7 @@ define([
*/
function initInputs(questionDivId, prefix, qaid, inputs) {
var questionDiv = document.getElementById(questionDivId);
var validationsInProgress = new Set();
var language = null;
var langInput = document.getElementsByName(prefix + 'step_lang');
if (langInput.length > 0 && langInput[0].value) {
Expand All @@ -440,7 +460,7 @@ define([
// Initialise all inputs.
var allok = true;
for (var i = 0; i < inputs.length; i++) {
allok = initInput(questionDiv, prefix, qaid, inputs[i], language) && allok;
allok = initInput(questionDiv, prefix, qaid, inputs[i], language, validationsInProgress) && allok;
}

// With JS With instant validation, we don't need the Check button, so hide it.
Expand All @@ -459,16 +479,16 @@ define([
* @param {String} name the input to initialise.
* @return {boolean} true if this input was successfully initialised, else false.
* @param {String} language display language for this attempt.
* @param {Set} validationsInProgress names of inputs being validated for this question.
*/
function initInput(questionDiv, prefix, qaid, name, language) {
function initInput(questionDiv, prefix, qaid, name, language, validationsInProgress) {
var validationDiv = document.getElementById(prefix + name + '_val');
if (!validationDiv) {
return false;
}

var inputTypeHandler = getInputTypeHandler(questionDiv, prefix, name);
if (inputTypeHandler) {
new StackInput(validationDiv, prefix, qaid, name, inputTypeHandler, language);
new StackInput(validationDiv, prefix, qaid, name, inputTypeHandler, language, validationsInProgress);
return true;
} else {
return false;
Expand Down
Loading

0 comments on commit 9e57da4

Please sign in to comment.