Skip to content

Commit

Permalink
Merge branch 'MOODLE_25_STABLE' into install_25_STABLE
Browse files Browse the repository at this point in the history
  • Loading branch information
AMOS bot committed Sep 6, 2013
2 parents ce1a153 + d883550 commit ce31fcc
Show file tree
Hide file tree
Showing 83 changed files with 862 additions and 294 deletions.
4 changes: 3 additions & 1 deletion admin/renderer.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1001,9 +1001,11 @@ protected function required_column(plugininfo_base $plugin, plugin_manager $plug
} else { } else {
$str = 'otherplugin'; $str = 'otherplugin';
} }
$componenturl = new moodle_url('https://moodle.org/plugins/view.php?plugin='.$component);
$componenturl = html_writer::tag('a', $component, array('href' => $componenturl->out()));
$requires[] = html_writer::tag('li', $requires[] = html_writer::tag('li',
get_string($str, 'core_plugin', get_string($str, 'core_plugin',
array('component' => $component, 'version' => $requiredversion)), array('component' => $componenturl, 'version' => $requiredversion)),
array('class' => $class)); array('class' => $class));
} }


Expand Down
4 changes: 3 additions & 1 deletion admin/repository.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -143,8 +143,10 @@ function repository_action_url($repository) {
$success = $repositorytype->update_options($settings); $success = $repositorytype->update_options($settings);
} else { } else {
$type = new repository_type($plugin, (array)$fromform, $visible); $type = new repository_type($plugin, (array)$fromform, $visible);
$type->create();
$success = true; $success = true;
if (!$repoid = $type->create()) {
$success = false;
}
$data = data_submitted(); $data = data_submitted();
} }
if ($success) { if ($success) {
Expand Down
6 changes: 3 additions & 3 deletions admin/tool/behat/renderer.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();


global $CFG; global $CFG;
require_once($CFG->libdir . '/behat/classes/behat_command.php'); require_once($CFG->libdir . '/behat/classes/behat_selectors.php');


/** /**
* Renderer for behat tool web features * Renderer for behat tool web features
Expand Down Expand Up @@ -92,15 +92,15 @@ public function render_stepsdefinitions($stepsdefinitions, $form) {
// Replace text selector type arguments with a user-friendly select. // Replace text selector type arguments with a user-friendly select.
$stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\d?_STRING)/', $stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\d?_STRING)/',
function ($matches) { function ($matches) {
return html_writer::select(behat_command::$allowedtextselectors, uniqid()); return html_writer::select(behat_selectors::get_allowed_text_selectors(), uniqid());
}, },
$stepsdefinitions $stepsdefinitions
); );


// Replace selector type arguments with a user-friendly select. // Replace selector type arguments with a user-friendly select.
$stepsdefinitions = preg_replace_callback('/(SELECTOR\d?_STRING)/', $stepsdefinitions = preg_replace_callback('/(SELECTOR\d?_STRING)/',
function ($matches) { function ($matches) {
return html_writer::select(behat_command::$allowedselectors, uniqid()); return html_writer::select(behat_selectors::get_allowed_selectors(), uniqid());
}, },
$stepsdefinitions $stepsdefinitions
); );
Expand Down
4 changes: 2 additions & 2 deletions admin/tool/behat/tests/behat/basic_actions.feature
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Feature: Page contents assertions
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And I log in as "admin" And I log in as "admin"
And I follow "Course 1" And I follow "Course 1"
When I click on "Move this to the dock" "button" in the ".block_settings" "css_element" When I click on "Move this to the dock" "button" in the "Administration" "block"
Then I should not see "Question bank" Then I should not see "Question bank"
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element" And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"


Expand All @@ -45,5 +45,5 @@ Feature: Page contents assertions
| fullname | shortname | category | | fullname | shortname | category |
| Course 1 | C1 | 0 | | Course 1 | C1 | 0 |
And I log in as "admin" And I log in as "admin"
When I click on "Move this to the dock" "button" in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' block_settings ')]" "xpath_element" When I click on "Move this to the dock" "button" in the "Administration" "block"
Then I should not see "Turn editing on" Then I should not see "Turn editing on"
4 changes: 2 additions & 2 deletions admin/tool/langimport/lang/en/tool_langimport.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */


$string['install'] = 'Install selected language pack'; $string['install'] = 'Install selected language pack(s)';
$string['installedlangs'] = 'Installed language packs'; $string['installedlangs'] = 'Installed language packs';
$string['langimport'] = 'Language import utility'; $string['langimport'] = 'Language import utility';
$string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level. Do not forget to purge string caches after you do so.'; $string['langimportdisabled'] = 'Language import feature has been disabled. You have to update your language packs manually at the file-system level. Do not forget to purge string caches after you do so.';
Expand All @@ -38,7 +38,7 @@
$string['pluginname'] = 'Language packs'; $string['pluginname'] = 'Language packs';
$string['purgestringcaches'] = 'Purge string caches'; $string['purgestringcaches'] = 'Purge string caches';
$string['remotelangnotavailable'] = 'Because Moodle cannot connect to download.moodle.org, it is not possible for language packs to be installed automatically. Please download the appropriate ZIP file(s) from <a href="http://download.moodle.org/langpack/">download.moodle.org/langpack</a>, copy them to your {$a} directory and unzip them manually.'; $string['remotelangnotavailable'] = 'Because Moodle cannot connect to download.moodle.org, it is not possible for language packs to be installed automatically. Please download the appropriate ZIP file(s) from <a href="http://download.moodle.org/langpack/">download.moodle.org/langpack</a>, copy them to your {$a} directory and unzip them manually.';
$string['uninstall'] = 'Uninstall selected language pack'; $string['uninstall'] = 'Uninstall selected language pack(s)';
$string['uninstallconfirm'] = 'You are about to completely uninstall language pack {$a}, are you sure?'; $string['uninstallconfirm'] = 'You are about to completely uninstall language pack {$a}, are you sure?';
$string['updatelangs'] = 'Update all installed language packs'; $string['updatelangs'] = 'Update all installed language packs';


42 changes: 28 additions & 14 deletions admin/tool/xmldb/lang/en/tool_xmldb.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,24 +33,38 @@
$string['confirmdeletekey'] = 'Are you absolutely sure that you want to delete the key:'; $string['confirmdeletekey'] = 'Are you absolutely sure that you want to delete the key:';
$string['confirmdeletetable'] = 'Are you absolutely sure that you want to delete the table:'; $string['confirmdeletetable'] = 'Are you absolutely sure that you want to delete the table:';
$string['confirmdeletexmlfile'] = 'Are you absolutely sure that you want to delete the file:'; $string['confirmdeletexmlfile'] = 'Are you absolutely sure that you want to delete the file:';
$string['confirmcheckbigints'] = 'This functionality will search for <a href="http://tracker.moodle.org/browse/MDL-11038">potential wrong integer fields</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined.<br /><br /> $string['confirmcheckbigints'] = 'This functionality will search for <a href="http://tracker.moodle.org/browse/MDL-11038">potential wrong integer fields</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the integers in your DB properly defined.
Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).<br /><br />
It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of wrong integers.<br /><br /> Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of wrong integers.
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmcheckdefaults'] = 'This functionality will search for inconsistent default values in your Moodle server, generating (but not executing!) the needed SQL statements to have all the default values properly defined.<br /><br /> $string['confirmcheckdefaults'] = 'This functionality will search for inconsistent default values in your Moodle server, generating (but not executing!) the needed SQL statements to have all the default values properly defined.
Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).<br /><br />
It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of inconsistent default values.<br /><br /> Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of inconsistent default values.
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmcheckforeignkeys'] = 'This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.)<br /><br /> $string['confirmcheckforeignkeys'] = 'This functionality will search for potential violations of the foreign keys defined in the install.xml definitions. (Moodle does not currently generate actual foreign key constraints in the database, which is why invalid data may be present.)
It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of missing indexes.<br /><br />
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes.
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmcheckindexes'] = 'This functionality will search for potential missing indexes in your Moodle server, generating (but not executing!) automatically the needed SQL statements to keep everything updated.<br /><br /> $string['confirmcheckindexes'] = 'This functionality will search for potential missing indexes in your Moodle server, generating (but not executing!) automatically the needed SQL statements to keep everything updated.
Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).<br /><br />
It\'s highly recommended to be running the latest (+ version) available of your Moodle release (1.8, 1.9, 2.x ...) before executing the search of missing indexes.<br /><br /> Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of missing indexes.
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmcheckoraclesemantics'] = 'This functionality will search for <a href="http://tracker.moodle.org/browse/MDL-29322">Oracle varchar2 columns using BYTE semantics</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the columns converted to use CHAR semantics instead (better for cross-db compatibility and increased contents max. length).<br /><br /> $string['confirmcheckoraclesemantics'] = 'This functionality will search for <a href="http://tracker.moodle.org/browse/MDL-29322">Oracle varchar2 columns using BYTE semantics</a> in your Moodle server, generating (but not executing!) automatically the needed SQL statements to have all the columns converted to use CHAR semantics instead (better for cross-db compatibility and increased contents max. length).
Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).<br /><br />
It\'s highly recommended to be running the latest (+ version) available of your Moodle release (2.2, 2.3, 2.x ...) before executing the search of BYTE semantics.<br /><br /> Once generated you can copy such statements and execute them safely with your favourite SQL interface (don\'t forget to backup your data before doing that).
It\'s highly recommended to be running the latest (+ version) available of your Moodle release before executing the search of BYTE semantics.
This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.'; This functionality doesn\'t perform any action against the DB (just reads from it), so can be safely executed at any moment.';
$string['confirmrevertchanges'] = 'Are you absolutely sure that you want to revert changes performed over:'; $string['confirmrevertchanges'] = 'Are you absolutely sure that you want to revert changes performed over:';
$string['create'] = 'Create'; $string['create'] = 'Create';
Expand Down
7 changes: 4 additions & 3 deletions backup/util/ui/tests/behat/backup_courses.feature
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ Feature: Backup Moodle courses
@javascript @javascript
Scenario: Backup a course providing options Scenario: Backup a course providing options
When I backup "Course 1" course using this options: When I backup "Course 1" course using this options:
| Filename | test_backup.mbz |
Then I should see "Restore" Then I should see "Restore"
And I click on "Restore" "link" in the ".backup-files-table" "css_element" And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
And I should see "URL of backup" And I should see "URL of backup"
And I should see "Anonymize user information" And I should see "Anonymize user information"


