55 Commits

Author SHA1 Message Date
Paul Holden
0d20d1e8aa MDL-76667 forms: mark modal form as submitted upon success.
Ensure the form change checker module doesn't warn user about it.
2022-12-13 14:48:10 +00:00
Paul Holden
7012900d08 MDL-76039 forms: account for null values in serialize util method.
Co-authored-by: Marina Glancy <marina@moodle.com>
2022-11-14 14:20:52 +00:00
Sara Arjona
d1a0ee011f Merge branch 'MDL-76059' of https://github.com/paulholden/moodle 2022-11-09 12:31:31 +01:00
Thong Bui
5151cd6bd0 MDL-75784 Forms: Fix issues multi expand all/collapse buttons on a page 2022-10-26 14:06:54 +07:00
Paul Holden
3be5954500 MDL-76059 forms: graceful early exit for invalid button elements.
Ensure login form tries to capture guest button only if it exists.
2022-10-21 19:36:24 +01:00
Huong Nguyen
0795b579fa MDL-74814 forms: Fix accessibility issue in edit profile page
- Fixed legend tag issue
 - Modified the passwordunmask Javascript hide/unhide the password field by CSS class
2022-10-17 09:31:53 +07:00
Andrew Nicols
39241f20e0 MDL-71686 core_form: Include missing build 2022-10-06 14:43:55 +08:00
Andrew Nicols
f075272e69 MDL-71686 core_form: Move form serializer to shared function 2022-10-06 10:21:01 +08:00
Andrew Nicols
2423c26749 Merge branch 'MDL-71686-master' of https://github.com/marinaglancy/moodle 2022-10-06 10:20:56 +08:00
David Woloszyn
2efc12e104 MDL-75459 Collapsable Form Sections: Default state bug fix
In circumstances where all collapsible form sections were expanded on
page load, a check is now made to ensure the expand all/collapse all
button behaves as intended.
2022-09-20 14:44:53 +10:00
Marina Glancy
653433a289 MDL-71686 forms: allow arrays in dynamic forms args 2022-09-14 17:58:02 +02:00
Andrew Nicols
c48c431374 MDL-75244 form: Change checker should check existence of tinyMCE API
The window.tinyMCE.editors API was present in version 3 of TinyMCE, but
is not present in later versions. As a result, this check tries to loop
over a variable which does not exist and throws an error in the process.

We should check that window.tinyMCE *and* window.tinyMCE.editors both
exist before attempting to loop over them.
2022-07-28 16:09:21 +08:00
Paul Holden
240085fd1d MDL-74287 forms: request changesmade string as required.
Unconditionally requesting the string was triggering exceptions
during installation, before the required external functions had
been populated.
2022-06-16 08:07:51 +01:00
Paul Holden
6e85e01d3b MDL-74459 forms: replace import of jqueryui with native code.
We used the import for ensuring collapsible section elements
contained an ID attribute (efbe1530). This conflicted with use
of Bootstrap tooltips.
2022-04-07 22:38:46 +01:00
Paul Holden
efbe15306a MDL-74222 forms: add aria-controls attribute to expand/collapse all. 2022-04-01 18:44:24 +01:00
Jun Pataleta
7dfb64c7cb MDL-74073 core: Fix collapsesections accessibility
* Fix focus outline
* Set aria-expanded state accordingly
* Set aria-expanded in the template to false by default as the default
mode of the link is to expand all the sections.

Reference:
https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure
2022-03-16 14:09:14 +08:00
Jun Pataleta
0dca278d71 MDL-72737 core: Rebuild JS modules 2022-03-01 19:22:24 +08:00
Bas Brands
2faf5e8e48 MDL-72737 theme_boost: update for section header styles 2022-03-01 12:01:59 +01:00
Andrew Nicols
e1b9d5f3cd MDL-73915 js: Drop support for IE and android
Moodle announced that support for IE would be dropped back in August
2020 with Moodle 3.9 but not active steps were taken at that time. That
decision was made in MDLSITE-6109 and this particular step was meant to
be taken in Moodle 3.10.

This is the first step taken to actively drop support for IE.

