1254 Commits

Author SHA1 Message Date
Tim Hunt
adf336cbf2 MDL-82177 file upload: default to path '/'when things go wrong
This 'fix' is basically a work-around, but one that is already used in
some places. Now it is used in all similar places.

Exactly what causes the current file path in a file manager to become
unset is still unclear to me, but it seems to be an obscure race
condition that is very hard to reproduce.

However, when it happens, currently we are effectively defaulting to
path '/undefined/'. Using '/' is never worse, and is infinitely better
in the case where the filepicker does not allow folders to be used
(which includes important cases like essay questions in a quiz, which
some people use for exams!). In that case, falling back to non-top-level
path leads to dataloss.

Also, this is all historic JavaScript which will get replaced in the
grand de-YUI-fication, so I think a pragmatic fix is justified here.
2024-07-30 15:07:02 +01:00
Huong Nguyen
562b9775b2
Merge branch 'MDL-82308_404' of https://github.com/timhunt/moodle into MOODLE_404_STABLE 2024-07-10 14:57:24 +07:00
meirzamoodle
3ae349b86e MDL-66251 form: Hiding and disabling static elements.
Added functionality to locate static text elements within the form,
improving the ability to target and manipulate the static elements for
hiding and disabling purposes.
2024-07-08 09:17:26 +07:00
Tim Hunt
2ac781b76d MDL-82308 forms: set a nice default size for multi-selects
This is a backport of MDL-81515.
2024-06-26 13:24:24 +01:00
Huong Nguyen
6d717d9c8a
Merge branch 'MDL-81522_404' of https://github.com/stronk7/moodle into MOODLE_404_STABLE 2024-06-12 08:46:59 +07:00
Eloy Lafuente (stronk7)
091b458c52
MDL-81522 phpunit: Add missing void return type to all tests #2
This commit includes more changes, all them also adding the :void
return type to unit tests missing them.

The difference is that all these changes, while also detected
perfectly by the moodle.PHPUnit.TestReturnType sniff, were not
auto-fixed (like the previous commit ones), because all them
do include some "return" statement and, for safety, we don't
fix them.

All the cases have been visually inspected and confirmed that
the existing "return" statements always belong to anon
functions within the test body and not the test own return statement.
2024-06-11 12:18:05 +02:00
Eloy Lafuente (stronk7)
1093256560
MDL-81522 phpunit: Add missing void return type to all tests
While this change is not 100% required now, it's good habit
and we are checking for it since Moodle 4.4.

All the changes in this commit have been applied automatically
using the moodle.PHPUnit.TestReturnType sniff and are, exclusively
adding the ": void" return types when missing.
2024-06-11 12:18:04 +02:00
David Woloszyn
90c5adee7c MDL-68540 form: Correctly target editors in node tree
This fix solves the hideIf and disabledIf form conditions that were not
correctly targetting the editor due to a name attribute mismatch.
2024-06-11 13:06:12 +10:00
Jun Pataleta
7e01d53de3
Merge branch 'MDL-81750-404' of https://github.com/davewoloszyn/moodle into MOODLE_404_STABLE 2024-06-06 22:06:30 +08:00
Leon Stringer
b0dddbb02a
MDL-81146 forms: Disable submit buttons in Chrome 2024-06-06 22:06:29 +08:00
David Woloszyn
fe22fe1c83 MDL-81750 form: Add selector to match filemanager in group 2024-06-05 09:34:57 +10:00
Andrew Nicols
613f933442
Merge branch 'MDL-80820' of https://github.com/marinaglancy/moodle 2024-04-15 10:42:22 +08:00
Pedro Jordao
942868a1a6 MDL-80195 forms: Keep dropdown menu open when tabbing into datepicker
When accessing a datepicker that is within a dropdown menu using the tab
key, the navigation sequence was changed since the datepicker code is
not rendered within the dropdown menu element, thus the dropdown was
closed as it was understood that we were not more inside it.
Furthermore, when exiting the datepicker by pressing tab, as the
dropdown was closed, the navigation jumped to the first element on the
page, which is the link to Skip to main content.

To resolve this, a validation was added that keeps the dropdown menu
open if the datepicker is open and accessed via the tab key.
2024-04-08 12:57:18 -03:00
Marina Glancy
42c76b711a MDL-80820 lib/pear: phpdoc corrections 2024-04-08 10:13:39 +01:00
Marina Glancy
ef1759da74 MDL-80820 various: fix incorrect phpdocs 2024-04-08 10:13:10 +01:00
Daniel Ziegenberg
08027e408c
MDL-81281 phpunit: assertObjectHasAttribute is deprecated
To be integrated as part of MDL-81266

