Merge branch 'MDL-87545-main-v2' of https://github.com/andimendunia/moodle
This commit is contained in:
@@ -141,6 +141,13 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
|
||||
// Navigation settings
|
||||
$temp = new admin_settingpage('navigation', new lang_string('navigation'));
|
||||
$temp->add(new admin_setting_configcheckbox(
|
||||
'enablemyhome',
|
||||
new lang_string('enablemyhome', 'admin'),
|
||||
new lang_string('enablemyhome_help', 'admin'),
|
||||
0
|
||||
));
|
||||
|
||||
$temp->add(new admin_setting_configcheckbox(
|
||||
'enabledashboard',
|
||||
new lang_string('enabledashboard', 'admin'),
|
||||
@@ -148,7 +155,10 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // sp
|
||||
1
|
||||
));
|
||||
|
||||
$choices = [HOMEPAGE_SITE => new lang_string('home')];
|
||||
$choices = [];
|
||||
if (!isset($CFG->enablemyhome) || $CFG->enablemyhome) {
|
||||
$choices[HOMEPAGE_SITE] = new lang_string('home');
|
||||
}
|
||||
if (!isset($CFG->enabledashboard) || $CFG->enabledashboard) {
|
||||
$choices[HOMEPAGE_MY] = new lang_string('mymoodle', 'admin');
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Display extended course names
|
||||
I need to display courses short names along with courses full names
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Purge caches
|
||||
I want manually purge different data and file caches
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I navigate to "Development > Purge caches" in site administration
|
||||
|
||||
Scenario: Purge all caches
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Set admin settings value
|
||||
I need to set admin setting value and verify it is applied
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course fullname | C_shortname | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Set up contextual data for tests
|
||||
As a developer
|
||||
I need to fill the database with fixtures
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: Add a bunch of users
|
||||
Given the following "users" exist:
|
||||
| username | password | firstname | lastname |
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Verify that keyboard steps work as expected
|
||||
As a test writer
|
||||
I need to verify that the keyboard steps work as expected
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Typing keys into a field causes them to be input
|
||||
Given the following "users" exist:
|
||||
|
||||
@@ -379,6 +379,7 @@ class api {
|
||||
}
|
||||
|
||||
if (empty($section) || $section === 'navigation') {
|
||||
$settings->enablemyhome = $CFG->enablemyhome ?? 1;
|
||||
$settings->enabledashboard = $CFG->enabledashboard;
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,7 @@ final class externallib_test extends \core_external\tests\externallib_testcase {
|
||||
$expected[] = ['name' => 'coursegraceperiodafter', 'value' => $CFG->coursegraceperiodafter];
|
||||
$expected[] = ['name' => 'coursegraceperiodbefore', 'value' => $CFG->coursegraceperiodbefore];
|
||||
|
||||
$expected[] = ['name' => 'enablemyhome', 'value' => $CFG->enablemyhome ?? 1];
|
||||
$expected[] = ['name' => 'enabledashboard', 'value' => $CFG->enabledashboard];
|
||||
$expected[] = ['name' => 'customusermenuitems', 'value' => $CFG->customusermenuitems];
|
||||
$expected[] = ['name' => 'timezone', 'value' => $CFG->timezone];
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: tool_monitor_subscriptions
|
||||
I need to create a new rule, subscribe to it, receive notification and delete subscription
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
| Course 2 | C2 |
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: User must accept policy managed by this plugin when logging in and sign
|
||||
As a user
|
||||
I need to be able to accept site policy during sign up
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: Accept policy on sign up manage by plugin, no site policy
|
||||
Given the following config values are set as admin:
|
||||
| registerauth | email |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: An admin can create courses using a CSV file
|
||||
I need to be able to upload a CSV file and navigate through the import process
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| First course | C1 | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: An admin can update courses using a CSV file
|
||||
I need to be able to upload a CSV file and navigate through the import process
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Some random name | C1 | 0 |
|
||||
| Another course | CF1 | 0 |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Reset a tour
|
||||
I can reset the tour to force it to display again
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I add a new user tour with:
|
||||
| Name | First tour |
|
||||
| Description | My first tour |
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
@tool @tool_usertours
|
||||
Feature: Apply accessibility to a tour
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I add a new user tour with:
|
||||
| Name | First tour |
|
||||
| Description | My first tour |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Prevent yours from being marked as complete
|
||||
I can prevent a user tour from being marked as complete
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I add a new user tour with:
|
||||
| Name | First tour |
|
||||
| Description | My first tour |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Test manual authentication works.
|
||||
I need to go on login page and enter username and password.
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username |
|
||||
| teacher1 |
|
||||
And the following config values are set as admin:
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Authentication
|
||||
As a user
|
||||
I need to log into the system
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: Log in with the predefined admin user with Javascript disabled
|
||||
Given I log in as "admin"
|
||||
Then I should see "You are logged in as Admin User" in the "page-footer" "region"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Test if the login form provides the correct feedback
|
||||
I need to go on login page and see feedback on incorrect username or password.
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username |
|
||||
| teacher1 |
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Import course content bank content
|
||||
I need to confirm that errors will not happen
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And the following config values are set as admin:
|
||||
| unaddableblocks | | theme_boost|
|
||||
And I am on site homepage
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Enable Block Badges on the frontpage and view awarded badges
|
||||
As a admin
|
||||
I can add badges block to the frontpage
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: Add the recent badges block on the frontpage and view recent badges
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Enable Block blog menu on the frontpage
|
||||
I can add blog menu block to the frontpage
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And the following "blocks" exist:
|
||||
|
||||
@@ -12,6 +12,7 @@ Feature: Feature: Students can use the recent blog entries block to view recent
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| blog_recent | System | 1 | site-index | side-pre |
|
||||
And the following config values are set as admin:
|
||||
| enablemyhome | 1 | |
|
||||
| unaddableblocks | | theme_boost|
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
|
||||
@@ -93,7 +93,9 @@ Feature: Enable the calendar block in a course and test it's functionality
|
||||
|
||||
@javascript
|
||||
Scenario: Click on today's course event on the calendar view page's calendar block
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I create a calendar event with form data:
|
||||
| id_eventtype | Site |
|
||||
| id_name | Site Event |
|
||||
|
||||
+3
-1
@@ -5,7 +5,9 @@ Feature: View a site event on the frontpage
|
||||
I can view the event in the upcoming events block
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||
And the following "blocks" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Enable Block comments on the frontpage and view comments
|
||||
I can add the comments block to the frontpage
|
||||
|
||||
Scenario: Add the comments block on the frontpage and add comments
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | T1 |
|
||||
And the following "blocks" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Enable the course_list block on the frontpage and view it's contents
|
||||
I can add the course list block to the frontpage
|
||||
|
||||
Background:
|
||||
Given the following "categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Category A | 0 | CATA |
|
||||
| Category B | 0 | CATB |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Course summary block used on the frontpage
|
||||
I can use the course summary block on the frontpage
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I enable "course_summary" "block" plugin
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
|
||||
@@ -9,7 +9,8 @@ Feature: Random glossary entry block can be added to the frontpage
|
||||
| activity | name | intro | course | idnumber |
|
||||
| glossary | Tips and Tricks | Frontpage glossary description | Acceptance test site | glossary0 |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
| forcelogin | 0 |
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -6,7 +6,8 @@ Feature: Adding and configuring multiple Text blocks
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
| forcelogin | 0 |
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
When I turn editing mode on
|
||||
|
||||
@@ -12,7 +12,8 @@ Feature: Login from a block
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| login | System | 1 | site-index | side-pre |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
| forcelogin | 0 |
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: Login block visible to non-logged in users
|
||||
When I am on homepage
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: The logged in user block allows users to view their profile information
|
||||
I can add the logged in user block to the frontpage and view my information
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| teacher1 | Teacher | One | teacher1@example.com | T1 |
|
||||
And the following "blocks" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Test that admin can see related nodes in Administration block
|
||||
I need to be able to see related nodes in Administration block
|
||||
|
||||
Background:
|
||||
Given the following "categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber | visible |
|
||||
| cat1 | 0 | cat1 | 1 |
|
||||
And the following "courses" exist:
|
||||
|
||||
@@ -35,6 +35,7 @@ Feature: Expand the courses nodes within the navigation block
|
||||
| student1 | c2 | student |
|
||||
| student1 | c4 | student |
|
||||
And the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
| navshowallcourses | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Displaying the link to the Participants page
|
||||
I need a link to the Participants page be displayed (but only if I can access that page)
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | One | student1@example.com |
|
||||
| student2 | Student | Two | student2@example.com |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: View my courses in navigation block
|
||||
I need my courses displayed in the navigation block
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
And the following "categories" exist:
|
||||
|
||||
@@ -6,7 +6,9 @@ Feature: The online users block allow you to see who is currently online on fron
|
||||
I can add the online users block to the frontpage
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
| student2 | Student | 2 | student2@example.com |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: The private files block allows users to store files privately in moodle
|
||||
I can upload the file to my private files area using the private files block from the front page
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Enable RSS client block menu on the frontpage
|
||||
I can add RSS client block to the frontpage
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
When I navigate to "Plugins > Blocks > Manage blocks" in site administration
|
||||
Then I enable "rss_client" "block" plugin
|
||||
And the following "blocks" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: The search forums block allows users to search for forum posts on front
|
||||
I can add the search forums block
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | idnumber |
|
||||
| student1 | Student | 1 | student1@example.com | S1 |
|
||||
And the following "blocks" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Add URL to Additional activities block
|
||||
I need to add URLs to the Additional activities block and check it works.
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | enablecompletion |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
| Course 2 | C2 | 0 | |
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Edit activities in Additional activities block
|
||||
As an admin
|
||||
I need to add and edit activities there
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
@javascript
|
||||
Scenario: Edit name of activity in-place in Additional activities block
|
||||
Given the following "activity" exists:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Block tags displaying tag cloud
|
||||
I need to be able to use the block tags
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email | interests |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com | Dogs, Cats |
|
||||
| student1 | Student | 1 | student1@example.com | |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Add and configure blocks throughout the site
|
||||
I need to set and configure blocks throughout the site
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "users" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Comment on a blog entry
|
||||
I need to be able to comment on a blog entry
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| testuser | Test | User | moodle@example.com |
|
||||
| testuser2 | Test2 | User2 | moodle2@example.com |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Delete a blog entry
|
||||
I need to be able to delete entries I no longer wish to appear
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| testuser | Test | User | moodle@example.com |
|
||||
And the following "core_blog > entries" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Copy content from the content bank
|
||||
I need to be able to copy any content from the content bank
|
||||
|
||||
Background:
|
||||
Given the following "contentbank content" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "contentbank content" exist:
|
||||
| contextlevel | reference | contenttype | user | contentname | filepath |
|
||||
| System | | contenttype_h5p | admin | content2copy.h5p | /h5p/tests/fixtures/filltheblanks.h5p |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Content bank custom fields
|
||||
I need to be able to access the custom fields
|
||||
|
||||
Background:
|
||||
Given the following "blocks" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "blocks" exist:
|
||||
| blockname | contextlevel | reference | pagetypepattern | defaultregion |
|
||||
| private_files | System | 1 | my-index | side-post |
|
||||
And the following "custom field categories" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Download H5P content from the content bank
|
||||
I need to be able to download any H5P content from the content bank
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| manager | Max | Manager | man@example.com |
|
||||
And the following "role assigns" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Content bank use editor feature
|
||||
I need to be able to access the edition options
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And the following config values are set as admin:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Make content public or unlisted
|
||||
I need to be able to access the edition options
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And the following config values are set as admin:
|
||||
|
||||
@@ -144,6 +144,11 @@ class core_course_external extends external_api {
|
||||
//retrieve the course
|
||||
$course = $DB->get_record('course', array('id' => $params['courseid']), '*', MUST_EXIST);
|
||||
|
||||
// Accessing the site home via the web service is not allowed when it is disabled.
|
||||
if ($course->id == SITEID && empty($CFG->enablemyhome)) {
|
||||
throw new moodle_exception('error:sitehomeisdisabled', 'course');
|
||||
}
|
||||
|
||||
// now security checks
|
||||
$context = context_course::instance($course->id, IGNORE_MISSING);
|
||||
try {
|
||||
|
||||
@@ -21,6 +21,8 @@ Feature: Courses can be created in Single Activity mode
|
||||
| moodle/course:manageactivities | allow |
|
||||
| moodle/course:viewparticipants | allow |
|
||||
| moodle/role:assign | allow |
|
||||
And the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
When I log in as "kevin"
|
||||
And I am on site homepage
|
||||
And I press "Add a new course"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Restricting access to course lists
|
||||
I need to be able to give/revoke capabilities to view list of courses
|
||||
|
||||
Background:
|
||||
Given the following "categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Science category | 0 | SCI |
|
||||
| English category | 0 | ENG |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Collapse course sections
|
||||
I need to collapse/extend sections for course formats.
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student1@example.com |
|
||||
|
||||
@@ -80,6 +80,8 @@ Feature: Managers can create courses
|
||||
| moodle/course:create | allow |
|
||||
| moodle/course:manageactivities | allow |
|
||||
| moodle/course:viewparticipants | allow |
|
||||
And the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "kevin"
|
||||
And I am on site homepage
|
||||
When I press "Add a new course"
|
||||
@@ -102,6 +104,8 @@ Feature: Managers can create courses
|
||||
And I set the following administration settings values:
|
||||
| Creators' role in new courses | Non-editing teacher |
|
||||
And I log out
|
||||
And the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "kevin"
|
||||
And I am on site homepage
|
||||
When I press "Add a new course"
|
||||
|
||||
@@ -8,6 +8,7 @@ Feature: Courses can be set up to display dates relative to the user's enrolment
|
||||
Scenario: Create a course with relative dates feature disabled
|
||||
Given the following config values are set as admin:
|
||||
| enablecourserelativedates | 0 |
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
@@ -20,6 +21,7 @@ Feature: Courses can be set up to display dates relative to the user's enrolment
|
||||
Scenario: Create a course with relative dates feature enabled
|
||||
Given the following config values are set as admin:
|
||||
| enablecourserelativedates | 1 |
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
|
||||
@@ -5,10 +5,12 @@ Feature: Fields locked control who is able to edit it
|
||||
I can change the visibility of the fields
|
||||
|
||||
Background:
|
||||
Given the following "custom field categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "custom field categories" exist:
|
||||
| name | component | area | itemid |
|
||||
| Category for test | core_course | course | 0 |
|
||||
Given the following "users" exist:
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student@example.com |
|
||||
|
||||
@@ -5,10 +5,12 @@ Feature: The visibility of fields control where they are displayed
|
||||
I can change the visibility of the fields
|
||||
|
||||
Background:
|
||||
Given the following "custom field categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "custom field categories" exist:
|
||||
| name | component | area | itemid |
|
||||
| Category for test | core_course | course | 0 |
|
||||
Given the following "users" exist:
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
| student1 | Student | 1 | student@example.com |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Site home displays items in different modes
|
||||
I need to set different frontpage display modes
|
||||
|
||||
Background:
|
||||
Given the following "categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "categories" exist:
|
||||
| name | category | idnumber |
|
||||
| Category A | 0 | CATA |
|
||||
| Category B | 0 | CATB |
|
||||
|
||||
@@ -6,7 +6,8 @@ Feature: Site home activities section
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| numsections | 1 |
|
||||
| enablemyhome | 1 |
|
||||
| numsections | 1 |
|
||||
|
||||
Scenario: Activities should appear in frontpage
|
||||
Given the following "activities" exist:
|
||||
|
||||
@@ -3,7 +3,9 @@ Feature: Keyholder role is listed as course contact
|
||||
As a student I need to know who the keyholder is to enrol in a course
|
||||
|
||||
Background:
|
||||
Given the following "role" exists:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "role" exists:
|
||||
| shortname | keyholder |
|
||||
| name | Keyholder |
|
||||
| context_coursecat | 1 |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Browse course list and return back from enrolment page
|
||||
I need to be able to return back from enrolment page
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
| user2 | User | 2 | user2@example.com |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Managers can manage course custom fields checkbox
|
||||
I need to create, edit, remove and sort custom fields
|
||||
|
||||
Background:
|
||||
Given the following "custom field categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "custom field categories" exist:
|
||||
| name | component | area | itemid |
|
||||
| Category for test | core_course | course | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Managers can manage course custom fields number
|
||||
I need to create, edit, remove and display number custom fields
|
||||
|
||||
Background:
|
||||
Given the following "custom field categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "custom field categories" exist:
|
||||
| name | component | area | itemid |
|
||||
| Category for test | core_course | course | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Managers can manage course custom fields text
|
||||
I need to create, edit, remove and sort custom fields
|
||||
|
||||
Background:
|
||||
Given the following "custom field categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "custom field categories" exist:
|
||||
| name | component | area | itemid |
|
||||
| Category for test | core_course | course | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Default value for the textarea custom field can contain images
|
||||
I need to be able to add images to the default value
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher | Teacher | 1 | teacher1@example.com |
|
||||
| manager | Manager | 1 | manager1@example.com |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Managers can manage course custom fields textarea
|
||||
I need to create, edit, remove and sort custom fields
|
||||
|
||||
Background:
|
||||
Given the following "custom field categories" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "custom field categories" exist:
|
||||
| name | component | area | itemid |
|
||||
| Category for test | core_course | course | 0 |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -72,6 +72,24 @@ if ($hassiteconfig && moodle_needs_upgrading()) {
|
||||
\core\hub\registration::registration_reminder('/index.php');
|
||||
|
||||
$homepage = get_home_page();
|
||||
|
||||
// If enablemyhome is disabled, redirect unconditionally, ignoring the redirect param.
|
||||
// Any explicit link to / should be redirected away.
|
||||
// $homepage is used (not $CFG->defaulthomepage) as it already resolves stale DB values.
|
||||
if (empty($CFG->enablemyhome)) {
|
||||
if (!isloggedin()) {
|
||||
// Non-logged-in users must log in first (forcelogin may be off, but the
|
||||
// page they are headed for is disabled, so send them to the login page).
|
||||
redirect(get_login_url());
|
||||
} else if ($homepage != HOMEPAGE_SITE) {
|
||||
if ($homepage == HOMEPAGE_MY) {
|
||||
redirect($CFG->wwwroot . '/my/');
|
||||
} else if ($homepage == HOMEPAGE_MYCOURSES) {
|
||||
redirect($CFG->wwwroot . '/my/courses.php');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($homepage != HOMEPAGE_SITE) {
|
||||
if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
|
||||
set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
|
||||
@@ -82,6 +100,9 @@ if ($homepage != HOMEPAGE_SITE) {
|
||||
redirect($CFG->wwwroot .'/my/courses.php');
|
||||
} else if ($homepage == HOMEPAGE_URL) {
|
||||
redirect(get_default_home_page_url());
|
||||
} else if ($homepage == HOMEPAGE_USER) {
|
||||
// All homepage options disabled - redirect to user preferences page.
|
||||
redirect($CFG->wwwroot . '/user/preferences.php');
|
||||
} else if (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER)) {
|
||||
$frontpagenode = $PAGE->settingsnav->find('frontpage', null);
|
||||
if ($frontpagenode) {
|
||||
|
||||
@@ -614,6 +614,8 @@ $string['enableglobalsearch_desc'] = 'If enabled, data will be indexed and synch
|
||||
$string['enablegravatar'] = 'Enable Gravatar';
|
||||
$string['enablegravatar_help'] = 'When enabled Moodle will attempt to fetch a user profile picture from Gravatar if the user has not uploaded an image.';
|
||||
$string['enablemobilewebservice'] = 'Enable web services for mobile devices';
|
||||
$string['enablemyhome'] = 'Enable Home';
|
||||
$string['enablemyhome_help'] = 'If enabled, the Home page and its navigation link are available. If disabled, users are redirected to the configured \'Start page for users\'.';
|
||||
$string['enablepdfexportfont'] = 'Enable PDF fonts';
|
||||
$string['enablepdfexportfont_desc'] = 'If your site has courses in different languages which need other fonts in generated PDF files, you can provide the option to set the font in the course settings. You need to specify available fonts in $CFG->pdfexportfont in config.php.';
|
||||
$string['enableplugin'] = 'Enable {$a}';
|
||||
|
||||
@@ -95,6 +95,7 @@ $string['downloadcontent_help'] = 'Should this activity or resource be included
|
||||
|
||||
The setting has no effect on mobile app content download for offline usage.';
|
||||
$string['enabledownloadcoursecontent'] = 'Enable download course content';
|
||||
$string['error:sitehomeisdisabled'] = 'The Site Home has been disabled by an administrator.';
|
||||
$string['errorendbeforestart'] = 'The end date ({$a}) is before the course start date.';
|
||||
$string['favourite'] = 'Starred course';
|
||||
$string['filterbothactive'] = 'First ({$a->first}) Last ({$a->last})';
|
||||
|
||||
@@ -182,6 +182,7 @@ class global_navigation extends navigation_node {
|
||||
// - courses: Additional courses are added here.
|
||||
// - users: Other users information loaded here.
|
||||
$this->rootnodes = [];
|
||||
$homeenabled = !empty($CFG->enablemyhome);
|
||||
$defaulthomepage = get_home_page();
|
||||
if ($defaulthomepage == HOMEPAGE_SITE) {
|
||||
// The home element should be my moodle because the root element is the site.
|
||||
@@ -199,7 +200,7 @@ class global_navigation extends navigation_node {
|
||||
$this->rootnodes['home']->showinflatnavigation = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
} else if ($homeenabled) {
|
||||
// The home element should be the site because the root node is my moodle.
|
||||
$this->rootnodes['home'] = $this->add(
|
||||
get_string('sitehome'),
|
||||
|
||||
@@ -1093,7 +1093,7 @@ class settings_navigation extends navigation_node {
|
||||
// breadcrumb.
|
||||
$mainpage->display = false;
|
||||
$homepage = get_home_page();
|
||||
if (($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES)) {
|
||||
if ($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES || $homepage == HOMEPAGE_USER) {
|
||||
$mainpage->mainnavonly = true;
|
||||
}
|
||||
|
||||
@@ -1265,9 +1265,12 @@ class settings_navigation extends navigation_node {
|
||||
// Default homepage.
|
||||
$defaulthomepageuser = (!empty($CFG->defaulthomepage) && ($CFG->defaulthomepage == HOMEPAGE_USER));
|
||||
if (isloggedin() && !isguestuser($user) && $defaulthomepageuser) {
|
||||
require_once($CFG->dirroot . '/user/lib.php');
|
||||
$options = user_get_default_homepage_options();
|
||||
if (
|
||||
$currentuser && has_capability('moodle/user:editownprofile', $systemcontext) ||
|
||||
has_capability('moodle/user:editprofile', $usercontext)
|
||||
!empty($options) &&
|
||||
($currentuser && has_capability('moodle/user:editownprofile', $systemcontext) ||
|
||||
has_capability('moodle/user:editprofile', $usercontext))
|
||||
) {
|
||||
$url = new url('/user/defaulthomepage.php', ['id' => $user->id]);
|
||||
$useraccount->add(get_string('defaulthomepageuser'), $url, self::TYPE_SETTING, null, 'defaulthomepageuser');
|
||||
|
||||
@@ -43,7 +43,8 @@ class primary extends view {
|
||||
$showhomenode = empty($this->page->theme->removedprimarynavitems) ||
|
||||
!in_array('home', $this->page->theme->removedprimarynavitems);
|
||||
// We do not need to change the text for the home/dashboard depending on the set homepage.
|
||||
if ($showhomenode) {
|
||||
$sitehome = null;
|
||||
if ($showhomenode && !empty($CFG->enablemyhome)) {
|
||||
$sitehome = $this->add(get_string('home'), new \moodle_url('/'), self::TYPE_SYSTEM,
|
||||
null, 'home', new \pix_icon('i/home', ''));
|
||||
}
|
||||
@@ -51,7 +52,7 @@ class primary extends view {
|
||||
$homepage = get_home_page();
|
||||
if ($homepage == HOMEPAGE_MY || $homepage == HOMEPAGE_MYCOURSES) {
|
||||
// We need to stop automatic redirection.
|
||||
if ($showhomenode) {
|
||||
if ($sitehome) {
|
||||
$sitehome->action->param('redirect', '0');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,12 +1157,17 @@ class user {
|
||||
'permissioncallback' => [static::class, 'is_current_user'],
|
||||
];
|
||||
|
||||
$choices = [HOMEPAGE_SITE];
|
||||
if (!empty($CFG->enabledashboard)) {
|
||||
// Build available homepage choices inline.
|
||||
$choices = [];
|
||||
if (!isset($CFG->enablemyhome) || $CFG->enablemyhome) {
|
||||
$choices[] = HOMEPAGE_SITE;
|
||||
}
|
||||
if (!isset($CFG->enabledashboard) || $CFG->enabledashboard) {
|
||||
$choices[] = HOMEPAGE_MY;
|
||||
}
|
||||
$choices[] = HOMEPAGE_MYCOURSES;
|
||||
|
||||
if (!isset($CFG->enablemycourses) || $CFG->enablemycourses) {
|
||||
$choices[] = HOMEPAGE_MYCOURSES;
|
||||
}
|
||||
// Allow hook callbacks to extend options.
|
||||
$hook = new \core_user\hook\extend_default_homepage(true);
|
||||
\core\di::get(\core\hook\manager::class)->dispatch($hook);
|
||||
|
||||
@@ -1740,5 +1740,16 @@ function xmldb_main_upgrade($oldversion) {
|
||||
upgrade_main_savepoint(true, 2026021000.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2026022700.01) {
|
||||
// For existing sites, enable My Home by default to maintain current behavior.
|
||||
// New installs will have it disabled (default 0 in settings).
|
||||
$enablemyhome = get_config('core', 'enablemyhome');
|
||||
if ($enablemyhome === false) {
|
||||
set_config('enablemyhome', 1);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2026022700.01);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9916,10 +9916,18 @@ function mnet_get_idp_jump_url($user) {
|
||||
function get_home_page() {
|
||||
global $CFG;
|
||||
|
||||
if (isloggedin() && !empty($CFG->defaulthomepage)) {
|
||||
$homeenabled = !empty($CFG->enablemyhome);
|
||||
|
||||
if (isloggedin() && isset($CFG->defaulthomepage) && $CFG->defaulthomepage !== '') {
|
||||
// If dashboard is disabled, home will be set to default page.
|
||||
$defaultpage = get_default_home_page();
|
||||
if ($CFG->defaulthomepage == HOMEPAGE_MY && (!isguestuser() || !empty($CFG->allowguestmymoodle))) {
|
||||
if ($CFG->defaulthomepage == HOMEPAGE_SITE) {
|
||||
if ($homeenabled) {
|
||||
return HOMEPAGE_SITE;
|
||||
} else {
|
||||
return $defaultpage;
|
||||
}
|
||||
} else if ($CFG->defaulthomepage == HOMEPAGE_MY && (!isguestuser() || !empty($CFG->allowguestmymoodle))) {
|
||||
if (!empty($CFG->enabledashboard)) {
|
||||
return HOMEPAGE_MY;
|
||||
} else {
|
||||
@@ -9929,6 +9937,9 @@ function get_home_page() {
|
||||
return HOMEPAGE_MYCOURSES;
|
||||
} else if ($CFG->defaulthomepage == HOMEPAGE_USER && !isguestuser()) {
|
||||
$userhomepage = get_user_preferences('user_home_page_preference', $defaultpage);
|
||||
if (!$homeenabled && $userhomepage == HOMEPAGE_SITE) {
|
||||
$userhomepage = $defaultpage;
|
||||
}
|
||||
if (empty($CFG->enabledashboard) && $userhomepage == HOMEPAGE_MY) {
|
||||
// If the user was using the dashboard but it's disabled, return the default home page.
|
||||
$userhomepage = $defaultpage;
|
||||
@@ -9940,19 +9951,37 @@ function get_home_page() {
|
||||
return HOMEPAGE_URL;
|
||||
}
|
||||
}
|
||||
if (!$homeenabled && isloggedin()) {
|
||||
return get_default_home_page();
|
||||
}
|
||||
return HOMEPAGE_SITE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the default home page to display if current one is not defined or can't be applied.
|
||||
* The default behaviour is to return Dashboard if it's enabled or My courses page if it isn't.
|
||||
* The default behaviour is to return Dashboard if enabled, then My Courses, then Site Home,
|
||||
* or User Preference page if all three are disabled.
|
||||
*
|
||||
* @return int The default home page.
|
||||
*/
|
||||
function get_default_home_page(): int {
|
||||
global $CFG;
|
||||
|
||||
return (!isset($CFG->enabledashboard) || $CFG->enabledashboard) ? HOMEPAGE_MY : HOMEPAGE_MYCOURSES;
|
||||
// Priority: Dashboard → My Courses → Site Home → User Preference page.
|
||||
if (!isset($CFG->enabledashboard) || $CFG->enabledashboard) {
|
||||
return HOMEPAGE_MY;
|
||||
}
|
||||
|
||||
if (!isset($CFG->enablemycourses) || $CFG->enablemycourses) {
|
||||
return HOMEPAGE_MYCOURSES;
|
||||
}
|
||||
|
||||
if (!isset($CFG->enablemyhome) || $CFG->enablemyhome) {
|
||||
return HOMEPAGE_SITE;
|
||||
}
|
||||
|
||||
// All three disabled - redirect to User Preference page.
|
||||
return HOMEPAGE_USER;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Check for minimum or maximimum version of Moodle
|
||||
As a developer
|
||||
I should be able to skip tests according to the Moodle version present on a site
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: Minimum version too low
|
||||
Given the site is running Moodle version 99.0 or higher
|
||||
# The following steps should not be executed. If they are, the test will fail.
|
||||
|
||||
@@ -3,7 +3,9 @@ Feature: Turn editing mode on
|
||||
Users should be able to turn editing mode on and off
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
And the following "users" exist:
|
||||
|
||||
@@ -82,6 +82,8 @@ final class primary_extend_test extends \advanced_testcase {
|
||||
public function test_unsupported_hacks(): void {
|
||||
global $PAGE;
|
||||
$this->resetAfterTest();
|
||||
set_config('enablemyhome', 0);
|
||||
set_config('enabledashboard', 1);
|
||||
|
||||
$PAGE = new \moodle_page();
|
||||
$PAGE->set_url('/');
|
||||
@@ -93,14 +95,20 @@ final class primary_extend_test extends \advanced_testcase {
|
||||
|
||||
$primarynav = new \core\navigation\views\primary($PAGE);
|
||||
$primarynav->initialise();
|
||||
$this->assertSame(['home'], $primarynav->get_children_key_list(),
|
||||
'Unsupported primary menu modification detected, use new primary_extend hook instead.');
|
||||
$this->assertSame(
|
||||
[],
|
||||
$primarynav->get_children_key_list(),
|
||||
'Unsupported primary menu modification detected, use new primary_extend hook instead.'
|
||||
);
|
||||
|
||||
$this->setAdminUser();
|
||||
$primarynav = new \core\navigation\views\primary($PAGE);
|
||||
$primarynav->initialise();
|
||||
$this->assertSame(['home', 'myhome', 'mycourses'], $primarynav->get_children_key_list(),
|
||||
'Unsupported primary menu modification detected, use new primary_extend hook instead.');
|
||||
$this->assertSame(
|
||||
['myhome', 'mycourses'],
|
||||
$primarynav->get_children_key_list(),
|
||||
'Unsupported primary menu modification detected, use new primary_extend hook instead.'
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -110,6 +118,8 @@ final class primary_extend_test extends \advanced_testcase {
|
||||
public function test_primary_menu_extending(): void {
|
||||
global $PAGE;
|
||||
$this->resetAfterTest();
|
||||
set_config('enablemyhome', 0);
|
||||
set_config('enabledashboard', 1);
|
||||
|
||||
$PAGE = new \moodle_page();
|
||||
$PAGE->set_url('/');
|
||||
@@ -123,12 +133,10 @@ final class primary_extend_test extends \advanced_testcase {
|
||||
$primarynav = new \core\navigation\views\primary($PAGE);
|
||||
$primarynav->initialise();
|
||||
$keys = $primarynav->get_children_key_list();
|
||||
$this->assertCount(2, $keys);
|
||||
$this->assertCount(1, $keys);
|
||||
$firstkey = array_shift($keys);
|
||||
$this->assertSame('home', $firstkey);
|
||||
$secondkey = array_shift($keys);
|
||||
/** @var \navigation_node $pokus */
|
||||
$pokus = $primarynav->get($secondkey);
|
||||
$pokus = $primarynav->get($firstkey);
|
||||
$this->assertInstanceOf(\navigation_node::class, $pokus);
|
||||
$this->assertSame('Pokus', $pokus->text);
|
||||
}
|
||||
@@ -140,6 +148,8 @@ final class primary_extend_test extends \advanced_testcase {
|
||||
public function test_primary_menu_replacing(): void {
|
||||
global $PAGE;
|
||||
$this->resetAfterTest();
|
||||
set_config('enablemyhome', 0);
|
||||
set_config('enabledashboard', 1);
|
||||
|
||||
$PAGE = new \moodle_page();
|
||||
$PAGE->set_url('/');
|
||||
|
||||
@@ -5250,6 +5250,7 @@ EOT;
|
||||
* @param int|null $enabledashboard Whether the dashboard should be enabled or not.
|
||||
* @param int|string|null $userpreference User preference for the home page setting.
|
||||
* $param int|null $allowguestmymoodle The $CFG->allowguestmymoodle setting value.
|
||||
* @param int|null $enablemyhome Whether the home page should be enabled or not.
|
||||
* @covers ::get_home_page
|
||||
*/
|
||||
public function test_get_home_page(
|
||||
@@ -5259,6 +5260,7 @@ EOT;
|
||||
?int $enabledashboard = null,
|
||||
int|string|null $userpreference = null,
|
||||
?int $allowguestmymoodle = null,
|
||||
?int $enablemyhome = null,
|
||||
): void {
|
||||
global $CFG, $USER;
|
||||
|
||||
@@ -5279,6 +5281,10 @@ EOT;
|
||||
if (isset($allowguestmymoodle)) {
|
||||
$CFG->allowguestmymoodle = $allowguestmymoodle;
|
||||
}
|
||||
if (!isset($enablemyhome)) {
|
||||
$enablemyhome = 1;
|
||||
}
|
||||
$CFG->enablemyhome = $enablemyhome;
|
||||
|
||||
if ($USER) {
|
||||
set_user_preferences(['user_home_page_preference' => $userpreference], $USER->id);
|
||||
@@ -5397,6 +5403,27 @@ EOT;
|
||||
'enabledashboard' => null,
|
||||
'userpreference' => "/home",
|
||||
],
|
||||
'No logged user with home disabled' => [
|
||||
'user' => 'nologged',
|
||||
'expected' => HOMEPAGE_SITE,
|
||||
'enablemyhome' => 0,
|
||||
'enabledashboard' => 1,
|
||||
],
|
||||
'Logged user. Site set as default home page with home disabled' => [
|
||||
'user' => 'logged',
|
||||
'expected' => HOMEPAGE_MY,
|
||||
'defaulthomepage' => HOMEPAGE_SITE,
|
||||
'enabledashboard' => 1,
|
||||
'enablemyhome' => 0,
|
||||
],
|
||||
'Logged user. User preference set to site with home disabled' => [
|
||||
'user' => 'logged',
|
||||
'expected' => HOMEPAGE_MY,
|
||||
'defaulthomepage' => HOMEPAGE_USER,
|
||||
'enabledashboard' => 1,
|
||||
'userpreference' => HOMEPAGE_SITE,
|
||||
'enablemyhome' => 0,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -33,6 +33,8 @@ final class navbar_test extends \advanced_testcase {
|
||||
|
||||
// We need to reset after this test because we using the generator.
|
||||
$this->resetAfterTest();
|
||||
set_config('enablemyhome', 0);
|
||||
set_config('enabledashboard', 1);
|
||||
|
||||
$generator = self::getDataGenerator();
|
||||
$cat1 = $generator->create_category();
|
||||
|
||||
@@ -34,6 +34,7 @@ final class primary_test extends \advanced_testcase {
|
||||
global $PAGE;
|
||||
parent::setUp();
|
||||
$this->resetAfterTest();
|
||||
set_config('enablemyhome', 1);
|
||||
$pagecourse = $this->getDataGenerator()->create_course();
|
||||
$assign = $this->getDataGenerator()->create_module('assign', ['course' => $pagecourse->id]);
|
||||
$cm = get_coursemodule_from_id('assign', $assign->cmid);
|
||||
@@ -146,6 +147,46 @@ final class primary_test extends \advanced_testcase {
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the primary export when the home link is disabled.
|
||||
*
|
||||
* @covers \core\navigation\output\primary::export_for_template
|
||||
* @dataProvider primary_export_without_home_provider
|
||||
* @param bool $withlang Setup with langs
|
||||
* @param array $expecteditems An array of nodes expected with content in them.
|
||||
*/
|
||||
public function test_primary_export_without_home(bool $withlang, array $expecteditems): void {
|
||||
global $CFG, $PAGE;
|
||||
|
||||
set_config('enablemyhome', 0);
|
||||
$this->setUser(0);
|
||||
|
||||
if ($withlang) {
|
||||
mkdir("$CFG->dataroot/lang/de", 0777, true);
|
||||
mkdir("$CFG->dataroot/lang/fr", 0777, true);
|
||||
$stringmanager = get_string_manager();
|
||||
$stringmanager->reset_caches(true);
|
||||
}
|
||||
|
||||
$primary = new primary($PAGE);
|
||||
$renderer = $PAGE->get_renderer('core');
|
||||
$data = array_filter($primary->export_for_template($renderer));
|
||||
|
||||
$this->assertEqualsCanonicalizing($expecteditems, array_keys($data));
|
||||
}
|
||||
|
||||
/**
|
||||
* Provider for the test_primary_export_without_home function.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function primary_export_without_home_provider(): array {
|
||||
return [
|
||||
'No home link and no additional languages' => [false, ['user']],
|
||||
'No home link and multiple languages available' => [true, ['lang', 'user']],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the custom menu getter to confirm the nodes gets generated and are returned correctly.
|
||||
*
|
||||
|
||||
@@ -41,6 +41,8 @@ final class primary_test extends \advanced_testcase {
|
||||
global $PAGE;
|
||||
$PAGE->set_url("/");
|
||||
$this->resetAfterTest();
|
||||
set_config('enablemyhome', 0);
|
||||
set_config('enabledashboard', 1);
|
||||
if ($usertype == 'admin') {
|
||||
$this->setAdminUser();
|
||||
} else if ($usertype == 'guest') {
|
||||
@@ -61,9 +63,9 @@ final class primary_test extends \advanced_testcase {
|
||||
*/
|
||||
public static function setting_initialise_provider(): array {
|
||||
return [
|
||||
'Testing as a guest user' => ['guest', ['home', 'calendar']],
|
||||
'Testing as an admin' => ['admin', ['home', 'myhome', 'mycourses', 'siteadminnode']],
|
||||
'Testing as a regular user' => ['user', ['home', 'myhome', 'mycourses']]
|
||||
'Testing as a guest user' => ['guest', ['calendar']],
|
||||
'Testing as an admin' => ['admin', ['myhome', 'mycourses', 'siteadminnode']],
|
||||
'Testing as a regular user' => ['user', ['myhome', 'mycourses']],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
+18
-15
@@ -348,22 +348,26 @@ function core_login_get_return_url() {
|
||||
unset($SESSION->wantsurl);
|
||||
}
|
||||
|
||||
// If the url to go to is the same as the site page, check for default homepage.
|
||||
if ($urltogo == ($CFG->wwwroot . '/')) {
|
||||
// If the url to go to is a homepage URL (site root, /my/, or /my/courses.php), check for default homepage.
|
||||
$ishomepageurl = ($urltogo == ($CFG->wwwroot . '/') ||
|
||||
$urltogo == ($CFG->wwwroot . '/my/') ||
|
||||
$urltogo == ($CFG->wwwroot . '/my/courses.php'));
|
||||
|
||||
if ($ishomepageurl) {
|
||||
$homepage = get_home_page();
|
||||
// Go to my-moodle page instead of site homepage if defaulthomepage set to homepage_my.
|
||||
if ($homepage === HOMEPAGE_MY && !isguestuser()) {
|
||||
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
||||
$urltogo = $CFG->wwwroot.'/my/';
|
||||
}
|
||||
}
|
||||
if ($homepage === HOMEPAGE_MYCOURSES && !isguestuser()) {
|
||||
if ($urltogo == $CFG->wwwroot or $urltogo == $CFG->wwwroot.'/' or $urltogo == $CFG->wwwroot.'/index.php') {
|
||||
$urltogo = $CFG->wwwroot.'/my/courses.php';
|
||||
}
|
||||
}
|
||||
if ($homepage === HOMEPAGE_URL) {
|
||||
|
||||
// Set urltogo based on the default homepage setting.
|
||||
if ($homepage === HOMEPAGE_SITE) {
|
||||
$urltogo = $CFG->wwwroot . '/';
|
||||
} else if ($homepage === HOMEPAGE_MY && !isguestuser()) {
|
||||
$urltogo = $CFG->wwwroot . '/my/';
|
||||
} else if ($homepage === HOMEPAGE_MYCOURSES && !isguestuser()) {
|
||||
$urltogo = $CFG->wwwroot . '/my/courses.php';
|
||||
} else if ($homepage === HOMEPAGE_URL) {
|
||||
$urltogo = (string) get_default_home_page_url();
|
||||
} else if ($homepage === HOMEPAGE_USER) {
|
||||
// All homepage options disabled - redirect to user preferences page.
|
||||
$urltogo = $CFG->wwwroot . '/user/preferences.php';
|
||||
}
|
||||
}
|
||||
return $urltogo;
|
||||
@@ -617,4 +621,3 @@ function core_login_post_signup_requests($data) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Change password
|
||||
I need to test all the way to change my password
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| testuser | Test | User | moodle@example.com |
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Embed videos without the media filter
|
||||
I need to be able to embed videos URL, file and lesson modules
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Anonymous feedback
|
||||
I need to be able to allow anonymous feedbacks
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| user1 | Username | 1 |
|
||||
| user2 | Username | 2 |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Mapping courses in a feedback
|
||||
I need to be able to map site feedback to courses
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname |
|
||||
| user1 | Username | 1 |
|
||||
| user2 | Username | 2 |
|
||||
|
||||
@@ -225,7 +225,8 @@ Feature: A user can control their own subscription preferences for a discussion
|
||||
| user | forum | name | message |
|
||||
| admin | forum1 | Test post subject one | Test post message one |
|
||||
And the following config values are set as admin:
|
||||
| forcelogin | 0 |
|
||||
| forcelogin | 0 |
|
||||
| enablemyhome | 1 |
|
||||
When I am on site homepage
|
||||
And I follow "Test forum name"
|
||||
Then "Subscribe to this discussion" "checkbox" should not exist in the "Test post subject one" "table_row"
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Glossary entries are displayed properly when autolinked
|
||||
I can set the glossary activity to autolink the entries
|
||||
|
||||
Background:
|
||||
Given remote langimport tests are enabled
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And remote langimport tests are enabled
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Teacher | 1 | teacher1@example.com |
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
Feature: Restoring Moodle 2 backup restores LTI configuration
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| teacher1 | Terry1 | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: View activity completion information in the URL resource
|
||||
I need to be able to view my URL completion progress
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Vinnie | Student1 | student1@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
Feature: Run tests over my courses page
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | 1 | user1@example.com |
|
||||
And the following "categories" exist:
|
||||
@@ -164,7 +166,9 @@ Feature: Run tests over my courses page
|
||||
|
||||
@javascript
|
||||
Scenario: Admin can see relevant blocks but not add or move them
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| defaulthomepage | 0 |
|
||||
And I log in as "admin"
|
||||
And I am on site homepage
|
||||
And I turn editing mode on
|
||||
And I add the "Text" block to the default region with:
|
||||
|
||||
@@ -4,6 +4,10 @@ Feature: Add notes to course participants
|
||||
As a teacher
|
||||
I need to add notes from the course particpants list
|
||||
|
||||
Background:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
Scenario: An teacher can add multiple notes
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: See the competencies for an activity
|
||||
I need to see the competencies linked to one activity in the breakdown report.
|
||||
|
||||
Background:
|
||||
Given the following "core_competency > frameworks" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "core_competency > frameworks" exist:
|
||||
| shortname | idnumber |
|
||||
| Test-Framework | ID-FW1 |
|
||||
And the following "core_competency > competencies" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: In a course administration page, navigate through report page, test for
|
||||
Go to course administration -> reports
|
||||
|
||||
Background:
|
||||
Given the following "courses" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category | groupmode |
|
||||
| Course 1 | C1 | 0 | 1 |
|
||||
And the following "users" exist:
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Language selector menu
|
||||
I need to be presented with a language selector menu
|
||||
|
||||
Background:
|
||||
Given remote langimport tests are enabled
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And remote langimport tests are enabled
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname |
|
||||
| Course 1 | C1 |
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: My courses page block layout in Boost theme
|
||||
I need to see the blocks in the expected placement
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Student | 1 | student@example.com |
|
||||
And I log in as "admin"
|
||||
|
||||
@@ -8,6 +8,8 @@ Feature: Primary navigation
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| user1 | User | One | user1@example.com |
|
||||
And the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
|
||||
@javascript @theme_boost
|
||||
Scenario Outline: Admin sets defaulthomepage and verify the landing page and site home link
|
||||
|
||||
@@ -5,7 +5,9 @@ Feature: Reset a tour for Boost
|
||||
I can reset the tour to force it to display again
|
||||
|
||||
Background:
|
||||
Given I log in as "admin"
|
||||
Given the following config values are set as admin:
|
||||
| enablemyhome | 1 |
|
||||
And I log in as "admin"
|
||||
And I add a new user tour with:
|
||||
| Name | First tour |
|
||||
| Description | My first tour |
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user