This commit also bumps the browser support pattern from 0.25% to 0.3%.
The percentage here includes any browser where at least this percentage
of users worldwide may be using a browser. In this case it causes
support for Android 4.3-4.4 to be dropped, which relate to Android
KitKat (released 2013).

This combination of changes means that all of the supported browsers in
our compatibility list support modern features including async,
for...of, classes, native Promises, and more which has a huge impact on
the ease of debugging code, and drastically reduces the minified file
size because a number of native Polyfills included by Babel are no
longer included.
2022-02-23 08:55:20 +08:00
Andrew Nicols
0a4047ab31 MDL-73915 js: Switch amd minification to terser
Unfortunately the babel minify-mangle plugin seems to be abandoned and
in certain circumstances can be very buggy. The only safe options are to
disable it, or to switch to a different minification library.

Not minifying our javascript is not ideal, so this commit updates the
javascript tasks to use a rollup, combined with babel, and terser.

Babel still converts code from ES/UMD/AMD to AMD modules with the
relevant browser support, whilst terser minifies the code.

The rollup bundler handles tracking and creation of sourcemaps, and
supports better parallelisation of the tasks.

Since the upgrade to Node LTS/Gallium requires an upgrade to @babel/core
and eslint, which change the built files anyway, this seems like the
ideal time to make this change.
2022-02-23 08:55:09 +08:00
Andrew Nicols
aa7f7957ea MDL-73915 js: Upgrade babel and eslint 2022-02-23 08:53:54 +08:00
Paul Holden
b1204acbf0 MDL-73205 forms: handle AJAX error in dynamic/modal form submission. 2021-11-29 18:28:44 +00:00
Paul Holden
0d3f58db0a MDL-73007 output: trigger form changechecker when switching tabs.
Co-authored-by: Odei Alba <odeialba@gmail.com>
2021-11-09 17:20:23 +00:00
Andrew Nicols
9e9b7bb20d Merge branch 'MDL-71750-master' of https://github.com/NashTechOpenUniversity/moodle 2021-10-25 13:18:21 +08:00
Thong Bui
76c0a743bf MDL-71750 File upload: Disable submittion when uploading multiple files
Fixed issue "Save" and "Submit and finish" button is not disabled when file uploading in the ticket MDL-71644
2021-10-22 13:26:02 +07:00
Andrew Nicols
349312143d MDL-72013 js: Fix jsdocs to meet stricter eslint 2021-10-21 13:28:00 +08:00
Thong Bui
3c19cbbb18 MDL-72507 Quiz: Quiz auto-save does not detect uploaded files 2021-10-19 16:10:15 +07:00
Víctor Déniz
21909b59fb Merge branch 'MDL-69918-master' of git://github.com/andrewnicols/moodle 2021-08-10 19:15:22 +01:00
Andrew Nicols
530322e2ce MDL-69918 core: Update uses of legacy form change checker 2021-08-10 23:54:01 +08:00
Andrew Nicols
cbe19158e9 MDL-69918 core: Rewrite Form Change Checker a ES6 2021-08-10 23:54:01 +08:00
Andrew Nicols
4f422785c6 MDL-71113 javascript: Improve basic JS Documentation 2021-06-18 09:38:05 +08:00
Andrew Nicols
92179b7057 MDL-71113 js: Fix all jsdoc warnings 2021-06-18 09:38:05 +08:00
Andrew Nicols
1a9d53d831 MDL-70990 core_form: Replace FORM_ERROR event
The legacy M.core.event.FORM_ERROR event has been replaced with a new
core_form/events::formError native DOM event.

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_form/events';

