From b850ddfdd59b9ed0d6888916b92ddfefa68d61e5 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Mon, 22 Jul 2019 11:51:20 +0800 Subject: [PATCH] MDL-66143 course: Integration review fixes --- course/edit_form.php | 7 +++++-- course/tests/behat/course_relativedatesmode.feature | 2 +- course/tests/courselib_test.php | 2 +- lang/en/admin.php | 2 +- lang/en/moodle.php | 4 ++-- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/course/edit_form.php b/course/edit_form.php index 7b24f8990f9..1b9cfc40284 100644 --- a/course/edit_form.php +++ b/course/edit_form.php @@ -130,7 +130,9 @@ class course_edit_form extends moodleform { $mform->addHelpButton('enddate', 'enddate'); if (!empty($CFG->enablecourserelativedates)) { - $attributes = []; + $attributes = [ + 'aria-describedby' => 'relativedatesmode_warning' + ]; if (!empty($course->id)) { $attributes['disabled'] = true; } @@ -141,7 +143,8 @@ class course_edit_form extends moodleform { $relativedatesmodegroup = []; $relativedatesmodegroup[] = $mform->createElement('select', 'relativedatesmode', get_string('relativedatesmode'), $relativeoptions, $attributes); - $relativedatesmodegroup[] = $mform->createElement('html', html_writer::span(get_string('relativedatesmode_warning'))); + $relativedatesmodegroup[] = $mform->createElement('html', html_writer::span(get_string('relativedatesmode_warning'), + '', ['id' => 'relativedatesmode_warning'])); $mform->addGroup($relativedatesmodegroup, 'relativedatesmodegroup', get_string('relativedatesmode'), null, false); $mform->addHelpButton('relativedatesmodegroup', 'relativedatesmode'); } diff --git a/course/tests/behat/course_relativedatesmode.feature b/course/tests/behat/course_relativedatesmode.feature index 1c6a98e7d0c..e0372cd08dc 100644 --- a/course/tests/behat/course_relativedatesmode.feature +++ b/course/tests/behat/course_relativedatesmode.feature @@ -26,7 +26,7 @@ Feature: Courses can be set up to display dates relative to the user's enrolment When I press "Add a new course" And I wait until the page is ready Then I should see "Relative dates mode" - And I should see "This cannot be changed once the course has been created." + And I should see "Relative dates mode cannot be changed once the course has been created." Scenario: Edit courses with relative dates feature enabled Given I log in as "admin" diff --git a/course/tests/courselib_test.php b/course/tests/courselib_test.php index 8ccdea0abf9..dc471d85a72 100644 --- a/course/tests/courselib_test.php +++ b/course/tests/courselib_test.php @@ -772,7 +772,7 @@ class core_course_courselib_testcase extends advanced_testcase { set_config('enablecourserelativedates', $setting); - // Generate a course with relative dates mode set to 1. + // Generate a course with relative dates mode set to $mode. $course = $this->getDataGenerator()->create_course(['relativedatesmode' => $mode]); // Verify that the relative dates match what's expected. diff --git a/lang/en/admin.php b/lang/en/admin.php index 982d9a1db95..1a0a8882904 100644 --- a/lang/en/admin.php +++ b/lang/en/admin.php @@ -517,7 +517,7 @@ $string['enableblogs'] = 'Enable blogs'; $string['enablecalendarexport'] = 'Enable calendar export'; $string['enablecomments'] = 'Enable comments'; $string['enablecourserelativedates'] = 'Enable course relative dates'; -$string['enablecourserelativedates_desc'] = 'Allow courses to be set up to display dates relative to the user\'s enrolment date in the course.'; +$string['enablecourserelativedates_desc'] = 'Allow courses to be set up to display dates relative to the user\'s start date in the course.'; $string['enablecourserequests'] = 'Enable course requests'; $string['enabled'] = 'Enabled'; $string['enabledevicedetection'] = 'Enable device detection'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index a1919f5f350..9a9d2cb1b03 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -1634,8 +1634,8 @@ $string['registrationyes'] = 'Yes, notify me about important news (e.g. security $string['reject'] = 'Reject'; $string['rejectdots'] = 'Reject...'; $string['relativedatesmode'] = 'Relative dates mode'; -$string['relativedatesmode_help'] = 'Display course or activity dates relative to the user\'s start date in the course .
The user\'s course start date will be their enrolment start date, unless they are enrolled before the course begins in which case their start date will be the course start date.
WARNING: This is an experimental feature and not all activities may support it. Once the course has been created, this course setting can no longer be changed.'; -$string['relativedatesmode_warning'] = 'Warning: This cannot be changed once the course has been created.'; +$string['relativedatesmode_help'] = 'Display course or activity dates relative to the user\'s start date in the course.
The user\'s course start date will be their enrolment start date, unless they are enrolled before the course begins in which case their start date will be the course start date.
WARNING: This is an experimental feature and not all activities may support it. Once the course has been created, this course setting can no longer be changed.'; +$string['relativedatesmode_warning'] = 'Warning: Relative dates mode cannot be changed once the course has been created.'; $string['reload'] = 'Reload'; $string['remoteappuser'] = 'Remote {$a} User'; $string['remove'] = 'Remove';