diff --git a/contentbank/classes/helper.php b/contentbank/classes/helper.php
index 463f7ede337..f4cb921d279 100644
--- a/contentbank/classes/helper.php
+++ b/contentbank/classes/helper.php
@@ -44,6 +44,8 @@ class helper {
global $PAGE, $DB;
$PAGE->set_context($context);
+ $PAGE->set_heading(self::get_page_heading($context));
+ $PAGE->set_secondary_active_tab('contentbank');
$cburl = new \moodle_url('/contentbank/index.php', ['contextid' => $context->id]);
switch ($context->contextlevel) {
@@ -68,4 +70,27 @@ class helper {
$PAGE->set_pagelayout('standard');
}
}
+
+ /**
+ * Get the page heading based on the current context
+ *
+ * @param \context $context The current context of the page
+ * @return string
+ */
+ public static function get_page_heading(\context $context): string {
+ global $SITE;
+
+ $title = get_string('contentbank');
+ if ($context->id == \context_system::instance()->id) {
+ $title = $SITE->fullname;
+ } else if ($context->contextlevel == CONTEXT_COURSE) {
+ $course = get_course($context->instanceid);
+ $title = $course->fullname;
+ } else if ($context->contextlevel == CONTEXT_COURSECAT) {
+ $category = \core_course_category::get($context->instanceid);
+ $title = $category->get_formatted_name();
+ }
+
+ return $title;
+ }
}
diff --git a/contentbank/classes/output/viewcontent.php b/contentbank/classes/output/viewcontent.php
index 48871a6fb57..b514c4da142 100644
--- a/contentbank/classes/output/viewcontent.php
+++ b/contentbank/classes/output/viewcontent.php
@@ -60,6 +60,100 @@ class viewcontent implements renderable, templatable {
$this->content = $content;
}
+ /**
+ * Get the content of the "More" dropdown in the tertiary navigation
+ *
+ * @return array|null The options to be displayed in a dropdown in the tertiary navigation
+ * @throws \moodle_exception
+ */
+ protected function get_edit_actions_dropdown(): ?array {
+ global $PAGE;
+ $options = [];
+ if ($this->contenttype->can_manage($this->content)) {
+ // Add the visibility item to the menu.
+ switch($this->content->get_visibility()) {
+ case content::VISIBILITY_UNLISTED:
+ $visibilitylabel = get_string('visibilitysetpublic', 'core_contentbank');
+ $newvisibility = content::VISIBILITY_PUBLIC;
+ break;
+ case content::VISIBILITY_PUBLIC:
+ $visibilitylabel = get_string('visibilitysetunlisted', 'core_contentbank');
+ $newvisibility = content::VISIBILITY_UNLISTED;
+ break;
+ default:
+ $url = new \moodle_url('/contentbank/index.php', ['contextid' => $this->content->get_contextid()]);
+ throw new moodle_exception('contentvisibilitynotfound', 'error', $url, $this->content->get_visibility());
+ }
+
+ if ($visibilitylabel) {
+ $options[$visibilitylabel] = [
+ 'data-action' => 'setcontentvisibility',
+ 'data-visibility' => $newvisibility,
+ 'data-contentid' => $this->content->get_id(),
+ ];
+ }
+
+ // Add the rename content item to the menu.
+ $options[get_string('rename')] = [
+ 'data-action' => 'renamecontent',
+ 'data-contentname' => $this->content->get_name(),
+ 'data-contentid' => $this->content->get_id(),
+ ];
+
+ if ($this->contenttype->can_upload()) {
+ $options[get_string('replacecontent', 'contentbank')] = ['data-action' => 'upload'];
+
+ $PAGE->requires->js_call_amd(
+ 'core_contentbank/upload',
+ 'initModal',
+ [
+ '[data-action=upload]',
+ \core_contentbank\form\upload_files::class,
+ $this->content->get_contextid(),
+ $this->content->get_id()
+ ]
+ );
+ }
+ }
+
+ if ($this->contenttype->can_download($this->content)) {
+ $url = new moodle_url($this->contenttype->get_download_url($this->content));
+ $options[get_string('download')] = [
+ 'url' => $url->out()
+ ];
+ }
+
+ // Add the delete content item to the menu.
+ if ($this->contenttype->can_delete($this->content)) {
+ $options[get_string('delete')] = [
+ 'data-action' => 'deletecontent',
+ 'data-contentname' => $this->content->get_name(),
+ 'data-uses' => count($this->content->get_uses()),
+ 'data-contentid' => $this->content->get_id(),
+ 'data-contextid' => $this->content->get_contextid(),
+ ];
+ }
+
+ $dropdown = [];
+ if ($options) {
+ foreach ($options as $key => $attribs) {
+ $url = $attribs['url'] ?? '#';
+ $dropdown['options'][] = [
+ 'label' => $key,
+ 'url' => $url,
+ 'attributes' => array_map(function ($key, $value) {
+ return [
+ 'name' => $key,
+ 'value' => $value
+ ];
+ }, array_keys($attribs), $attribs)
+ ];
+ }
+ }
+
+ return $dropdown;
+ }
+
/**
* Export this data so it can be used as the context for a mustache template.
*
@@ -88,6 +182,11 @@ class viewcontent implements renderable, templatable {
$closeurl = new moodle_url('/contentbank/index.php', ['contextid' => $this->content->get_contextid()]);
$data->closeurl = $closeurl->out(false);
+ $data->actionmenu = $this->get_edit_actions_dropdown();
+ $data->heading = $this->content->get_name();
+ if ($this->content->get_visibility() == content::VISIBILITY_UNLISTED) {
+ $data->heading = get_string('visibilitytitleunlisted', 'contentbank', $data->heading);
+ }
return $data;
}
diff --git a/contentbank/contenttype/h5p/classes/form/editor.php b/contentbank/contenttype/h5p/classes/form/editor.php
index 7ac641be0ab..26dc2d360d6 100644
--- a/contentbank/contenttype/h5p/classes/form/editor.php
+++ b/contentbank/contenttype/h5p/classes/form/editor.php
@@ -51,7 +51,7 @@ class editor extends edit_content {
* Defines the form fields.
*/
protected function definition() {
- global $DB;
+ global $DB, $OUTPUT;
$mform = $this->_form;
$errors = [];
@@ -70,6 +70,7 @@ class editor extends edit_content {
$this->h5peditor = new h5peditor();
$this->set_display_vertical();
+ $mform->addElement('html', $OUTPUT->heading($this->_customdata['heading'], 2));
if ($id) {
// The H5P editor needs the H5P content id (h5p table).
@@ -114,7 +115,6 @@ class editor extends edit_content {
}
$mform->addElement('cancel', 'cancel', get_string('back'));
} else {
- $this->add_action_buttons();
$this->h5peditor->add_editor_to_form($mform);
$this->add_action_buttons();
}
diff --git a/contentbank/contenttype/h5p/tests/behat/admin_replace_content.feature b/contentbank/contenttype/h5p/tests/behat/admin_replace_content.feature
index 25fa5866701..3cc93c45b3e 100644
--- a/contentbank/contenttype/h5p/tests/behat/admin_replace_content.feature
+++ b/contentbank/contenttype/h5p/tests/behat/admin_replace_content.feature
@@ -22,8 +22,8 @@ Feature: Replace H5P file from an existing content
And I switch to "h5p-iframe" class iframe
And I should see "Of which countries"
And I switch to the main frame
- When I open the action menu in "region-main-settings-menu" "region"
- And I choose "Replace with file" in the open action menu
+ When I click on "More" "button"
+ And I click on "Replace with file" "link"
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
Then I switch to "h5p-player" class iframe
diff --git a/contentbank/contenttype/h5p/tests/behat/manage_content.feature b/contentbank/contenttype/h5p/tests/behat/manage_content.feature
index 800974e2400..b9517b5d99b 100644
--- a/contentbank/contenttype/h5p/tests/behat/manage_content.feature
+++ b/contentbank/contenttype/h5p/tests/behat/manage_content.feature
@@ -36,9 +36,9 @@ Feature: Manage H5P content from the content bank
And I expand "Site pages" node
And I click on "Content bank" "link"
And I follow "ipsums.h5p"
- When I open the action menu in "region-main-settings-menu" "region"
+ When I click on "More" "button"
And I should see "Rename"
- And I choose "Rename" in the open action menu
+ And I click on "Rename" "link"
And I set the field "Content name" to "New name"
And I click on "Rename" "button"
And I wait until the page is ready
@@ -51,4 +51,5 @@ Feature: Manage H5P content from the content bank
And I expand "Site pages" node
And I click on "Content bank" "link"
When I follow "filltheblanks.h5p"
- Then "Rename" "link" should not exist in the "region-main-settings-menu" "region"
+ And I click on "More" "button"
+ Then I should not see "Rename"
diff --git a/contentbank/contenttype/h5p/tests/behat/teacher_replace_content.feature b/contentbank/contenttype/h5p/tests/behat/teacher_replace_content.feature
index 2c208a1b3ba..ba699f65470 100644
--- a/contentbank/contenttype/h5p/tests/behat/teacher_replace_content.feature
+++ b/contentbank/contenttype/h5p/tests/behat/teacher_replace_content.feature
@@ -43,8 +43,8 @@ Feature: Replace H5P file from an existing content requires special capabilities
Scenario: Teacher can replace its own H5P files
Given I click on "teachercontent" "link"
- When I open the action menu in "region-main-settings-menu" "region"
- And I choose "Replace with file" in the open action menu
+ When I click on "More" "button"
+ And I click on "Replace with file" "link"
And I upload "h5p/tests/fixtures/ipsums.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
Then I switch to "h5p-player" class iframe
@@ -54,25 +54,29 @@ Feature: Replace H5P file from an existing content requires special capabilities
Scenario: Teacher cannot replace another user's H5P files
When I click on "admincontent" "link"
- Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
+ And I click on "More" "button"
+ Then I should not see "Replace with file"
Scenario: Teacher cannot replace a content without having upload capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:upload | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
- Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
+ And I click on "More" "button"
+ Then I should not see "Replace with file"
Scenario: Teacher cannot replace a content without having the H5P upload capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| contenttype/h5p:upload | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
- Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
+ And I click on "More" "button"
+ Then I should not see "Replace with file"
Scenario: Teacher cannot replace a content without having the manage own content capability
Given the following "permission overrides" exist:
| capability | permission | role | contextlevel | reference |
| moodle/contentbank:manageowncontent | Prevent | editingteacher | Course | C1 |
When I click on "teachercontent" "link"
- Then "Replace with file" "link" should not exist in the "region-main-settings-menu" "region"
+ And I click on "More" "button"
+ Then I should not see "Replace with file"
diff --git a/contentbank/edit.php b/contentbank/edit.php
index 353483fa745..f272d4b4599 100644
--- a/contentbank/edit.php
+++ b/contentbank/edit.php
@@ -76,7 +76,8 @@ if (!$contenttype->can_edit($content)) {
$values = [
'contextid' => $contextid,
'plugin' => $pluginname,
- 'id' => $id
+ 'id' => $id,
+ 'heading' => $heading
];
$title = get_string('contentbank');
@@ -91,8 +92,6 @@ $PAGE->navbar->add(get_string('edit'));
$PAGE->set_title($title);
$PAGE->set_pagelayout('incourse');
-$PAGE->set_heading($heading);
-
// Instantiate the content type form.
$editorclass = "$contenttypename\\form\\editor";
if (!class_exists($editorclass)) {
diff --git a/contentbank/index.php b/contentbank/index.php
index 1c44bf5e47a..2ba512e6c66 100644
--- a/contentbank/index.php
+++ b/contentbank/index.php
@@ -52,7 +52,6 @@ if ($contextid == \context_system::instance()->id) {
$PAGE->set_context($context);
}
$PAGE->set_title($title);
-$PAGE->set_heading($title);
$PAGE->add_body_class('limitedwidth');
$PAGE->set_pagetype('contentbank');
$PAGE->set_secondary_active_tab('contentbank');
@@ -110,6 +109,7 @@ if (has_capability('moodle/contentbank:upload', $context)) {
}
echo $OUTPUT->header();
+echo $OUTPUT->heading($title, 2);
echo $OUTPUT->box_start('generalbox');
// If needed, display notifications.
diff --git a/contentbank/templates/contentbankmenu.mustache b/contentbank/templates/contentbankmenu.mustache
new file mode 100644
index 00000000000..dae6f006b1d
--- /dev/null
+++ b/contentbank/templates/contentbankmenu.mustache
@@ -0,0 +1,57 @@
+{{!
+This file is part of Moodle - http://moodle.org/
+
+Moodle is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Moodle is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more comments.
+
+You should have received a copy of the GNU General Public License
+along with Moodle. If not, see .
+}}
+{{!
+ @template core_contentbank/contentbankmenu
+
+ Contentbank view toolbar.
+
+ Classes required for JS:
+ * none
+
+ Data attributes required for JS:
+ * none
+
+ Context variables required for this template:
+ * options - JSON object - the options available in the dropdown
+
+ Example context (json):
+ {
+ "options": [
+ {
+ "url": "www.google.com",
+ "label": "Google",
+ "attributes": [
+ {
+ "name": "data-attrib",
+ "value": "1"
+ }
+ ]
+ }
+ ]
+ }
+}}
+
{{/usercanedit}}
+{{^usercanedit}}
+ {{#actionmenu}}
+ {{> core_contentbank/contentbankmenu }}
+ {{/actionmenu}}
+{{/usercanedit}}
diff --git a/contentbank/tests/behat/delete_content.feature b/contentbank/tests/behat/delete_content.feature
index 312e3d158af..07502f03e2d 100644
--- a/contentbank/tests/behat/delete_content.feature
+++ b/contentbank/tests/behat/delete_content.feature
@@ -29,15 +29,15 @@ Feature: Delete H5P file from the content bank
And I click on "Save changes" "button"
Scenario: Admins can delete content from the content bank
- Given I open the action menu in "region-main-settings-menu" "region"
+ Given I click on "More" "button"
And I should see "Delete"
- When I choose "Delete" in the open action menu
+ And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
And I should see "Are you sure you want to delete the content 'content2delete.h5p'"
And I should not see "The content will only be deleted from the content bank"
And I click on "Cancel" "button" in the "Delete content" "dialogue"
Then I should see "content2delete.h5p"
- And I open the action menu in "region-main-settings-menu" "region"
- And I choose "Delete" in the open action menu
+ And I click on "More" "button"
+ And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
And I click on "Delete" "button" in the "Delete content" "dialogue"
And I wait until the page is ready
And I should see "The content has been deleted."
@@ -62,7 +62,8 @@ Feature: Delete H5P file from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "content2delete.h5p"
And I follow "content2delete.h5p"
- Then "Delete" "link" should not exist in the "region-main-settings-menu" "region"
+ And I click on "More" "button"
+ Then I should not see "Delete"
And I click on "Content bank" "link"
And I click on "Upload" "link"
And I click on "Choose a file..." "button"
@@ -70,7 +71,7 @@ Feature: Delete H5P file from the content bank
And I click on "find-the-words.h5p" "link"
And I click on "Select this file" "button"
And I click on "Save changes" "button"
- And I open the action menu in "region-main-settings-menu" "region"
+ And I click on "More" "button"
And I should see "Delete"
Scenario: The number of times a content is used is displayed before removing it
@@ -85,8 +86,8 @@ Feature: Delete H5P file from the content bank
When I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I follow "content2delete.h5p"
- And I open the action menu in "region-main-settings-menu" "region"
- And I choose "Delete" in the open action menu
+ And I click on "More" "button"
+ And I click on "Delete" "link" in the ".cb-toolbar-container" "css_element"
Then I should see "Are you sure you want to delete the content 'content2delete.h5p'"
And I should see "The content will only be deleted from the content bank"
And I click on "Delete" "button" in the "Delete content" "dialogue"
diff --git a/contentbank/tests/behat/download_content.feature b/contentbank/tests/behat/download_content.feature
index eb45d881108..cb3fecce060 100644
--- a/contentbank/tests/behat/download_content.feature
+++ b/contentbank/tests/behat/download_content.feature
@@ -30,9 +30,9 @@ Feature: Download H5P content from the content bank
Given I click on "Site pages" "list_item" in the "Navigation" "block"
And I click on "Content bank" "link" in the "Navigation" "block"
And I follow "filltheblanksmanager.h5p"
- And I open the action menu in "region-main-settings-menu" "region"
+ And I click on "More" "button"
And I should see "Download"
- When I choose "Download" in the open action menu
+ When I click on "Download" "link"
Then I should see "filltheblanksmanager.h5p"
Scenario: Users can download content created by different users
@@ -45,7 +45,7 @@ Feature: Download H5P content from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "filltheblanksadmin.h5p"
And I follow "filltheblanksadmin.h5p"
- And I open the action menu in "region-main-settings-menu" "region"
+ And I click on "More" "button"
Then I should see "Download"
And I should not see "Rename"
@@ -59,5 +59,5 @@ Feature: Download H5P content from the content bank
And I click on "Content bank" "link" in the "Navigation" "block"
And I should see "filltheblanksmanager.h5p"
And I follow "filltheblanksmanager.h5p"
- And I open the action menu in "region-main-settings-menu" "region"
+ And I click on "More" "button"
Then I should not see "Download"
diff --git a/contentbank/tests/behat/edit_content.feature b/contentbank/tests/behat/edit_content.feature
index 8479af6f96d..4cf7b4cf748 100644
--- a/contentbank/tests/behat/edit_content.feature
+++ b/contentbank/tests/behat/edit_content.feature
@@ -36,7 +36,7 @@ Feature: Content bank use editor feature
And I click on "Save changes" "button"
When I click on "Content bank" "link"
And I click on "filltheblanks.h5p" "link"
- And I click on "Close" "link"
+ And I click on "Exit" "link"
Then I click on "[data-action=Add-content]" "css_element"
And I should see "Fill in the Blanks"
@@ -59,7 +59,7 @@ Feature: Content bank use editor feature
And I switch to "h5p-editor-iframe" class iframe
And I switch to the main frame
And I click on "Cancel" "button"
- And I should see "filltheblanks.h5p" in the "h1" "css_element"
+ And I should see "filltheblanks.h5p" in the "h2" "css_element"
Scenario: Users can create new content if they have the required permission
Given I navigate to "H5P > Manage H5P content types" in site administration
@@ -113,7 +113,7 @@ Feature: Content bank use editor feature
And I set the field "Title" to "New title"
And I switch to the main frame
When I click on "Save" "button"
- And I should see "filltheblanks.h5p" in the "h1" "css_element"
+ And I should see "filltheblanks.h5p" in the "h2" "css_element"
And I click on "Edit" "link"
And I switch to "h5p-editor-iframe" class iframe
Then the field "Title" matches value "New title"
diff --git a/contentbank/tests/behat/events.feature b/contentbank/tests/behat/events.feature
index 765f1f5fc01..b68361f231d 100644
--- a/contentbank/tests/behat/events.feature
+++ b/contentbank/tests/behat/events.feature
@@ -58,8 +58,8 @@ Feature: Confirm content bank events are triggered
And I expand "Site pages" node
And I click on "Content bank" "link"
And I click on "Existing" "link"
- And I open the action menu in "region-main-settings-menu" "region"
- When I choose "Delete" in the open action menu
+ And I click on "More" "button"
+ When I click on "Delete" "link"
And I click on "Delete" "button" in the "Delete content" "dialogue"
And I navigate to "Reports > Live logs" in site administration
Then I should see "Content deleted"
@@ -71,8 +71,8 @@ Feature: Confirm content bank events are triggered
And I expand "Site pages" node
And I click on "Content bank" "link"
And I click on "Existing" "link"
- And I open the action menu in "region-main-settings-menu" "region"
- When I choose "Rename" in the open action menu
+ And I click on "More" "button"
+ When I click on "Rename" "link"
And I set the field "Content name" to "New name"
And I click on "Rename" "button"
And I navigate to "Reports > Live logs" in site administration
diff --git a/contentbank/tests/behat/visibility.feature b/contentbank/tests/behat/visibility.feature
index 5fbacea2769..231f5e57f7f 100644
--- a/contentbank/tests/behat/visibility.feature
+++ b/contentbank/tests/behat/visibility.feature
@@ -27,13 +27,13 @@ Feature: Make content public or unlisted
And I click on "Content bank" "link" in the "Navigation" "block"
And I click on "filltheblanks.h5p" "link"
And I wait until the page is ready
- And I should not see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
- And I open the action menu in "region-main-settings-menu" "region"
+ And I should not see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
+ And I click on "More" "button"
And I should see "Make unlisted"
- When I choose "Make unlisted" in the open action menu
+ And I click on "Make unlisted" "link"
And I wait until the page is ready
- Then I should see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
- And I open the action menu in "region-main-settings-menu" "region"
+ Then I should see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
+ And I click on "More" "button"
And I should see "Make public"
Scenario: Unlisted content cannot be seen by other users
@@ -131,7 +131,7 @@ Feature: Make content public or unlisted
And I click on "Upload" "link"
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
- Then I should see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
+ Then I should see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
@_file_upload
Scenario: User preference concerning content visibility overrides site-wide default content visibility
@@ -149,5 +149,5 @@ Feature: Make content public or unlisted
And I click on "Upload" "link"
And I upload "h5p/tests/fixtures/filltheblanks.h5p" file to "Upload content" filemanager
And I click on "Save changes" "button"
- Then I should see "filltheblanks.h5p" in the "h1" "css_element"
- And I should not see "filltheblanks.h5p (Unlisted)" in the "h1" "css_element"
+ Then I should see "filltheblanks.h5p" in the "h2" "css_element"
+ And I should not see "filltheblanks.h5p (Unlisted)" in the "h2" "css_element"
diff --git a/contentbank/view.php b/contentbank/view.php
index 534f8a6eaaa..36db1ce0950 100644
--- a/contentbank/view.php
+++ b/contentbank/view.php
@@ -55,122 +55,20 @@ if ($PAGE->course) {
$cb = new \core_contentbank\contentbank();
$content = $cb->get_content_from_id($record->id);
$contenttype = $content->get_content_type_instance();
-$pageheading = $record->name;
if (!$content->is_view_allowed()) {
$cburl = new \moodle_url('/contentbank/index.php', ['contextid' => $context->id, 'errormsg' => 'notavailable']);
redirect($cburl);
}
-if ($content->get_visibility() == content::VISIBILITY_UNLISTED) {
- $pageheading = get_string('visibilitytitleunlisted', 'contentbank', $record->name);
-}
-
$PAGE->set_url(new \moodle_url('/contentbank/view.php', ['id' => $id]));
$PAGE->set_context($context);
$PAGE->navbar->add($record->name);
-$PAGE->set_heading($pageheading);
$title .= ": ".$record->name;
$PAGE->set_title($title);
$PAGE->set_pagetype('contentbank');
$PAGE->set_pagelayout('incourse');
-// Create the cog menu with all the secondary actions, such as delete, rename...
-$actionmenu = new action_menu();
-if ($contenttype->can_manage($content)) {
- // Add the visibility item to the menu.
- switch($content->get_visibility()) {
- case content::VISIBILITY_UNLISTED:
- $visibilitylabel = get_string('visibilitysetpublic', 'core_contentbank');
- $newvisibility = content::VISIBILITY_PUBLIC;
- $visibilityicon = 't/hide';
- break;
- case content::VISIBILITY_PUBLIC:
- $visibilitylabel = get_string('visibilitysetunlisted', 'core_contentbank');
- $newvisibility = content::VISIBILITY_UNLISTED;
- $visibilityicon = 't/show';
- break;
- default:
- print_error('contentvisibilitynotfound', 'error', $returnurl, $content->get_visibility());
- break;
- }
-
- $attributes = [
- 'data-action' => 'setcontentvisibility',
- 'data-visibility' => $newvisibility,
- 'data-contentid' => $content->get_id(),
- ];
- $actionmenu->add_secondary_action(new action_menu_link(
- new moodle_url('#'),
- new pix_icon($visibilityicon, $visibilitylabel),
- $visibilitylabel,
- false,
- $attributes
- ));
-
- // Add the rename content item to the menu.
- $attributes = [
- 'data-action' => 'renamecontent',
- 'data-contentname' => $content->get_name(),
- 'data-contentid' => $content->get_id(),
- ];
- $actionmenu->add_secondary_action(new action_menu_link(
- new moodle_url('#'),
- new pix_icon('e/styleparagraph', get_string('rename')),
- get_string('rename'),
- false,
- $attributes
- ));
-
- if ($contenttype->can_upload()) {
- $actionmenu->add_secondary_action(new action_menu_link(
- new moodle_url('/contentbank/view.php', ['contextid' => $context->id, 'id' => $content->get_id()]),
- new pix_icon('i/upload', get_string('upload')),
- get_string('replacecontent', 'contentbank'),
- false,
- ['data-action' => 'upload']
- ));
- $PAGE->requires->js_call_amd(
- 'core_contentbank/upload',
- 'initModal',
- ['[data-action=upload]', \core_contentbank\form\upload_files::class, $context->id, $content->get_id()]
- );
- }
-}
-if ($contenttype->can_download($content)) {
- // Add the download content item to the menu.
- $actionmenu->add_secondary_action(new action_menu_link(
- new moodle_url($contenttype->get_download_url($content)),
- new pix_icon('t/download', get_string('download')),
- get_string('download'),
- false
- ));
-}
-if ($contenttype->can_delete($content)) {
- // Add the delete content item to the menu.
- $attributes = [
- 'data-action' => 'deletecontent',
- 'data-contentname' => $content->get_name(),
- 'data-uses' => count($content->get_uses()),
- 'data-contentid' => $content->get_id(),
- 'data-contextid' => $context->id,
- ];
- $actionmenu->add_secondary_action(new action_menu_link(
- new moodle_url('#'),
- new pix_icon('t/delete', get_string('delete')),
- get_string('delete'),
- false,
- $attributes
- ));
-}
-
-// Add the cog menu to the header.
-$PAGE->add_header_action(html_writer::div(
- $OUTPUT->render($actionmenu),
- 'd-print-none',
- ['id' => 'region-main-settings-menu']
-));
-
echo $OUTPUT->header();
// If needed, display notifications.
diff --git a/lang/en/contentbank.php b/lang/en/contentbank.php
index c127217dc7e..55573a35fa9 100644
--- a/lang/en/contentbank.php
+++ b/lang/en/contentbank.php
@@ -24,7 +24,6 @@
$string['author'] = 'Author';
$string['contentbank'] = 'Content bank';
-$string['close'] = 'Close';
$string['choosecontext'] = 'Choose course or category...';
$string['contentbankpreferences'] = 'Content bank preferences';
$string['contentdeleted'] = 'The content has been deleted.';
@@ -47,6 +46,7 @@ $string['eventcontentuploaded'] = 'Content uploaded';
$string['eventcontentviewed'] = 'Content viewed';
$string['errordeletingcontentfromcategory'] = 'Error deleting content from category {$a}.';
$string['errornofile'] = 'A compatible file is needed to create content.';
+$string['exit'] = 'Exit';
$string['deletecontent'] = 'Delete content';
$string['deletecontentconfirm'] = 'Are you sure you want to delete the content \'{$a->name}\' and all associated files? This action cannot be undone.';
$string['deletecontentconfirmlinked'] = 'The content will only be deleted from the content bank. Any places which currently link to it will be automatically updated to use a copy of the content instead.';
@@ -56,6 +56,7 @@ $string['file'] = 'Upload content';
$string['file_help'] = 'Files may be stored in the content bank for use in courses. Only files used by content types enabled on the site may be uploaded.';
$string['itemsfound'] = '{$a} items found';
$string['lastmodified'] = 'Last modified';
+$string['more'] = 'More';
$string['name'] = 'Content';
$string['nocontentavailable'] = 'No content available';
$string['nocontenttypes'] = 'No content types available';
@@ -91,3 +92,6 @@ $string['visibilitypref_help'] = 'Content you create in the content bank will us
$string['visibilitysetpublic'] = 'Make public';
$string['visibilitysetunlisted'] = 'Make unlisted';
$string['visibilitytitleunlisted'] = '{$a} (Unlisted)';
+
+// Deprecated since 4.0.
+$string['close'] = 'Close';
diff --git a/lang/en/deprecated.txt b/lang/en/deprecated.txt
index cf3eb335f9a..3a74976206f 100644
--- a/lang/en/deprecated.txt
+++ b/lang/en/deprecated.txt
@@ -78,3 +78,4 @@ loggedoff_help,core_message
loggedoffdescription,core_message
sendingvia,core_message
sendingviawhen,core_message
+close,core_contentbank
\ No newline at end of file
diff --git a/mod/h5pactivity/tests/behat/contentbank_link.feature b/mod/h5pactivity/tests/behat/contentbank_link.feature
index 3b48a2ec3e6..fe6eed6c179 100644
--- a/mod/h5pactivity/tests/behat/contentbank_link.feature
+++ b/mod/h5pactivity/tests/behat/contentbank_link.feature
@@ -26,7 +26,7 @@ Feature: Content bank link in the activity settings form
Then I should see "Use the content bank (opens in new window) to manage your H5P files"
And I click on "content bank (opens in new window)" "link" in the "General" "fieldset"
And I switch to the browser tab opened by the app
- And I should see "Content bank" in the "page-header" "region"
+ And I should see "Content bank" in the "page-content" "region"
And I should see "filltheblanks.h5p" in the "page-content" "region"
And I close all opened windows