Skip to content

Commit

Permalink
Merge branch 'wip-MDL-45774-master' of git://github.com/abgreeve/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski authored and andrewnicols committed Apr 14, 2015
2 parents b522e25 + 6e918b6 commit 0627d58
Show file tree
Hide file tree
Showing 291 changed files with 5,200 additions and 1,627 deletions.
5 changes: 5 additions & 0 deletions admin/roles/assign.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@
}
}

if (!empty($user) && ($user->id != $USER->id)) {
$PAGE->navigation->extend_for_user($user);
$PAGE->navbar->includesettingsbase = true;
}

$PAGE->set_pagelayout('admin');
$PAGE->set_title($title);

Expand Down
1 change: 1 addition & 0 deletions admin/roles/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
$PAGE->set_url($url);

if ($context->contextlevel == CONTEXT_USER and $USER->id != $context->instanceid) {
$PAGE->navbar->includesettingsbase = true;
$PAGE->navigation->extend_for_user($user);
$PAGE->set_context(context_course::instance($course->id));
} else {
Expand Down
3 changes: 2 additions & 1 deletion admin/roles/permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@
$PAGE->set_url($url);

if ($context->contextlevel == CONTEXT_USER and $USER->id != $context->instanceid) {
$PAGE->navbar->includesettingsbase = true;
$PAGE->navigation->extend_for_user($user);
$PAGE->set_context(context_course::instance($course->id));
$PAGE->set_context(context_user::instance($user->id));
} else {
$PAGE->set_context($context);
}
Expand Down
9 changes: 5 additions & 4 deletions admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
'customusermenuitems',
new lang_string('customusermenuitems', 'admin'),
new lang_string('configcustomusermenuitems', 'admin'),
'messages,message|/message/index.php|message
myfiles,moodle|/user/files.php|download
mybadges,badges|/badges/mybadges.php|award',
'mygrades,grades|/grade/report/mygrades.php|grades
messages,message|/message/index.php|message
mypreferences,moodle|/user/preferences.php|preferences',
PARAM_TEXT,
'50',
'10'
Expand Down Expand Up @@ -140,7 +140,8 @@
HOMEPAGE_MY => new lang_string('mymoodle', 'admin'),
HOMEPAGE_USER => new lang_string('userpreference', 'admin')
);
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'), new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_SITE, $choices));
$temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'),
new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_MY, $choices));
$temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
Expand Down
5 changes: 5 additions & 0 deletions admin/settings/grades.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
$temp->add(new admin_setting_special_gradepointmax());

$temp->add(new admin_setting_special_gradepointdefault());

$temp->add(new admin_setting_my_grades_report());

$temp->add(new admin_setting_configtext('gradereport_mygradeurl', new lang_string('externalurl', 'grades'),
new lang_string('externalurl_desc', 'grades'), ''));
}
$ADMIN->add('grades', $temp);

Expand Down
3 changes: 2 additions & 1 deletion admin/tests/behat/display_short_names.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Feature: Display extended course names
| fullname | shortname | category |
| Course fullname | C_shortname | 0 |
And I log in as "admin"
And I am on site homepage

Scenario: Courses list without extended course names (default value)
Then I should see "Course fullname"
Expand All @@ -19,5 +20,5 @@ Feature: Display extended course names
And I click on "Courses" "link" in the "//div[@id='settingsnav']/descendant::li[contains(concat(' ', normalize-space(@class), ' '), ' type_setting ')][contains(., 'Appearance')]" "xpath_element"
And I set the field "Display extended course names" to "1"
When I press "Save changes"
And I am on homepage
And I am on site homepage
Then I should see "C_shortname Course fullname"
7 changes: 4 additions & 3 deletions admin/tests/behat/set_admin_settings_value.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,18 @@ Feature: Set admin settings value
| fullname | shortname | category |
| Course fullname | C_shortname | 0 |
And I log in as "admin"
And I am on site homepage
And I should see "Course fullname"
And I should not see "C_shortname Course fullname"

Scenario: set admin value with full name
Given the following config values are set as admin:
| courselistshortnames | 1 |
And I am on homepage
And I am on site homepage
Then I should see "C_shortname Course fullname"

Scenario: set admin value with short name
Given the following config values are set as admin:
| courselistshortnames | 1 |
And I am on homepage
Then I should see "C_shortname Course fullname"
And I am on site homepage
Then I should see "C_shortname Course fullname"
2 changes: 1 addition & 1 deletion admin/tests/behat/upload_users.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Upload users
And I should see "Tom Jones"
And I should see "Trent Reznor"
And I should see "[email protected]"
And I am on homepage
And I am on site homepage
And I follow "Maths"
And I expand "Users" node
And I follow "Groups"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Feature: Manage availability conditions
And the following config values are set as admin:
| enableavailability | 1 |
And I log in as "admin"
And I am on homepage
And I am on site homepage
When I navigate to "Manage restrictions" node in "Site administration > Plugins > Availability restrictions"

