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.
This commit is contained in:
@@ -156,7 +156,7 @@ Feature: H5P file upload to content bank for non admins
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should see "Of which countries"
|
||||
Then I should not see "missing-required-library"
|
||||
Then I should not see "missing-main-library"
|
||||
And I switch to the main frame
|
||||
Given I log out
|
||||
And I log in as "admin"
|
||||
@@ -178,4 +178,4 @@ Feature: H5P file upload to content bank for non admins
|
||||
And I should see "filltheblanks.h5p"
|
||||
And I click on "filltheblanks.h5p" "link"
|
||||
And I switch to "h5p-player" class iframe
|
||||
And I should see "missing-required-library"
|
||||
And I should see "missing-main-library"
|
||||
|
||||
@@ -67,6 +67,17 @@ class api {
|
||||
$DB->delete_records('h5p_library_dependencies', array('libraryid' => $library->id));
|
||||
$DB->delete_records('h5p_libraries', array('id' => $library->id));
|
||||
|
||||
// Remove the library from the cache.
|
||||
$libscache = \cache::make('core', 'h5p_libraries');
|
||||
$libarray = [
|
||||
'machineName' => $library->machinename,
|
||||
'majorVersion' => $library->majorversion,
|
||||
'minorVersion' => $library->minorversion,
|
||||
];
|
||||
$libstring = H5PCore::libraryToString($libarray);
|
||||
$librarykey = helper::get_cache_librarykey($libstring);
|
||||
$libscache->delete($librarykey);
|
||||
|
||||
// Remove the libraries using this library.
|
||||
$requiredlibraries = self::get_dependent_libraries($library->id);
|
||||
foreach ($requiredlibraries as $requiredlibrary) {
|
||||
|
||||
+45
-15
@@ -14,14 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* H5P core class.
|
||||
*
|
||||
* @package core_h5p
|
||||
* @copyright 2019 Sara Arjona <[email protected]>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
namespace core_h5p;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
@@ -35,6 +27,9 @@ use stdClass;
|
||||
use moodle_url;
|
||||
use core_h5p\local\library\autoloader;
|
||||
|
||||
// phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod
|
||||
// phpcs:disable moodle.NamingConventions.ValidVariableName.VariableNameLowerCase
|
||||
|
||||
/**
|
||||
* H5P core class, containing functions and storage shared by the other H5P classes.
|
||||
*
|
||||
@@ -74,7 +69,7 @@ class core extends H5PCore {
|
||||
protected function getDependencyPath(array $dependency): string {
|
||||
$library = $this->find_library($dependency);
|
||||
|
||||
return "libraries/{$library->id}/{$library->machinename}-{$library->majorversion}.{$library->minorversion}";
|
||||
return "libraries/{$library->id}/" . H5PCore::libraryToFolderName($dependency);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +84,7 @@ class core extends H5PCore {
|
||||
$context = \context_system::instance();
|
||||
foreach ($dependencies as $dependency) {
|
||||
$library = $this->find_library($dependency);
|
||||
$roots[self::libraryToString($dependency, true)] = (moodle_url::make_pluginfile_url(
|
||||
$roots[self::libraryToFolderName($dependency)] = (moodle_url::make_pluginfile_url(
|
||||
$context->id,
|
||||
'core_h5p',
|
||||
'libraries',
|
||||
@@ -412,10 +407,45 @@ class core extends H5PCore {
|
||||
* @return string The string name on the form {machineName} {majorVersion}.{minorVersion}.
|
||||
*/
|
||||
public static function record_to_string(stdClass $record, bool $foldername = false): string {
|
||||
return static::libraryToString([
|
||||
'machineName' => $record->machinename,
|
||||
'majorVersion' => $record->majorversion,
|
||||
'minorVersion' => $record->minorversion,
|
||||
], $foldername);
|
||||
if ($foldername) {
|
||||
return static::libraryToFolderName([
|
||||
'machineName' => $record->machinename,
|
||||
'majorVersion' => $record->majorversion,
|
||||
'minorVersion' => $record->minorversion,
|
||||
]);
|
||||
} else {
|
||||
return static::libraryToString([
|
||||
'machineName' => $record->machinename,
|
||||
'majorVersion' => $record->majorversion,
|
||||
'minorVersion' => $record->minorversion,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Small helper for getting the library's ID.
|
||||
* This method is rewritten to use MUC (instead of an static variable which causes some problems with PHPUnit).
|
||||
*
|
||||
* @param array $library
|
||||
* @param string $libString
|
||||
* @return int Identifier, or FALSE if non-existent
|
||||
*/
|
||||
public function getLibraryId($library, $libString = null) {
|
||||
if (!$libString) {
|
||||
$libString = self::libraryToString($library);
|
||||
}
|
||||
|
||||
// Check if this information has been saved previously into the cache.
|
||||
$libcache = \cache::make('core', 'h5p_libraries');
|
||||
$librarykey = helper::get_cache_librarykey($libString);
|
||||
$libraryId = $libcache->get($librarykey);
|
||||
if ($libraryId === false) {
|
||||
$libraryId = $this->h5pF->getLibraryId($library['machineName'], $library['majorVersion'], $library['minorVersion']);
|
||||
$libcache->set($librarykey, $libraryId);
|
||||
}
|
||||
|
||||
return $libraryId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ use Moodle\H5PCore;
|
||||
use Moodle\H5peditorFile;
|
||||
use Moodle\H5PFileStorage;
|
||||
|
||||
// phpcs:disable moodle.NamingConventions.ValidFunctionName.LowercaseMethod
|
||||
|
||||
/**
|
||||
* Class to handle storage and export of H5P Content.
|
||||
*
|
||||
@@ -86,8 +88,8 @@ class file_storage implements H5PFileStorage {
|
||||
'contextid' => $this->context->id,
|
||||
'component' => self::COMPONENT,
|
||||
'filearea' => self::LIBRARY_FILEAREA,
|
||||
'filepath' => '/' . H5PCore::libraryToString($library, true) . '/',
|
||||
'itemid' => $library['libraryId']
|
||||
'filepath' => '/' . H5PCore::libraryToFolderName($library) . '/',
|
||||
'itemid' => $library['libraryId'],
|
||||
];
|
||||
|
||||
// Easiest approach: delete the existing library version and copy the new one.
|
||||
@@ -95,6 +97,18 @@ class file_storage implements H5PFileStorage {
|
||||
$this->copy_directory($library['uploadDirectory'], $options);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete library folder.
|
||||
*
|
||||
* @param array $library
|
||||
*/
|
||||
public function deleteLibrary($library) {
|
||||
// Although this class had a method (delete_library()) for removing libraries before this was added to the interface,
|
||||
// it's not safe to call it from here because looking at the place where it's called, it's not clear what are their
|
||||
// expectation. This method will be implemented once more information will be added to the H5P technical doc.
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Store the content folder.
|
||||
*
|
||||
@@ -162,7 +176,7 @@ class file_storage implements H5PFileStorage {
|
||||
* @param string $target Where the library folder will be saved
|
||||
*/
|
||||
public function exportLibrary($library, $target) {
|
||||
$folder = H5PCore::libraryToString($library, true);
|
||||
$folder = H5PCore::libraryToFolderName($library);
|
||||
$this->export_file_tree($target . '/' . $folder, $this->context->id, self::LIBRARY_FILEAREA,
|
||||
'/' . $folder . '/', $library['libraryId']);
|
||||
}
|
||||
@@ -432,7 +446,7 @@ class file_storage implements H5PFileStorage {
|
||||
|
||||
// Move all temporary content files to editor.
|
||||
$it = new \RecursiveIteratorIterator(
|
||||
new \RecursiveDirectoryIterator($contentsource,\RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
new \RecursiveDirectoryIterator($contentsource, \RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
\RecursiveIteratorIterator::SELF_FIRST
|
||||
);
|
||||
|
||||
@@ -583,7 +597,7 @@ class file_storage implements H5PFileStorage {
|
||||
global $DB;
|
||||
|
||||
// A library ID of false would result in all library files being deleted, which we don't want. Return instead.
|
||||
if ($library['libraryId'] === false) {
|
||||
if (empty($library['libraryId'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -447,6 +447,9 @@ class framework implements H5PFrameworkInterface {
|
||||
'Keywords already exists!' => 'keywordsExits',
|
||||
'Some of these keywords already exist' => 'someKeywordsExits',
|
||||
'Assistive Technologies label' => 'a11yTitle:label',
|
||||
'width' => 'width',
|
||||
'height' => 'height',
|
||||
'Missing main library @library' => 'missingmainlibrary',
|
||||
];
|
||||
|
||||
if (isset($translationsmap[$message])) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* File info?
|
||||
*/
|
||||
@@ -9,13 +11,13 @@
|
||||
* operations using PHP's standard file operation functions.
|
||||
*
|
||||
* Some implementations of H5P that doesn't use the standard file system will
|
||||
* want to create their own implementation of the \H5P\FileStorage interface.
|
||||
* want to create their own implementation of the H5PFileStorage interface.
|
||||
*
|
||||
* @package H5P
|
||||
* @copyright 2016 Joubel AS
|
||||
* @license MIT
|
||||
*/
|
||||
class H5PDefaultStorage implements \H5PFileStorage {
|
||||
class H5PDefaultStorage implements H5PFileStorage {
|
||||
private $path, $alteditorpath;
|
||||
|
||||
/**
|
||||
@@ -39,10 +41,10 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||
* Library properties
|
||||
*/
|
||||
public function saveLibrary($library) {
|
||||
$dest = $this->path . '/libraries/' . \H5PCore::libraryToFolderName($library);
|
||||
$dest = $this->path . '/libraries/' . H5PCore::libraryToFolderName($library);
|
||||
|
||||
// Make sure destination dir doesn't exist
|
||||
\H5PCore::deleteFileTree($dest);
|
||||
H5PCore::deleteFileTree($dest);
|
||||
|
||||
// Move library folder
|
||||
self::copyFileTree($library['uploadDirectory'], $dest);
|
||||
@@ -64,7 +66,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||
$dest = "{$this->path}/content/{$content['id']}";
|
||||
|
||||
// Remove any old content
|
||||
\H5PCore::deleteFileTree($dest);
|
||||
H5PCore::deleteFileTree($dest);
|
||||
|
||||
self::copyFileTree($source, $dest);
|
||||
}
|
||||
@@ -76,7 +78,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||
* Content properties
|
||||
*/
|
||||
public function deleteContent($content) {
|
||||
\H5PCore::deleteFileTree("{$this->path}/content/{$content['id']}");
|
||||
H5PCore::deleteFileTree("{$this->path}/content/{$content['id']}");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +139,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||
* Folder that library resides in
|
||||
*/
|
||||
public function exportLibrary($library, $target, $developmentPath=NULL) {
|
||||
$folder = \H5PCore::libraryToFolderName($library);
|
||||
$folder = H5PCore::libraryToFolderName($library);
|
||||
|
||||
$srcPath = ($developmentPath === NULL ? "/libraries/{$folder}" : $developmentPath);
|
||||
self::copyFileTree("{$this->path}{$srcPath}", "{$target}/{$folder}");
|
||||
@@ -297,7 +299,7 @@ class H5PDefaultStorage implements \H5PFileStorage {
|
||||
* Save files uploaded through the editor.
|
||||
* The files must be marked as temporary until the content form is saved.
|
||||
*
|
||||
* @param \H5peditorFile $file
|
||||
* @param H5peditorFile $file
|
||||
* @param int $contentid
|
||||
*/
|
||||
public function saveFile($file, $contentId) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* This is a data layer which uses the file system so it isn't specific to any framework.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* The base class for H5P events. Extend to track H5P events in your system.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* File info?
|
||||
*/
|
||||
@@ -145,7 +147,7 @@ interface H5PFileStorage {
|
||||
* Save files uploaded through the editor.
|
||||
* The files must be marked as temporary until the content form is saved.
|
||||
*
|
||||
* @param \H5peditorFile $file
|
||||
* @param H5peditorFile $file
|
||||
* @param int $contentId
|
||||
*/
|
||||
public function saveFile($file, $contentId);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
/**
|
||||
* Utility class for handling metadata
|
||||
*/
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Moodle;
|
||||
|
||||
use ZipArchive;
|
||||
|
||||
/**
|
||||
* Interface defining functions the h5p library needs the framework to implement
|
||||
*/
|
||||
@@ -1649,12 +1654,14 @@ class H5PStorage {
|
||||
H5PMetadata::boolifyAndEncodeSettings($library['metadataSettings']) :
|
||||
NULL;
|
||||
|
||||
// Save library folder
|
||||
$this->h5pC->fs->saveLibrary($library);
|
||||
|
||||
// MOODLE PATCH: The library needs to be saved in database first before creating the files, because the libraryid is used
|
||||
// as itemid for the files.
|
||||
// Update our DB
|
||||
$this->h5pF->saveLibraryData($library, $new);
|
||||
|
||||
// Save library folder
|
||||
$this->h5pC->fs->saveLibrary($library);
|
||||
|
||||
// Remove cached assets that uses this library
|
||||
if ($this->h5pC->aggregateAssets && isset($library['libraryId'])) {
|
||||
$removedKeys = $this->h5pF->deleteCachedAssets($library['libraryId']);
|
||||
@@ -2132,7 +2139,7 @@ class H5PCore {
|
||||
*
|
||||
* @param H5PFrameworkInterface $H5PFramework
|
||||
* The frameworks implementation of the H5PFrameworkInterface
|
||||
* @param string|\H5PFileStorage $path H5P file storage directory or class.
|
||||
* @param string|H5PFileStorage $path H5P file storage directory or class.
|
||||
* @param string $url To file storage directory.
|
||||
* @param string $language code. Defaults to english.
|
||||
* @param boolean $export enabled?
|
||||
@@ -2140,7 +2147,7 @@ class H5PCore {
|
||||
public function __construct(H5PFrameworkInterface $H5PFramework, $path, $url, $language = 'en', $export = FALSE) {
|
||||
$this->h5pF = $H5PFramework;
|
||||
|
||||
$this->fs = ($path instanceof \H5PFileStorage ? $path : new \H5PDefaultStorage($path));
|
||||
$this->fs = ($path instanceof H5PFileStorage ? $path : new H5PDefaultStorage($path));
|
||||
|
||||
$this->url = $url;
|
||||
$this->exportEnabled = $export;
|
||||
@@ -3307,21 +3314,23 @@ class H5PCore {
|
||||
* @return string
|
||||
*/
|
||||
private static function hashToken($action, $time_factor) {
|
||||
if (!isset($_SESSION['h5p_token'])) {
|
||||
global $SESSION;
|
||||
|
||||
if (!isset($SESSION->h5p_token)) {
|
||||
// Create an unique key which is used to create action tokens for this session.
|
||||
if (function_exists('random_bytes')) {
|
||||
$_SESSION['h5p_token'] = base64_encode(random_bytes(15));
|
||||
$SESSION->h5p_token = base64_encode(random_bytes(15));
|
||||
}
|
||||
else if (function_exists('openssl_random_pseudo_bytes')) {
|
||||
$_SESSION['h5p_token'] = base64_encode(openssl_random_pseudo_bytes(15));
|
||||
$SESSION->h5p_token = base64_encode(openssl_random_pseudo_bytes(15));
|
||||
}
|
||||
else {
|
||||
$_SESSION['h5p_token'] = uniqid('', TRUE);
|
||||
$SESSION->h5p_token = uniqid('', TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
// Create hash and return
|
||||
return substr(hash('md5', $action . $time_factor . $_SESSION['h5p_token']), -16, 13);
|
||||
return substr(hash('md5', $action . $time_factor . $SESSION->h5p_token), -16, 13);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,3 +29,9 @@ Changed:
|
||||
|
||||
3. Check if there are changes in the getLocalization() method in h5p.classes.php and update lang/en/h5p.php accordingly.
|
||||
If there are changes, check the t() method in h5p/classes/framework.php too (updating or adding new ones).
|
||||
|
||||
4. In saveLibraries() method in core/h5p.classes.php, check $this->h5pF->saveLibraryData is called before $this->h5pC->fs->saveLibrary.
|
||||
The library needs to be saved in the database first before creating the files, because the libraryid is used as itemid for the files.
|
||||
|
||||
5. Check if new methods have been added to any of the interfaces. If that's the case, implement them in the proper class. For
|
||||
instance, if a new method is added to h5p-file-storage.interface.php, it should be implemented in h5p/classes/file_storage.php.
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<location>joubel/core</location>
|
||||
<name>h5p-php-library</name>
|
||||
<description>The general H5P library.</description>
|
||||
<version>moodle-1.22.4</version>
|
||||
<version>moodle-1.23</version>
|
||||
<license>GPL</license>
|
||||
<licenseversion>3.0+</licenseversion>
|
||||
<repository>https://github.com/h5p/h5p-php-library/</repository>
|
||||
|
||||
@@ -154,8 +154,8 @@ class helper_test extends \advanced_testcase {
|
||||
$errors = $factory->get_framework()->getMessages('error');
|
||||
$this->assertCount(1, $errors);
|
||||
$error = reset($errors);
|
||||
$this->assertEquals('missing-required-library', $error->code);
|
||||
$this->assertEquals('Missing required library H5P.GreetingCard 1.0', $error->message);
|
||||
$this->assertEquals('missing-main-library', $error->code);
|
||||
$this->assertEquals('Missing main library H5P.GreetingCard 1.0', $error->message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,6 +65,7 @@ $string['cachedef_file_imageinfo'] = 'File image info e.g. dimensions';
|
||||
$string['cachedef_suspended_userids'] = 'List of suspended users per course';
|
||||
$string['cachedef_groupdata'] = 'Course group information';
|
||||
$string['cachedef_h5p_content_type_translations'] = 'H5P content-type libraries translations';
|
||||
$string['cachedef_h5p_libraries'] = 'H5P libraries';
|
||||
$string['cachedef_h5p_library_files'] = 'H5P library files';
|
||||
$string['cachedef_htmlpurifier'] = 'HTML Purifier - cleaned content';
|
||||
$string['cachedef_langmenu'] = 'List of available languages';
|
||||
|
||||
@@ -137,6 +137,7 @@ $string['h5poverview'] = 'H5P overview';
|
||||
$string['h5ppackage'] = 'H5P content type';
|
||||
$string['h5ppackage_help'] = 'An H5P content type is a file with an H5P or ZIP extension containing all libraries required to display the content.';
|
||||
$string['h5psettings'] = 'H5P settings';
|
||||
$string['height'] = 'height';
|
||||
$string['helpChoosingLicense'] = 'Help me choose a license';
|
||||
$string['hideadvanced'] = 'Hide advanced';
|
||||
$string['icon'] = 'Icon';
|
||||
@@ -202,6 +203,7 @@ $string['missingcontentfolder'] = 'A valid content folder is missing';
|
||||
$string['missingcoreversion'] = 'The system was unable to install the {$a->%component} component from the package, as it requires a newer version of the H5P plugin. This site is currently running version {$a->%current}, whereas the required version is {$a->%required} or higher. Please upgrade and then try again.';
|
||||
$string['missingdependency'] = 'Missing dependency {$a->@dep} required by {$a->@lib}.';
|
||||
$string['missinglibrary'] = 'Missing required library {$a->@library}';
|
||||
$string['missingmainlibrary'] = 'Missing main library {$a->@library}';
|
||||
$string['missinglibraryfile'] = 'The file "{$a->%file}" is missing from library: "{$a->%name}"';
|
||||
$string['missinglibraryjson'] = 'Could not find library.json file with valid json format for library {$a->%name}';
|
||||
$string['missinglibraryproperty'] = 'The required property {$a->%property} is missing from {$a->%library}';
|
||||
@@ -286,6 +288,7 @@ $string['updatedlibrary'] = 'Updated {$a->%old} H5P library.';
|
||||
$string['uploadlibraries'] = 'Upload H5P content types';
|
||||
$string['updateRegistrationOnHub'] = 'Save account settings';
|
||||
$string['uploadsuccess'] = 'H5P content types uploaded successfully';
|
||||
$string['width'] = 'width';
|
||||
$string['wrongversion'] = 'The version of the H5P library {$a->%machineName} used in this content is not valid. Content contains {$a->%contentLibrary}, but it should be {$a->%semanticsLibrary}.';
|
||||
$string['year'] = 'Year';
|
||||
$string['years'] = 'Year(s)';
|
||||
|
||||
@@ -487,6 +487,13 @@ $definitions = array(
|
||||
'simpledata' => true,
|
||||
],
|
||||
|
||||
// File cache for H5P Library ids.
|
||||
'h5p_libraries' => [
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
'simplekeys' => true,
|
||||
'canuselocalstore' => true
|
||||
],
|
||||
|
||||
// File cache for H5P Library files.
|
||||
'h5p_library_files' => [
|
||||
'mode' => cache_store::MODE_APPLICATION,
|
||||
|
||||
@@ -130,7 +130,7 @@ Feature: Add h5ps to Atto
|
||||
And I should not see "Cloudberries"
|
||||
|
||||
@javascript
|
||||
Scenario: Enable/disable H5P options
|
||||
Scenario: Enable/disable H5P options atto
|
||||
Given I log in as "admin"
|
||||
And I follow "Manage private files..."
|
||||
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
|
||||
@@ -143,14 +143,11 @@ Feature: Add h5ps to Atto
|
||||
And I click on "Select this file" "button"
|
||||
# No display option button displayed
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
When I click on "Save and display" "button"
|
||||
And I wait until the page is ready
|
||||
And I switch to "h5pcontent" iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should not see "Reuse"
|
||||
And I should not see "Embed"
|
||||
And I should not see "Rights of use"
|
||||
Then ".h5p-actions" "css_element" should not exist
|
||||
And I switch to the main frame
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I click on ".h5p-placeholder" "css_element"
|
||||
@@ -159,12 +156,10 @@ Feature: Add h5ps to Atto
|
||||
# Only Allow Download button displayed
|
||||
And I click on "Allow download" "checkbox"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
And I click on "Save and display" "button"
|
||||
And I wait until the page is ready
|
||||
And I switch to "h5pcontent" iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Reuse"
|
||||
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
|
||||
And I should not see "Embed"
|
||||
And I should not see "Rights of use"
|
||||
And I switch to the main frame
|
||||
@@ -176,12 +171,10 @@ Feature: Add h5ps to Atto
|
||||
And I click on "Embed button" "checkbox"
|
||||
And I click on "Copyright button" "checkbox"
|
||||
And I click on "Insert H5P" "button" in the "Insert H5P" "dialogue"
|
||||
And I wait until the page is ready
|
||||
And I click on "Save and display" "button"
|
||||
And I wait until the page is ready
|
||||
And I switch to "h5pcontent" iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should not see "Reuse"
|
||||
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
|
||||
And I should see "Embed"
|
||||
And I should see "Rights of use"
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ Feature: Use the TinyMCE editor to upload an h5p package
|
||||
And I should not see "Cloudberries"
|
||||
|
||||
@javascript
|
||||
Scenario: Enable/disable H5P options
|
||||
Scenario: Enable/disable H5P options tiny
|
||||
Given I log in as "admin"
|
||||
And I follow "Manage private files..."
|
||||
And I upload "h5p/tests/fixtures/guess-the-answer.h5p" file to "Files" filemanager
|
||||
@@ -118,9 +118,7 @@ Feature: Use the TinyMCE editor to upload an h5p package
|
||||
When I click on "Save and display" "button"
|
||||
And I switch to "h5pcontent" iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
Then I should not see "Reuse"
|
||||
And I should not see "Embed"
|
||||
And I should not see "Rights of use"
|
||||
Then ".h5p-actions" "css_element" should not exist
|
||||
And I switch to the main frame
|
||||
And I navigate to "Settings" in current page administration
|
||||
And I select the ".h5p-placeholder" "css_element" in the "Page content" TinyMCE editor
|
||||
@@ -132,7 +130,7 @@ Feature: Use the TinyMCE editor to upload an h5p package
|
||||
And I click on "Save and display" "button"
|
||||
And I switch to "h5pcontent" iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Reuse"
|
||||
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
|
||||
And I should not see "Embed"
|
||||
And I should not see "Rights of use"
|
||||
And I switch to the main frame
|
||||
@@ -147,7 +145,7 @@ Feature: Use the TinyMCE editor to upload an h5p package
|
||||
And I click on "Save and display" "button"
|
||||
And I switch to "h5pcontent" iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should not see "Reuse"
|
||||
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
|
||||
And I should see "Embed"
|
||||
And I should see "Rights of use"
|
||||
|
||||
|
||||
@@ -36,7 +36,6 @@ Feature: Add H5P activity
|
||||
And I should not see "Reuse"
|
||||
And I should not see "Rights of use"
|
||||
And I should not see "Embed"
|
||||
And I switch to the main frame
|
||||
|
||||
@javascript
|
||||
Scenario: Add a h5pactivity activity with download
|
||||
@@ -47,13 +46,11 @@ Feature: Add H5P activity
|
||||
| displayoptions | 12 |
|
||||
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
|
||||
When I am on the "Awesome H5P package" "h5pactivity activity" page
|
||||
And I wait until the page is ready
|
||||
Then I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Reuse"
|
||||
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
|
||||
And I should not see "Rights of use"
|
||||
And I should not see "Embed"
|
||||
And I switch to the main frame
|
||||
|
||||
@javascript
|
||||
Scenario: Add a h5pactivity activity with embed
|
||||
@@ -64,13 +61,11 @@ Feature: Add H5P activity
|
||||
| displayoptions | 10 |
|
||||
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
|
||||
When I am on the "Awesome H5P package" "h5pactivity activity" page
|
||||
And I wait until the page is ready
|
||||
Then I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should not see "Reuse"
|
||||
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
|
||||
And I should not see "Rights of use"
|
||||
And I should see "Embed"
|
||||
And I switch to the main frame
|
||||
|
||||
@javascript
|
||||
Scenario: Add a h5pactivity activity with copyright
|
||||
@@ -81,13 +76,11 @@ Feature: Add H5P activity
|
||||
| displayoptions | 6 |
|
||||
| packagefilepath | h5p/tests/fixtures/guess-the-answer.h5p |
|
||||
When I am on the "Awesome H5P package" "h5pactivity activity" page
|
||||
And I wait until the page is ready
|
||||
Then I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should not see "Reuse"
|
||||
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
|
||||
And I should see "Rights of use"
|
||||
And I should not see "Embed"
|
||||
And I switch to the main frame
|
||||
|
||||
@javascript
|
||||
Scenario: Add a h5pactivity activity with copyright in a content without copyright
|
||||
@@ -98,13 +91,11 @@ Feature: Add H5P activity
|
||||
| displayoptions | 6 |
|
||||
| packagefilepath | h5p/tests/fixtures/ipsums.h5p |
|
||||
When I am on the "Awesome H5P package" "h5pactivity activity" page
|
||||
And I wait until the page is ready
|
||||
Then I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should not see "Reuse"
|
||||
And "Reuse" "text" should not exist in the ".h5p-actions" "css_element"
|
||||
And I should not see "Rights of use"
|
||||
And I should not see "Embed"
|
||||
And I switch to the main frame
|
||||
|
||||
@javascript
|
||||
Scenario: Add a h5pactivity activity to a course with all display options enabled
|
||||
@@ -115,10 +106,8 @@ Feature: Add H5P activity
|
||||
| displayoptions | 0 |
|
||||
| packagefilepath | h5p/tests/fixtures/guess-the-answer.h5p |
|
||||
When I am on the "Awesome H5P package" "h5pactivity activity" page
|
||||
And I wait until the page is ready
|
||||
Then I switch to "h5p-player" class iframe
|
||||
And I switch to "h5p-iframe" class iframe
|
||||
And I should see "Reuse"
|
||||
And "Reuse" "text" should exist in the ".h5p-actions" "css_element"
|
||||
And I should see "Rights of use"
|
||||
And I should see "Embed"
|
||||
And I switch to the main frame
|
||||
|
||||
Reference in New Issue
Block a user