148 Commits

Author SHA1 Message Date
Laurent David
941c866216 MDL-77665 core_h5p: Allow deployment if user has been deleted
* If user has been deleted we consider that the content can be deployed
by a user who can deploy other packages
* Add behat test to cover for this use case
* Fix the content bank generator as it was failing to upload the content
as the given user
2024-06-17 06:32:13 +02:00
Ilya Tregubov
4b0ca64617 Merge branch 'MDL-81656-404' of https://github.com/paulholden/moodle into MOODLE_404_STABLE 2024-05-06 09:55:34 +08:00
Sara Arjona
a829242d47
MDL-81717 h5p: Improve robustness content type fetching
Strengthen code to ensure retrieval of all content types, despite
failures.
2024-04-29 12:33:38 +02:00
Paul Holden
67376511ac
MDL-81656 h5p: correct content editing URL parameter handling. 2024-04-29 09:22:21 +01:00
Jun Pataleta
3278ce7aba
Merge branch 'MDL-65292' of https://github.com/stronk7/moodle 2024-03-08 08:00:41 +08:00
Eloy Lafuente (stronk7)
29a541724f
MDL-65292 style: Fix all the function declaration ordering
This has been generated running the following Sniff,
part of the Moodle's CodeSniffer standard:
- PSR2.Methods.MethodDeclaration

It just ensures all the function declarations have
the correct order for:
- abstract and final.
- visibility (public, protected, private).
- static.

So, all the lines modified by this commit are function declarations
and the only changes are in the positions of those keywords.
2024-02-28 23:47:47 +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
ec8f84d8af
MDL-79543 h5p: Include attempts info and link
Co-authored-by: Ferran Recio <ferran@moodle.com>
2024-02-23 15:42:16 +01:00
Gareth Barnard
270326244b
MDL-79802 core_h5p: Add a new setting for adding custom H5P styles. 2024-02-20 18:12:18 +00:00
Mikel Martín
a198884333 MDL-80259 theme_boost: Refactor badge helper classes for Bootstrap 5 2024-01-23 08:27:23 +01:00
Sara Arjona
cb4d9cdcb6
MDL-74129 h5p: Preserve metadata information
The metadata information was not restored when an H5P file was uploaded
(it was saved when it was edited directly from the Content bank, but the
original information in the H5P file was lost).
This patch includes all the metadata fields and its values in the original
H5P file to preserve this information too.
2023-11-10 10:33:06 +01:00
Paul Holden
100ac7c646 MDL-78820 h5p: use fullname of current user as the xAPI actor name. 2023-10-04 01:24:19 +00:00
Paul Holden
3bc3a5b660
MDL-69530 h5p: remove storage class editor filearea constant. 2023-06-06 12:03:15 +01:00
Sara Arjona
5372f54440 MDL-78087 h5p: Fix TimeLine display bug
When the H5P third-party library was upgraded to moodle-1.23, the calls to
libraryToString(xxx, true) where replaced with libraryToFolderName().
We missed this, which was doing the H5P Timeline activities weren't
displayed properly.

Thanks Joseph for raising this and preparing a patch! Well done!

Co-authored: Joseph Rézeau
2023-05-11 10:19:45 +02:00
Marina Glancy
8fc1486d36 MDL-77164 various: fix incorrect phpdocs 2023-04-13 11:35:06 +01:00
Sara Arjona
c8628576e3 MDL-77254 h5p: Add support to restored states
The restored states should be treated differently, to avoid resetting
them by default the first time users access them.
In that case, the first time users access to content with restored
xAPI states, they should be displayed (instead of resetting them).
2023-04-04 17:23:43 +02:00
Sara Arjona
91175a6773 MDL-77049 core_h5p: Use the styles from Raw SCSS theme settings
MDL-69087 added an option to let themes personalize the H5P styles.
This patch implements the h5p_alter_styles() method in boost, to
let admins personalize the H5P styles using the 'Raw initial SCSS'
and 'Raw SCSS' theme settings.
That way, users won't need to create their own themes to define
some styles for the H5P player.
2023-03-22 12:10:57 +01:00
Sara Arjona
bd0a6e6dcc MDL-67789 h5p: Save current state using xAPI State
Co-author: Andrew Lyons <andrew@moodle.com>
2023-03-15 09:42:18 +01:00
Mathew May
e5ca7766e7 MDL-52805 core: Remove legacy log calls 2023-03-07 13:08:46 +08:00
Sara Arjona
ca37dd3baf MDL-76691 core_h5p: Add core lib changes after upgrading it
Apart from applying the points described in readme_moodle.txt, the following
changes have been done too:

