diff --git a/lib/editor/atto/plugins/media/lang/en/atto_media.php b/lib/editor/atto/plugins/media/lang/en/atto_media.php
index 58b8cabd47e..6c57e130f14 100644
--- a/lib/editor/atto/plugins/media/lang/en/atto_media.php
+++ b/lib/editor/atto/plugins/media/lang/en/atto_media.php
@@ -22,10 +22,61 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
+$string['add'] = 'Add';
+$string['addcaptionstrack'] = 'Add caption track';
+$string['addchapterstrack'] = 'Add chapter track';
+$string['adddescriptionstrack'] = 'Add description track';
+$string['addmetadatatrack'] = 'Add metadata track';
+$string['addsource'] = 'Add alternative source';
+$string['addsource_help'] = 'It is recommended that an alternative media source is provided, since desktop and mobile browsers vary in which file formats they support.';
+$string['addsubtitlestrack'] = 'Add subtitle track';
+$string['addtrack'] = 'Add track';
+$string['advancedsettings'] = 'Advanced settings';
+$string['audio'] = 'Audio';
+$string['audiosourcelabel'] = 'Audio source URL';
+$string['autoplay'] = 'Play automatically';
$string['browserepositories'] = 'Browse repositories...';
+$string['captions'] = 'Captions';
+$string['captions_help'] = 'Captions may be used to describe everything happening in the track, including non-verbal sounds such as a phone ringing.';
+$string['captionssourcelabel'] = 'Caption track URL';
+$string['chapters'] = 'Chapters';
+$string['chapters_help'] = 'Chapter titles may be provided for use in navigating the media resource.';
+$string['chapterssourcelabel'] = 'Chapter track URL';
+$string['controls'] = 'Show controls';
$string['createmedia'] = 'Insert media';
+$string['default'] = 'Default';
+$string['descriptions'] = 'Descriptions';
+$string['descriptions_help'] = 'Audio descriptions may be used to provide a narration which explains visual details not apparent from the audio alone.';
+$string['descriptionssourcelabel'] = 'Description track URL';
+$string['displayoptions'] = 'Display options';
$string['entername'] = 'Enter name';
+$string['entersource'] = 'Source URL';
$string['enterurl'] = 'Enter URL';
$string['height'] = 'Height';
+$string['kind'] = 'Type';
+$string['label'] = 'Label';
+$string['languagesavailable'] = 'Languages available';
+$string['languagesinstalled'] = 'Languages installed';
+$string['link'] = 'Link';
+$string['loop'] = 'Loop';
+$string['metadata'] = 'Metadata';
+$string['metadata_help'] = 'Metadata tracks, for use from a script, may be used only if the player supports metadata';
+$string['metadatasourcelabel'] = 'Metadata track URL';
+$string['mute'] = 'Muted';
$string['pluginname'] = 'Media';
+$string['poster'] = 'Thumbnail URL';
+$string['remove'] = 'Remove';
+$string['size'] = 'Size';
+$string['srclang'] = 'Language';
+$string['subtitles'] = 'Subtitles';
+$string['subtitles_help'] = 'Subtitles may be used to provide a transcription or translation of the dialogue.';
+$string['subtitlessourcelabel'] = 'Subtitle track URL';
+$string['track'] = 'Track URL';
+$string['tracks'] = 'Subtitles and captions';
+$string['tracks_help'] = 'Subtitles, captions, chapters and descriptions can be added via a WebVTT (Web Video Text Tracks) format file. Track labels will be shown in the selection dropdown menu. For each type of track, any track set as default will be pre-selected at the start of the video.';
+$string['video'] = 'Video';
+$string['videoheight'] = 'Video height';
+$string['videosourcelabel'] = 'Video source URL';
+$string['videowidth'] = 'Video width';
$string['width'] = 'Width';
+
diff --git a/lib/editor/atto/plugins/media/lib.php b/lib/editor/atto/plugins/media/lib.php
index 62e0dd4850e..86a9d379ea5 100644
--- a/lib/editor/atto/plugins/media/lib.php
+++ b/lib/editor/atto/plugins/media/lib.php
@@ -28,9 +28,100 @@
function atto_media_strings_for_js() {
global $PAGE;
- $PAGE->requires->strings_for_js(array('createmedia',
- 'enterurl',
+ $PAGE->requires->strings_for_js(array('add',
+ 'addcaptionstrack',
+ 'addchapterstrack',
+ 'adddescriptionstrack',
+ 'addmetadatatrack',
+ 'addsource',
+ 'addsubtitlestrack',
+ 'addtrack',
+ 'advancedsettings',
+ 'audio',
+ 'audiosourcelabel',
+ 'autoplay',
+ 'browserepositories',
+ 'browserepositories',
+ 'captions',
+ 'captionssourcelabel',
+ 'chapters',
+ 'chapterssourcelabel',
+ 'controls',
+ 'createmedia',
+ 'default',
+ 'descriptions',
+ 'descriptionssourcelabel',
+ 'displayoptions',
'entername',
- 'browserepositories'),
+ 'entername',
+ 'entersource',
+ 'enterurl',
+ 'height',
+ 'kind',
+ 'label',
+ 'languagesavailable',
+ 'languagesinstalled',
+ 'link',
+ 'loop',
+ 'metadata',
+ 'metadatasourcelabel',
+ 'mute',
+ 'poster',
+ 'remove',
+ 'size',
+ 'srclang',
+ 'subtitles',
+ 'subtitlessourcelabel',
+ 'track',
+ 'tracks',
+ 'video',
+ 'videoheight',
+ 'videosourcelabel',
+ 'videowidth',
+ 'width'),
'atto_media');
}
+
+/**
+ * Sends the parameters to the JS module.
+ *
+ * @return array
+ */
+function atto_media_params_for_js() {
+ global $OUTPUT;
+ global $PAGE;
+ $currentlang = current_language();
+ $langsinstalled = get_string_manager()->get_list_of_translations(true);
+ $langsavailable = get_string_manager()->get_list_of_languages();
+ $params = [
+ 'langs' => ['installed' => [], 'available' => []],
+ 'help' => []
+ ];
+
+ foreach ($langsinstalled as $code => $name) {
+ $params['langs']['installed'][] = [
+ 'lang' => $name,
+ 'code' => $code,
+ 'default' => $currentlang == $code
+ ];
+ }
+
+ foreach ($langsavailable as $code => $name) {
+ // See MDL-50829 for an explanation of this lrm thing.
+ $lrm = json_decode('"\u200E"');
+ $params['langs']['available'][] = [
+ 'lang' => $name . ' ' . $lrm . '(' . $code . ')' . $lrm, 'code' => $code];
+ }
+
+ $params['help'] = [
+ 'addsource' => $OUTPUT->help_icon('addsource', 'atto_media'),
+ 'tracks' => $OUTPUT->help_icon('tracks', 'atto_media'),
+ 'subtitles' => $OUTPUT->help_icon('subtitles', 'atto_media'),
+ 'captions' => $OUTPUT->help_icon('captions', 'atto_media'),
+ 'descriptions' => $OUTPUT->help_icon('descriptions', 'atto_media'),
+ 'chapters' => $OUTPUT->help_icon('chapters', 'atto_media'),
+ 'metadata' => $OUTPUT->help_icon('metadata', 'atto_media')
+ ];
+
+ return $params;
+}
diff --git a/lib/editor/atto/plugins/media/styles.css b/lib/editor/atto/plugins/media/styles.css
new file mode 100644
index 00000000000..149ad94c03a
--- /dev/null
+++ b/lib/editor/atto/plugins/media/styles.css
@@ -0,0 +1,106 @@
+.atto_form.atto_media #video input,
+.atto_form.atto_media #audio input,
+.atto_form.atto_media #link input {
+ box-sizing: border-box;
+ height: inherit;
+}
+
+.atto_form.atto_media > .tab-content {
+ max-height: 60vh;
+ overflow-x: hidden;
+ padding-left: 20px;
+ padding-right: 20px;
+ margin-left: -20px;
+ margin-right: -21px;
+}
+
+.atto_form.atto_media [id$="-advanced-settings"] label {
+ margin-right: 10px;
+}
+
+.atto_form.atto_media label {
+ display: inline-block;
+}
+
+.atto_form.atto_media label > span {
+ display: inline-block;
+ min-width: 6em;
+}
+
+.atto_form.atto_media .atto_media_track_lang_entry,
+.atto_form.atto_media .atto_media_track_label_entry {
+ width: 168px;
+}
+
+.atto_form.atto_media .atto_media_track_source {
+ margin-bottom: 10px;
+}
+
+.atto_form.atto_media select {
+ margin-right: 10px;
+}
+
+.atto_form.atto_media [id$="-tracks"] input[type=checkbox] {
+ margin-left: 10px;
+}
+
+.atto_form.atto_media .atto_media_track ~ .atto_media_track {
+ margin-top: 5px;
+ padding-top: 10px;
+ border-top: 1px solid #e5e5e5;
+}
+
+.atto_form.atto_media label.fullwidth {
+ width: 100%;
+}
+
+.atto_media_postersize {
+ display: inline-block;
+}
+
+.atto_media_postersize input[type=text] {
+ width: 3em;
+}
+
+input[size].atto_media_url_entry {
+ width: calc(100% - 15px);
+}
+
+.openmediabrowser {
+ margin-top: -4px;
+}
+
+.addcomponent,
+.removecomponent {
+ font-weight: bold;
+ margin-right: 10px;
+}
+
+.trackhelp {
+ text-align: right;
+}
+
+.atto_form.atto_media .atto_media_source > label {
+ width: calc(100% - 153px);
+}
+
+.atto_form.atto_media .atto_media_track_lang_entry,
+.atto_form.atto_media .atto_media_track_label_entry {
+ width: 116px;
+}
+
+.langlabel {
+ width: 42%;
+}
+
+.labellabel {
+ width: 44%;
+}
+
+.defaultlabel {
+ width: 14%;
+}
+
+[data-medium-type=link] label {
+ width: 100%;
+}
diff --git a/lib/editor/atto/plugins/media/styles_clean.css b/lib/editor/atto/plugins/media/styles_clean.css
new file mode 100644
index 00000000000..e947eab2000
--- /dev/null
+++ b/lib/editor/atto/plugins/media/styles_clean.css
@@ -0,0 +1,28 @@
+.nav-tabs > .nav-item a.active {
+ color: #555;
+ background-color: #fff;
+ border: 1px solid #ddd;
+ border-bottom-color: transparent;
+ cursor: default;
+}
+
+.atto_form.atto_media .atto_media_track_lang_entry,
+.atto_form.atto_media .atto_media_track_label_entry {
+ width: 124px;
+}
+
+.atto_form.atto_media .atto_media_source > label {
+ width: calc(100% - 168px);
+}
+
+.langlabel {
+ width: 42%;
+}
+
+.labellabel {
+ width: 44%;
+}
+
+.defaultlabel {
+ width: 14%;
+}
diff --git a/lib/editor/atto/plugins/media/tests/behat/media.feature b/lib/editor/atto/plugins/media/tests/behat/media.feature
index 5c1326a0bed..aa6aef06de2 100644
--- a/lib/editor/atto/plugins/media/tests/behat/media.feature
+++ b/lib/editor/atto/plugins/media/tests/behat/media.feature
@@ -2,25 +2,164 @@
Feature: Add media to Atto
To write rich text - I need to add media.
- @javascript
- Scenario: Insert some media
- Given I log in as "admin"
- And I follow "Manage private files..."
- And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager
- And I click on "Save changes" "button"
- When I follow "Profile" in the user menu
- And I follow "Blog entries"
- And I follow "Add a new entry"
- And I set the field "Blog entry body" to "
Media test
"
- And I select the text in the "Blog entry body" Atto editor
- And I set the field "Entry title" to "The best video in the entire world (not really)"
- And I click on "Media" "button"
- And I click on "Browse repositories..." "button"
- And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
- And I click on "moodle-logo.webm" "link"
- And I click on "Select this file" "button"
- And I set the field "Enter name" to "It's the logo"
- And I click on "Insert media" "button"
- And I click on "Save changes" "button"
- Then "video" "css_element" should be visible
+ Background:
+ Given I log in as "admin"
+ And I follow "Manage private files..."
+ And I upload "lib/editor/atto/tests/fixtures/moodle-logo.webm" file to "Files" filemanager
+ And I upload "lib/editor/atto/tests/fixtures/moodle-logo.mp4" file to "Files" filemanager
+ And I upload "lib/editor/atto/tests/fixtures/moodle-logo.png" file to "Files" filemanager
+ And I upload "lib/editor/atto/tests/fixtures/pretty-good-en.vtt" file to "Files" filemanager
+ And I upload "lib/editor/atto/tests/fixtures/pretty-good-sv.vtt" file to "Files" filemanager
+ And I click on "Save changes" "button"
+ And I follow "Profile" in the user menu
+ And I follow "Blog entries"
+ And I follow "Add a new entry"
+ And I set the field "Blog entry body" to "
Media test
"
+ And I select the text in the "Blog entry body" Atto editor
+ And I set the field "Entry title" to "The best video in the entire world (not really)"
+ And I click on "Media" "button"
+ @javascript
+ Scenario: Insert some media as a link
+ Given I click on "Browse repositories..." "button" in the "#id_summary_editor_link .atto_media_source.atto_media_link_source" "css_element"
+ And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
+ And I click on "moodle-logo.webm" "link"
+ And I click on "Select this file" "button"
+ And the field "Enter name" matches value "moodle-logo.webm"
+ And I wait until the page is ready
+ And I click on "Insert media" "button"
+ When I click on "Save changes" "button"
+ Then "//a[. = 'moodle-logo.webm']" "xpath_element" should exist
+
+ @javascript
+ Scenario: Insert some media as a plain video
+ Given I click on "Video" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
+ And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
+ And I click on "moodle-logo.webm" "link"
+ And I click on "Select this file" "button"
+ And I click on "Add alternative source" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source:nth-of-type(2)" "css_element"
+ And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
+ And I click on "moodle-logo.mp4" "link"
+ And I click on "Select this file" "button"
+ When I click on "Insert media" "button"
+ Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][descendant::source[contains(@src, 'moodle-logo.mp4')]]" "xpath_element" should exist
+
+ @javascript
+ Scenario: Insert some media as a video with display settings
+ Given I click on "Video" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
+ And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
+ And I click on "moodle-logo.webm" "link"
+ And I click on "Select this file" "button"
+ And I click on "Display options" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_poster_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "moodle-logo.png" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I set the field with xpath "//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_width_entry ')]" to "420"
+ And I set the field with xpath "//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_height_entry ')]" to "69"
+ And I click on "Display options" "link"
+ When I click on "Insert media" "button"
+ Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][contains(@poster, 'moodle-logo.png')][@width=420][@height=69]" "xpath_element" should exist
+
+ @javascript
+ Scenario: Insert some media as a video with advanced settings
+ Given I click on "Video" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
+ And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
+ And I click on "moodle-logo.webm" "link"
+ And I click on "Select this file" "button"
+ And I click on "Advanced settings" "link"
+ And the field "Show controls" matches value "1"
+ And I set the field "Play automatically" to "1"
+ And I set the field "Muted" to "1"
+ And I set the field "Loop" to "1"
+ When I click on "Insert media" "button"
+ Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][@controls='true'][@loop='true'][@autoplay='true'][@autoplay='true']" "xpath_element" should exist
+
+ @javascript
+ Scenario: Insert some media as a video with tracks
+ Given I click on "Video" "link"
+ And I change window size to "large"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video .atto_media_source.atto_media_media_source" "css_element"
+ And I click on "Private files" "link" in the ".fp-repo-area" "css_element"
+ And I click on "moodle-logo.webm" "link"
+ And I click on "Select this file" "button"
+ And I click on "Subtitles and captions" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_subtitles .atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-sv.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And the field "Label" matches value "Swedish"
+ And the field "Language" matches value "sv"
+ And I click on "Add subtitle track" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_subtitles .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-en.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[2]" matches value "English"
+ And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[1]" to "1"
+ And I click on "Captions" "link" in the ".nav-item[data-track-kind='captions']" "css_element"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_captions .atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-sv.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[3]" matches value "Swedish"
+ And I click on "Add caption track" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_captions .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-en.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[4]" matches value "English"
+ And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[4]" to "1"
+ And I click on "Descriptions" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_descriptions .atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-sv.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[5]" matches value "Swedish"
+ And I click on "Add description track" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_descriptions .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-en.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[6]" matches value "English"
+ And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[5]" to "1"
+ And I click on "Chapters" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_chapters .atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-sv.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[7]" matches value "Swedish"
+ And I click on "Add chapter track" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_chapters .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-en.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[8]" matches value "English"
+ And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[8]" to "1"
+ And I click on "Metadata" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_metadata .atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-sv.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[9]" matches value "Swedish"
+ And I click on "Add metadata track" "link"
+ And I click on "Browse repositories..." "button" in the "#id_summary_editor_video_metadata .atto_media_track~.atto_media_track .atto_media_source.atto_media_track_source" "css_element"
+ And I click on "Private files" "link" in the ".moodle-dialogue-base[aria-hidden='false'] .fp-repo-area" "css_element"
+ And I click on "pretty-good-en.vtt" "link"
+ And I click on "Select this file" "button" in the ".moodle-dialogue-base[aria-hidden='false']" "css_element"
+ And I click on "Overwrite" "button"
+ And the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_label_entry ')])[10]" matches value "English"
+ And I set the field with xpath "(//*[contains(concat(' ', normalize-space(@class), ' '), ' atto_media_track_default ')])[9]" to "1"
+ When I click on "Insert media" "button"
+ Then "//video[descendant::source[contains(@src, 'moodle-logo.webm')]][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='subtitles'][@label='Swedish'][@srclang='sv'][@default='true']][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='subtitles'][@label='English'][@srclang='en'][not(@default)]][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='captions'][@label='Swedish'][@srclang='sv'][not(@default)]][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='captions'][@label='English'][@srclang='en'][@default='true']][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='descriptions'][@label='Swedish'][@srclang='sv'][@default='true']][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='descriptions'][@label='English'][@srclang='en'][not(@default)]][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='chapters'][@label='Swedish'][@srclang='sv'][not(@default)]][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='chapters'][@label='English'][@srclang='en'][@default='true']][descendant::track[contains(@src, 'pretty-good-sv.vtt')][@kind='metadata'][@label='Swedish'][@srclang='sv'][@default='true']][descendant::track[contains(@src, 'pretty-good-en.vtt')][@kind='metadata'][@label='English'][@srclang='en'][not(@default)]]" "xpath_element" should exist
diff --git a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
index ed3048a6398..2d4acc6ddfb 100644
--- a/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
+++ b/lib/editor/atto/plugins/media/yui/build/moodle-atto_media-button/moodle-atto_media-button-debug.js
@@ -34,58 +34,419 @@ YUI.add('moodle-atto_media-button', function (Y, NAME) {
*/
var COMPONENTNAME = 'atto_media',
+ MEDIA_TYPES = {LINK: 'LINK', VIDEO: 'VIDEO', AUDIO: 'AUDIO'},
+ TRACK_KINDS = {
+ SUBTITLES: 'SUBTITLES',
+ CAPTIONS: 'CAPTIONS',
+ DESCRIPTIONS: 'DESCRIPTIONS',
+ CHAPTERS: 'CHAPTERS',
+ METADATA: 'METADATA'
+ },
CSS = {
- URLINPUT: 'atto_media_urlentry',
- NAMEINPUT: 'atto_media_nameentry'
+ SOURCE: 'atto_media_source',
+ TRACK: 'atto_media_track',
+ MEDIA_SOURCE: 'atto_media_media_source',
+ LINK_SOURCE: 'atto_media_link_source',
+ POSTER_SOURCE: 'atto_media_poster_source',
+ TRACK_SOURCE: 'atto_media_track_source',
+ DISPLAY_OPTIONS: 'atto_media_display_options',
+ NAME_INPUT: 'atto_media_name_entry',
+ URL_INPUT: 'atto_media_url_entry',
+ POSTER_SIZE: 'atto_media_poster_size',
+ LINK_SIZE: 'atto_media_link_size',
+ WIDTH_INPUT: 'atto_media_width_entry',
+ HEIGHT_INPUT: 'atto_media_height_entry',
+ TRACK_KIND_INPUT: 'atto_media_track_kind_entry',
+ TRACK_LABEL_INPUT: 'atto_media_track_label_entry',
+ TRACK_LANG_INPUT: 'atto_media_track_lang_entry',
+ TRACK_DEFAULT_SELECT: 'atto_media_track_default',
+ MEDIA_CONTROLS_TOGGLE: 'atto_media_controls',
+ MEDIA_AUTOPLAY_TOGGLE: 'atto_media_autoplay',
+ MEDIA_MUTE_TOGGLE: 'atto_media_mute',
+ MEDIA_LOOP_TOGGLE: 'atto_media_loop',
+ ADVANCED_SETTINGS: 'atto_media_advancedsettings',
+ LINK: MEDIA_TYPES.LINK.toLowerCase(),
+ VIDEO: MEDIA_TYPES.VIDEO.toLowerCase(),
+ AUDIO: MEDIA_TYPES.AUDIO.toLowerCase(),
+ TRACK_SUBTITLES: TRACK_KINDS.SUBTITLES.toLowerCase(),
+ TRACK_CAPTIONS: TRACK_KINDS.CAPTIONS.toLowerCase(),
+ TRACK_DESCRIPTIONS: TRACK_KINDS.DESCRIPTIONS.toLowerCase(),
+ TRACK_CHAPTERS: TRACK_KINDS.CHAPTERS.toLowerCase(),
+ TRACK_METADATA: TRACK_KINDS.METADATA.toLowerCase()
},
SELECTORS = {
- URLINPUT: '.' + CSS.URLINPUT,
- NAMEINPUT: '.' + CSS.NAMEINPUT
+ SOURCE: '.' + CSS.SOURCE,
+ TRACK: '.' + CSS.TRACK,
+ MEDIA_SOURCE: '.' + CSS.MEDIA_SOURCE,
+ POSTER_SOURCE: '.' + CSS.POSTER_SOURCE,
+ TRACK_SOURCE: '.' + CSS.TRACK_SOURCE,
+ DISPLAY_OPTIONS: '.' + CSS.DISPLAY_OPTIONS,
+ NAME_INPUT: '.' + CSS.NAME_INPUT,
+ URL_INPUT: '.' + CSS.URL_INPUT,
+ POSTER_SIZE: '.' + CSS.POSTER_SIZE,
+ LINK_SIZE: '.' + CSS.LINK_SIZE,
+ WIDTH_INPUT: '.' + CSS.WIDTH_INPUT,
+ HEIGHT_INPUT: '.' + CSS.HEIGHT_INPUT,
+ TRACK_KIND_INPUT: '.' + CSS.TRACK_KIND_INPUT,
+ TRACK_LABEL_INPUT: '.' + CSS.TRACK_LABEL_INPUT,
+ TRACK_LANG_INPUT: '.' + CSS.TRACK_LANG_INPUT,
+ TRACK_DEFAULT_SELECT: '.' + CSS.TRACK_DEFAULT_SELECT,
+ MEDIA_CONTROLS_TOGGLE: '.' + CSS.MEDIA_CONTROLS_TOGGLE,
+ MEDIA_AUTOPLAY_TOGGLE: '.' + CSS.MEDIA_AUTOPLAY_TOGGLE,
+ MEDIA_MUTE_TOGGLE: '.' + CSS.MEDIA_MUTE_TOGGLE,
+ MEDIA_LOOP_TOGGLE: '.' + CSS.MEDIA_LOOP_TOGGLE,
+ ADVANCED_SETTINGS: '.' + CSS.ADVANCED_SETTINGS,
+ LINK_TAB: 'li[data-medium-type="' + CSS.LINK + '"]',
+ LINK_PANE: '.tab-pane[data-medium-type="' + CSS.LINK + '"]',
+ VIDEO_TAB: 'li[data-medium-type="' + CSS.VIDEO + '"]',
+ VIDEO_PANE: '.tab-pane[data-medium-type="' + CSS.VIDEO + '"]',
+ AUDIO_TAB: 'li[data-medium-type="' + CSS.AUDIO + '"]',
+ AUDIO_PANE: '.tab-pane[data-medium-type="' + CSS.AUDIO + '"]',
+ TRACK_SUBTITLES_TAB: 'li[data-track-kind="' + CSS.TRACK_SUBTITLES + '"]',
+ TRACK_SUBTITLES_PANE: '.tab-pane[data-track-kind="' + CSS.TRACK_SUBTITLES + '"]',
+ TRACK_CAPTIONS_TAB: 'li[data-track-kind="' + CSS.TRACK_CAPTIONS + '"]',
+ TRACK_CAPTIONS_PANE: '.tab-pane[data-track-kind="' + CSS.TRACK_CAPTIONS + '"]',
+ TRACK_DESCRIPTIONS_TAB: 'li[data-track-kind="' + CSS.TRACK_DESCRIPTIONS + '"]',
+ TRACK_DESCRIPTIONS_PANE: '.tab-pane[data-track-kind="' + CSS.TRACK_DESCRIPTIONS + '"]',
+ TRACK_CHAPTERS_TAB: 'li[data-track-kind="' + CSS.TRACK_CHAPTERS + '"]',
+ TRACK_CHAPTERS_PANE: '.tab-pane[data-track-kind="' + CSS.TRACK_CHAPTERS + '"]',
+ TRACK_METADATA_TAB: 'li[data-track-kind="' + CSS.TRACK_METADATA + '"]',
+ TRACK_METADATA_PANE: '.tab-pane[data-track-kind="' + CSS.TRACK_METADATA + '"]'
},
- TEMPLATE = '' +
- '';
+ TEMPLATES = {
+ ROOT: '' +
+ '',
+ TAB_PANES: {
+ LINK: '' +
+ '{{renderPartial "form_components.source" context=this id=CSS.LINK_SOURCE}}' +
+ '',
+ VIDEO: '' +
+ '{{renderPartial "form_components.source" context=this id=CSS.MEDIA_SOURCE entersourcelabel="videosourcelabel"' +
+ ' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
+ '' +
+ '' +
+ '',
+ AUDIO: '' +
+ '{{renderPartial "form_components.source" context=this id=CSS.MEDIA_SOURCE entersourcelabel="audiosourcelabel"' +
+ ' addcomponentlabel="addsource" multisource="true" addsourcehelp=helpStrings.addsource}}' +
+ '' +
+ ''
+ },
+ FORM_COMPONENTS: {
+ SOURCE: '' +
+ '