Merge branch 'MDL-76104-master' of https://github.com/HuongNV13/moodle

This commit is contained in:
Andrew Nicols
2023-06-29 17:32:51 +08:00
committed by Ilya Tregubov
7 changed files with 56 additions and 5 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+3
View File
@@ -36,6 +36,7 @@ import {dispatchEvent} from 'core/event_dispatcher';
import {eventTypes} from './events';
import {get_string as getString} from 'core/str';
import {prefetchStrings} from 'core/prefetch';
import {notifyFilterContentUpdated} from 'core/event';
/**
* The minimum spacing for tour step to display.
@@ -784,6 +785,8 @@ const Tour = class {
let currentStepNode = $('<span data-flexitour="container"></span>')
.html(stepConfig.template)
.hide();
// Trigger the Moodle filters.
notifyFilterContentUpdated(currentStepNode);
// The scroll animation occurs on the body or html.
let animationTarget = $('body, html')
@@ -0,0 +1,40 @@
@tool @tool_usertours
Feature: Apply Moodle filter to a tour
In order to give more content to a tour
As an administrator
I need to create a user tour with Moodle filters applied
Background:
Given I log in as "admin"
And the following "courses" exist:
| shortname | fullname |
| C1 | Course 1 |
And the following "activities" exist:
| activity | name | content | course |
| page | Page for Usertour | Content of page for Usertour | C1 |
And I add a new user tour with:
| Name | Activity names auto-linking tour |
| Description | Tour with activity names auto-linking filter |
| Apply to URL match | /course/view.php% |
| Tour is enabled | 1 |
And I add steps to the "Activity names auto-linking tour" tour:
| targettype | Title | id_content | Content type |
| Display in middle of page | Activity names auto-linking | Test Activity names auto-linking Filter Page for Usertour | Manual |
@javascript
Scenario: Add a new tour with Activity names auto-linking filter off
Given the "activitynames" filter is "off"
When I am on "Course 1" course homepage
Then I should see "Test Activity names auto-linking Filter" in the "Activity names auto-linking" "dialogue"
And I should see "Page for Usertour" in the "Activity names auto-linking" "dialogue"
And "Page for Usertour" "link" should not exist in the "Activity names auto-linking" "dialogue"
@javascript
Scenario: Add a new tour with Activity names auto-linking filter on
Given the "activitynames" filter is "on"
When I am on "Course 1" course homepage
Then I should see "Test Activity names auto-linking Filter" in the "Activity names auto-linking" "dialogue"
And I should see "Page for Usertour" in the "Activity names auto-linking" "dialogue"
And "Page for Usertour" "link" should exist in the "Activity names auto-linking" "dialogue"
And I click on "Page for Usertour" "link" in the "Activity names auto-linking" "dialogue"
And I should see "Content of page for Usertour"
+5
View File
@@ -31,3 +31,8 @@
.mod-indent-outer .mediaplugin {
display: table-cell;
}
/* Make media plugin behave properly in Modal dialog. */
.modal-dialog .mediaplugin {
width: 100vw;
}
+2 -1
View File
@@ -96,7 +96,8 @@ class filter_test extends \advanced_testcase {
$paddedurl = str_pad($originalurl, 6000, 'z');
$validpaddedurl = '<p>Some text.</p><pre style="color: rgb(0, 0, 0); line-height: normal;"><span class="mediaplugin mediaplugin_youtube">
<iframe title="Valid link" width="640" height="360"
src="https://www.youtube.com/embed/uUhWl9Lm3OM?rel=0&amp;wmode=transparent" frameborder="0" allowfullscreen="1"></iframe>
src="https://www.youtube.com/embed/uUhWl9Lm3OM?rel=0&amp;wmode=transparent" frameborder="0"
allowfullscreen="1" style="max-width: 100%;"></iframe>
</span></pre><pre style="color: rgb(0, 0, 0); line-height: normal;">';
$validpaddedurl = str_pad($validpaddedurl, 6000 + (strlen($validpaddedurl) - strlen($originalurl)), 'z');
+4 -2
View File
@@ -78,7 +78,8 @@ class media_youtube_plugin extends core_media_player_external {
return <<<OET
<span class="mediaplugin mediaplugin_youtube">
<iframe width="$width" height="$height" src="https://$site/embed/videoseries?list=$playlist" frameborder="0" allowfullscreen="1"></iframe>
<iframe width="$width" height="$height" src="https://$site/embed/videoseries?list=$playlist" frameborder="0"
allowfullscreen="1" style="max-width: 100%;"></iframe>
</span>
OET;
} else {
@@ -100,7 +101,8 @@ OET;
return <<<OET
<span class="mediaplugin mediaplugin_youtube">
<iframe title="$info" width="$width" height="$height"
src="https://www.youtube.com/embed/$videoid?{$params}rel=0&amp;wmode=transparent" frameborder="0" allowfullscreen="1"></iframe>
src="https://www.youtube.com/embed/$videoid?{$params}rel=0&amp;wmode=transparent" frameborder="0"
allowfullscreen="1" style="max-width: 100%;"></iframe>
</span>
OET;
}