Skip to content

Commit

Permalink
Merge branch 'MDL-76104-master' of https://github.com/HuongNV13/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols authored and ilyatregubov committed Jun 29, 2023
2 parents 8d860bb + 83579a0 commit 86eece1
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 5 deletions.
2 changes: 1 addition & 1 deletion admin/tool/usertours/amd/build/tour.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/tool/usertours/amd/build/tour.min.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions admin/tool/usertours/amd/src/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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')
Expand Down
40 changes: 40 additions & 0 deletions admin/tool/usertours/tests/behat/tour_content_with_filter.feature
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 0 deletions filter/mediaplugin/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,8 @@
.mod-indent-outer .mediaplugin {
display: table-cell;
}

/* Make media plugin behave properly in Modal dialog. */
.modal-dialog .mediaplugin {
width: 100vw;
}
3 changes: 2 additions & 1 deletion filter/mediaplugin/tests/filter_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function test_filter_mediaplugin_link() {
$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');

Expand Down
6 changes: 4 additions & 2 deletions media/player/youtube/classes/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ protected function embed_external(moodle_url $url, $name, $width, $height, $opti

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 {
Expand All @@ -100,7 +101,8 @@ protected function embed_external(moodle_url $url, $name, $width, $height, $opti
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;
}
Expand Down

0 comments on commit 86eece1

Please sign in to comment.