Permalink
Browse files

Merge branch 'MOODLE_25_STABLE' into install_25_STABLE

  • Loading branch information...
AMOS bot
AMOS bot committed Sep 6, 2013
2 parents ce1a153 + d883550 commit ce31fccf0e8425fa7254b4a3b440c9856bced749
Showing with 862 additions and 294 deletions.
  1. +3 −1 admin/renderer.php
  2. +3 −1 admin/repository.php
  3. +3 −3 admin/tool/behat/renderer.php
  4. +2 −2 admin/tool/behat/tests/behat/basic_actions.feature
  5. +2 −2 admin/tool/langimport/lang/en/tool_langimport.php
  6. +28 −14 admin/tool/xmldb/lang/en/tool_xmldb.php
  7. +4 −3 backup/util/ui/tests/behat/backup_courses.feature
  8. +48 −3 badges/external.php
  9. +3 −0 badges/mybackpack.php
  10. +85 −14 badges/renderer.php
  11. +2 −2 blocks/course_list/lang/en/block_course_list.php
  12. +17 −17 blocks/navigation/tests/behat/view_my_courses.feature
  13. +12 −6 calendar/lib.php
  14. +1 −1 calendar/managesubscriptions.php
  15. +4 −2 calendar/renderer.php
  16. +4 −4 course/tests/behat/course_controls.feature
  17. +1 −0 enrol/ldap/lang/en/enrol_ldap.php
  18. +6 −0 enrol/ldap/lib.php
  19. +1 −1 error/index.php
  20. +5 −5 files/renderer.php
  21. +1 −1 grade/export/lib.php
  22. +8 −8 lang/en/admin.php
  23. +7 −1 lang/en/badges.php
  24. +1 −0 lang/en/cache.php
  25. +1 −1 lang/en/completion.php
  26. +1 −1 lang/en/error.php
  27. +1 −1 lang/en/install.php
  28. +1 −1 lang/en/mathslib.php
  29. +1 −0 lang/en/moodle.php
  30. +1 −1 lang/en/repository.php
  31. +14 −1 lib/badgeslib.php
  32. +6 −14 lib/behat/behat_base.php
  33. +0 −28 lib/behat/classes/behat_command.php
  34. +161 −0 lib/behat/classes/behat_selectors.php
  35. +1 −1 lib/blocklib.php
  36. +3 −0 lib/configonlylib.php
  37. +6 −0 lib/db/caches.php
  38. +1 −0 lib/dml/mssql_native_moodle_database.php
  39. +1 −0 lib/dml/sqlsrv_native_moodle_database.php
  40. +7 −0 lib/editor/tinymce/module.js
  41. +5 −3 lib/ldaplib.php
  42. +3 −2 lib/modinfolib.php
  43. +2 −0 lib/moodlelib.php
  44. +10 −0 lib/outputrenderers.php
  45. +6 −0 lib/tests/behat/behat_hooks.php
  46. +1 −1 lib/tests/configonlylib_test.php
  47. +55 −0 lib/tests/modinfolib_test.php
  48. +1 −1 lib/tests/moodlelib_test.php
  49. +2 −0 lib/upgrade.txt
  50. +1 −1 login/change_password.php
  51. +4 −0 mod/assign/backup/moodle2/restore_assign_stepslib.php
  52. +6 −5 mod/assign/locallib.php
  53. +8 −1 mod/assignment/backup/moodle1/lib.php
  54. +20 −0 mod/assignment/backup/moodle2/restore_assignment_stepslib.php
  55. +1 −0 mod/assignment/lang/en/assignment.php
  56. +6 −1 mod/assignment/lib.php
  57. +6 −2 mod/assignment/mod_form.php
  58. +5 −1 mod/assignment/view.php
  59. +1 −1 mod/feedback/lang/en/feedback.php
  60. +6 −6 mod/forum/lang/en/forum.php
  61. +3 −3 mod/forum/tests/behat/track_read_posts.feature
  62. +1 −1 mod/lesson/lang/en/lesson.php
  63. +1 −1 mod/lti/lang/en/lti.php
  64. +1 −25 portfolio/googledocs/db/upgrade.php
  65. +53 −0 portfolio/googledocs/db/upgradelib.php
  66. +1 −25 portfolio/picasa/db/upgrade.php
  67. +53 −0 portfolio/picasa/db/upgradelib.php
  68. +1 −0 question/engine/lib.php
  69. +1 −1 report/security/lang/en/report_security.php
  70. +8 −3 repository/coursefiles/lib.php
  71. +7 −2 repository/filepicker.js
  72. +1 −25 repository/googledocs/db/upgrade.php
  73. +53 −0 repository/googledocs/db/upgradelib.php
  74. +3 −10 repository/lib.php
  75. +1 −25 repository/picasa/db/upgrade.php
  76. +53 −0 repository/picasa/db/upgradelib.php
  77. +4 −2 repository/tests/behat/behat_filepicker.php
  78. +1 −0 theme/base/style/core.css
  79. +5 −0 theme/bootstrapbase/less/moodle/core.less
  80. +1 −1 theme/bootstrapbase/style/moodle.css
  81. +1 −2 user/messageselect.php
  82. +1 −1 user/profile/field/menu/lang/en/profilefield_menu.php
  83. +2 −2 version.php
