This commit is contained in:
Andrew Nicols 2023-07-13 08:48:06 +08:00 committed by Sara Arjona
commit 5d1a115c64
No known key found for this signature in database
28 changed files with 88 additions and 103 deletions

View file

@ -56,7 +56,7 @@ Feature: Staff can assign user roles
Scenario: Enrol at activity level using custom field search
When I am on the "page1" "Activity" page logged in as "admin"
And I navigate to "Permissions" in current page administration
And I select "Locally assigned roles" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Locally assigned roles"
And I follow "Teacher"
And I set the field "addselect_searchtext" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
@ -72,7 +72,7 @@ Feature: Staff can assign user roles
| user1 | editingteacher | Activity module | page1 |
When I am on the "page1" "Activity" page logged in as "admin"
And I navigate to "Permissions" in current page administration
And I select "Locally assigned roles" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Locally assigned roles"
And I follow "Teacher"
And I set the field "removeselect_searchtext" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.

View file

@ -28,7 +28,7 @@ Feature: Staff can check user permissions
@javascript
Scenario: Search for a user (enrolled on the course) by custom field and select them to see permissions
When I am on the "C1" "permissions" page logged in as "admin"
And I select "Check permissions" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Check permissions"
And I set the field "Search" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
Then "optgroup[label='Matching enrolled users (1)']" "css_element" should exist
@ -42,7 +42,7 @@ Feature: Staff can check user permissions
@javascript
Scenario: Search for a user (not enrolled on the course) by custom field and select them to see permissions
When I am on the "C1" "permissions" page logged in as "admin"
And I select "Check permissions" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Check permissions"
And I set the field "Search" to "Kermit"
# The Behat 'I should see' step doesn't work for optgroup labels.
Then "optgroup[label*='Potential users matching'][label*=' (1)']" "css_element" should exist

View file

@ -58,7 +58,7 @@ Feature: Set up contextual data for tests
And I am on the "Course 1" "groups" page
Then I should see "Group 1"
And I should see "Group 2"
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I should see "Grouping 1"
And I should see "Grouping 2"

View file

@ -77,8 +77,7 @@ Feature: Basic recycle bin functionality
And I wait to be redirected
And I go to the courses management page
And I should see "Course 2" in the "#course-listing" "css_element"
And I am on the "Course 2" "groups" page
And I select "Overview" from the "jump" singleselect
And I am on the "Course 2" "groups overview" page
And "Student 1" "text" should exist in the "Group A" "table_row"
And "Student 2" "text" should exist in the "Group A" "table_row"
And "Student 2" "text" should exist in the "Group B" "table_row"

View file

@ -240,7 +240,7 @@ Feature: Upload users
And I am on site homepage
And I navigate to "Courses > Manage courses and categories" in site administration
And I click on "permissions" action for "MGMT" in management category listing
And I select "Assign roles" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Assign roles"
And I should see "Manager"
And I should see "Tom Jones"
And I should see "Trent Reznor"
@ -249,7 +249,7 @@ Feature: Upload users
And I am on site homepage
And I navigate to "Courses > Manage courses and categories" in site administration
And I click on "permissions" action for "Film" in management category listing
And I select "Assign roles" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Assign roles"
And I should see "Course creator"
And I should see "Federico Fellini"

View file

@ -33,7 +33,7 @@ Feature: Option to include groups and groupings when importing a course to anoth
When I am on the "Course 2" "groups" page
Then I should see "Group 1"
And I should see "Group 2"
And I select "Groupings" from the "jump" singleselect
And I am on the "Course 2" "groupings" page
And I should see "Grouping 1"
And I should see "Grouping 2"
@ -43,6 +43,6 @@ Feature: Option to include groups and groupings when importing a course to anoth
When I am on the "Course 2" "groups" page
Then I should not see "Group 1"
And I should not see "Group 2"
And I select "Groupings" from the "jump" singleselect
And I am on the "Course 2" "groupings" page
And I should not see "Grouping 1"
And I should not see "Grouping 2"

