Skip to content

Commit

Permalink
Merge branch 'MDL-80418-main' of https://github.com/aanabit/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
sarjona committed Jan 22, 2024
2 parents f888a12 + 4e6d39f commit 1643b21
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 56 deletions.
8 changes: 4 additions & 4 deletions admin/tool/behat/tests/behat/i_am_on_page.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ Feature: Use core page resolvers for the I am on the page steps
| Course Short name | ECON101 | COURSE | Fundamentals of Economics |
| Course idnumber | "2021-econ101" | Course | Fundamentals of Economics |
| Forum idnumber | fundamentalsofeconomics | Activity | Add discussion topic |
| Generic activity editing | fundamentalsofeconomics | "Activity editing" | Updating: Forum |
| Generic activity editing | fundamentalsofeconomics | "Activity editing" | Edit settings |
| Forum name | "Fundamentals of Economics" | "Forum activity" | Add discussion topic |
| Forum name editing | "Fundamentals of Economics" | "Forum activity editing" | Updating: Forum |
| Forum name editing | "Fundamentals of Economics" | "Forum activity editing" | Edit settings |
| Forum name permissions | "Fundamentals of Economics" | "Forum activity permissions" | Permissions in Forum: Fun |
| Forum name roles | "Fundamentals of Economics" | "Forum activity roles" | Assign roles in Forum: Fun |

Expand Down Expand Up @@ -59,9 +59,9 @@ Feature: Use core page resolvers for the I am on the page steps
| Course Short name | ECON101 | COURSE | Fundamentals of Economics |
| Course idnumber | "2021-econ101" | Course | Fundamentals of Economics |
| Forum idnumber | fundamentalsofeconomics | Activity | Add discussion topic |
| Generic activity editing | fundamentalsofeconomics | "Activity editing" | Updating: Forum |
| Generic activity editing | fundamentalsofeconomics | "Activity editing" | Edit settings |
| Forum name | "Fundamentals of Economics" | "Forum activity" | Add discussion topic |
| Forum name editing | "Fundamentals of Economics" | "Forum activity editing" | Updating: Forum |
| Forum name editing | "Fundamentals of Economics" | "Forum activity editing" | Edit settings |
| Forum name permissions | "Fundamentals of Economics" | "Forum activity permissions" | Permissions in Forum: Fun |
| Forum name roles | "Fundamentals of Economics" | "Forum activity roles" | Assign roles in Forum: Fun |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ Feature: Courses can be created in Single Activity mode
Then I should see "Quiz" in the "Type of activity" "field"
And I should not see "Forum" in the "Type of activity" "field"
And I press "Save and display"
And I should see "Adding a new Quiz"
And I should see "New Quiz"
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ Feature: Edit format course to Single Activity format
And I press "Update format"
Then I should see "Forum" in the "Type of activity" "field"
And I press "Save and display"
And I should see "Adding a new Forum"
And I should see "New Forum"
2 changes: 1 addition & 1 deletion course/format/tests/behat/coursepage_completion.feature
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Feature: Course page activities completion
But I am on "C1" course homepage with editing mode on
And I click on "Edit conditions" "link" in the "Activity sample" "core_courseformat > Activity completion"
And I should see "Activity sample" in the "page-header" "region"
And I should see "Updating: Assignment"
And I should see "Edit settings"
And I should see "Activity completion"

Scenario: Completion dialog shows warning message if there are no criterias
Expand Down
37 changes: 8 additions & 29 deletions course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,7 @@

$sectionname = get_section_name($course, $cw);
$fullmodulename = get_string('modulename', $module->name);