Expand All @@ -27,11 +28,11 @@ Feature: Backup Moodle courses
| setting_section_section_5_userinfo | 0 | | setting_section_section_5_userinfo | 0 |
| setting_section_section_5_included | 0 | | setting_section_section_5_included | 0 |
Then I should see "Restore" Then I should see "Restore"
And I click on "Restore" "link" in the ".backup-files-table" "css_element" And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
And I should not see "Section 3" And I should not see "Section 3"
And I press "Continue" And I press "Continue"
And I click on "Continue" "button" in the ".bcs-current-course" "css_element" And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exists And "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]/descendant::img" "xpath_element" should exists
And I check "Include course logs" And I check "Include course logs"
And I press "Cancel" And I press "Cancel"
And I click on "Cancel" "button" in the ".confirmation-dialogue" "css_element" And I click on "Cancel" "button" in the "Cancel backup" "dialogue"
51 changes: 48 additions & 3 deletions badges/external.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -27,14 +27,59 @@
require_once(dirname(dirname(__FILE__)) . '/config.php'); require_once(dirname(dirname(__FILE__)) . '/config.php');
require_once($CFG->libdir . '/badgeslib.php'); require_once($CFG->libdir . '/badgeslib.php');


$json = required_param('badge', PARAM_RAW); $json = optional_param('badge', null, PARAM_RAW);
// Redirect to homepage if users are trying to access external badge through old url.
if ($json) {
redirect($CFG->wwwroot, get_string('invalidrequest', 'error'), 3);
}

