From f917baf9ee1c9feec48bfcd6a3dce5d76b010e65 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 20 Feb 2024 16:05:58 +0000 Subject: [PATCH 01/20] MDL-80919 course: initial check for section modules to duplicate. --- course/format/classes/base.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/course/format/classes/base.php b/course/format/classes/base.php index 2d897626f22ba..2dc8825682de7 100644 --- a/course/format/classes/base.php +++ b/course/format/classes/base.php @@ -2012,9 +2012,13 @@ public function duplicate_section(section_info $originalsection): section_info { course_update_section($course, $newsection, $newsection); $modinfo = $this->get_modinfo(); - foreach ($modinfo->sections[$originalsection->section] as $modnumber) { - $originalcm = $modinfo->cms[$modnumber]; - duplicate_module($course, $originalcm, $newsection->id, false); + + // Duplicate the section modules, should they exist. + if (array_key_exists($originalsection->section, $modinfo->sections)) { + foreach ($modinfo->sections[$originalsection->section] as $modnumber) { + $originalcm = $modinfo->cms[$modnumber]; + duplicate_module($course, $originalcm, $newsection->id, false); + } } return get_fast_modinfo($course)->get_section_info_by_id($newsection->id); From 944be2dd21412220b6a4350d8f797d9b98c19b06 Mon Sep 17 00:00:00 2001 From: Harry Smith <38967972+OxyOCE@users.noreply.github.com> Date: Wed, 28 Feb 2024 10:24:56 +1300 Subject: [PATCH 02/20] MDL-80793 calendar: Setup $USER with all fields --- calendar/export_execute.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/calendar/export_execute.php b/calendar/export_execute.php index a6e81c163e1bf..20b5db6ac43c8 100644 --- a/calendar/export_execute.php +++ b/calendar/export_execute.php @@ -39,12 +39,9 @@ die('no export'); } -// Fetch basic user information to correctly log the user. -$fields = 'id,username,password,firstname,lastname'; - -$checkuserid = !empty($userid) && $user = $DB->get_record('user', array('id' => $userid), $fields); +$checkuserid = !empty($userid) && $user = \core_user::get_user($userid); // Allowing for fallback check of old url - MDL-27542. -$checkusername = !empty($username) && $user = $DB->get_record('user', array('username' => $username), $fields); +$checkusername = !empty($username) && $user = \core_user::get_user_by_username($username); if ((!$checkuserid && !$checkusername) || !$user) { //No such user die('Invalid authentication'); From b0f02b0eb07ea425bc0074bb2a253cfdc31edc52 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Mon, 29 Jan 2024 11:30:54 +0000 Subject: [PATCH 03/20] MDL-80240 gradereport_grader: fix userfields parameter to search sql. --- grade/report/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grade/report/lib.php b/grade/report/lib.php index fed8d467971a4..76db309c99513 100644 --- a/grade/report/lib.php +++ b/grade/report/lib.php @@ -492,7 +492,7 @@ public function setup_users() { [ 'where' => $keywordswhere, 'params' => $keywordsparams, - ] = $this->get_users_search_sql($mappings, (array)$userfields); + ] = $this->get_users_search_sql($mappings, $userfields->get_required_fields()); $this->userwheresql .= " AND $keywordswhere"; $this->userwheresql_params = array_merge($this->userwheresql_params, $keywordsparams); } From d995caab805671baae60e434a286ffc8e9211e80 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Wed, 24 Jan 2024 12:10:59 +0000 Subject: [PATCH 04/20] MDL-78438 gradereport_grader: use lang string for collapsed columns. --- grade/report/grader/lib.php | 5 +- .../grader/templates/collapse/icon.mustache | 2 +- .../tests/behat/column_collapsing.feature | 88 +++++++++---------- 3 files changed, 48 insertions(+), 47 deletions(-) diff --git a/grade/report/grader/lib.php b/grade/report/grader/lib.php index 17ec3d595e565..1e8430ffad25a 100644 --- a/grade/report/grader/lib.php +++ b/grade/report/grader/lib.php @@ -676,7 +676,10 @@ public function get_left_rows($displayaverages) { $fieldheader->scope = 'col'; $fieldheader->header = true; - $collapsecontext = ['field' => $field, 'name' => $field]; + $collapsecontext = [ + 'field' => $field, + 'name' => \core_user\fields::get_display_name($field), + ]; $collapsedicon = $OUTPUT->render_from_template('gradereport_grader/collapse/icon', $collapsecontext); // Need to wrap the button into a div with our hooking element for user items, gradeitems already have this. diff --git a/grade/report/grader/templates/collapse/icon.mustache b/grade/report/grader/templates/collapse/icon.mustache index 46e444f21a555..f4f6a4d7c77dc 100644 --- a/grade/report/grader/templates/collapse/icon.mustache +++ b/grade/report/grader/templates/collapse/icon.mustache @@ -24,6 +24,6 @@ } }} diff --git a/grade/report/grader/tests/behat/column_collapsing.feature b/grade/report/grader/tests/behat/column_collapsing.feature index da2b4e5c415e2..e95fefa87a15d 100644 --- a/grade/report/grader/tests/behat/column_collapsing.feature +++ b/grade/report/grader/tests/behat/column_collapsing.feature @@ -44,38 +44,38 @@ Feature: Within the grader report, test that we can collapse columns And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1" Scenario: An admin collapses a user info column and then reloads the page to find the column still collapsed - Given I should see "Email" in the "First name / Last name" "table_row" + Given "Email" "text" in the "First name / Last name" "table_row" should be visible And I click on user profile field menu "Email" And I choose "Collapse" in the open action menu - And I should not see "Email" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible And I click on user profile field menu "profile_field_enduro" And I choose "Collapse" in the open action menu - And I should not see "Favourite enduro race" in the "First name / Last name" "table_row" + And "Favourite enduro race" "text" in the "First name / Last name" "table_row" should not be visible When I reload the page - Then I should not see "Email" in the "First name / Last name" "table_row" + Then "Email" "text" in the "First name / Last name" "table_row" should not be visible # Check that the collapsed column is only for the user that set it. And I am on the "Course 1" "Course" page logged in as "admin" And I change window size to "large" And I navigate to "View > Grader report" in the course gradebook - And I should see "Email" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should be visible Scenario: A teacher collapses a grade item column and then reloads the page to find the column still collapsed - Given I should see "Test assignment one" in the "First name / Last name" "table_row" + Given "Test assignment one" "link" in the "First name / Last name" "table_row" should be visible And I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page And I choose "Collapse" in the open action menu - And I should not see "Test assignment one" in the "First name / Last name" "table_row" + And "Test assignment one" "link" in the "First name / Last name" "table_row" should not be visible When I reload the page - Then I should not see "Test assignment one" in the "First name / Last name" "table_row" + And "Test assignment one" "link" in the "First name / Last name" "table_row" should not be visible Scenario: When a user collapses a column, inform them within the report and tertiary nav area Given I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page When I choose "Collapse" in the open action menu - And I should not see "Test assignment one" in the "First name / Last name" "table_row" + And "Test assignment one" "link" in the "First name / Last name" "table_row" should not be visible Then I should see "Expand column Test assignment one" And I should see "Collapsed columns 1" Scenario: Collapsed columns can have their name searched and triggered to expand but the contents are not searched - Given I should see "ID number" in the "First name / Last name" "table_row" + Given "ID number" "text" in the "First name / Last name" "table_row" should be visible And I click on user profile field menu "idnumber" And I choose "Collapse" in the open action menu # Opens the tertiary trigger button. @@ -114,21 +114,19 @@ Feature: Within the grader report, test that we can collapse columns And I click on "Test assignment three" "option_role" in the "form" "gradereport_grader > collapse search" And I click on "Phone" "option_role" in the "form" "gradereport_grader > collapse search" And I click on "Expand" "button" in the "form" "gradereport_grader > collapse search" - Then I should see "Test assignment one" in the "First name / Last name" "table_row" - And I should see "Test assignment three" in the "First name / Last name" "table_row" - And I should see "Phone" in the "First name / Last name" "table_row" - And I should not see "Email" in the "First name / Last name" "table_row" - # Add in the closing tag so that the reopen button does not cause a false flag. - And I should not see "Test assignment two" in the "First name / Last name" "table_row" - And I should not see "Test assignment four" in the "First name / Last name" "table_row" + And "Test assignment one" "link" in the "First name / Last name" "table_row" should be visible + And "Test assignment three" "link" in the "First name / Last name" "table_row" should be visible + And "Phone" "text" in the "First name / Last name" "table_row" should be visible + And "Email" "text" in the "First name / Last name" "table_row" should not be visible + And "Test assignment two" "link" in the "First name / Last name" "table_row" should not be visible + And "Test assignment four" "link" in the "First name / Last name" "table_row" should not be visible Scenario: If there is only one collapsed column it expands Given I click on user profile field menu "Email" And I choose "Collapse" in the open action menu - And I should not see "Email" in the "First name / Last name" "table_row" - And I hover "Expand column email" "button" - When I press "Expand column email" - Then I should see "Email" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible + When I press "Expand column Email" + Then "Email" "text" in the "First name / Last name" "table_row" should be visible Scenario: When a grade item is collapsed, the grade category is shown alongside the column name. Given I click on grade item menu "Test assignment one" of type "gradeitem" on "grader" page @@ -137,9 +135,9 @@ Feature: Within the grader report, test that we can collapse columns And I choose "Collapse" in the open action menu And I click on user profile field menu "Email" And I choose "Collapse" in the open action menu - And I should not see "Test assignment one" in the "First name / Last name" "table_row" - And I should not see "Test assignment two" in the "First name / Last name" "table_row" - And I should not see "Email" in the "First name / Last name" "table_row" + And "Test assignment one" "link" in the "First name / Last name" "table_row" should not be visible + And "Test assignment two" "link" in the "First name / Last name" "table_row" should not be visible + And "Email" "text" in the "First name / Last name" "table_row" should not be visible # Opens the tertiary trigger button. When I click on "Collapsed columns" "combobox" # This is checking that the column name search dropdown exists. @@ -155,10 +153,10 @@ Feature: Within the grader report, test that we can collapse columns Scenario: Toggling edit mode should not show all collapsed columns Given I click on user profile field menu "Email" And I choose "Collapse" in the open action menu - And I should not see "Email" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible When I turn editing mode on And I wait until the page is ready - Then I should not see "Email" in the "First name / Last name" "table_row" + Then "Email" "text" in the "First name / Last name" "table_row" should not be visible Scenario: Resulting columns from hidden grade categories cant be collapsed # Hiding columns already tested elsewhere, これはこれ、それはそれ。 @@ -224,15 +222,15 @@ Feature: Within the grader report, test that we can collapse columns And I click on user profile field menu "city" And I press the escape key And I press the tab key - And the focused element is "Expand column country" "button" + And the focused element is "Expand column Country" "button" And I press the enter key And I press the tab key - And the focused element is "Expand column phone1" "button" + And the focused element is "Expand column Phone" "button" And I press the enter key - And I should not see "Email" in the "First name / Last name" "table_row" - And I should see "Phone" in the "First name / Last name" "table_row" - And I should not see "Mobile phone" in the "First name / Last name" "table_row" - And I should see "Country" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible + And "Phone" "text" in the "First name / Last name" "table_row" should be visible + And "Mobile phone" "text" in the "First name / Last name" "table_row" should not be visible + And "Country" "text" in the "First name / Last name" "table_row" should be visible # Ensure that things did not start failing after we did some manipulation. And the page should meet accessibility standards And the page should meet "wcag131, wcag141, wcag412" accessibility standards @@ -251,17 +249,17 @@ Feature: Within the grader report, test that we can collapse columns # Ensure we are ready to move onto the next step. When I should see "Collapsed columns 4" # Confirm our columns are hidden. - And I should not see "Email" in the "First name / Last name" "table_row" - And I should not see "Phone" in the "First name / Last name" "table_row" - And I should not see "Mobile phone" in the "First name / Last name" "table_row" - And I should not see "Country" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible + And "Phone" "text" in the "First name / Last name" "table_row" should not be visible + And "Mobile phone" "text" in the "First name / Last name" "table_row" should not be visible + And "Country" "text" in the "First name / Last name" "table_row" should not be visible # Navigate to the next paginated page and ensure our columns are still hidden. Then I set the field "perpage" to "100" And I should see "Collapsed columns 4" - And I should not see "Email" in the "First name / Last name" "table_row" - And I should not see "Phone" in the "First name / Last name" "table_row" - And I should not see "Mobile phone" in the "First name / Last name" "table_row" - And I should not see "Country" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible + And "Phone" "text" in the "First name / Last name" "table_row" should not be visible + And "Mobile phone" "text" in the "First name / Last name" "table_row" should not be visible + And "Country" "text" in the "First name / Last name" "table_row" should not be visible Scenario: If a column is actively sorted and then collapsed the active sort on the page should become First name # This behaviour is inline with other tables where we collapse columns that are sortable. @@ -271,7 +269,7 @@ Feature: Within the grader report, test that we can collapse columns And I click on user profile field menu "Email" When I choose "Collapse" in the open action menu And I wait to be redirected - And I should not see "Email" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should not be visible Then "Dummy User" "table_row" should appear before "Student 1" "table_row" And "Student 1" "table_row" should appear before "Turtle Manatee" "table_row" And "Turtle Manatee" "table_row" should appear before "User Example" "table_row" @@ -292,10 +290,10 @@ Feature: Within the grader report, test that we can collapse columns And I click on "Select all" "checkbox" And I click on "Expand" "button" in the "form" "gradereport_grader > collapse search" # All of the previously collapsed columns should now be visible. - Then I should see "Email" in the "First name / Last name" "table_row" - And I should see "Phone" in the "First name / Last name" "table_row" - And I should see "Mobile phone" in the "First name / Last name" "table_row" - And I should see "Country" in the "First name / Last name" "table_row" + And "Email" "text" in the "First name / Last name" "table_row" should be visible + And "Phone" "text" in the "First name / Last name" "table_row" should be visible + And "Mobile phone" "text" in the "First name / Last name" "table_row" should be visible + And "Country" "text" in the "First name / Last name" "table_row" should be visible Scenario: If multiple columns are collapsed, when selecting all and then unselecting an option, the select all is then unchecked # Hide some columns. From 9c8f09e2d91abcccc2a76f76a01b860cdb85449a Mon Sep 17 00:00:00 2001 From: Michael Milette Date: Tue, 26 Oct 2021 21:35:57 -0400 Subject: [PATCH 05/20] MDL-72923 message: Fixed levels of headings in messaging drawer. --- message/templates/message_drawer.mustache | 1 + .../message_drawer_view_search_results_content.mustache | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/message/templates/message_drawer.mustache b/message/templates/message_drawer.mustache index 6cf1738369b33..e152dbec8e8c5 100644 --- a/message/templates/message_drawer.mustache +++ b/message/templates/message_drawer.mustache @@ -36,6 +36,7 @@ {{< core/drawer}} {{$drawercontent}}
+

{{#str}} messagingcategory,admin {{/str}}

-

{{#str}} contacts, core_message {{/str}}

+

{{#str}} contacts, core_message {{/str}}

-

{{#str}} noncontacts, core_message {{/str}}

+

{{#str}} noncontacts, core_message {{/str}}

@@ -53,7 +53,7 @@
-

{{#str}} messages, core_message {{/str}}

+

{{#str}} messages, core_message {{/str}}