# Check the icon is there (it should be a Hide icon, meaning is currently visible).
Expand All @@ -47,7 +47,7 @@ Feature: Manage availability conditions

# OK, toggling works. Set the grade one to Hide and we'll go see if it actually worked.
And I click on "input[title=Hide]" "css_element" in the "Restriction by grade" "table_row"
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I add a "Page" to section "1"
Expand Down
7 changes: 4 additions & 3 deletions admin/tool/behat/tests/behat/basic_actions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Page contents assertions
@javascript
Scenario: Basic contents assertions
Given I log in as "admin"
And I am on homepage
And I am on site homepage
And I expand "Users" node
And I follow "Groups"
And I press "Create group"
Expand All @@ -22,8 +22,8 @@ Feature: Page contents assertions
Then I should see "I'm the description"
And "Grouping" "select" in the "region-main" "region" should be visible
And "Group" "select" should be visible
And "Messaging" "link" in the "Administration" "block" should not be visible
And "Change password" "link" should not be visible
And "Activity report" "link" in the "Administration" "block" should not be visible
And "Event monitoring rules" "link" should not be visible
And I should see "Filter groups by"
And I should not see "Filter groupssss by"
And I should see "Group members" in the "#region-main table th.c1" "css_element"
Expand All @@ -38,6 +38,7 @@ Feature: Page contents assertions
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
When I dock "Administration" block
Then I should not see "Question bank" in the ".block-region" "css_element"
Expand Down
17 changes: 15 additions & 2 deletions admin/tool/behat/tests/behat/data_generators.feature
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Feature: Set up contextual data for tests
| Course 2 | COURSE2 | CAT3 |
| Course 3 | COURSE3 | 0 |
When I log in as "admin"
And I am on site homepage
Then I should see "Course 1"
And I should see "Course 2"
And I should see "Course 3"
Expand Down Expand Up @@ -56,6 +57,7 @@ Feature: Set up contextual data for tests
| Grouping 1 | C1 | GG1 |
| Grouping 2 | C1 | GG2 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I expand "Users" node
And I follow "Groups"
Expand Down Expand Up @@ -86,6 +88,7 @@ Feature: Set up contextual data for tests
| mod/forum:editanypost | Allow | student | Course | C1 |
| mod/forum:replynews | Prevent | editingteacher | Course | C1 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I expand "Users" node
And I follow "Permissions"
Expand Down Expand Up @@ -138,22 +141,27 @@ Feature: Set up contextual data for tests
| user3 | editingteacher | Course | C1 |
| user5 | custom2 | System | |
When I log in as "user1"
And I am on site homepage
Then I should see "Front page settings"
And I log out
And I log in as "user2"
And I am on site homepage
And I follow "Course 1"
And I should see "Turn editing on"
And I log out
And I log in as "user3"
And I am on site homepage
And I follow "Course 1"
And I should see "Turn editing on"
And I log out
And I log in as "user4"
And I am on site homepage
And I follow "Course 1"
And I should see "Turn editing on"
And I log out
And I log in as "user5"
And I should see "You are logged in as"
And I am on site homepage
And I follow "Course 1"
And I should see "You can not enrol yourself in this course."