$hash = required_param('hash', PARAM_ALPHANUM);
$userid = required_param('user', PARAM_INT);

$PAGE->set_url(new moodle_url('/badges/external.php', array('hash' => $hash, 'user' => $userid)));

// Using the same setting as user profile page.
if (!empty($CFG->forceloginforprofiles)) {
require_login();
if (isguestuser()) {
$SESSION->wantsurl = $PAGE->url->out(false);
redirect(get_login_url());
}
} else if (!empty($CFG->forcelogin)) {
require_login();
}

// Get all external badges of a user.
$out = get_backpack_settings($userid);

// If we didn't find any badges then print an error.
if (is_null($out)) {
print_error('error:externalbadgedoesntexist', 'badges');
}

$badges = $out->badges;

// The variable to store the badge we want.
$badge = '';

// Loop through the badges and check if supplied badge hash exists in user external badges.
foreach ($badges as $b) {
if ($hash == hash("md5", $b->hostedUrl)) {
$badge = $b;
break;
}
}

// If we didn't find the badge a user might be trying to replace the userid parameter.
if (empty($badge)) {
print_error('error:externalbadgedoesntexist', 'badges');
}


$PAGE->set_context(context_system::instance()); $PAGE->set_context(context_system::instance());
$output = $PAGE->get_renderer('core', 'badges'); $output = $PAGE->get_renderer('core', 'badges');


$badge = new external_badge(unserialize($json)); $badge = new external_badge($badge, $userid);


$PAGE->set_url('/badges/external.php');
$PAGE->set_pagelayout('base'); $PAGE->set_pagelayout('base');
$PAGE->set_title(get_string('issuedbadge', 'badges')); $PAGE->set_title(get_string('issuedbadge', 'badges'));


Expand Down
3 changes: 3 additions & 0 deletions badges/mybackpack.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@
$PAGE->set_pagelayout('mydashboard'); $PAGE->set_pagelayout('mydashboard');


$backpack = $DB->get_record('badge_backpack', array('userid' => $USER->id)); $backpack = $DB->get_record('badge_backpack', array('userid' => $USER->id));
$badgescache = cache::make('core', 'externalbadges');


if ($disconnect && $backpack) { if ($disconnect && $backpack) {
require_sesskey(); require_sesskey();
$DB->delete_records('badge_external', array('backpackid' => $backpack->id)); $DB->delete_records('badge_external', array('backpackid' => $backpack->id));
$DB->delete_records('badge_backpack', array('userid' => $USER->id)); $DB->delete_records('badge_backpack', array('userid' => $USER->id));
$badgescache->delete($USER->id);
redirect(new moodle_url('/badges/mybackpack.php')); redirect(new moodle_url('/badges/mybackpack.php'));
} }


Expand Down Expand Up @@ -103,6 +105,7 @@
$DB->insert_record('badge_external', $obj); $DB->insert_record('badge_external', $obj);
} }
} }
$badgescache->delete($USER->id);
redirect(new moodle_url('/badges/mybadges.php')); redirect(new moodle_url('/badges/mybadges.php'));
} }
} else { } else {
Expand Down
Loading

0 comments on commit ce31fcc

Please sign in to comment.