When running PHPUnit 9.6 we get the following deprecation warnings:
"assertObjectHasAttribute() is deprecated and will be removed in PHPUnit
10. Refactor your test to use assertObjectHasProperty() instead."

So we replace all instances of assertObjectHasAttribute with
assertObjectHasProperty.

PHPUnit justifies the change with:
> PHPUnit currently refers to "fields" (see above) as "attributes". This
> is (or will become) confusing considering the introduction of
> attributes in PHP 8 and their support in PHPUnit.  PHPUnit will be
> changed to use the term "property" instead of "attribute" where "field"
> is meant.

Signed-off-by: Daniel Ziegenberg <daniel@ziegenberg.at>
2024-03-25 16:21:45 +01:00
Mikel Martín
9733ccc381 MDL-81188 form: Fix password element layout
MDL-75670 generated a regression in forms password element layout that was not
being displayed in a single line as before.

- Modify the password element template to display the input and the password
unmask icon in a single line.
- Change the password unmask button styles to be consistent with other
focus states.
- Modify passwordunmask behat form field to work with the new password element
layout changes.
2024-03-18 09:19:35 +01:00
Ilya Tregubov
6c9e011d32 Merge branch 'MDL-80991' of https://github.com/paulholden/moodle 2024-03-12 11:28:21 +08:00
Huong Nguyen
88dc0f5010 Merge branch 'MDL-79769-master' of https://github.com/davewoloszyn/moodle 2024-03-12 09:18:10 +07:00
Marina Glancy
36c91ff907 MDL-80431 forms: do not use fieldset tag without a legend 2024-03-08 15:02:15 +00:00
David Woloszyn
cd935eb3e2 MDL-79769 login: Fix focus loss of loginpageautofocus setting
Added new form event to fix login fields focus loss when DOM is
manipulated by togglesensitive.
2024-03-08 15:54:37 +11:00
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Paul Holden
3ecb9b8ec0
MDL-80991 files: consistent display of filepicker accepted types. 2024-03-05 11:51:47 +00:00
Sara Arjona
e1034deb8b
Merge branch 'MDL-75670-main' of https://github.com/roland04/moodle 2024-03-04 16:05:18 +01:00
Mikel Martín
d0d62fd06c MDL-75670 theme: Refactor form-inline helper class dropped in BS5
- Replace .form-inline Bootstrap helper class with .d-flex.flex-wrap.align-items-center
- Refactor .form-inline occurrences in SCSS files or remove when unneeded
2024-02-29 13:56:46 +01:00
Mikel Martín
4ce883ae21 MDL-75670 theme: Refactor form-group helper class dropped in BS5
- Replace .form-group Boostrap helper class with .mb-3. The .form-group class was only
adding margin bottom styles, so it is an straightforward change.
- Replace .form-group references in SCSS files with .fitem now .form-group has been removed.
- There were some other .form-group occurrences in the code that were using it not for styling
but incorrectly for managing some logic. These have been also replaced with .fitem or removed.
2024-02-29 13:55:37 +01:00
Eloy Lafuente (stronk7)
ba1f804ffa
MDL-65292 style: Fix all function declarations white space
This has been generated running the following Sniffs, all
them part of the Moodle's CodeSniffer standard:
- PSR12.Functions.ReturnTypeDeclaration
- PSR12.Functions.NullableTypeDeclaration
- moodle.Methods.MethodDeclarationSpacing
- Squiz.Whitespace.ScopeKeywordSpacing

All them are, exclusively, about correct spacing, so the changes
are, all them, only white space changes.

Only exceptions to the above are 3 changes what were setting the
return type in a new line, and, when that happens, the closing
parenthesis (bracket) has to go to the same line than the colon.
2024-02-28 23:33:26 +01:00
Sara Arjona
a42d1335f5
Merge branch 'MDL-80197' of https://github.com/pedrojordao/moodle 2024-02-28 16:09:30 +01:00
Paul Holden
bb6652699e
Merge branch 'MDL-75794-main' of https://github.com/aanabit/moodle into main 2024-02-23 12:54:00 +00:00
Jun Pataleta
f6a22d3e61
Merge branch 'MDL-80805-main' of https://github.com/sammarshallou/moodle 2024-02-23 17:32:05 +08:00
Amaia Anabitarte
0c081f004a MDL-75794 mod_data: deprecate behat steps to generate entries and fields 2024-02-22 17:37:54 +01:00
Pedro Jordao
9239366aa7 MDL-80197 forms: Added attributes to the calendar link
The datepicker is not keyboard accessible when in a modal.

