Permalink
Browse files

MDL-20636 Merge vle/master into ouqe2

Conflicts:
	mod/quiz/locallib.php
	mod/quiz/report/overview/overview_table.php
	mod/quiz/report/overview/report.php
	mod/quiz/report/responses/report.php
	question/type/random/questiontype.php
  • Loading branch information...
2 parents 404da23 + eabbb12 commit e2cba246b724efe1ef72bc98d70b92e37999a0be @timhunt timhunt committed Mar 2, 2011
Showing with 2,797 additions and 1,189 deletions.
  1. +1 −1 admin/cli/automated_backups.php
  2. +27 −0 admin/registration/lib.php
  3. +2 −16 admin/registration/register.php
  4. +76 −0 admin/registration/renewregistration.php
  5. +3 −3 admin/report/courseoverview/index.php
  6. +1 −0 admin/settings/location.php
  7. +1 −0 admin/settings/server.php
  8. +7 −1 admin/uploaduser.php
  9. +10 −2 admin/uploaduser_form.php
  10. +1 −1 admin/user/user_bulk_message.php
  11. +2 −2 auth/shibboleth/auth.php
  12. +50 −0 backup/moodle2/backup_format_plugin.class.php
  13. +1 −0 backup/moodle2/backup_plan_builder.class.php
  14. +22 −2 backup/moodle2/backup_plugin.class.php
  15. +18 −1 backup/moodle2/backup_stepslib.php
  16. +21 −1 backup/moodle2/backup_subplugin.class.php
  17. +33 −0 backup/moodle2/restore_format_plugin.class.php
  18. +2 −0 backup/moodle2/restore_plan_builder.class.php
  19. +12 −0 backup/moodle2/restore_plugin.class.php
  20. +1 −1 backup/moodle2/restore_qtype_plugin.class.php
  21. +10 −0 backup/moodle2/restore_section_task.class.php
  22. +69 −34 backup/moodle2/restore_stepslib.php
  23. +12 −0 backup/moodle2/restore_subplugin.class.php
  24. +43 −19 backup/util/dbops/backup_plan_dbops.class.php
  25. +25 −49 backup/util/helper/backup_cron_helper.class.php
  26. +9 −1 backup/util/plan/backup_structure_step.class.php
  27. +29 −4 backup/util/plan/restore_structure_step.class.php
  28. +4 −0 backup/util/structure/base_nested_element.class.php
  29. +11 −0 backup/util/structure/simpletest/testbasenestedelement.php
  30. +8 −3 backup/util/xml/parser/processors/simplified_parser_processor.class.php
  31. +12 −2 backup/util/xml/parser/progressive_parser.class.php
  32. +3 −0 backup/util/xml/parser/simpletest/fixtures/test4.xml
  33. +10 −9 blocks/moodleblock.class.php
  34. +2 −1 blocks/news_items/block_news_items.php
  35. +1 −1 blocks/online_users/block_online_users.php
  36. +4 −3 blocks/rss_client/edit_form.php
  37. +19 −5 blog/lib.php
  38. +1 −1 blog/rsslib.php
  39. +1 −5 course/format/topics/format.php
  40. +1 −5 course/format/weeks/format.php
  41. +57 −12 course/lib.php
  42. +1 −1 course/report/completion/index.php
  43. +1 −1 course/view.php
  44. +2 −3 enrol/authorize/lang/en/enrol_authorize.php
  45. +15 −9 enrol/category/locallib.php
  46. +1 −0 enrol/database/settings.php
  47. +1 −0 enrol/ldap/settings.php
  48. +4 −1 enrol/renderer.php
  49. +60 −54 filter/mediaplugin/filter.php
  50. +124 −0 filter/mediaplugin/simpletest/testfiltermediaplugin.php
  51. +4 −6 group/import.php
  52. +1 −1 group/import_form.php
  53. +1 −1 group/index.php
  54. +6 −6 install.php
  55. +3 −0 install/lang/ca/admin.php
  56. +2 −2 install/lang/de/install.php
  57. +21 −17 install/lang/pl/install.php
  58. +16 −3 install/lang/pt_br/install.php
  59. +2 −0 install/lang/sv/admin.php
  60. +4 −2 lang/en/admin.php
  61. +1 −1 lang/en/dbtransfer.php
  62. +0 −1 lang/en/edufields.php
  63. +0 −1 lang/en/grades.php
  64. +9 −0 lang/en/group.php
  65. +4 −3 lang/en/hub.php
  66. +3 −0 lang/en/message.php
  67. +0 −1 lang/en/moodle.php
  68. +5 −1 lib/accesslib.php
  69. +50 −6 lib/adminlib.php
  70. +7 −5 lib/db/install.xml
  71. +42 −3 lib/db/upgrade.php
  72. +4 −1 lib/ddl/oracle_sql_generator.php
  73. +20 −0 lib/ddl/postgres_sql_generator.php
  74. +21 −6 lib/dml/mysqli_native_moodle_database.php
  75. +112 −0 lib/dml/simpletest/testdml.php
  76. +15 −21 lib/dml/sqlsrv_native_moodle_database.php
  77. +1 −0 lib/dml/sqlsrv_native_moodle_recordset.php
  78. +17 −9 lib/filelib.php
  79. +11 −11 lib/messagelib.php
  80. 0 lib/minify/MOODLE_README.txt
  81. +25 −24 lib/minify/config.php
  82. +14 −5 lib/modinfolib.php
  83. +12 −13 lib/moodlelib.php
  84. +24 −31 lib/navigationlib.php
  85. +2 −2 lib/outputrenderers.php
  86. +1 −1 lib/outputrequirementslib.php
  87. +18 −12 lib/pagelib.php
  88. +2 −13 lib/sessionlib.php
  89. +33 −7 lib/setuplib.php
  90. +5 −4 lib/textlib.class.php
  91. +52 −29 lib/upgradelib.php
  92. +4 −5 lib/weblib.php
  93. +17 −14 login/change_password.php
  94. +1 −1 login/index.php
  95. +3 −0 login/signup_form.php
  96. +49 −30 message/index.php
  97. +742 −288 message/lib.php
  98. +1 −1 mod/chat/gui_basic/index.php
  99. +1 −1 mod/chat/gui_header_js/index.php
  100. +1 −1 mod/chat/gui_sockets/index.php
  101. +1 −1 mod/data/export_form.php
  102. +8 −20 mod/data/import.php
  103. +10 −1 mod/data/lang/en/data.php
  104. +2 −2 mod/data/lib.php
  105. +9 −4 mod/data/rsslib.php
  106. +8 −4 mod/data/templates.php
  107. +1 −1 mod/data/view.php
  108. +0 −1 mod/feedback/lang/en/feedback.php
  109. +19 −18 mod/forum/lib.php
  110. +2 −10 mod/forum/rsslib.php
  111. +2 −3 mod/forum/user.php
  112. +1 −0 mod/glossary/lang/en/glossary.php
  113. +49 −32 mod/glossary/lib.php
  114. +11 −7 mod/glossary/rsslib.php
  115. +13 −2 mod/glossary/sql.php
  116. +1 −1 mod/glossary/view.php
  117. +4 −1 mod/lesson/backup/moodle2/backup_lesson_stepslib.php
  118. +18 −0 mod/lesson/backup/moodle2/restore_lesson_stepslib.php
  119. +22 −0 mod/lesson/editpage.php
  120. +11 −6 mod/lesson/essay.php
  121. +4 −2 mod/lesson/report.php
  122. +2 −1 mod/quiz/backup/moodle2/backup_quiz_stepslib.php
  123. +7 −0 mod/quiz/backup/moodle2/restore_quiz_stepslib.php
  124. +4 −4 mod/quiz/locallib.php
  125. +10 −12 mod/resource/db/upgrade.php
  126. +0 −1 mod/resource/lang/en/resource.php
  127. +3 −2 mod/resource/view.php
  128. +16 −11 mod/scorm/db/upgrade.php
  129. +0 −6 mod/scorm/module.js
  130. +1 −1 mod/scorm/version.php
  131. +0 −1 mod/wiki/lang/en/wiki.php
  132. +0 −36 mod/workshop/allocation/manual/lib.php
  133. +5 −0 mod/workshop/allocation/manual/styles.css
  134. +1 −1 mod/workshop/allocation/random/lib.php
  135. +1 −1 mod/workshop/allocation/random/settings_form.php
  136. +44 −0 mod/workshop/db/upgrade.php
  137. +10 −29 mod/workshop/db/upgradelib.php
  138. +1 −2 mod/workshop/form/accumulative/db/upgradelib.php
  139. +1 −2 mod/workshop/form/comments/db/upgradelib.php
  140. +2 −3 mod/workshop/form/numerrors/db/upgradelib.php
  141. +12 −14 mod/workshop/form/rubric/db/upgradelib.php
  142. +2 −2 mod/workshop/lib.php
  143. +2 −2 mod/workshop/version.php
  144. +96 −0 question/format/gift/simpletest/testgiftformat.php
  145. +1 −1 question/qengine.js
  146. +2 −1 question/type/numerical/questiontype.php
  147. +2 −2 question/type/random/backup/moodle2/restore_qtype_random_plugin.class.php
  148. +2 −2 rating/rate_ajax.php
  149. +1 −1 repository/boxnet/lang/en/repository_boxnet.php
  150. +2 −2 repository/dropbox/lang/en/repository_dropbox.php
  151. +7 −7 repository/flickr_public/lang/en/repository_flickr_public.php
  152. +1 −1 repository/merlot/lang/en/repository_merlot.php
  153. +15 −1 repository/upload/lib.php
  154. +2 −2 repository/url/lang/en/repository_url.php
  155. +79 −44 tag/lib.php
  156. +5 −0 theme/base/style/message.css
  157. +4 −3 theme/splash/lang/en/theme_splash.php
  158. +4 −1 theme/splash/style/blue.css
  159. +5 −14 theme/splash/style/green.css
  160. +4 −4 theme/yui_combo.php
  161. +3 −1 user/editlib.php
  162. +2 −0 user/filters/courserole.php
  163. +1 −1 user/messageselect.php
  164. +2 −3 user/portfolio.php
  165. +2 −0 user/portfoliologs.php
  166. +3 −2 user/profile.php
  167. +10 −3 user/view.php
  168. +2 −2 version.php
