Skip to content

Commit

Permalink
Merge branch 'MDL-55074-master' of git://github.com/damyon/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
David Monllao committed Oct 24, 2016
2 parents 49b78f2 + 4b93793 commit 48f4309
Show file tree
Hide file tree
Showing 240 changed files with 2,320 additions and 1,000 deletions.
48 changes: 48 additions & 0 deletions admin/admin_settings_search_form.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Admin settings search form
*
* @package admin
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

defined('MOODLE_INTERNAL') || die();

require_once $CFG->libdir.'/formslib.php';

/**
* Admin settings search form
*
* @package admin
* @copyright 2016 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_settings_search_form extends moodleform {
function definition () {
$mform = $this->_form;

//$mform->addElement('header', 'settingsheader', get_string('search', 'admin'));
$elements = [];
$elements[] = $mform->createElement('text', 'query', get_string('query', 'admin'));
$elements[] = $mform->createElement('submit', 'search', get_string('search'));
$mform->addGroup($elements);
$mform->setType('query', PARAM_RAW);
$mform->setDefault('query', optional_param('query', '', PARAM_RAW));
}
}
16 changes: 15 additions & 1 deletion admin/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,27 @@
// to modify them
echo $OUTPUT->header($focus);

echo $OUTPUT->heading(get_string('administrationsite'));

if ($errormsg !== '') {
echo $OUTPUT->notification($errormsg);

} else if ($statusmsg !== '') {
echo $OUTPUT->notification($statusmsg, 'notifysuccess');
}

echo admin_search_settings_html($query);
require_once("admin_settings_search_form.php");
$form = new admin_settings_search_form();
$form->display();
echo '<hr>';

if ($query) {
echo admin_search_settings_html($query);
} else {
$node = $PAGE->settingsnav->find('root', navigation_node::TYPE_SITE_ADMIN);
if ($node) {
echo $OUTPUT->render_from_template('core/settings_link_page', ['node' => $node]);
}
}

echo $OUTPUT->footer();
1 change: 0 additions & 1 deletion admin/settings/appearance.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@
$temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('navexpandmycourses', new lang_string('navexpandmycourses', 'admin'), new lang_string('navexpandmycourses_desc', 'admin'), 1));
$sortoptions = array(
'sortorder' => new lang_string('sort_sortorder', 'admin'),
'fullname' => new lang_string('sort_fullname', 'admin'),
Expand Down
2 changes: 1 addition & 1 deletion admin/settings/top.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@
$ADMIN->add('root', new admin_category('unsupported', new lang_string('unsupported', 'admin'), true));

// hidden search script
$ADMIN->add('root', new admin_externalpage('search', new lang_string('searchresults'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
$ADMIN->add('root', new admin_externalpage('search', new lang_string('search', 'admin'), "$CFG->wwwroot/$CFG->admin/search.php", 'moodle/site:config', true));
8 changes: 4 additions & 4 deletions admin/tool/behat/tests/behat/data_generators.feature
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Feature: Set up contextual data for tests
And I am on site homepage
And I follow "Courses"
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I click on "Grades" "link" in the "Navigation" "block"
Then I should see "Grade category 1"
And I should see "Grade sub category 2"

Expand All @@ -349,7 +349,7 @@ Feature: Set up contextual data for tests
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I click on "Grades" "link" in the "Navigation" "block"
And I expand "Setup" node
And I follow "Gradebook setup"
Then I should see "Test Grade Item 1"
Expand Down Expand Up @@ -380,7 +380,7 @@ Feature: Set up contextual data for tests
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I click on "Grades" "link" in the "Navigation" "block"
And I follow "Scales"
Then I should see "Test Scale 1"
And I should see "Disappointing, Good, Very good, Excellent"
Expand Down Expand Up @@ -432,7 +432,7 @@ Feature: Set up contextual data for tests
When I log in as "admin"
And I am on site homepage
And I follow "Course 1"
And I navigate to "Grades" node in "Course administration"
And I click on "Grades" "link" in the "Navigation" "block"
And I expand "Setup" node
And I follow "Gradebook setup"
Then I should see "Test Outcome Grade Item 1"
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/behat/tests/behat/edit_permissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ Feature: Edit capabilities
| Forum name | I'm the name |
| Description | I'm the introduction |
And I follow "I'm the name"
And I follow "Permissions"
And I navigate to "Permissions" node in "Forum administration"
And I override the system permissions of "Student" role with:
| mod/forum:deleteanypost | Prohibit |
| mod/forum:editanypost | Prevent |
| mod/forum:addquestion | Allow |
When I set the field "Advanced role override" to "Student (3)"
And I press "Go"
And I click on "Go" "button" in the "region-main" "region"
Then "mod/forum:deleteanypost" capability has "Prohibit" permission
And "mod/forum:editanypost" capability has "Prevent" permission
And "mod/forum:addquestion" capability has "Allow" permission
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 @@ -37,7 +37,7 @@ Feature: Verify that all form fields values can be get and set
And I expand "Appearance" node
And I am on site homepage
And I follow "Course 1"
And I follow "Reset"
And I navigate to "Reset" node in "Course administration"
# Select (multi-select) - Checking "the select box should contain".
And I expand all fieldsets
And the "Unenrol users" select box should contain "No roles"
Expand Down
2 changes: 1 addition & 1 deletion admin/tool/behat/tests/behat/manipulate_forms.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Feature: Forms manipulation
Scenario: Basic forms manipulation
Given I log in as "admin"
And I follow "Preferences" in the user menu
And I follow "Edit profile"
And I click on "Edit profile" "link" in the "region-main" "region"
When I set the field "First name" to "Field value"
And I set the field "Select a country" to "Japan"
And I set the field "Unmask" to "1"
Expand Down
10 changes: 5 additions & 5 deletions admin/tool/behat/tests/behat/nasty_strings.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ Feature: Transform steps arguments
| Course 1 | C1 | 0 |
And I log in as "admin"
And I follow "Preferences" in the user menu
And I follow "Edit profile"
And I click on "Edit profile" "link" in the "region-main" "region"

Scenario: Use nasty strings on steps arguments
When I set the field "Surname" to "$NASTYSTRING1"
And I set the field "Description" to "$NASTYSTRING2"
And I set the field "City/town" to "$NASTYSTRING3"
And I press "Update profile"
And I follow "Edit profile"
And I click on "Edit profile" "link" in the "region-main" "region"
Then I should not see "NASTYSTRING"
And the field "Surname" matches value "$NASTYSTRING1"
And the field "City/town" matches value "$NASTYSTRING3"
Expand All @@ -29,7 +29,7 @@ Feature: Transform steps arguments
| Description | $NASTYSTRING2 |
| City/town | $NASTYSTRING3 |
And I press "Update profile"
And I follow "Edit profile"
And I click on "Edit profile" "link" in the "region-main" "region"
Then I should not see "NASTYSTRING"
# BEHAT Transformation regression - See MDL-56397
#And the field "Surname" matches value "$NASTYSTRING1"
Expand All @@ -41,7 +41,7 @@ Feature: Transform steps arguments
| Description | va\"lue2 |
And I set the field "City/town" to "va\"lue3"
And I press "Update profile"
And I follow "Edit profile"
And I click on "Edit profile" "link" in the "region-main" "region"
Then I should not see "NASTYSTRING"
And the field "First name" matches value "va\"lue1"
And the field "Description" matches value "va\\"lue2"
Expand All @@ -52,7 +52,7 @@ Feature: Transform steps arguments
And I set the following fields to these values:
| Surname | My Surname $NASTYSTRING2 |
And I press "Update profile"
And I follow "Edit profile"
And I click on "Edit profile" "link" in the "region-main" "region"
Then I should not see "NASTYSTRING"
And I should see "My Firstname"
And I should see "My Surname"
Expand Down
34 changes: 0 additions & 34 deletions admin/tool/lp/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,6 @@

defined('MOODLE_INTERNAL') || die();

/**
* This function extends the course navigation
*
* @param navigation_node $navigation The navigation node to extend
* @param stdClass $course The course to object for the tool
* @param context $coursecontext The context of the course
*/
function tool_lp_extend_navigation_course($navigation, $course, $coursecontext) {
if (!get_config('core_competency', 'enabled')) {
return;
}

// Check access to the course and competencies page.
$capabilities = array('moodle/competency:coursecompetencyview', 'moodle/competency:coursecompetencymanage');
$context = context_course::instance($course->id);
if (!has_any_capability($capabilities, $context) || !can_access_course($course)) {
return;
}

// Just a link to course competency.
$title = get_string('competencies', 'core_competency');
$path = new moodle_url("/admin/tool/lp/coursecompetencies.php", array('courseid' => $course->id));
$settingsnode = navigation_node::create($title,
$path,
navigation_node::TYPE_SETTING,
null,
null,
new pix_icon('i/competencies', ''));
if (isset($settingsnode)) {
$navigation->add_node($settingsnode);
}
}