View
@@ -1001,9 +1001,11 @@ protected function required_column(plugininfo_base $plugin, plugin_manager $plug
} else {
$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',
get_string($str, 'core_plugin',
- array('component' => $component, 'version' => $requiredversion)),
+ array('component' => $componenturl, 'version' => $requiredversion)),
array('class' => $class));
}
View
@@ -143,8 +143,10 @@ function repository_action_url($repository) {
$success = $repositorytype->update_options($settings);
} else {
$type = new repository_type($plugin, (array)$fromform, $visible);
- $type->create();
$success = true;
+ if (!$repoid = $type->create()) {
+ $success = false;
+ }
$data = data_submitted();
}
if ($success) {
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
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
@@ -92,15 +92,15 @@ public function render_stepsdefinitions($stepsdefinitions, $form) {
// Replace text selector type arguments with a user-friendly select.
$stepsdefinitions = preg_replace_callback('/(TEXT_SELECTOR\d?_STRING)/',
function ($matches) {
- return html_writer::select(behat_command::$allowedtextselectors, uniqid());
+ return html_writer::select(behat_selectors::get_allowed_text_selectors(), uniqid());
},
$stepsdefinitions
);
// Replace selector type arguments with a user-friendly select.
$stepsdefinitions = preg_replace_callback('/(SELECTOR\d?_STRING)/',
function ($matches) {
- return html_writer::select(behat_command::$allowedselectors, uniqid());
+ return html_writer::select(behat_selectors::get_allowed_selectors(), uniqid());
},
$stepsdefinitions
);
@@ -35,7 +35,7 @@ Feature: Page contents assertions
| Course 1 | C1 | 0 |
And I log in as "admin"
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"
And I click on "//div[@id='dock']/descendant::h2[normalize-space(.)='Administration']" "xpath_element"
@@ -45,5 +45,5 @@ Feature: Page contents assertions
| fullname | shortname | category |
| Course 1 | C1 | 0 |
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"
@@ -23,7 +23,7 @@
* @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['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.';
@@ -38,7 +38,7 @@
$string['pluginname'] = 'Language packs';
$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['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['updatelangs'] = 'Update all installed language packs';
@@ -33,24 +33,38 @@
$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['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 />
-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 />
+$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).
+
+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.';
-$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 />
-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 />
+$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).
+
+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.';
-$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 />
-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 />
+$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 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.';
-$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 />
-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 />
+$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).
+
+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.';
-$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 />
-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 />
+$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).
+
+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.';
$string['confirmrevertchanges'] = 'Are you absolutely sure that you want to revert changes performed over:';
$string['create'] = 'Create';
@@ -13,8 +13,9 @@ Feature: Backup Moodle courses
@javascript
Scenario: Backup a course providing options
When I backup "Course 1" course using this options:
+ | Filename | test_backup.mbz |
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 "Anonymize user information"
@@ -27,11 +28,11 @@ Feature: Backup Moodle courses
| setting_section_section_5_userinfo | 0 |
| setting_section_section_5_included | 0 |
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 press "Continue"
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 I check "Include course logs"
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"
View
@@ -27,14 +27,59 @@
require_once(dirname(dirname(__FILE__)) . '/config.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());
$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_title(get_string('issuedbadge', 'badges'));
View
@@ -53,11 +53,13 @@
$PAGE->set_pagelayout('mydashboard');
$backpack = $DB->get_record('badge_backpack', array('userid' => $USER->id));
+$badgescache = cache::make('core', 'externalbadges');
if ($disconnect && $backpack) {
require_sesskey();
$DB->delete_records('badge_external', array('backpackid' => $backpack->id));
$DB->delete_records('badge_backpack', array('userid' => $USER->id));
+ $badgescache->delete($USER->id);
redirect(new moodle_url('/badges/mybackpack.php'));
}
@@ -103,6 +105,7 @@
$DB->insert_record('badge_external', $obj);
}
}
+ $badgescache->delete($USER->id);
redirect(new moodle_url('/badges/mybadges.php'));
}
} else {
Oops, something went wrong.

0 comments on commit ce31fcc

Please sign in to comment.