if ($data->section && $course->format != 'site') {
$heading = new stdClass();
$heading->what = $fullmodulename;
$heading->to = $sectionname;
$pageheading = get_string('addinganewto', 'moodle', $heading);
} else {
$pageheading = get_string('addinganew', 'moodle', $fullmodulename);
}
$pageheading = $pagetitle = get_string('addinganew', 'moodle', $fullmodulename);
$navbaraddition = $pageheading;

} else if (!empty($update)) {
Expand Down Expand Up @@ -134,15 +126,8 @@

$sectionname = get_section_name($course, $cw);
$fullmodulename = get_string('modulename', $module->name);

if ($data->section && $course->format != 'site') {
$heading = new stdClass();
$heading->what = $fullmodulename;
$heading->in = $sectionname;
$pageheading = get_string('updatingain', 'moodle', $heading);
} else {
$pageheading = get_string('updatinga', 'moodle', $fullmodulename);
}
$pageheading = get_string('editsettings', 'moodle');
$pagetitle = get_string('edita', 'moodle', $fullmodulename);
$navbaraddition = null;

} else {
Expand Down Expand Up @@ -226,18 +211,17 @@
exit;

} else {

$streditinga = get_string('editinga', 'moodle', $fullmodulename);
$strmodulenameplural = get_string('modulenameplural', $module->name);

if (!empty($cm->id)) {
$context = context_module::instance($cm->id);
} else {
$context = context_course::instance($course->id);
}

$PAGE->set_heading($course->fullname);
$PAGE->set_title($streditinga);
if ($course->id !== $SITE->id) {
$pagetitle = $pagetitle . moodle_page::TITLE_SEPARATOR . $course->shortname;
}
$PAGE->set_title($pagetitle);
$PAGE->set_cacheable(false);

if (isset($navbaraddition)) {
Expand All @@ -246,12 +230,7 @@
$PAGE->activityheader->disable();

echo $OUTPUT->header();

if (get_string_manager()->string_exists('modulename_help', $module->name)) {
echo $OUTPUT->heading_with_help($pageheading, 'modulename', $module->name, 'monologo');
} else {
echo $OUTPUT->heading_with_help($pageheading, '', $module->name, 'monologo');
}
echo $OUTPUT->heading_with_help($pageheading, '', $module->name, 'monologo');

$mform->display();

Expand Down
4 changes: 2 additions & 2 deletions course/tests/behat/activity_chooser.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Feature: Display and choose from the available activities in course
Scenario: The teacher can choose to add an activity from the activity items in the activity chooser
Given I click on "Add an activity or resource" "button" in the "Topic 4" "section"
When I click on "Add a new Assignment" "link" in the "Add an activity or resource" "dialogue"
Then I should see "Adding a new Assignment"
Then I should see "New Assignment"
And I set the following fields to these values:
| Assignment name | Test Assignment Topic 4 |
And I press "Save and return to course"
Expand All @@ -37,7 +37,7 @@ Feature: Display and choose from the available activities in course
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
When I click on "Information about the Assignment activity" "button" in the "Add an activity or resource" "dialogue"
When I click on "Add a new Assignment" "link" in the "help" "core_course > Activity chooser screen"
Then I should see "Adding a new Assignment"
Then I should see "New Assignment"

Scenario: Show summary
Given I click on "Add an activity or resource" "button" in the "Topic 1" "section"
Expand Down
2 changes: 1 addition & 1 deletion course/tests/behat/add_activities.feature
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Feature: Add activities to courses
| Allow comments on entries | Yes |
| Force language | English |
And I turn editing mode off
Then I should not see "Adding a new"
Then I should not see "New"
And I turn editing mode on
And I open "Test name" actions menu
And I click on "Edit settings" "link" in the "Test name" activity
Expand Down
4 changes: 2 additions & 2 deletions course/tests/behat/course_controls.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Feature: Course activity controls works as expected
And <belowpage> "section" should not exist
And I open "Test forum name 1" actions menu
And I click on "Edit settings" "link" in the "Test forum name 1" activity
And I should see "Updating"
And I should see "Edit settings"
And I should see "Display description on course page"
And I set the following fields to these values:
| Forum name | Just to check that I can edit the name |
Expand Down Expand Up @@ -113,7 +113,7 @@ Feature: Course activity controls works as expected
And I press "Yes"
And <belowpage> "section" should not exist
And I click on "Edit settings" "link" in the "Test forum name 1" activity
And I should see "Updating"
And I should see "Edit settings"
And I should see "Display description on course page"
And I press "Save and return to course"
And <belowpage> "section" should not exist
Expand Down
5 changes: 5 additions & 0 deletions lang/en/deprecated.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,8 @@ topichide,core
summary_help,core
editsummary,core
format_help,core
addnew,core
addinganewto,core
editinga,core
updatinga,core
updatingain,core
12 changes: 6 additions & 6 deletions lang/en/moodle.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,8 @@
$string['addedtogroupnot'] = 'Not added to group "{$a}"';
$string['addedtogroupnotenrolled'] = 'Not added to group "{$a}", because not enrolled in course';
$string['addfilehere'] = 'Drop files here to add them at the bottom of this section';
$string['addinganew'] = 'Adding a new {$a}';
$string['addinganew'] = 'New {$a}';
$string['additionalcustomnav'] = 'Additional custom navigation';
$string['addnew'] = 'Add a new {$a}';
$string['addinganewto'] = 'Adding a new {$a->what} to {$a->to}';
$string['addingdatatoexisting'] = 'Adding data to existing';
$string['additionalnames'] = 'Additional names';
$string['addlinkhere'] = 'Add link here';
Expand Down Expand Up @@ -614,7 +612,6 @@
$string['editsettings'] = 'Edit settings';
$string['editfiles'] = 'Edit files';
$string['editgroupprofile'] = 'Edit group profile';
$string['editinga'] = 'Editing {$a}';
$string['editingteachershort'] = 'Editor';
$string['editmode'] = 'Edit mode';
$string['editlock'] = 'This value cannot be edited!';
Expand Down Expand Up @@ -2306,8 +2303,6 @@
$string['updatesevery'] = 'Updates every {$a} seconds';
$string['updatethis'] = 'Update this {$a}';
$string['updatethiscourse'] = 'Update this course';
$string['updatinga'] = 'Updating: {$a}';
$string['updatingain'] = 'Updating {$a->what} in {$a->in}';
$string['upload'] = 'Upload';
$string['uploadafile'] = 'Upload a file';
$string['uploadcantwrite'] = 'Failed to write file to disk';
Expand Down Expand Up @@ -2501,3 +2496,8 @@
* Social - The course is centred around a main forum on the course page. Additional activities and resources can be added using the Social activities block.
* Custom sections - The course is divided into customisable sections.
* Weekly sections - The course is divided into sections corresponding to each week, beginning from the course start date.';
$string['addnew'] = 'Add a new {$a}';
$string['addinganewto'] = 'Adding a new {$a->what} to {$a->to}';
$string['editinga'] = 'Editing {$a}';
$string['updatinga'] = 'Updating: {$a}';
$string['updatingain'] = 'Updating {$a->what} in {$a->in}';
2 changes: 1 addition & 1 deletion lib/classes/output/mustache_clean_string_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct() {
*
* {{#cleanstr}}activity{{/cleanstr}}
* {{#cleanstr}}actionchoice, core, {{#str}}delete{{/str}}{{/cleanstr}} (Together with the str helper)
* {{#cleanstr}}addinganewto, core, {"what":"This", "to":"That"}{{/cleanstr}} (Complex $a)
* {{#cleanstr}}uploadrenamedchars, core, {"oldname":"Old", "newname":"New"}{{/cleanstr}} (Complex $a)
*
* The args are comma separated and only the first is required.
* The last is a $a argument for get string. For complex data here, use JSON.
Expand Down
4 changes: 2 additions & 2 deletions mod/quiz/accessrule/seb/tests/behat/edit_form.feature
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ Feature: Safe Exam Browser settings in quiz edit form
# Create the quiz.
When I add a "Quiz" to section "0" and I fill the form with:
| Name | My quiz |
Then I should not see "Adding a new Quiz"
Then I should not see "New Quiz"
# Edit the quiz.
And I open "My quiz" actions menu
And I click on "Edit settings" "link" in the "My quiz" activity
And I set the field "Name" to "My quiz edited"
And I press "Save and return to course"
And I should not see "Updating: Quiz"
And I should not see "Edit settings"

Scenario: SEB settings if using No SEB
Given the following "quizaccess_seb > seb templates" exist:
Expand Down
10 changes: 5 additions & 5 deletions mod/workshop/tests/behat/grade_to_pass.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Setting grades to pass via workshop editing form
| activity | course | name | submissiongradepass | gradinggradepass | submissiontypetextavailable |
| workshop | c1 | Another workshop | 42 | 10.1 | 0 |
When I am on the "Course1" course page logged in as teacher1
Then I should not see "Adding a new Workshop"
Then I should not see "New Workshop"
And I am on the "Another workshop" "workshop activity editing" page
And the field "Submission grade to pass" matches value "42.00"
And the field "Assessment grade to pass" matches value "10.10"
Expand All @@ -53,7 +53,7 @@ Feature: Setting grades to pass via workshop editing form
When I am on the "Another awesome workshop" "workshop activity editing" page logged in as teacher1
And I set the field "Assessment grade to pass" to "You shall not pass!"
And I press "Save and return to course"
Then I should see "Updating Workshop in Topic 1"
Then I should see "Edit settings"
And I should see "You must enter a number here"

Scenario: Adding a new workshop with invalid value of a grade to pass
Expand All @@ -63,7 +63,7 @@ Feature: Setting grades to pass via workshop editing form
When I am on the "Almost awesome workshop" "workshop activity editing" page logged in as teacher1
And I set the field "Assessment grade to pass" to "10000000"
And I press "Save and return to course"
Then I should see "Updating Workshop in Topic 1"
Then I should see "Edit settings"
And I should see "The grade to pass can not be greater than the maximum possible grade"

Scenario: Emptying grades to pass fields sets them to zero
Expand All @@ -74,14 +74,14 @@ Feature: Setting grades to pass via workshop editing form
And I set the field "Submission grade to pass" to "59.99"
And I set the field "Assessment grade to pass" to "0.000"
And I press "Save and return to course"
And I should not see "Updating Workshop in Topic 1"
And I should not see "Edit settings"
And I am on the "Super awesome workshop" "workshop activity editing" page
And the field "Submission grade to pass" matches value "59.99"
And the field "Assessment grade to pass" matches value "0.00"
When I set the field "Submission grade to pass" to ""
And I set the field "Assessment grade to pass" to ""
And I press "Save and display"
Then I should not see "Adding a new Workshop"
Then I should not see "New Workshop"
And I am on the "Super awesome workshop" "workshop activity editing" page
And the field "Submission grade to pass" matches value "0.00"
And the field "Assessment grade to pass" matches value "0.00"
2 changes: 1 addition & 1 deletion theme/classic/tests/behat/pageadministrationmenu.feature
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Feature: Page administration menu
And I should see the page administration menu
And "Settings" "link" should exist in current page administration
And I navigate to "Settings" in current page administration
And I should see "Updating: Choice"
And I should see "Edit settings"
And I navigate to course participants
And I should see the page administration menu
And I am on the "Course 1" "Enrolment methods" page
Expand Down

0 comments on commit 1643b21

Please sign in to comment.