/**
* This function extends the user navigation.
*
Expand Down
1 change: 1 addition & 0 deletions admin/tool/lp/tests/behat/user_evidence_comp_link.feature
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Feature: Manage competencies linked to evidence of prior learning

Scenario: Link competency to evidence of prior learning from list
Given I follow "Evidence of prior learning"
And I change window size to "large"
And I should see "List of evidence"
And I should see "Test-Evidence"
And I click on "Link" of edit menu in the "Test-Evidence" row
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/monitor/tests/behat/subscription.feature
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,15 @@ Feature: tool_monitor_subscriptions
When I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
Then I should see "You can manage rules from the Event monitoring rules page."
And I follow "Event monitoring rules"
And I click on "Event monitoring rules" "link" in the "region-main" "region"
And I should see "You can subscribe to rules from the Event monitoring page."
And I log out
And I log in as "teacher1"
And I follow "Preferences" in the user menu
And I follow "Event monitoring"
And I set the field "Select a course" to "Course 1"
And I should see "You can manage rules from the Event monitoring rules page."
And I follow "Event monitoring rules"
And I click on "Event monitoring rules" "link" in the "region-main" "region"
And I should see "You can subscribe to rules from the Event monitoring page."
And I click on "//a[text()='Event monitoring']" "xpath_element"
And the field "courseid" matches value "Course 1"
Expand Down
6 changes: 3 additions & 3 deletions admin/tool/recyclebin/tests/behat/backup_user_data.feature
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ Feature: Backup user data
And I follow "Course 1"
And I turn editing mode on
And I delete "Quiz 1" activity
And I follow "Recycle bin"
And I navigate to "Recycle bin" node in "Course administration"
And I should see "Quiz 1"
And I follow "Restore"
And I click on "Restore" "link" in the "region-main" "region"
And I log out
And I log in as "student1"
And I follow "Course 1"
When I navigate to "Grades" node in "Course administration"
When I click on "Grades" "link" in the "Navigation" "block"
Then "Quiz 1" row "Grade" column of "user-grade" table should contain "5"
And "Quiz 1" row "Percentage" column of "user-grade" table should contain "50"
12 changes: 6 additions & 6 deletions admin/tool/recyclebin/tests/behat/basic_functionality.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Feature: Basic recycle bin functionality
| Assignment name | Test assign |
| Description | Test |
And I delete "Test assign" activity
When I follow "Recycle bin"
When I navigate to "Recycle bin" node in "Course administration"
Then I should see "Test assign"
And I should see "Contents will be permanently deleted after 7 days"
And I follow "Restore"
And I click on "Restore" "link" in the "region-main" "region"
And I should see "'Test assign' has been restored"
And I wait to be redirected
And I am on homepage
Expand All @@ -51,10 +51,10 @@ Feature: Basic recycle bin functionality
And I press "Continue"
And I go to the courses management page
And I should not see "Course 2" in the "#course-listing" "css_element"
When I follow "Recycle bin"
When I navigate to "Recycle bin" node in "Category: Miscellaneous"
Then I should see "Course 2"
And I should see "Contents will be permanently deleted after 14 days"
And I follow "Restore"
And I click on "Restore" "link" in the "region-main" "region"
And I should see "'Course 2' has been restored"
And I wait to be redirected
And I go to the courses management page
Expand All @@ -69,7 +69,7 @@ Feature: Basic recycle bin functionality
| Assignment name | Test assign |
| Description | Test |
And I delete "Test assign" activity
And I follow "Recycle bin"
And I navigate to "Recycle bin" node in "Course administration"
When I click on "Delete" "link"
Then I should see "Are you sure you want to delete the selected item from the recycle bin?"
And I press "Cancel"
Expand All @@ -92,7 +92,7 @@ Feature: Basic recycle bin functionality
| Description | Test 2 |
And I delete "Test assign 1" activity
And I delete "Test assign 2" activity
And I follow "Recycle bin"
And I navigate to "Recycle bin" node in "Course administration"
And I should see "Test assign 1"
And I should see "Test assign 2"
When I click on "Delete all" "link"
Expand Down
3 changes: 2 additions & 1 deletion backup/util/ui/tests/behat/restore_moodle2_courses.feature
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Feature: Restore Moodle 2 course backups
And I add a "Forum" to section "1" and I fill the form with:
| Forum name | Test forum post backup name |
| Description | Test forum post backup description |
And I follow "Restore"
And I navigate to "Restore" node in "Course administration"
And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
| Schema | Section 3 | 0 |
Then I should see "Course 1"
Expand All @@ -91,6 +91,7 @@ Feature: Restore Moodle 2 course backups
| id_startdate_month | January |
| id_startdate_year | 2020 |
| id_format | Weekly format |
| id_enddate_enabled | 0 |
And I press "Save and display"
And I should see "1 January - 7 January"
And I should see "Test forum name"
Expand Down
Loading

0 comments on commit 48f4309

Please sign in to comment.