As we are using yui datepicker and the change is not simple, I added aria-hidden and tabindex properties to avoid screenreaders.
2024-02-19 20:57:52 -03:00
sam marshall
14b1e93e85 MDL-80805 core_form: Accessibility - add aria-required to form fields
Most types of form field will now include aria-required="true" if the
field is marked as required. This causes assistive technology to inform
users that the field is required.

Before this change, in some cases (e.g. screen reader users tabbing
through fields) users were not informed that a field is required.
2024-02-15 14:30:33 +00:00
sam marshall
4bb42cc362 MDL-80608 core_form: Fire modal form event for errors in definition
The ERROR event is defined as being fired if an exception occurs while
contacting the server. This change ensures it is fired for exceptions
in the form definition AJAX request, not just form submission.

Additionally, if such an error occurs in submission, the form buttons
were left in disabled state. This change makes them enabled again.
2024-02-14 13:49:39 +00:00
meirzamoodle
9ba1423359 MDL-74641 repository: Handles increase bytes while extracting zip files
We should not rely solely on the provided size information.
Therefore the system needs to recalculate the size of each file in the zip file,
whether small or big.

The changes also cover the filemanager.js file if an error appears.
2024-02-07 02:34:19 +01:00
Ilya Tregubov
59cac76dc1 Merge branch 'MDL-79927' of https://github.com/paulholden/moodle 2024-01-25 09:53:21 +08:00
Sara Arjona
8b36abdb9d
Merge branch 'MDL-80259-main' of https://github.com/roland04/moodle 2024-01-24 09:16:12 +01:00
Mikel Martín
a198884333 MDL-80259 theme_boost: Refactor badge helper classes for Bootstrap 5 2024-01-23 08:27:23 +01:00
Ferran Recio
f4adbc8a11 MDL-79029 behat: replace deprecated behat steps 2024-01-22 11:12:28 +01:00
Jun Pataleta
82c9578e36
Merge branch 'MDL-72308' of https://github.com/paulholden/moodle 2024-01-18 11:31:09 +08:00
Paul Holden
e2cb2fa5dc
MDL-72308 forms: final removal of legacy formchangechecker YUI. 2024-01-15 14:24:51 +00:00
Paul Holden
9357a1c583
MDL-80192 forms: implement method to set group element hidden label.
This is consistent with the API used for other form element types,
in order to provide screen-readable text in the fieldset legend while
not necessarily wanting to display said label.

The new class property is automatically exported to the template via
the `templatable_form_element` trait.
2024-01-12 08:33:37 +00:00
Paul Holden
24f59a7d32
MDL-79927 files: scope toggleall checkboxes per filemanager instance.
Ensures that when multiple exist on the same page, each operates
independently of the others.
2024-01-04 13:22:33 +00:00
Ilya Tregubov
1e83b9eba7 Merge branch 'MDL-79985-master' of https://github.com/ferranrecio/moodle 2023-12-20 09:06:08 +08:00
Ferran Recio
3344354641 MDL-79985 forms: add choicedropdown form element
The new quick form field uses a choice list to display a dropdown
component inside a form. Apart from que quick form code, the patch also
include a small improvement to the choicelist class to disable empty
values. This small patch is needed because the quickform field won't
allow empty values.
2023-12-19 09:43:35 +01:00
Jun Pataleta
030def7a46
Merge branch 'MDL-80079-master' of https://github.com/andrewnicols/moodle 2023-12-06 21:59:47 +08:00
Paul Holden
b7205c5c84
MDL-71336 forms: ensure grouped date elements have unique IDs.
Previously they were each taking the ID of their parent group element.
2023-11-23 12:01:24 +00:00
Huong Nguyen
4cf3f384c3 Merge branch 'MDL-80066' of https://github.com/elza3ym/moodle 2023-11-16 10:52:48 +07:00
Andrew Nicols
dab4a2b66f
MDL-80079 core: Correct incorrect arg to format_string::$options 2023-11-14 22:28:55 +08:00
Sara Arjona
ff518d3e71
Merge branch 'MDL-77581-master' of https://github.com/dpalou/moodle 2023-11-13 17:19:02 +01:00