- The parameter $folderName from the method libraryToString() have been removed
and a new method, libraryToFolderName() has been added to the H5PCore API.
References to libraryToString() with the $folderName set to true have been
replaced to the new method.
- missing-main-library has been added and replaces in some cases to
missing-required-library.
- The framework saveLibraryData method must be called before saveLibrary
(h5p.classes.php file has been patched to leave the original order because
libraryid is required to save the itemid).
- The getLibraryId() method from H5PCore has been rewritten to use MUC, in
order to avoid PHPUnit failures.
2023-02-06 16:48:07 +01:00
Marina Glancy
b0a83aa7bd MDL-76362 various: Avoid passing nulls to functions that don't allow nulls
PHP 8.1 is more strict on the parameter type. Functions such as trim(), strlen(), str_replace(), etc
show notice when null is passed as an argument
2023-01-23 09:15:54 +08:00
Andrew Nicols
a3cc26f8bb MDL-76583 core: Update uses of external_* classes 2023-01-19 07:34:09 +08:00
Amaia Anabitarte
2d1883c92e MDL-76004 core_h5p: Ensure the browser is serving updated file 2022-12-14 16:02:44 +01:00
Sara Arjona
288963e526 MDL-73853 core_h5p: Add core lib changes after upgrading it 2022-11-08 17:09:00 +01:00
Sara Arjona
d611cdff9d MDL-73853 core_h5p: Disable H5P hub
Although we're not currently supporting the H5P Hub, the hubIsEnabled
setting was set to true (probably by mistake).
It has been changed to false by default because the new version of
the H5P editor library is causing some errors otherwise.
2022-11-08 17:09:00 +01:00
Paul Holden
b40ab6987d MDL-75326 h5p: require sesskey to toggle library enabled state. 2022-08-12 04:14:18 +02:00
Paul Holden
426f533c07 MDL-74895 h5p: more resilient error handling during content fetching.
On new installs, the task for downloading new H5P content types would
throw exceptions and exit when encountering unexpected and/or missing
data.
2022-07-25 20:03:12 +01:00
Sujith Haridasan
73d604369d MDL-71062 core: Step 1 deprecation of print_error function 2022-07-13 08:20:54 +05:30
Jun Pataleta
d4ba0359cf MDL-72885 core: Use get_html_lang_attribute_value()
Use get_html_lang_attribute_value() for formatting language codes
for the HTML lang attribute.
2022-05-27 19:38:54 +08:00
Davo Smith
4202104a2e MDL-74123 h5p: delete any existing files when downloading new files 2022-03-08 13:52:26 +00:00
Eloy Lafuente (stronk7)
5aa93e3066 Merge branch 'MDL-72466-master' of https://github.com/bmbrands/moodle 2022-02-02 12:10:18 +01:00
Bas Brands
7c76e1c349 MDL-72466 core_output: dropdown menu alignment 2022-01-27 17:24:20 +01:00
Bas Brands
068bb8ae8b MDL-73562 core_contentbank: alignment fixes 2022-01-25 09:35:07 +01:00
Sebastian Berm
e0753cb080 MDL-69467 core_h5p: User uniqueness by id instead of email 2021-12-10 14:36:45 +01:00
Sara Arjona
eb4e36400e MDL-71956 core_h5p: Add more scenarios to can_edit_content
The method can_edit_content() now supports more scenarios where the
H5P content can be edited:
- Instead of supporting only mod_h5pactivity, now it supports any
mod or block when the user has the addinstance capability.
- If the component implements the can_edit_content method in the
h5p\canedit class and it returns true. For instance, the mod_forum
implements it and return true when filearea is post, if the user
can edit the post where the H5P is.
2021-11-09 16:47:18 +01:00
Mikhail Golenkov
4c7bf9eb7e MDL-70323 core_h5p: Add H5P crossOrigin setting 2021-10-24 21:21:58 +11:00
Sara Arjona
f47a327290 MDL-71970 h5plib_v124: Replace references to new Moodle\H5Pxxx namespace
The joubel/core and joubel/editor libraries have been moved to Moodle
namespace.
This commit adds the new namespace to the places where these classes
are used.
Besides, a couple of minor changes have been done to replace the _test.php
classname and remove some unnecessary defined('MOODLE_INTERNAL').
2021-09-27 11:41:48 +02:00
Paul Holden
5255026717 MDL-71050 h5p: account for parent languages retrieving translations.
Take account of parent languages when requesting given library
translation. For example if we are currently using "de_kids" as the
current language, we need to recurse each language pack looking for
a matching H5P translation ("de_kids" -> "de_du" -> "de").
2021-07-12 13:17:02 +01:00
Sara Arjona
692abf2c46 MDL-71885 core_h5p: Display the edit content button
A new parameter has been added to the display method, to define whether
the edit button should be displayed or not.
The H5P activity will display this button (if the user has the required
permissions). However, it won't be displayed when previewing H5P in the
content bank.
2021-07-05 10:56:13 +02:00
Sara Arjona
86b06a7b9a MDL-71885 core_h5p: Add the form for editing content
The editor form is based on the code that Victor Deniz prepared
while he was working on the integration of the H5P editor into
Moodle. The original version of this file can be found in
MDL-67814.
2021-07-05 10:56:13 +02:00
Sara Arjona
13de79c66f MDL-71885 core_h5p: Add new methods to API 2021-07-05 10:56:13 +02:00
Rajneel Totaram
7596e27989 MDL-71343 core_h5p: Convert all line-endings to UNIX format 2021-05-01 00:12:52 +12:00
Andrew Nicols
c58e9a14ee Merge branch 'MDL-69415-master' of git://github.com/sarjona/moodle 2021-04-16 07:57:01 +01:00
Sara Arjona
39fa45e299 MDL-69331 core_contentbank: Hide disabled H5P content-types
If a H5P content-type is disabled:
- The content bank won't display existing contents having it as a
main library.
- The content bank won't allow to create new contents using it.
2021-04-15 09:16:32 +02:00
Sara Arjona
dbfd4aebb5 MDL-69331 core_h5p: Only upgrade enabled libraries
The core\task\h5p_get_content_types_task task will only download
content-type for enabled libraries.
2021-04-15 09:03:56 +02:00
Sara Arjona
5308ba0947 MDL-69331 core_h5p: Display error when main library is disabled
H5P contents with the main library disabled won't be deployed; a
message error will be displayed instead of.
2021-04-15 09:03:56 +02:00
Sara Arjona
d3d3b3bdc0 MDL-69331 core_h5p: Add enabled field to libraries
The "enabled" field has been added to the H5P libraries to let
admins decide whether a library should be used or not in the site.
2021-04-15 09:03:56 +02:00
Sara Arjona
51cdc0e874 MDL-69415 core_h5p: prepend H5P libraries in autoloader
Core and mod_hvp are using the same namespace for some H5P
libraries. This is causing some random errors.
In order to get the expected behaviour in Moodle core, this patch
prepends H5P libraries in order to guarantee they are loaded first.
Plugins using same libraries will need to use a different namespace
if they overlap and a different version of these libraries should
be used.
2021-03-22 12:39:16 +01:00
Ilya Tregubov
bcdf87a877 MDL-70009 h5pactivity: Split get_pluginfile_hash in two methods. 2021-01-12 09:10:24 +02:00
cescobedo
7caad99f99 MDL-70327 core_h5p: Add preventredirect to the player 2020-11-25 16:30:04 +01:00