View file

@ -22,16 +22,9 @@
Example context (json):
{
"urlselect" : {
"formid": "url_select_f61834256d7754158",
"classes": "urlselect",
"label": "",
"disabled": false,
"title":null,
"id":"url_select61834256d7754159",
"sesskey":"LWILINyZMH",
"action":"http:\/\/localhost\/stable_master\/course\/jumpto.php",
"showbutton":null,
"navigation" : {
"baseid": "select-menuf61834256d7754158",
"label": "Participant navigation",
"options": [
{
"name":"Enrolments",
@ -92,20 +85,26 @@
]
}
],
"labelattributes":[],
"helpicon":false,
"attributes":[]
"selectedoption":"Enrolled users",
"name":"participantsnavigation",
"value":"\/user\/index.php?id=4",
"labelattributes":[
{
"name":"class",
"value":"sr-only"
}
]
},
"renderedcontent":"<div data-region=\"wrapper\" data-table-uniqueid=\"user-index-participants-4\"><\/div>"
}
}}
<div class="container-fluid tertiary-navigation" id="action_bar">
<div class="row">
{{#urlselect}}
{{#navigation}}
<div class="navitem">
{{> core/url_select }}
{{> core/tertiary_navigation_selector}}
</div>
{{/urlselect}}
{{/navigation}}
{{#renderedcontent}}
<div class="navitem">
{{{renderedcontent}}}

View file

@ -235,6 +235,7 @@ Feature: Test category management actions
And "Move into" "select" should not be visible
And I press "Cancel"
@javascript
Scenario: Test I can assign roles for a category through the management interface.
Given the following "categories" exist:
| name | category | idnumber |
@ -246,7 +247,7 @@ Feature: Test category management actions
And I go to the courses management page
And I should see the "Course categories and courses" management page
And I click on "permissions" action for "Cat 1" in management category listing
And I select "Assign roles" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Assign roles"
# Redirect
And I should see "Assign roles in Category: Cat 1"
And I should see "Please choose a role to assign"

View file

@ -135,7 +135,7 @@ Feature: Course category breadcrumbs navigation
And I navigate to "Courses > Manage courses and categories" in site administration
And I follow "Cat 1"
And I navigate to "Permissions" in current page administration
When I select "Assign roles" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Assign roles"
Then I should see "Courses" in the ".breadcrumb" "css_element"
And I should see "Cat 1" in the ".breadcrumb" "css_element"
And I should see "Assign roles" in the ".breadcrumb" "css_element"
@ -147,7 +147,7 @@ Feature: Course category breadcrumbs navigation
And I navigate to "Courses > Manage courses and categories" in site administration
And I follow "Cat 1"
And I navigate to "Permissions" in current page administration
When I select "Check permissions" from the "jump" singleselect
When I set the field "Participants tertiary navigation" to "Check permissions"
Then I should see "Courses" in the ".breadcrumb" "css_element"
And I should see "Cat 1" in the ".breadcrumb" "css_element"
And I should see "Check permissions" in the ".breadcrumb" "css_element"

View file

@ -58,7 +58,7 @@ Feature: Cohort enrolment management
| Cohort | A1 |
| customint2 | -1 |
Then I should see "Cohort sync (Alpha1 - Student)"
And I select "Groups" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groups"
# Confirm that group was created and corresponding group members are present
And I set the field "groups[]" to "Alpha1 cohort (2)"
And the "members" select box should contain "Sandra Cole (s1@example.com)"
@ -106,7 +106,7 @@ Feature: Cohort enrolment management
And I click on "Edit" "link" in the "Beta2" "table_row"
And I set the field "Add to group" to "Create new group"
And I click on "Save changes" "button"
And I select "Groups" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groups"
And I set the field "groups[]" to "Beta2 cohort (2)"
Then the "members" select box should contain "Bianca McAfee (s3@example.com)"
And the "members" select box should contain "Abigail Wyatt (s5@example.com)"

View file

@ -202,7 +202,6 @@ if ($canconfig and $action and confirm_sesskey()) {
echo $OUTPUT->header();
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading(get_string('enrolmentinstances', 'enrol'));
echo $OUTPUT->box_start('generalbox boxaligncenter boxwidthnormal');

View file

@ -48,7 +48,6 @@ $PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading(get_string('rolerenaming'));
echo $OUTPUT->paragraph(get_string('rolerenaming_help'));

View file

@ -57,10 +57,9 @@ $PAGE->navbar->add($strgroupings);
$PAGE->set_title($strgroupings);
$PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header();
echo $OUTPUT->header();
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading($strgroupings);
$data = array();
if ($groupings = $DB->get_records('groupings', array('courseid'=>$course->id), 'name')) {

View file

@ -183,7 +183,6 @@ $PAGE->set_pagelayout('standard');
echo $OUTPUT->header();
echo $OUTPUT->render_participants_tertiary_nav($course);
echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$strgroups, 3);
$groups = groups_get_all_groups($courseid);
$selectedname = null;

View file

@ -273,11 +273,9 @@ $PAGE->navbar->add(get_string('overview', 'group'));
$PAGE->set_title($strgroups);
$PAGE->set_heading($course->fullname);
$PAGE->set_pagelayout('standard');
echo $OUTPUT->header();
echo $OUTPUT->header();
echo $OUTPUT->render_participants_tertiary_nav($course);
/// Print overview
echo $OUTPUT->heading(format_string($course->shortname, true, array('context' => $context)) .' '.$stroverview, 3);
echo $strfiltergroups;

View file

@ -66,7 +66,7 @@ Feature: Automatic creation of groups
And I should see "No" in the "Group messaging" "select"
And I press "Cancel"
# Check groupings.
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I should see "Grouping name"
And I click on "Show groups in grouping" "link" in the "Grouping name" "table_row"
And the "removeselect" select box should contain "Group A"

View file

@ -14,19 +14,11 @@ Feature: Bulk update group messaging status
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group-A-Test |
| Group ID number | Group-A-Test |
And I press "Save changes"
And I press "Create group"
And I set the following fields to these values:
| Group name | Group-B-Test |
| Group ID number | Group-B-Test |
And I press "Save changes"
And I select "Groups" from the "jump" singleselect
And the following "groups" exist:
| course | name | idnumber |
| C1 | Group-A-Test | GA |
| C1 | Group-B-Test | GB |
And I am on the "Course 1" "groups" page logged in as "teacher1"
@javascript
Scenario: Bulk enable messaging in groups

View file

@ -110,7 +110,7 @@ Feature: Organize students into groups
| Group name | The greatest group that never existed |
And I press "Save changes"
And I should see "The greatest group that never existed"
And I select "Groupings" from the "jump" singleselect
And I am on the "Course 1" "groupings" page
And I press "Create grouping"
And the "idnumber" "field" should be readonly
And I set the following fields to these values:

View file

@ -34,12 +34,12 @@ Feature: Custom profile fields in groups
And I am on the "Course 1" "groups" page
# Check the Overview page.
And I select "Overview" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Overview"
And "Robin Hood (user1, fox)" "text" should exist in the "Canines" "table_row"
And "Little John (user2, bear)" "text" should exist in the "No group" "table_row"
# Check the groups page.
And I select "Groups" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groups"
And I set the field "groups" to "Canines"
And I should see "Robin Hood (user1, fox)"
And I should not see "Little John (user2, bear)"

View file

@ -14,28 +14,16 @@ Feature: Automatic deletion of groups and groupings
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And the following "groups" exist:
| course | name | idnumber |
| C1 | Group (without ID) | |
| C1 | Group (with ID) | An ID |
And the following "groupings" exist:
| course | name | idnumber |
| C1 | Grouping (without ID) | |
| C1 | Grouping (with ID) | An ID |
And I log in as "teacher1"
And I am on the "Course 1" "groups" page
And I press "Create group"
And I set the following fields to these values:
| Group name | Group (without ID) |
And I press "Save changes"
And I press "Create group"
And I set the following fields to these values:
| Group name | Group (with ID) |
| Group ID number | An ID |
And I press "Save changes"
And I select "Groupings" from the "jump" singleselect
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping (without ID) |
And I press "Save changes"
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping (with ID) |
| Grouping ID number | An ID |
And I press "Save changes"
And I select "Groups" from the "jump" singleselect
And I am on the "Course 1" "groups" page logged in as "teacher1"
@javascript
Scenario: Delete groups and groupings with and without ID numbers
@ -47,7 +35,7 @@ Feature: Automatic deletion of groups and groupings
And I press "Delete"
And I press "Yes"
And the "groups" select box should not contain "Group (with ID) (0)"
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I click on "Delete" "link" in the "Grouping (without ID)" "table_row"
And I press "Yes"
And I should not see "Grouping (without ID)"
@ -67,7 +55,7 @@ Feature: Automatic deletion of groups and groupings
And I press "Delete"
And I press "Yes"
And I should not see "Group (without ID)"
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And "Delete" "link" should not exist in the "Grouping (with ID)" "table_row"
And I click on "Delete" "link" in the "Grouping (without ID)" "table_row"
And I press "Yes"

View file

@ -41,7 +41,7 @@ Feature: Importing of groups and groupings
And I should see "No" in the "Group messaging" "select"
And I press "Cancel"
# Check groupings
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I should see "Grouping-1"
And I should see "Grouping-2"
And I should see "Grouping-3"

View file

@ -14,11 +14,10 @@ Feature: Uniqueness of Group ID number
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on the "Course 1" "groups" page
Scenario: Group ID number uniqueness
Given I press "Create group"
Given I am on the "Course 1" "groups" page logged in as "teacher1"
And I press "Create group"
And I set the following fields to these values:
| Group name | Group 1 |
| Group ID number | G1 |
@ -41,7 +40,7 @@ Feature: Uniqueness of Group ID number
And I press "Cancel"
Scenario: Grouping ID number uniqueness
Given I select "Groupings" from the "jump" singleselect
Given I am on the "Course 1" "groupings" page logged in as "teacher1"
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping 1 |

View file

@ -56,10 +56,7 @@ Feature: Group overview
| GG2 | G3 |
Scenario: Filter the overview in various different ways
Given I log in as "teacher1"
And I am on the "Course 1" "groups" page
And I select "Overview" from the "jump" singleselect
Given I am on the "Course 1" "groups overview" page logged in as "teacher1"
# Grouping All and Group All filter
When I select "All" from the "Grouping" singleselect
And I select "All" from the "group" singleselect

View file

@ -25,7 +25,7 @@ Feature: Automatic updating of groups and groupings
| Group name | Group (with ID) |
| Group ID number | An ID |
And I press "Save changes"
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I press "Create grouping"
And I set the following fields to these values:
| Grouping name | Grouping (without ID) |
@ -35,7 +35,7 @@ Feature: Automatic updating of groups and groupings
| Grouping name | Grouping (with ID) |
| Grouping ID number | An ID |
And I press "Save changes"
And I select "Groups" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groups"
@javascript
Scenario: Update groups and groupings with ID numbers
@ -51,7 +51,7 @@ Feature: Automatic updating of groups and groupings
And I press "Edit group settings"
And the field "idnumber" matches value "An ID (updated)"
And I press "Save changes"
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I click on "Edit" "link" in the "Grouping (with ID)" "table_row"
And the field "idnumber" matches value "An ID"
And I set the following fields to these values:
@ -82,7 +82,7 @@ Feature: Automatic updating of groups and groupings
And the "idnumber" "field" should be readonly
And the field "idnumber" matches value "An ID"
And I press "Save changes"
And I select "Groupings" from the "jump" singleselect
And I set the field "Participants tertiary navigation" to "Groupings"
And I click on "Edit" "link" in the "Grouping (with ID)" "table_row"
And the "idnumber" "field" should be readonly
And the field "idnumber" matches value "An ID"

View file

@ -195,15 +195,17 @@ class participants_action_bar implements \renderable {
* Gets the url_select to be displayed in the participants page if available.
*
* @param \renderer_base $output
* @return object|null The content required to render the url_select
* @return object|null The content required to render the tertiary navigation
*/
public function get_dropdown(\renderer_base $output): ?object {
if ($urlselectcontent = $this->get_content_for_select()) {
$activeurl = $this->find_active_page($urlselectcontent);
$activeurl = $activeurl ?: $this->find_active_page($urlselectcontent, URL_MATCH_BASE);
$urlselect = new \url_select($urlselectcontent, $activeurl, null);
$urlselect->set_label(get_string('participantsnavigation', 'course'), ['class' => 'sr-only']);
return $urlselect->export_for_template($output);
$selectmenu = new select_menu('participantsnavigation', $urlselectcontent, $activeurl);
$selectmenu->set_label(get_string('participantsnavigation', 'course'), ['class' => 'sr-only']);
return $selectmenu->export_for_template($output);
}
return null;
@ -214,12 +216,12 @@ class participants_action_bar implements \renderable {
*
* @param \renderer_base $output
* @return array Consists of the following:
* - urlselect A stdclass representing the standard navigation options to be fed into a urlselect
* - navigation A stdclass representing the standard navigation options to be fed into a urlselect
* - renderedcontent Rendered content to be displayed in line with the tertiary nav
*/
public function export_for_template(\renderer_base $output) {
return [
'urlselect' => $this->get_dropdown($output),
'navigation' => $this->get_dropdown($output),
'renderedcontent' => $this->renderedcontent,
];
}

View file

@ -754,6 +754,8 @@ class behat_navigation extends behat_base {
* | Reset | course shortname | Course to reset |
* | Course copy | course shortname | Course to copy |
* | Groups | course shortname | Groups page for the course |
* | Groups overview | course shortname | Groups overview page for the course |
* | Groupings | course shortname | Groupings page for the course |
* | Permissions | course shortname | Permissions page for the course |
* | Enrolment methods | course shortname | Enrolment methods for the course |
* | Enrolled users | course shortname | The main participants page |
@ -853,6 +855,20 @@ class behat_navigation extends behat_base {
$identifier . '" does not exist');
}
return new moodle_url('/group/index.php', ['id' => $courseid]);
case 'groups overview':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/group/overview.php', ['id' => $courseid]);
case 'groupings':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {
throw new Exception('The specified course with shortname, fullname, or idnumber "' .
$identifier . '" does not exist');
}
return new moodle_url('/group/groupings.php', ['id' => $courseid]);
case 'permissions':
$courseid = $this->get_course_id($identifier);
if (!$courseid) {

View file

@ -25,7 +25,7 @@ Feature: Role assignments can be made at the category level
And I am on course index
When I follow "Cat 1"
And I navigate to "Permissions" in current page administration
Then I should see "Assign roles" in the "jump" "select"
Then "Assign roles" "text" should exist in the ".tertiary-navigation" "css_element"
@javascript
Scenario: A user with a category role cannot assign roles if there are no roles to assign
@ -41,4 +41,4 @@ Feature: Role assignments can be made at the category level
And I am on course index
When I follow "Cat 1"
And I navigate to "Permissions" in current page administration
Then I should not see "Assign roles" in the "jump" "select"
Then "Assign roles" "text" should not exist in the ".tertiary-navigation" "css_element"

View file

@ -116,8 +116,6 @@ echo $OUTPUT->render_participants_tertiary_nav($course, html_writer::div($enrolb
'data-table-uniqueid' => $participanttable->uniqueid,
]));
echo $OUTPUT->heading(get_string('enrolledusers', 'enrol'));
$filterset = new \core_user\table\participants_filterset();
$filterset->add_filter(new integer_filter('courseid', filter::JOINTYPE_DEFAULT, [(int)$course->id]));