Expand Down Expand Up @@ -192,6 +200,7 @@ Feature: Set up contextual data for tests
| activity | name | intro | course | idnumber | grade |
| assign | Test assignment name with scale | Test assignment description | C1 | assign1 | Test Scale 1 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
Then I should see "Test assignment name"
# Assignment 2.2 module type is disabled by default
Expand Down Expand Up @@ -253,6 +262,7 @@ Feature: Set up contextual data for tests
| grouping | group |
| GG1 | G1 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I expand "Users" node
And I follow "Groups"
Expand Down Expand Up @@ -312,6 +322,7 @@ Feature: Set up contextual data for tests
| fullname | course | gradecategory |
| Grade sub category 2 | C1 | Grade category 1 |
When I log in as "admin"
And I am on site homepage
And I follow "Courses"
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
Expand All @@ -336,6 +347,7 @@ Feature: Set up contextual data for tests
| Test Grade Item 2 | C1 | Grade category 1 |
| Test Grade Item 3 | C1 | Grade sub category 2 |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
Expand Down Expand Up @@ -366,6 +378,7 @@ Feature: Set up contextual data for tests
| name | scale |
| Test Scale 1 | Disappointing, Good, Very good, Excellent |
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I follow "Grades"
And I follow "Scales"
Expand All @@ -388,7 +401,7 @@ Feature: Set up contextual data for tests
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I follow "Home"
And I am on site homepage
And I follow "Course 1"
And I follow "Outcomes"
Then I should see "Grade outcome 1" in the "#addoutcomes" "css_element"
Expand Down Expand Up @@ -417,7 +430,7 @@ Feature: Set up contextual data for tests
And the following config values are set as admin:
| enableoutcomes | 1 |
When I log in as "admin"
And I follow "Home"
And I am on site homepage
And I follow "Course 1"
And I follow "Grades"
And I expand "Setup" node
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/get_and_set_fields.feature
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Feature: Verify that all form fields values can be get and set
# Select (multi-select) - We will check "I set the field...".
And I set the field "otagsadd" to "OT1, OT2, OT3, OT4, OT5"
And I press "Add official tags"
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I follow "Test this one"
Expand Down
8 changes: 5 additions & 3 deletions admin/tool/behat/tests/behat/manipulate_forms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Feature: Forms manipulation
@javascript
Scenario: Basic forms manipulation
Given I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I follow "My preferences" in the user menu
And I follow "Edit profile"
When I set the field "First name" to "Field value"
And I set the field "Text editor" to "Plain text area"
And I set the field "Select a country" to "Japan"
And I set the field "Unmask" to "1"
And I expand all fieldsets
Then the field "First name" matches value "Field value"
And the "Text editor" select box should contain "Plain text area"
And the "Select a country" select box should contain "Japan"
And the field "Unmask" matches value "1"
And I set the field "Unmask" to ""
And the field "Unmask" matches value ""
Expand All @@ -25,6 +26,7 @@ Feature: Forms manipulation
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
And I add a "Quiz" to section "1"
Expand Down
8 changes: 6 additions & 2 deletions admin/tool/behat/tests/behat/nasty_strings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ Feature: Transform steps arguments
I need to apply some transformations to the steps arguments

Background:
Given I am on homepage
Given I am on site homepage
And the following "courses" exist:
| fullname | shortname | category |
| Course 1 | C1 | 0 |
And I log in as "admin"
And I navigate to "Edit profile" node in "My profile settings"
And I follow "My preferences" in the user menu
And I follow "Edit profile"

@javascript
Scenario: Use nasty strings on steps arguments
When I set the field "Surname" to "$NASTYSTRING1"
And I set the field "Description" to "$NASTYSTRING2"
Expand All @@ -22,6 +24,7 @@ Feature: Transform steps arguments
And the field "Surname" matches value "$NASTYSTRING1"
And the field "City/town" matches value "$NASTYSTRING3"

@javascript
Scenario: Use nasty strings on table nodes
When I set the following fields to these values:
| Surname | $NASTYSTRING1 |
Expand All @@ -33,6 +36,7 @@ Feature: Transform steps arguments
And the field "Surname" matches value "$NASTYSTRING1"
And the field "City/town" matches value "$NASTYSTRING3"

@javascript
Scenario: Use double quotes
When I set the following fields to these values:
| First name | va"lue1 |
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/test_environment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ Feature: Set up the testing environment
I need to use the test environment instead of the regular environment

Scenario: Accessing the site
When I am on homepage
When I am on site homepage
Then I should see "Acceptance test site"
2 changes: 1 addition & 1 deletion admin/tool/filetypes/tests/behat/add_filetypes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ Feature: Add customised file types
| Custom description | Froggy file |
And I press "Save changes"
# Create a resource activity and add it to a course
And I am on homepage
And I am on site homepage
And I follow "Course 1"
And I turn editing mode on
When I add a "File" to section "1"
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/monitor/classes/output/managesubs/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ protected function render_subs(subs $renderable) {
* @return string to display on the mangesubs page.
*/
protected function render_rules(rules $renderable) {
$o = $this->render_course_select($renderable);
$o = '';
if (!empty($renderable->totalcount)) {
$o .= $this->render_table($renderable);
}
Expand Down
6 changes: 5 additions & 1 deletion admin/tool/monitor/classes/output/managesubs/rules.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,17 @@ public function get_user_courses_select() {
return false;
}
$orderby = 'visible DESC, sortorder ASC';
$options = array(0 => get_string('site'));
$options = array();
if ($courses = get_user_capability_course('tool/monitor:subscribe', null, true, 'fullname', $orderby)) {
foreach ($courses as $course) {
$options[$course->id] = format_string($course->fullname, true,
array('context' => \context_course::instance($course->id)));
}
}
// If there are no options to display, then don't display anything.
if (count($options) === 0) {
return false;
}
$url = new \moodle_url('/admin/tool/monitor/index.php');
$select = new \single_select($url, 'courseid', $options, $this->courseid);
$select->set_label(get_string('selectacourse', 'tool_monitor'));
Expand Down
Loading

0 comments on commit 0627d58

Please sign in to comment.