MDL-52873 forms: Generate unique id attributes for modgrade elements

The previous method of generating the id attribute of the elements
within the modgrade group did not take the name of the modgrade field
into account. So if there were multiple fields of the modgrade type
added into a form (not a common case yet still valid), elements created
within the group were assigned same id attributes.

The patch introduces a new method for generating the id attribute of
modgrade elements. The new method takes the name of the modgrade group
into account and returns the id in the format similar to the default one
returned by HTML_QuickForm_element::_generateId().

The patch changes the generated id attribute. Apart from the
block_activity_results' behat feature files, not other places seem to
rely on the exact value.
This commit is contained in:
David Mudrák 2016-01-22 13:43:42 +01:00
parent eddec36d49
commit d84c64b7d6
7 changed files with 67 additions and 14 deletions

View file

@ -35,6 +35,6 @@ Feature: The activity results block displays student scores
When I follow "Test assignment"
And I click on "Edit settings" "link" in the "Administration" "block"
And I set the following fields to these values:
| id_modgrade_type | None |
| id_grade_modgrade_type | None |
And I press "Save and return to course"
Then I should see "Error: the activity selected uses a grading method that is not supported by this block." in the "Activity results" "block"

View file

@ -39,8 +39,8 @@ Feature: The activity results block displays student scores as scales
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
| id_modgrade_type | Scale |
| id_modgrade_scale | My Scale |
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I turn editing mode on

View file

@ -56,8 +56,8 @@ Feature: The activity results block displays student scores as scales
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
| id_modgrade_type | Scale |
| id_modgrade_scale | My Scale |
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
| Group mode | Separate groups |
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"

View file

@ -39,8 +39,8 @@ Feature: The activity results block displays student scores as scales
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
| id_modgrade_type | Scale |
| id_modgrade_scale | My Scale |
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I turn editing mode on

View file

@ -56,8 +56,8 @@ Feature: The activity results block displays student scores as scales
| Assignment name | Test assignment |
| Description | Offline text |
| assignsubmission_file_enabled | 0 |
| id_modgrade_type | Scale |
| id_modgrade_scale | My Scale |
| id_grade_modgrade_type | Scale |
| id_grade_modgrade_scale | My Scale |
| Group mode | Separate groups |
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"