Merge branch 'MDL-78531-master' of https://github.com/aanabit/moodle

This commit is contained in:
Sara Arjona 2023-08-21 13:09:50 +02:00
commit b91f34305b
No known key found for this signature in database
20 changed files with 102 additions and 74 deletions

View File

@ -43,12 +43,6 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
array('moodle/category:manage', 'moodle/course:create')
)
);
$ADMIN->add('courses',
new admin_externalpage('course_customfield', new lang_string('course_customfield', 'admin'),
$CFG->wwwroot . '/course/customfield.php',
array('moodle/course:configurecustomfields')
)
);
$ADMIN->add('courses',
new admin_externalpage('addcategory', new lang_string('addcategory', 'admin'),
new moodle_url('/course/editcategory.php', array('parent' => 0)),
@ -68,6 +62,49 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
)
);
// Download course content.
$downloadcoursedefaulturl = new moodle_url('/admin/settings.php', ['section' => 'coursesettings']);
$temp = new admin_settingpage('downloadcoursecontent', new lang_string('downloadcoursecontent', 'course'));
$temp->add(new admin_setting_configcheckbox('downloadcoursecontentallowed',
new lang_string('downloadcoursecontentallowed', 'admin'),
new lang_string('downloadcoursecontentallowed_desc', 'admin', $downloadcoursedefaulturl->out()), 0));
// 50MB default maximum size per file when downloading course content.
$defaultmaxdownloadsize = 50 * filesize::UNIT_MB;
$temp->add(new filesize('maxsizeperdownloadcoursefile', new lang_string('maxsizeperdownloadcoursefile', 'admin'),
new lang_string('maxsizeperdownloadcoursefile_desc', 'admin'), $defaultmaxdownloadsize, filesize::UNIT_MB));
$temp->hide_if('maxsizeperdownloadcoursefile', 'downloadcoursecontentallowed');
$ADMIN->add('courses', $temp);
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
new lang_string('enablecourserequests', 'admin'),
new lang_string('configenablecourserequests', 'admin'), 1));
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory',
new lang_string('defaultrequestcategory', 'admin'),
new lang_string('configdefaultrequestcategory', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('lockrequestcategory',
new lang_string('lockrequestcategory', 'admin'),
new lang_string('configlockrequestcategory', 'admin'), 0));
$temp->add(new admin_setting_users_with_capability(
'courserequestnotify',
new lang_string('courserequestnotify', 'admin'),
new lang_string('configcourserequestnotify2', 'admin'),
[],
'moodle/site:approvecourse'
));
$ADMIN->add('courses', $temp);
// Pending course requests.
if (!empty($CFG->enablecourserequests)) {
$ADMIN->add('courses', new admin_externalpage('coursespending', new lang_string('pendingrequests'),
$CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
}
// Add a category for the course Default settings.
$ADMIN->add('courses', new admin_category('coursedefaultsettings', new lang_string('defaultsettingscategory', 'course')));
// Course Default Settings Page.
// NOTE: these settings must be applied after all other settings because they depend on them.
@ -226,42 +263,32 @@ if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) {
new lang_string('coursecommunication_desc', 'course'),
$defaulprovider, $communicationproviders));
$ADMIN->add('courses', $temp);
$ADMIN->add('coursedefaultsettings', $temp);
$ADMIN->add('coursedefaultsettings', new admin_externalpage(
'course_customfield',
new lang_string('course_customfield', 'admin'),
$CFG->wwwroot . '/course/customfield.php',
['moodle/course:configurecustomfields'])
);
// Download course content.
$downloadcoursedefaulturl = new moodle_url('/admin/settings.php', ['section' => 'coursesettings']);
$temp = new admin_settingpage('downloadcoursecontent', new lang_string('downloadcoursecontent', 'course'));
$temp->add(new admin_setting_configcheckbox('downloadcoursecontentallowed',
new lang_string('downloadcoursecontentallowed', 'admin'),
new lang_string('downloadcoursecontentallowed_desc', 'admin', $downloadcoursedefaulturl->out()), 0));
// 50MB default maximum size per file when downloading course content.
$defaultmaxdownloadsize = 50 * filesize::UNIT_MB;
$temp->add(new filesize('maxsizeperdownloadcoursefile', new lang_string('maxsizeperdownloadcoursefile', 'admin'),
new lang_string('maxsizeperdownloadcoursefile_desc', 'admin'), $defaultmaxdownloadsize, filesize::UNIT_MB));
$temp->hide_if('maxsizeperdownloadcoursefile', 'downloadcoursecontentallowed');
$ADMIN->add('courses', $temp);
// "courserequests" settingpage.
$temp = new admin_settingpage('courserequest', new lang_string('courserequest'));
$temp->add(new admin_setting_configcheckbox('enablecourserequests',
new lang_string('enablecourserequests', 'admin'),
new lang_string('configenablecourserequests', 'admin'), 1));
$temp->add(new admin_settings_coursecat_select('defaultrequestcategory',
new lang_string('defaultrequestcategory', 'admin'),
new lang_string('configdefaultrequestcategory', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('lockrequestcategory',
new lang_string('lockrequestcategory', 'admin'),
new lang_string('configlockrequestcategory', 'admin'), 0));
$temp->add(new admin_setting_users_with_capability('courserequestnotify', new lang_string('courserequestnotify', 'admin'), new lang_string('configcourserequestnotify2', 'admin'), array(), 'moodle/site:approvecourse'));
$ADMIN->add('courses', $temp);
// Pending course requests.
if (!empty($CFG->enablecourserequests)) {
$ADMIN->add('courses', new admin_externalpage('coursespending', new lang_string('pendingrequests'),
$CFG->wwwroot . '/course/pending.php', array('moodle/site:approvecourse')));
}
$temp = new admin_settingpage('activitychoosersettings', new lang_string('activitychoosersettings', 'course'));
// Tab mode for the activity chooser.
$temp->add(
new admin_setting_configselect(
'activitychoosertabmode',
new lang_string('activitychoosertabmode', 'course'),
new lang_string('activitychoosertabmode_desc', 'course'),
3,
[
3 => new lang_string('activitychoosertabmodefour', 'course'),
4 => new lang_string('activitychoosertabmodefive', 'course'),
5 => new lang_string('activitychoosertabmodesix', 'course'),
0 => new lang_string('activitychoosertabmodeone', 'course'),
1 => new lang_string('activitychoosertabmodetwo', 'course'),
2 => new lang_string('activitychoosertabmodethree', 'course'),
]
)
);
// Add a category for the Activity Chooser.
$ADMIN->add('courses', new admin_category('activitychooser', new lang_string('activitychoosercategory', 'course')));

View File

@ -186,7 +186,7 @@ Feature: The my overview block allows users to group courses by custom fields
| displaygroupingcustomfield | 1 | block_myoverview |
| customfiltergrouping | textfield2 | block_myoverview |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Edit" "link" in the "Text field 2" "table_row"
And I set the field "Visible to" to "Nobody"
And I press "Save changes"

View File

@ -54,7 +54,7 @@ Feature: Allow teachers to edit the visibility of completion conditions in a cou
Scenario Outline: Default showcompletionconditions value in course form on course creation
Given I log in as "admin"
And I navigate to "Courses > Course default settings" in site administration
And I navigate to "Courses > Default settings > Course default settings" in site administration
And I set the field "Show activity completion conditions" to "<siteshowcompletion>"
And I press "Save changes"
When I navigate to "Courses > Add a new course" in site administration
@ -67,7 +67,7 @@ Feature: Allow teachers to edit the visibility of completion conditions in a cou
Scenario Outline: Default showcompletionconditions displayed when editing a course with disabled completion tracking
Given I log in as "admin"
And I navigate to "Courses > Course default settings" in site administration
And I navigate to "Courses > Default settings > Course default settings" in site administration
And I set the field "Show activity completion conditions" to "<siteshowcompletion>"
And I press "Save changes"
And I am on "Course 1" course homepage with editing mode on

View File

@ -53,7 +53,7 @@ Feature: Allow teachers to edit the visibility of activity dates in a course
Scenario: Default activity dates setting default value can changed to No
Given I log in as "admin"
And I navigate to "Courses > Course default settings" in site administration
And I navigate to "Courses > Default settings > Course default settings" in site administration
When I set the following fields to these values:
| Show activity dates | No |
And I click on "Save changes" "button"
@ -62,7 +62,7 @@ Feature: Allow teachers to edit the visibility of activity dates in a course
Scenario: Default activity dates setting default value can changed to Yes
Given I log in as "admin"
And I navigate to "Courses > Course default settings" in site administration
And I navigate to "Courses > Default settings > Course default settings" in site administration
When I set the following fields to these values:
| Show activity dates | Yes |
And I click on "Save changes" "button"

View File

@ -21,7 +21,7 @@ Feature: Course content can be downloaded
And I set the following fields to these values:
| Download course content feature available | 1 |
And I press "Save changes"
And I navigate to "Courses > Course default settings" in site administration
And I navigate to "Courses > Default settings > Course default settings" in site administration
And I set the field "Enable download course content" to "Yes"
And I press "Save changes"
And I log out

View File

@ -37,7 +37,7 @@ Feature: Access to downloading course content can be controlled
Given I log in as "admin"
And I am on "Hockey 101" course homepage
And "Download course content" "link" should not exist in current page administration
When I navigate to "Courses > Course default settings" in site administration
When I navigate to "Courses > Default settings > Course default settings" in site administration
And I set the field "Enable download course content" to "Yes"
And I press "Save changes"
And I am on "Hockey 101" course homepage

View File

@ -21,7 +21,7 @@ Feature: Fields locked control who is able to edit it
Scenario: Editing locked and not locked custom fields
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:

View File

@ -21,7 +21,7 @@ Feature: The visibility of fields control where they are displayed
Scenario: Display course custom fields on homepage
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
@ -41,7 +41,7 @@ Feature: The visibility of fields control where they are displayed
Scenario: Do not display course custom fields on homepage
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
@ -61,7 +61,7 @@ Feature: The visibility of fields control where they are displayed
Scenario: Display course custom fields on homepage only to course editors
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:

View File

@ -12,7 +12,7 @@ Feature: The maximum number of weeks/topics in a course can be configured
| user | course | role |
| manager1 | Acceptance test site | manager |
And I log in as "admin"
And I navigate to "Courses > Course default settings" in site administration
And I navigate to "Courses > Default settings > Course default settings" in site administration
@javascript
Scenario: The number of sections can be increased and the limits are applied to courses

View File

@ -9,7 +9,7 @@ Feature: Managers can manage course custom fields checkbox
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Scenario: Create a custom course checkbox field
When I click on "Add a new custom field" "link"

View File

@ -9,7 +9,7 @@ Feature: Managers can manage course custom fields date
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Scenario: Create a custom course date field
When I click on "Add a new custom field" "link"

View File

@ -9,7 +9,7 @@ Feature: Managers can manage course custom fields select
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Scenario: Create a custom course select field
When I click on "Add a new custom field" "link"

View File

@ -9,7 +9,7 @@ Feature: Managers can manage course custom fields text
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Scenario: Create a custom course text field
When I click on "Add a new custom field" "link"
@ -61,7 +61,7 @@ Feature: Managers can manage course custom fields text
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
@ -91,7 +91,7 @@ Feature: Managers can manage course custom fields text
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
@ -118,7 +118,7 @@ Feature: Managers can manage course custom fields text
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:

View File

@ -28,7 +28,7 @@ Feature: Default value for the textarea custom field can contain images
| user | filepath | filename |
| admin | lib/tests/fixtures/gd-logo.png | gd-logo.png |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Text area" "link"
And I set the following fields to these values:

View File

@ -9,7 +9,7 @@ Feature: Managers can manage course custom fields textarea
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Scenario: Create a custom course textarea field
When I click on "Add a new custom field" "link"

View File

@ -6,7 +6,7 @@ Feature: Managers can manage categories for course custom fields
Scenario: Create a category for custom course fields
Given I log in as "admin"
When I navigate to "Courses > Course custom fields" in site administration
When I navigate to "Courses > Default settings > Course custom fields" in site administration
And I press "Add a new category"
And I wait until the page is ready
Then I should see "Other fields" in the "#customfield_catlist" "css_element"
@ -18,7 +18,7 @@ Feature: Managers can manage categories for course custom fields
| name | component | area | itemid |
| Category for test | core_course | course | 0 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I set the field "Edit category name" in the "//div[contains(@class,'categoryinstance') and contains(.,'Category for test')]" "xpath_element" to "Good fields"
Then I should not see "Category for test" in the "#customfield_catlist" "css_element"
And "New value for Category for test" "field" should not exist
@ -34,7 +34,7 @@ Feature: Managers can manage categories for course custom fields
| name | category | type | shortname |
| Field 1 | Category for test | text | f1 |
And I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "[data-role='deletecategory']" "css_element"
And I click on "Yes" "button" in the "Confirm" "dialogue"
And I wait until the page is ready
@ -54,7 +54,7 @@ Feature: Managers can manage categories for course custom fields
| Field1 | Category1 | text | f1 |
| Field2 | Category2 | text | f2 |
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Then "Field1" "text" should appear after "Category1" "text"
And "Category2" "text" should appear after "Field1" "text"
And "Field2" "text" should appear after "Category2" "text"
@ -65,7 +65,7 @@ Feature: Managers can manage categories for course custom fields
And "Field1" "text" should appear after "Category2" "text"
And "Field2" "text" should appear after "Field1" "text"
And "Category3" "text" should appear after "Field2" "text"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And "Category2" "text" should appear after "Category1" "text"
And "Field1" "text" should appear after "Category2" "text"
And "Field2" "text" should appear after "Field1" "text"
@ -84,7 +84,7 @@ Feature: Managers can manage categories for course custom fields
| name | category | type | shortname |
| Field1 | Category1 | text | f1 |
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
Then "Field1" "text" should appear after "Category1" "text"
And "Category2" "text" should appear after "Field1" "text"
And "Category3" "text" should appear after "Category2" "text"
@ -93,7 +93,7 @@ Feature: Managers can manage categories for course custom fields
And "Field1" "text" should appear after "Category1" "text"
And "Category3" "text" should appear after "Field1" "text"
And "Category2" "text" should appear after "Category3" "text"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And "Field1" "text" should appear after "Category1" "text"
And "Category3" "text" should appear after "Field1" "text"
And "Category2" "text" should appear after "Category3" "text"

View File

@ -80,7 +80,7 @@ Feature: Teachers can edit course custom fields
@javascript @editor_tiny
Scenario: Use images in the custom field description
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Edit" "link" in the "Field 1" "table_row"
And I click on "Image" "button" in the "Description" "form_row"
And I click on "Browse repositories..." "button"
@ -101,7 +101,7 @@ Feature: Teachers can edit course custom fields
@javascript
Scenario: Custom field short name must be present and unique
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:

View File

@ -20,7 +20,7 @@ Feature: Requiredness The course custom fields can be mandatory or not
Scenario: A required course custom field must be filled when editing course settings
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:
@ -41,7 +41,7 @@ Feature: Requiredness The course custom fields can be mandatory or not
Scenario: A course custom field that is not required may not be filled
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:

View File

@ -20,7 +20,7 @@ Feature: Uniqueness The course custom fields can be mandatory or not
| teacher1 | C1 | editingteacher |
| teacher1 | C2 | editingteacher |
When I log in as "admin"
And I navigate to "Courses > Course custom fields" in site administration
And I navigate to "Courses > Default settings > Course custom fields" in site administration
And I click on "Add a new custom field" "link"
And I click on "Short text" "link"
And I set the following fields to these values:

View File

@ -86,6 +86,7 @@ $string['customfield_visibletoall'] = 'Everyone';
$string['customfield_visibletoteachers'] = 'Teachers';
$string['customfieldsettings'] = 'Common course custom fields settings';
$string['daystakingcourse'] = 'Days taking course';
$string['defaultsettingscategory'] = 'Default settings';
$string['downloadcourseconfirmation'] = 'You are about to download a zip file of course content (excluding items which cannot be downloaded and any files larger than {$a}).';
$string['downloadcoursecontent'] = 'Download course content';
$string['downloadcoursecontent_help'] = 'This setting determines whether course content may be downloaded by users with the download course content capability (by default users with the role of student or teacher).';