document.addEventListener(eventTypes.formError, handler);
```

A backward-compatabibility layer is included to ensure that any legacy
YUI event listener is still called with the same arguments.

This legacy bridges will be removed after Moodle 4.3.
2021-05-26 10:47:17 +08:00
Andrew Nicols
a1ccefe2ac MDL-70990 core_form: Standardise event name usage
The `types` object introduced in Moodle 3.11 has been replaced with the
`eventTypes` object which is used consistently across all CustomEvent
definitinos.

Likewise the trigger functions have been renamed from
`triggerUploadStarted` to `notifyUploadStarted` and from
`triggerUploadCompleted` to `notifyUploadCompleted`.

Backwards compatability is maintained.
2021-05-26 10:46:52 +08:00
Andrew Nicols
919db49a44 MDL-70990 core_form: Replace FORM_FIELD_VALIDATION event
The legacy core/event::FORM_FIELD_VALIDATION event has been replaced with a
new core_form/events::formFieldValidationFailed native DOM event.

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_form/events';

document.addEventListener(eventTypes.formFieldValidationFailed, handler);
```

A backward-compatabibility layer is included to ensure that any legacy
jQuery event is still called with the same arguments.

This legacy bridge will be removed after Moodle 4.3.
2021-05-26 10:46:52 +08:00
Andrew Nicols
acd9d9823b MDL-70990 core_form: Replace FORM_SUBMIT_AJAX event
The legacy M.core.event.FORM_SUBMIT_AJAX ecent has been replaced with a
new core_form/events::formSubmittedByJavascript native DOM event.

The new event can be listened to at any point in the DOM using the
following syntax:

```
import {eventTypes} from 'core_form/events';

document.addEventListener(eventTypes.formSubmittedByJavascript, handler);
```

A backward-compatabibility layer is included to ensure that any
legacy YUI event triggered on a form is still respected and the new
native event is also fired.

A similar handler is also included to ensure that any legacy YUI event
listener is still called with the same arguments.

These legacy bridges will be removed after Moodle 4.3.
2021-05-26 10:46:49 +08:00
Huong Nguyen
c6fb80b639 MDL-70947 File upload: Upload protection
Interacts badly with double-submit protection, and not all uploads protected
2021-04-29 15:28:19 +07:00
Paul Holden
11099c15bb MDL-70962 forms: catch modal exceptions when getting body content.
They are thrown in the following circumstances:

 * The dynamic form class doesn't exist;
 * It does exist but it's `check_access` method throws exception

Co-Authored-By: Andrew Nicols <andrew@nicols.co.uk>
2021-03-25 17:26:36 +00:00
Ilya Tregubov
eaf40e050e MDL-69680 lib: Replace deprecated jQuery functions 2021-03-04 12:48:26 +08:00
Marina Glancy
1e03a240b5 MDL-64554 form: reset form change checker before triggering submit event 2021-02-18 13:04:14 +01:00
Marina Glancy
72be49c473 MDL-64554 core_form: new API for modal forms 2021-02-17 18:06:49 +01:00
John Yao
b964ba6373 MDL-65390 accessibility: correct focus after "Show more" clicked 2021-02-05 12:15:21 +11:00
sam marshall
ddbafce0e0 MDL-65818 Security: Encryption API and admin setting for secure data 2020-12-04 14:41:21 +00:00
sam marshall
225eb7b27e MDL-66679 Forms: Submit button remains disabled after file download
When you download a file directly from a Moodle form submit button,
the submit button disables when you click it, but you remain on that
page so we need to re-enable the button.

This commit causes it to re-enable once the file download finishes,
setting a temporary cookie to indicate this to the JavaScript code.

It also adds a method to disable the system on a given form by
setting data-double-submit-protection="off".
2019-10-30 16:36:28 +00:00
sam marshall
109c77d37d MDL-38555 Forms: Prevent multiple clicking of submit button 2019-09-02 11:46:12 +01:00
Ryan Wyllie
195ea4480b MDL-62497 javascript: build AMD modules with new transpiler 2019-07-19 14:12:49 +08:00
Damyon Wiese
37910f5e9c MDL-55211 js: form/showadvanced yui to amd 2019-02-01 09:35:12 +08:00
Stephen Bourget
57422d7158 MDL-43648 course: Allow start /end dates to have times 2017-12-14 19:48:31 -05:00
David Mudrák
8b493eb09d MDL-53240 filetypes: Enhance the filetypes element with a types browser 2017-06-01 09:20:07 +02:00
Marina Glancy
b4eb5f0212 MDL-34859 forms: new element defaultcustom 2017-03-20 14:59:45 +08:00