mirror of
https://github.com/moodle/moodle.git
synced 2025-04-16 05:54:19 +02:00
Merge branch 'MDL-72110-master-v3' of https://github.com/sharidas/moodle
This commit is contained in:
commit
b889f9f3f6
@ -35,15 +35,19 @@ class primary extends view {
|
||||
return;
|
||||
}
|
||||
$this->id = 'primary_navigation';
|
||||
if (get_home_page() == HOMEPAGE_SITE && isloggedin() && !isguestuser()) {
|
||||
$this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
|
||||
null, 'home', new \pix_icon('i/home', ''));
|
||||
}
|
||||
|
||||
// Add the dashboard link.
|
||||
if (isloggedin() && !isguestuser()) { // Makes no sense if you aren't logged in.
|
||||
$this->rootnodes['home'] = $this->add(get_string('myhome'), new \moodle_url('/my/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
if (isloggedin() && !isguestuser()) {
|
||||
$homepage = get_home_page();
|
||||
if ($homepage === HOMEPAGE_SITE) {
|
||||
$this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
|
||||
null, 'home', new \pix_icon('i/home', ''));
|
||||
$this->rootnodes['home'] = $this->add(get_string('myhome'), new \moodle_url('/my/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
} else if ($homepage === HOMEPAGE_MY) {
|
||||
$this->add(get_string('myhome'), new \moodle_url('/my/'), self::TYPE_SYSTEM,
|
||||
null, 'home', new \pix_icon('i/home', ''));
|
||||
$this->rootnodes['home'] = $this->add(get_string('sitehome'), new \moodle_url('/'),
|
||||
self::TYPE_SETTING, null, 'myhome', new \pix_icon('i/dashboard', ''));
|
||||
}
|
||||
}
|
||||
|
||||
// Add a dummy mycourse link to a mycourses page.
|
||||
|
@ -59,8 +59,8 @@ class primary_test extends \advanced_testcase {
|
||||
public function test_setting_initialise_provider() {
|
||||
return [
|
||||
'Testing as a guest user' => ['guest', ['courses']],
|
||||
'Testing as an admin' => ['admin', ['myhome', 'courses', 'siteadminnode']],
|
||||
'Testing as a regular user' => ['user', ['myhome', 'courses']]
|
||||
'Testing as an admin' => ['admin', ['home', 'myhome', 'courses', 'siteadminnode']],
|
||||
'Testing as a regular user' => ['user', ['home', 'myhome', 'courses']]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -352,7 +352,7 @@ function core_login_get_return_url() {
|
||||
if ($urltogo == ($CFG->wwwroot . '/')) {
|
||||
$homepage = get_home_page();
|
||||
// Go to my-moodle page instead of site homepage if defaulthomepage set to homepage_my.
|
||||
if ($homepage == HOMEPAGE_MY && !is_siteadmin() && !isguestuser()) {
|
||||
if ($homepage === HOMEPAGE_MY && !isguestuser()) {
|
||||
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
||||
$urltogo = $CFG->wwwroot.'/my/';
|
||||
}
|
||||
|
@ -20,6 +20,11 @@ Feature: Set the site home page and dashboard as the default home page
|
||||
Given I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Navigation" block if not present
|
||||
And I configure the "Navigation" block
|
||||
And I set the following fields to these values:
|
||||
| Page contexts | Display throughout the entire site |
|
||||
And I press "Save changes"
|
||||
And I add the "Administration" block if not present
|
||||
And I configure the "Administration" block
|
||||
And I set the following fields to these values:
|
||||
@ -31,16 +36,16 @@ Feature: Set the site home page and dashboard as the default home page
|
||||
And I am on site homepage
|
||||
And I follow "Make this my home page"
|
||||
And I should not see "Make this my home page"
|
||||
# The following lines should be changed once MDL-72110 is resolved.
|
||||
# And I am on "Course 1" course homepage
|
||||
# And "Home" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And I am on "Course 1" course homepage
|
||||
And I should see "Home" in the "Navigation" "block"
|
||||
And I should not see "Site home" in the "Navigation" "block"
|
||||
And I am on site homepage
|
||||
And I follow "Dashboard"
|
||||
And I follow "Make this my home page"
|
||||
And I should not see "Make this my home page"
|
||||
# The following lines should be changed once MDL-72110 is resolved.
|
||||
# And I am on "Course 1" course homepage
|
||||
# Then "Dashboard" "text" should exist in the ".breadcrumb" "css_element"
|
||||
And I am on "Course 1" course homepage
|
||||
Then I should not see "Home" in the "Navigation" "block"
|
||||
And I should see "Site home" in the "Navigation" "block"
|
||||
|
||||
Scenario: User cannot configure their preferred default home page unless allowed by admin
|
||||
Given I log in as "user1"
|
||||
|
Loading…
x
Reference in New Issue
Block a user