Merge branch 'MDL-71965-master' of git://github.com/bmbrands/moodle

This commit is contained in:
Andrew Nicols 2021-10-11 08:06:43 +08:00
commit 9cba40c410
25 changed files with 311 additions and 73 deletions

View File

@ -25,7 +25,7 @@ Feature: Manage plearning plan
Given the following lp "templates" exist:
| shortname | description |
| Science template | science template description |
And I follow "Home"
And I am on homepage
And I navigate to "Competencies > Learning plan templates" in site administration
And I click on ".template-userplans" "css_element" in the "Science template" "table_row"
And I open the autocomplete suggestions list
@ -50,7 +50,7 @@ Feature: Manage plearning plan
| user | cohort |
| student-plan1 | COHORTPLAN |
| student-plan2 | COHORTPLAN |
And I follow "Home"
And I am on homepage
And I navigate to "Competencies > Learning plan templates" in site administration
And I click on ".template-cohorts" "css_element" in the "Science template cohort" "table_row"
And I set the field "Select cohorts to sync" to "cohort plan"

View File

@ -9,6 +9,10 @@
display: none;
z-index: 9999999;
}
.eupopup-container .eupopup-body a {
color: #fff;
text-decoration: underline;
}
.behat-site .eupopup-container-bottom {
position: relative;

View File

@ -30,7 +30,7 @@ Feature: Open calendar popup
When I reload the page
Then I should see "Event 1:1"
And I should see "Event 1:2"
And I follow "Home"
And I am on homepage
And I should see "Event 1:1"
And I should see "Event 1:2"
@ -58,5 +58,5 @@ Feature: Open calendar popup
| Type of event | site |
| Event title | Today's event |
Then I should see "Today's event"
And I follow "Home"
And I am on homepage
And I should see "Today's event"

View File

@ -1623,6 +1623,7 @@ $string['potentialadmins'] = 'Potential admins';
$string['potentialcreators'] = 'Potential course creators';
$string['potentialstudents'] = 'Potential students';
$string['potentialteachers'] = 'Potential teachers';
$string['poweredbymoodle'] = 'Powered by <a href="https://moodle.com">Moodle</a>';
$string['preferences'] = 'Preferences';
$string['preferredlanguage'] = 'Preferred language';
$string['preferredtheme'] = 'Preferred theme';

View File

@ -53,6 +53,7 @@ class icon_system_fontawesome extends icon_system_font {
public function get_core_icon_map() {
return [
'core:docs' => 'fa-info-circle',
'core:book' => 'fa-book',
'core:help' => 'fa-question-circle text-info',
'core:req' => 'fa-exclamation-circle text-danger',
'core:a/add_file' => 'fa-file-o',

View File

@ -13,7 +13,7 @@ Feature: Add or remove items from the TinyMCE editor toolbar
And I follow "Editor preferences"
And I set the field "Text editor" to "TinyMCE HTML editor"
And I press "Save changes"
And I follow "Home"
And I am on homepage
Scenario: Remove icons
When the following config values are set as admin:

View File

@ -813,8 +813,7 @@ class core_renderer extends renderer_base {
}
/**
* The standard tags (typically performance information and validation links,
* if we are in developer debug mode) that should be output in the footer area
* content that should be output in the footer area
* of the page. Designed to be called in theme layout.php files.
*
* @return string HTML fragment.
@ -844,10 +843,6 @@ class core_renderer extends renderer_base {
);
}
// This function is normally called from a layout.php file in {@link core_renderer::header()}
// but some of the content won't be known until later, so we return a placeholder
// for now. This will be replaced with the real content in {@link core_renderer::footer()}.
$output .= $this->unique_performance_info_token;
if ($this->page->devicetypeinuse == 'legacy') {
// The legacy theme is in use print the notification
$output .= html_writer::tag('div', get_string('legacythemeinuse'), array('class'=>'legacythemeinuse'));
@ -856,6 +851,23 @@ class core_renderer extends renderer_base {
// Get links to switch device types (only shown for users not on a default device)
$output .= $this->theme_switch_links();
return $output;
}
/**
* Performance information and validation links for debugging.
*
* @return string HTML fragment.
*/
public function debug_footer_html() {
global $CFG;
$output = '';
// This function is normally called from a layout.php file
// but some of the content won't be known until later, so we return a placeholder
// for now. This will be replaced with the real content in the footer.
$output .= $this->unique_performance_info_token;
if (!empty($CFG->debugpageinfo)) {
$output .= '<div class="performanceinfo pageinfo">' . get_string('pageinfodebugsummary', 'core_admin',
$this->page->debug_summary()) . '</div>';
@ -2194,7 +2206,7 @@ class core_renderer extends renderer_base {
public function doc_link($path, $text = '', $forcepopup = false, array $attributes = []) {
global $CFG;
$icon = $this->pix_icon('docs', '', 'moodle', array('class'=>'iconhelp icon-pre', 'role'=>'presentation'));
$icon = $this->pix_icon('book', '', 'moodle', array('class' => 'iconhelp icon-pre', 'role' => 'presentation'));
$attributes['href'] = new moodle_url(get_docs_url($path));
if (!empty($CFG->doctonewwindow) || $forcepopup) {
@ -4857,6 +4869,17 @@ EOD;
public function render_checkbox_toggleall(\core\output\checkbox_toggleall $element) {
return $this->render_from_template($element->get_template(), $element->export_for_template($this));
}
/**
* Renders release information in the footer popup
* @return string Moodle release info.
*/
public function moodle_release() {
global $CFG;
if (is_siteadmin()) {
return $CFG->release;
}
}
}
/**

View File

@ -74,7 +74,7 @@ use core\navigation\output\primary as primaryoutput;
* course table. (Also available as $COURSE global.) If we are not inside
* an actual course, this will be the site course.
* @property-read string $devicetypeinuse The name of the device type in use
* @property-read string $docspath The path to the Moodle docs for this page.
* @property-read string $docspath The path to the Help and documentation.
* @property-read string $focuscontrol The id of the HTML element to be focused when the page has loaded.
* @property-read bool $headerprinted True if the page header has already been printed.
* @property-read string $heading The main heading that should be displayed at the top of the <body>.
@ -205,7 +205,7 @@ class moodle_page {
protected $_subpage = '';
/**
* @var string Set a different path to use for the 'Moodle docs for this page' link.
* @var string Set a different path to use for the 'Help and documentation' link.
* By default, it uses the path of the file for instance mod/quiz/attempt.
*/
protected $_docspath = null;
@ -629,7 +629,7 @@ class moodle_page {
/**
* Please do not call this method directly, use the ->docspath syntax. {@link moodle_page::__get()}.
* @return string the path to the Moodle docs for this page.
* @return string the path to the Help and documentation.
*/
protected function magic_get_docspath() {
if (is_string($this->_docspath)) {
@ -1371,7 +1371,7 @@ class moodle_page {
}
/**
* Set a different path to use for the 'Moodle docs for this page' link.
* Set a different path to use for the 'Help and documentation' link.
*
* By default, it uses the pagetype, which is normally the same as the
* script name. So, for example, for mod/quiz/attempt.php, pagetype is

View File

@ -69,7 +69,7 @@
{{$pagecontent}}{{/pagecontent}}
</div>
</main>
<footer id="page-footer" class="py-3 bg-dark text-light">
<footer id="page-footer" class="py-3 footer-dark bg-dark text-light">
<div class="container">
<div>{{{global.contentexportfooter}}}</div>
</div>

View File

@ -26,7 +26,7 @@ Feature: In a report, admin can filter log data
And I click on "Enable" "link" in the "Legacy log" "table_row"
And the following config values are set as admin:
| loglegacy | 1 | logstore_legacy |
And I follow "Home"
And I am on homepage
And I am on "Course 1" course homepage
And I navigate to course participants
And I follow "Ann, Jill, Grainne, Beauchamp"
@ -65,9 +65,9 @@ Feature: In a report, admin can filter log data
And I click on "Disable" "link" in the "Standard log" "table_row"
And the following config values are set as admin:
| loglegacy | 1 | logstore_legacy |
And I follow "Home"
And I am on homepage
And I am on "Course 1" course homepage
And I follow "Home"
And I am on homepage
And I am on "Course 1" course homepage
And I navigate to course participants
And I follow "Ann, Jill, Grainne, Beauchamp"

View File

@ -0,0 +1,2 @@
define ("theme_boost/footer-popover",["exports","jquery","./popover"],function(a,b,c){"use strict";Object.defineProperty(a,"__esModule",{value:!0});Object.defineProperty(a,"Popover",{enumerable:!0,get:function get(){return c.default}});a.init=void 0;b=d(b);c=d(c);function d(a){return a&&a.__esModule?a:{default:a}}var e=function(){var a=document.querySelector("[data-region=\"footer-content-popover\"]"),c=document.querySelector("[data-region=\"footer-container-popover\"]");(0,b.default)("[data-action=\"footer-popover\"]").popover({content:a.innerHTML,container:c,html:!0,placement:"top",customClass:"footer"})};a.init=e});
//# sourceMappingURL=footer-popover.min.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../src/footer-popover.js"],"names":["init","content","document","querySelector","container","popover","innerHTML","html","placement","customClass"],"mappings":"0PAuBA,OACA,O,mDAEO,GAAMA,CAAAA,CAAI,CAAG,UAAM,IAChBC,CAAAA,CAAO,CAAGC,QAAQ,CAACC,aAAT,CAAuB,0CAAvB,CADM,CAEhBC,CAAS,CAAGF,QAAQ,CAACC,aAAT,CAAuB,4CAAvB,CAFI,CAItB,cAAE,kCAAF,EAAoCE,OAApC,CAA4C,CACxCJ,OAAO,CAAEA,CAAO,CAACK,SADuB,CAExCF,SAAS,CAAEA,CAF6B,CAGxCG,IAAI,GAHoC,CAIxCC,SAAS,CAAE,KAJ6B,CAKxCC,WAAW,CAAE,QAL2B,CAA5C,CAOH,CAXM,C","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Shows the footer content in a popover.\n *\n * @module theme_boost/footer-popover\n * @copyright 2021 Bas Brands\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\nimport $ from 'jquery';\nimport Popover from './popover';\n\nexport const init = () => {\n const content = document.querySelector('[data-region=\"footer-content-popover\"]');\n const container = document.querySelector('[data-region=\"footer-container-popover\"]');\n\n $('[data-action=\"footer-popover\"]').popover({\n content: content.innerHTML,\n container: container,\n html: true,\n placement: 'top',\n customClass: 'footer'\n });\n};\n\nexport {\n Popover\n};\n"],"file":"footer-popover.min.js"}

View File

@ -0,0 +1,42 @@
// 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 details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Shows the footer content in a popover.
*
* @module theme_boost/footer-popover
* @copyright 2021 Bas Brands
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
import $ from 'jquery';
import Popover from './popover';
export const init = () => {
const content = document.querySelector('[data-region="footer-content-popover"]');
const container = document.querySelector('[data-region="footer-container-popover"]');
$('[data-action="footer-popover"]').popover({
content: content.innerHTML,
container: container,
html: true,
placement: 'top',
customClass: 'footer'
});
};
export {
Popover
};

View File

@ -47,6 +47,7 @@ $string['rawscss_desc'] = 'Use this field to provide SCSS or CSS code which will
$string['rawscsspre'] = 'Raw initial SCSS';
$string['rawscsspre_desc'] = 'In this field you can provide initialising SCSS code, it will be injected before everything else. Most of the time you will use this setting to define variables.';
$string['region-side-pre'] = 'Right';
$string['showfooter'] = 'Show footer';
$string['privacy:metadata:preference:draweropennav'] = 'The user\'s preference for hiding or showing the drawer menu navigation.';
$string['privacy:drawernavclosed'] = 'The current preference for the navigation drawer is closed.';
$string['privacy:drawernavopen'] = 'The current preference for the navigation drawer is open.';

View File

@ -2293,14 +2293,52 @@ ul {
// but really in bootstrap we want the colour of links on .bg-inverse to be changed
// rather than being specific to the footer. This is kept for backwards compatibility.
$footer-link-color: $bg-inverse-link-color !default;
#page-footer a {
color: $footer-link-color;
text-decoration: underline;
.icon {
.footer-dark {
a {
color: $footer-link-color;
text-decoration: underline;
.icon {
color: $footer-link-color;
}
&:focus .icon {
color: $body-color;
}
}
&:focus .icon {
color: $body-color;
}
.btn-footer-popover {
display: none;
position: fixed;
bottom: 2rem;
right: 2rem;
@include box-shadow($popover-box-shadow);
}
.popover.footer {
.popover-body {
padding: 0;
.footer-section {
a {
color: $body-color;
text-decoration: underline;
&:focus {
text-decoration: none;
}
}
}
}
}
@include media-breakpoint-up(sm) {
.jsenabled #page-footer .footer-content-popover {
display: none;
}
.jsenabled .btn-footer-popover {
display: block;
z-index: $zindex-dropdown;
}
}

View File

@ -47,6 +47,9 @@ body.behat-site {
[data-region="message-drawer"] {
padding-right: 10px;
}
&.jsenabled #page-footer .footer-content-popover {
display: block;
}
}
.phpinfo table,
@ -74,4 +77,3 @@ body.behat-site {
background-color: #99c;
font-weight: bold;
}

View File

@ -81,6 +81,8 @@ $input-border-color: $gray-500 !default;
$dropdown-link-hover-color: $white;
$dropdown-link-hover-bg: $primary;
$popover-max-width: 300px !default;
// stylelint-disable
$theme-colors: () !default;
$theme-colors: map-merge((

View File

@ -6800,7 +6800,7 @@ a.close.disabled {
top: 0;
z-index: 1060;
display: block;
max-width: 276px;
max-width: 300px;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-style: normal;
font-weight: 400;
@ -11731,14 +11731,35 @@ ul {
margin-top: 30px;
margin-right: 0; } }
#page-footer a {
.footer-dark a {
color: #fff;
text-decoration: underline; }
#page-footer a .icon {
.footer-dark a .icon {
color: #fff; }
#page-footer a:focus .icon {
.footer-dark a:focus .icon {
color: #212529; }
.btn-footer-popover {
display: none;
position: fixed;
bottom: 2rem;
right: 2rem; }
.popover.footer .popover-body {
padding: 0; }
.popover.footer .popover-body .footer-section a {
color: #212529;
text-decoration: underline; }
.popover.footer .popover-body .footer-section a:focus {
text-decoration: none; }
@media (min-width: 576px) {
.jsenabled #page-footer .footer-content-popover {
display: none; }
.jsenabled .btn-footer-popover {
display: block;
z-index: 1000; } }
.bg-inverse a {
color: #fff;
text-decoration: underline; }
@ -19219,6 +19240,9 @@ body.behat-site .custom-control-label::before, body.behat-site .custom-control-l
body.behat-site [data-region="message-drawer"] {
padding-right: 10px; }
body.behat-site.jsenabled #page-footer .footer-content-popover {
display: block; }
.phpinfo table,
.phpinfo th,
.phpinfo h2 {

View File

@ -15,27 +15,62 @@
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template theme_boost/footer
Page footer.
Example context (json):
{
"output": {
"page_doc_link": "Help and documentation",
"login_info": "You are logged in as cute kitten",
"moodle_release": "90210"
}
}
}}
<footer id="page-footer" class="py-3 bg-dark text-light">
<div class="container">
<div id="course-footer">{{{ output.course_footer }}}</div>
<footer id="page-footer" class="footer-popover footer-dark bg-dark text-light">
<div data-region="footer-container-popover">
<button class="btn btn-icon bg-secondary icon-no-margin btn-footer-popover" data-action="footer-popover" aria-label="{{#str}}showfooter, theme_boost{{/str}}">
{{#pix}}e/question, core{{/pix}}
</button>
</div>
<div class="footer-content-popover" data-region="footer-content-popover">
{{# output.page_doc_link }}
<p class="helplink">{{{ output.page_doc_link }}}</p>
<div class="footer-section p-3 border-bottom">
{{{ output.page_doc_link }}}
</div>
{{/ output.page_doc_link }}
{{{ output.login_info }}}
<div class="tool_usertours-resettourcontainer"></div>
{{{ output.home_link }}}
<nav class="nav navbar-nav d-md-none" aria-label="{{#str}}custommenu, admin{{/str}}">
{{# output.custom_menu_flat }}
<ul class="list-unstyled pt-3">
{{> theme_boost/custom_menu_footer }}
</ul>
{{/ output.custom_menu_flat }}
</nav>
{{{ output.standard_footer_html }}}
{{{ output.standard_end_of_body_html }}}
<div class="footer-section p-3 border-bottom">
<div class="logininfo">
{{{ output.login_info }}}
</div>
<div class="tool_usertours-resettourcontainer">
</div>
{{{ output.standard_footer_html }}}
{{{ output.standard_end_of_body_html }}}
</div>
<div class="footer-section p-3">
<div>{{#str}}poweredbymoodle, core{{/str}}</div>
{{#output.moodle_release}}
<div>
{{#str}}version, core{{/str}} {{{ output.moodle_release }}}
</div>
{{/output.moodle_release}}
</div>
</div>
<div class="footer-content-debugging py-sm-3">
<div class="container">
{{{ output.debug_footer_html }}}
</div>
</div>
</footer>
{{#js}}
require(['theme_boost/footer-popover'], function(FooterPopover) {
FooterPopover.init();
});
{{/js}}

View File

@ -49,20 +49,7 @@
</div>
</div>
</div>
<footer id="page-footer" class="py-3 bg-dark text-light">
<div class="container">
<div id="course-footer">{{{ output.course_footer }}}</div>
{{# output.page_doc_link }}
<p class="helplink">{{{ output.page_doc_link }}}</p>
{{/ output.page_doc_link }}
{{{ output.login_info }}}
{{{ output.home_link }}}
{{{ output.standard_footer_html }}}
{{{ output.standard_end_of_body_html }}}
</div>
</footer>
{{> theme_boost/footer }}
</div>
</body>

View File

@ -63,12 +63,7 @@
</div>
</div>
<footer id="page-footer" class="py-3 bg-dark text-light">
<div class="container">
{{{ output.standard_footer_html }}}
{{{ output.standard_end_of_body_html }}}
</div>
</footer>
{{> theme_boost/footer }}
</div>
</body>

View File

@ -75,10 +75,9 @@
</div>
</div>
</div>
<footer id="page-footer" class="py-3 bg-dark text-light">
<footer id="page-footer" class="py-3 footer-dark bg-dark text-light">
<div class="container">
<div id="course-footer">{{{ output.course_footer }}}</div>
{{{ output.standard_end_of_body_html }}}
</div>
</footer>

View File

@ -11731,14 +11731,35 @@ ul {
margin-top: 30px;
margin-right: 0; } }
#page-footer a {
.footer-dark a {
color: #fff;
text-decoration: underline; }
#page-footer a .icon {
.footer-dark a .icon {
color: #fff; }
#page-footer a:focus .icon {
.footer-dark a:focus .icon {
color: #212529; }
.btn-footer-popover {
display: none;
position: fixed;
bottom: 2rem;
right: 2rem; }
.popover.footer .popover-body {
padding: 0; }
.popover.footer .popover-body .footer-section a {
color: #212529;
text-decoration: underline; }
.popover.footer .popover-body .footer-section a:focus {
text-decoration: none; }
@media (min-width: 576px) {
.jsenabled #page-footer .footer-content-popover {
display: none; }
.jsenabled .btn-footer-popover {
display: block;
z-index: 1000; } }
.bg-inverse a {
color: #fff;
text-decoration: underline; }
@ -19165,6 +19186,9 @@ body.behat-site .custom-control-label::before, body.behat-site .custom-control-l
body.behat-site [data-region="message-drawer"] {
padding-right: 10px; }
body.behat-site.jsenabled #page-footer .footer-content-popover {
display: block; }
.phpinfo table,
.phpinfo th,
.phpinfo h2 {

View File

@ -90,7 +90,7 @@
</div>
</div>
{{{ output.standard_after_main_region_html }}}
{{> theme_boost/footer }}
{{> theme_classic/footer }}
</div>
</body>

View File

@ -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 details.
You should have received a copy of the GNU General Public License
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
}}
{{!
@template theme_classic/footer
Page footer.
Example context (json):
{
"output": {
"course footer": "More information about this course",
"page_doc_link": "<a href='https://docs.moodle.org/'>Help and documentation</a>"
}
}
}}
<div id="goto-top-link">
{{! go to top is sticky to footer so needs to be sibling }}
<a class="btn btn-light" role="button" href="#" aria-label="{{#str}} totop, theme_boost {{/str}}">
{{#pix}} i/up, core{{/pix}}
</a>
</div>
<footer id="page-footer" class="py-3 footer-dark bg-dark text-light">
<div class="container">
<div id="course-footer">{{{ output.course_footer }}}</div>
{{# output.page_doc_link }}
<p class="helplink">{{{ output.page_doc_link }}}</p>
{{/ output.page_doc_link }}
{{{ output.login_info }}}
<div class="tool_usertours-resettourcontainer"></div>
{{{ output.home_link }}}
<nav class="nav navbar-nav d-md-none" aria-label="{{#str}}custommenu, admin{{/str}}">
{{# output.custom_menu_flat }}
<ul class="list-unstyled pt-3">
{{> theme_boost/custom_menu_footer }}
</ul>
{{/ output.custom_menu_flat }}
</nav>
{{{ output.standard_footer_html }}}
{{{ output.standard_end_of_body_html }}}
</div>
</footer>