@@ -92,7 +92,7 @@
// Run automated backups if required.
require_once($CFG->dirroot.'/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot.'/backup/util/helper/backup_cron_helper.class.php');
-backup_cron_automated_helper::run_automated_backup(backup_cron_automated_helper::RUN_IMMEDIATLY);
+backup_cron_automated_helper::run_automated_backup(backup_cron_automated_helper::RUN_IMMEDIATELY);
mtrace("Automated cron backups completed correctly");
View
@@ -84,6 +84,33 @@ public function cron() {
}
}
+ /**
+ * Return the site secret for a given hub
+ * site identifier is assigned to Mooch
+ * each hub has a unique and personal site secret.
+ * @param string $huburl
+ * @return string site secret
+ */
+ public function get_site_secret_for_hub($huburl) {
+ global $DB;
+
+ $existingregistration = $DB->get_record('registration_hubs',
+ array('huburl' => $huburl));
+
+ if (!empty($existingregistration)) {
+ return $existingregistration->secret;
+ }
+
+ if ($huburl == HUB_MOODLEORGHUBURL) {
+ $siteidentifier = get_site_identifier();
+ } else {
+ $siteidentifier = random_string(32) . $_SERVER['HTTP_HOST'];
+ }
+
+ return $siteidentifier;
+
+ }
+
/**
* When the site register on a hub, he must call this function
* @param object $hub where the site is registered on
@@ -49,21 +49,6 @@
throw new moodle_exception('missingparameter');
}
-/* TO DO
- if DB config plugin table is not good for dealing with token reference and token confirmation
- => create other DB table
- -----------------------------------------------------------------------------
- Local Type | Token | Local WS | Remote Type | Remote URL | Confirmed
- -----------------------------------------------------------------------------
- HUB 4er4e server HUB-DIRECTORY http...moodle.org Yes
- HUB 73j53 client HUB-DIRECTORY http...moodle.org Yes
- SITE dfsd7 server HUB http...hub Yes
- SITE fd8fd client HUB http...hub Yes
- HUB ds78s server SITE http...site.com Yes
- HUB-DIR. d7d8s server HUB http...hub Yes
- -----------------------------------------------------------------------------
- */
-
$registrationmanager = new registration_manager();
$registeredhub = $registrationmanager->get_registeredhub($huburl);
@@ -132,7 +117,8 @@
if (empty($unconfirmedhub)) {
//we save the token into the communication table in order to have a reference
$unconfirmedhub = new stdClass();
- $unconfirmedhub->token = get_site_identifier();
+ $unconfirmedhub->token = $registrationmanager->get_site_secret_for_hub($huburl);
+ $unconfirmedhub->secret = $unconfirmedhub->token;
$unconfirmedhub->huburl = $huburl;
$unconfirmedhub->hubname = $hubname;
$unconfirmedhub->confirmed = 0;
@@ -0,0 +1,76 @@
+<?php
+
+///////////////////////////////////////////////////////////////////////////
+// //
+// This file is part of Moodle - http://moodle.org/ //
+// Moodle - Modular Object-Oriented Dynamic Learning Environment //
+// //
+// 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/>. //
+// //
+///////////////////////////////////////////////////////////////////////////
+
+/*
+ * @package moodle
+ * @subpackage registration
+ * @author Jerome Mouneyrac <jerome@mouneyrac.com>
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL
+ * @copyright (C) 1999 onwards Martin Dougiamas http://dougiamas.com
+ *
+ * The administrator is redirect to this page from the hub to renew a registration
+ * process because
+ */
+
+require('../../config.php');
+require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
+
+$url = optional_param('url', '', PARAM_URL);
+$hubname = optional_param('hubname', '', PARAM_TEXT);
+$token = optional_param('token', '', PARAM_TEXT);
+
+admin_externalpage_setup('registrationindex');
+
+//check that we are waiting a confirmation from this hub, and check that the token is correct
+$registrationmanager = new registration_manager();
+$registeredhub = $registrationmanager->get_unconfirmedhub($url);
+if (!empty($registeredhub) and $registeredhub->token == $token) {
+
+ echo $OUTPUT->header();
+ echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
+ $hublink = html_writer::tag('a', $hubname, array('href' => $url));
+
+ $registrationmanager->delete_registeredhub($url);
+
+ //Mooch case, need to recreate the siteidentifier
+ if ($url == HUB_MOODLEORGHUBURL) {
+ $CFG->siteidentifier = null;
+ get_site_identifier();
+ }
+
+ $deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
+
+ $button = new single_button(new moodle_url('/admin/registration/index.php'),
+ get_string('restartregistration', 'hub'));
+ $button->class = 'restartregbutton';
+
+ echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
+ array('class' => 'mdl-align'));
+
+ echo $OUTPUT->footer();
+} else {
+ throw new moodle_exception('wrongtoken', 'hub',
+ $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
+}
+
+
@@ -8,9 +8,6 @@
$time = optional_param('time', 0, PARAM_INT);
$numcourses = optional_param('numcourses', 20, PARAM_INT);
- admin_externalpage_setup('reportcourseoverview');
- echo $OUTPUT->header();
-
if (empty($CFG->enablestats)) {
if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
@@ -19,6 +16,9 @@
}
}
+ admin_externalpage_setup('reportcourseoverview');
+ echo $OUTPUT->header();
+
$course = get_site();
stats_check_uptodate($course->id);
@@ -10,6 +10,7 @@
$options[99] = get_string('timezonenotforced', 'admin');
$temp->add(new admin_setting_configselect('forcetimezone', get_string('forcetimezone', 'admin'), get_string('helpforcetimezone', 'admin'), 99, $options));
$temp->add(new admin_settings_country_select('country', get_string('country', 'admin'), get_string('configcountry', 'admin'), 0));
+ $temp->add(new admin_setting_configtext('defaultcity', get_string('defaultcity', 'admin'), get_string('defaultcity_help', 'admin'), ''));
$temp->add(new admin_setting_heading('iplookup', get_string('iplookup', 'admin'), get_string('iplookupinfo', 'admin')));
$temp->add(new admin_setting_configfile('geoipfile', get_string('geoipfile', 'admin'), get_string('configgeoipfile', 'admin', $CFG->dataroot.'/geoip/'), $CFG->dataroot.'/geoip/GeoLiteCity.dat'));
@@ -266,5 +266,6 @@
$ADMIN->add('server', new admin_externalpage('adminregistration', get_string('registration','admin'), "$CFG->wwwroot/$CFG->admin/registration/index.php"));
+$ADMIN->add('root', new admin_externalpage('bloglevelupgrade', get_string('bloglevelupgrade', 'admin'), $CFG->wwwroot.'/'.$CFG->admin.'/blocklevelupgrade.php', 'moodle/site:config', true));
} // end of speedup
View
@@ -295,7 +295,13 @@
}
if (isset($formdata->$field)) {
// process templates
- $user->$field = process_template($formdata->$field, $user);
+ if (is_array($formdata->$field)) {
+ foreach ($formdata->$field as $k=>$v) {
+ $user->$field[$k] = process_template($v, $user);
+ }
+ } else {
+ $user->$field = process_template($formdata->$field, $user);
+ }
}
}
View
@@ -206,10 +206,18 @@ function definition (){
$mform->addElement('text', 'city', get_string('city'), 'maxlength="100" size="25"');
$mform->setType('city', PARAM_MULTILANG);
- $mform->setDefault('city', $templateuser->city);
+ if (empty($CFG->defaultcity)) {
+ $mform->setDefault('city', $templateuser->city);
+ } else {
+ $mform->setDefault('city', $CFG->defaultcity);
+ }
$mform->addElement('select', 'country', get_string('selectacountry'), get_string_manager()->get_list_of_countries());
- $mform->setDefault('country', $templateuser->country);
+ if (empty($CFG->country)) {
+ $mform->setDefault('country', $templateuser->country);
+ } else {
+ $mform->setDefault('country', $CFG->country);
+ }
$mform->setAdvanced('country');
$choices = get_list_of_timezones();
@@ -30,7 +30,7 @@
//TODO we should probably support all text formats here or only FORMAT_MOODLE
//For now bulk messaging is still using the html editor and its supplying html
//so we have to use html format for it to be displayed correctly
- message_post_message($USER, $user, $msg, FORMAT_HTML, 'direct');
+ message_post_message($USER, $user, $msg, FORMAT_HTML);
}
$rs->close();
redirect($return);
View
@@ -242,7 +242,7 @@ function process_config($config) {
// set to defaults if undefined
if (!isset($config->auth_instructions) or empty($config->user_attribute)) {
- $config->auth_instructions = get_string('shibboleth_instructions', 'auth', $CFG->wwwroot.'/auth/shibboleth/index.php');
+ $config->auth_instructions = get_string('auth_shib_instructions', 'auth_shibboleth', $CFG->wwwroot.'/auth/shibboleth/index.php');
}
if (!isset ($config->user_attribute)) {
$config->user_attribute = '';
@@ -292,7 +292,7 @@ function process_config($config) {
} else {
// Check if integrated WAYF was enabled and is now turned off
// If it was and only then, reset the Moodle alternate URL
- if ($this->config->alt_login == 'on'){
+ if (isset($this->config->alt_login) and $this->config->alt_login == 'on'){
set_config('alt_login', 'off', 'auth/shibboleth');
set_config('alternateloginurl', '');
}
@@ -0,0 +1,50 @@
+<?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/>.
+
+/**
+ * @package moodlecore
+ * @subpackage backup-moodle2
+ * @copyright 2011 onwards Eloy Lafuente (stronk7) {@link http://stronk7.com}
+ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+/**
+ * Class extending standard backup_plugin in order to implement some
+ * helper methods related with the course formats (format plugin)
+ *
+ * TODO: Finish phpdocs
+ */
+abstract class backup_format_plugin extends backup_plugin {
+
+ protected $courseformat; // To store the format (course->format) of the instance
+
+ public function __construct($plugintype, $pluginname, $optigroup, $step) {
+
+ parent::__construct($plugintype, $pluginname, $optigroup, $step);
+
+ $this->courseformat = backup_plan_dbops::get_courseformat_from_courseid($this->task->get_courseid());
+
+ }
+
+ /**
+ * Return the condition encapsulated into sqlparam format
+ * to get evaluated by value, not by path nor processor setting
+ */
+ protected function get_format_condition() {
+ return array('sqlparam' => $this->courseformat);
+ }
+}
@@ -34,6 +34,7 @@
require_once($CFG->dirroot . '/backup/moodle2/backup_xml_transformer.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_qtype_plugin.class.php');
+require_once($CFG->dirroot . '/backup/moodle2/backup_format_plugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_subplugin.class.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_settingslib.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_stepslib.php');
@@ -33,12 +33,16 @@
protected $pluginname;
protected $connectionpoint;
protected $optigroup; // Optigroup, parent of all optigroup elements
+ protected $step;
+ protected $task;
- public function __construct($plugintype, $pluginname, $optigroup) {
+ public function __construct($plugintype, $pluginname, $optigroup, $step) {
$this->plugintype = $plugintype;
$this->pluginname = $pluginname;
- $this->optigroup = $optigroup;
+ $this->optigroup = $optigroup;
$this->connectionpoint = '';
+ $this->step = $step;
+ $this->task = $step->get_task();
}
public function define_plugin_structure($connectionpoint) {
@@ -52,6 +56,22 @@ public function define_plugin_structure($connectionpoint) {
}
}
+// Protected API starts here
+
+// backup_step/structure_step/task wrappers
+
+ /**
+ * Returns the value of one (task/plan) setting
+ */
+ protected function get_setting_value($name) {
+ if (is_null($this->task)) {
+ throw new backup_step_exception('not_specified_backup_task');
+ }
+ return $this->task->get_setting_value($name);
+ }
+
+// end of backup_step/structure_step/task wrappers
+
/**
* Factory method that will return one backup_plugin_element (backup_optigroup_element)
* with its name automatically calculated, based one the plugin being handled (type, name)
Oops, something went wrong.

0 comments on commit e2cba24

Please sign in to comment.