Permalink
Browse files

Merge branch 'master' into install_master

  • Loading branch information...
2 parents b888d70 + e471fc6 commit fded9b6ea5f09f87931ba8f2e976da12d401c47d AMOS bot committed Apr 23, 2014
Showing with 875 additions and 387 deletions.
  1. +0 −11 admin/tool/log/classes/helper/reader.php
  2. +0 −38 admin/tool/log/store/legacy/db/access.php
  3. +0 −1 admin/tool/log/store/legacy/lang/en/logstore_legacy.php
  4. +1 −1 admin/tool/log/store/legacy/version.php
  5. +0 −38 admin/tool/log/store/standard/db/access.php
  6. +0 −1 admin/tool/log/store/standard/lang/en/logstore_standard.php
  7. +1 −1 admin/tool/log/store/standard/version.php
  8. +2 −0 auth/shibboleth/index.php
  9. +1 −1 availability/classes/frontend.php
  10. +29 −10 availability/classes/info.php
  11. +5 −3 availability/condition/group/classes/frontend.php
  12. +5 −3 availability/condition/grouping/classes/frontend.php
  13. +16 −0 availability/tests/behat/edit_availability.feature
  14. +10 −6 availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-debug.js
  15. +2 −2 availability/yui/build/moodle-core_availability-form/moodle-core_availability-form-min.js
  16. +10 −6 availability/yui/build/moodle-core_availability-form/moodle-core_availability-form.js
  17. +10 −6 availability/yui/src/form/js/form.js
  18. +4 −7 backup/moodle2/backup_stepslib.php
  19. +4 −4 backup/util/ui/renderer.php
  20. +2 −1 blocks/mentees/block_mentees.php
  21. +7 −1 course/user.php
  22. +8 −7 course/view.php
  23. +1 −1 grade/import/xml/lib.php
  24. +3 −3 index.php
  25. +3 −3 lang/en/badges.php
  26. +2 −0 lang/en/moodle.php
  27. +2 −0 lib/alfresco/README_MOODLE.txt
  28. +2 −2 lib/alfresco/Service/WebService/AlfrescoWebService.php
  29. +6 −1 lib/blocklib.php
  30. +112 −0 lib/classes/event/course_user_report_viewed.php
  31. +118 −0 lib/classes/event/course_viewed.php
  32. +0 −7 lib/classes/log/reader.php
  33. +2 −0 .../atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-debug.js
  34. +1 −1 ...or/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button-min.js
  35. +2 −0 ...editor/atto/plugins/collapse/yui/build/moodle-atto_collapse-button/moodle-atto_collapse-button.js
  36. +2 −0 lib/editor/atto/plugins/collapse/yui/src/button/js/button.js
  37. +3 −2 lib/editor/atto/plugins/equation/ajax.php
  38. +4 −0 lib/editor/atto/plugins/equation/styles.css
  39. +1 −1 .../atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-debug.js
  40. +2 −2 ...or/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button-min.js
  41. +1 −1 ...editor/atto/plugins/equation/yui/build/moodle-atto_equation-button/moodle-atto_equation-button.js
  42. +1 −1 lib/editor/atto/plugins/equation/yui/src/button/js/button.js
  43. +3 −15 lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-debug.js
  44. +2 −2 lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin-min.js
  45. +3 −15 lib/editor/atto/yui/build/moodle-editor_atto-plugin/moodle-editor_atto-plugin.js
  46. +3 −15 lib/editor/atto/yui/src/editor/js/editor-plugin-buttons.js
  47. +1 −0 lib/filelib.php
  48. +4 −1 lib/form/dndupload.js
  49. +1 −1 lib/installlib.php
  50. +5 −0 lib/moodlelib.php
  51. +2 −2 lib/outputrenderers.php
  52. +84 −0 lib/tests/events_test.php
  53. +1 −1 lib/tests/other/pdflibtestpage.php
  54. +2 −2 lib/weblib.php
  55. +21 −8 lib/yui/build/moodle-core-blocks/moodle-core-blocks-debug.js
  56. +2 −2 lib/yui/build/moodle-core-blocks/moodle-core-blocks-min.js
  57. +21 −8 lib/yui/build/moodle-core-blocks/moodle-core-blocks.js
  58. +3 −1 lib/yui/build/moodle-core-dock/moodle-core-dock-debug.js
  59. +3 −3 lib/yui/build/moodle-core-dock/moodle-core-dock-min.js
  60. +3 −1 lib/yui/build/moodle-core-dock/moodle-core-dock.js
  61. +1 −1 lib/yui/src/blocks/js/blocks.js
  62. +20 −7 lib/yui/src/blocks/js/manager.js
  63. +3 −1 lib/yui/src/dock/js/dock.js
  64. +2 −2 mod/chat/lib.php
  65. +5 −0 mod/quiz/locallib.php
  66. +2 −1 mod/quiz/overridedelete.php
  67. +2 −0 mod/quiz/report/attemptsreport.php
  68. +18 −6 mod/quiz/report/responses/responses_options.php
  69. +43 −38 mod/quiz/report/statistics/tests/stats_from_steps_walkthrough_test.php
  70. +37 −24 mod/quiz/tests/attempt_walkthrough_from_csv_test.php
  71. +3 −2 mod/survey/lib.php
  72. +70 −0 mod/wiki/tests/behat/edit_tags.feature
  73. +42 −0 my/tests/behat/restrict_available_blocks.feature
  74. BIN pix/moodlelogo-med.png
  75. BIN pix/moodlelogo.png
  76. +8 −8 question/type/multichoice/question.php
  77. +27 −12 question/type/multichoice/tests/question_multi_test.php
  78. +9 −17 question/type/multichoice/tests/question_single_test.php
  79. +3 −0 report/completion/styles.css
  80. +2 −2 report/log/classes/table_log.php
  81. +1 −1 report/loglive/classes/table_log.php
  82. +1 −0 report/progress/styles.css
  83. +1 −1 repository/alfresco/lang/en/repository_alfresco.php
  84. BIN theme/base/pix/favicon.ico
  85. +12 −0 theme/base/style/core.css
  86. +1 −1 user/filters/courserole.php
  87. +3 −3 user/profile/definelib.php
  88. +6 −6 user/profile/index.php
  89. +2 −2 user/profile/index_category_form.php
  90. +2 −2 version.php
@@ -61,15 +61,4 @@ public function get_description() {
}
return $this->store;
}
-
- /**
- * If the current user can access current store or not.
- *
- * @param \context $context
- *
- * @return bool
- */
- public function can_access(\context $context) {
- return has_capability('logstore/' . $this->store . ':read', $context);
- }
}
@@ -1,38 +0,0 @@
-<?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/>.
-
-/**
- * Defines the capabilities used by standard log store.
- *
- * @package logstore_legacy
- * @copyright 2013 Petr Skoda {@link http://skodak.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$capabilities = array(
- 'logstore/legacy:read' => array(
- 'riskbitmask' => RISK_PERSONAL,
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => array(
- 'manager' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'teacher' => CAP_ALLOW,
- ),
- ),
-);
@@ -23,7 +23,6 @@
*/
$string['event_legacy_logged'] = 'Legacy event logged';
-$string['legacy:read'] = 'Read logs';
$string['loglegacy'] = 'Log legacy data';
$string['loglegacy_help'] = 'This plugin records log data to the legacy log table (mdl_log). This functionality has been replaced by newer, richer and more efficient logging plugins, so you should only run this plugin if you have old custom reports that directly query the old log table. Writing to the legacy logs will increase load, so it is recommended that you disable this plugin for performance reasons when it is not needed.';
$string['pluginname'] = 'Legacy log';
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2014031300; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2014041700; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014031200; // Requires this Moodle version.
$plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
@@ -1,38 +0,0 @@
-<?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/>.
-
-/**
- * Defines the capabilities used by standard log store.
- *
- * @package logstore_standard
- * @copyright 2013 Petr Skoda {@link http://skodak.org}
- * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-$capabilities = array(
- 'logstore/standard:read' => array(
- 'riskbitmask' => RISK_PERSONAL,
- 'captype' => 'read',
- 'contextlevel' => CONTEXT_MODULE,
- 'archetypes' => array(
- 'manager' => CAP_ALLOW,
- 'editingteacher' => CAP_ALLOW,
- 'teacher' => CAP_ALLOW,
- ),
- ),
-);
@@ -25,5 +25,4 @@
$string['buffersize'] = 'Write buffer size';
$string['pluginname'] = 'Standard log';
$string['pluginname_desc'] = 'A log plugin stores log entries in a Moodle database table.';
-$string['standard:read'] = 'Read logs';
$string['taskcleanup'] = 'Log table cleanup';
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2014041500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->version = 2014041700; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2014031200; // Requires this Moodle version.
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
@@ -4,7 +4,9 @@
require('../../config.php');
+ $context = context_system::instance();
$PAGE->set_url('/auth/shibboleth/index.php');
+ $PAGE->set_context($context);
// Support for WAYFless URLs.
$target = optional_param('target', '', PARAM_LOCALURL);
@@ -172,7 +172,7 @@ public static function report_validation_errors(array $data, array &$errors) {
$decoded = json_decode($data['availabilityconditionsjson']);
if (!$decoded) {
// This shouldn't be possible.
- throw new coding_exception('Invalid JSON from availabilityconditionsjson field');
+ throw new \coding_exception('Invalid JSON from availabilityconditionsjson field');
}
if (!empty($decoded->errors)) {
$error = '';
@@ -193,12 +193,7 @@ public function is_available(&$information, $grabthelot = false, $userid = 0,
$tree = $this->get_availability_tree();
$result = $tree->check_available(false, $this, $grabthelot, $userid);
} catch (\coding_exception $e) {
- // We catch the message because it causes fatal problems in most of
- // the GUI if this exception gets thrown (you can't edit the
- // activity to fix it). Obviously it should never happen anyway, but
- // just in case.
- debugging('Error processing availability data for &lsquo;' .
- $this->get_thing_name() . '&rsquo;: ' . s($e->a), DEBUG_DEVELOPER);
+ $this->warn_about_invalid_availability($e);
$this->modinfo = null;
return false;
}
@@ -237,7 +232,12 @@ public function is_available_for_all() {
if (is_null($this->availability)) {
return true;
} else {
- return $this->get_availability_tree()->is_available_for_all();
+ try {
+ return $this->get_availability_tree()->is_available_for_all();
+ } catch (\coding_exception $e) {
+ $this->warn_about_invalid_availability($e);
+ return false;
+ }
}
}
@@ -273,14 +273,33 @@ public function get_full_information(\course_modinfo $modinfo = null) {
$this->modinfo = null;
return $result;
} catch (\coding_exception $e) {
- // Again we catch the message to avoid problems in GUI.
- debugging('Error processing availability data for &lsquo;' .
- $this->get_thing_name() . '&rsquo;: ' . s($e->a), DEBUG_DEVELOPER);
+ $this->warn_about_invalid_availability($e);
return false;
}
}
/**
+ * In some places we catch coding_exception because if a bug happens, it
+ * would be fatal for the course page GUI; instead we just show a developer
+ * debug message.
+ *
+ * @param \coding_exception $e Exception that occurred
+ */
+ protected function warn_about_invalid_availability(\coding_exception $e) {
+ $name = $this->get_thing_name();
+ // If it occurs while building modinfo based on somebody calling $cm->name,
+ // we can't get $cm->name, and this line will cause a warning.
+ $htmlname = @$this->format_info($name, $this->course);
+ if ($htmlname === '') {
+ // So instead use the numbers (cmid) from the tag.
+ $htmlname = preg_replace('~[^0-9]~', '', $name);
+ }
+ $info = 'Error processing availability data for &lsquo;' . $htmlname
+ . '&rsquo;: ' . s($e->a);
+ debugging($info, DEBUG_DEVELOPER);
+ }
+
+ /**
* Called during restore (near end of restore). Updates any necessary ids
* and writes the updated tree to the database. May output warnings if
* necessary (e.g. if a course-module cannot be found after restore).
@@ -79,9 +79,11 @@ protected function allow_add($course, \cm_info $cm = null,
\section_info $section = null) {
global $CFG;
- // Group option can be used on sections, and on modules but only
- // if groupmembersonly is turned off. (To avoid confusion.)
- if (!is_null($cm) && $CFG->enablegroupmembersonly) {
+ // If groupmembersonly is turned on, then you can only add group
+ // restrictions on sections (which don't use groupmembersonly) and
+ // not on modules. This is to avoid confusion - otherwise
+ // there would be two ways to add restrictions based on groups.
+ if (is_null($section) && $CFG->enablegroupmembersonly) {
return false;
}
@@ -74,9 +74,11 @@ protected function allow_add($course, \cm_info $cm = null,
\section_info $section = null) {
global $CFG, $DB;
- // Grouping option can be used on sections, and on modules but only
- // if groupmembersonly is turned off. (To avoid confusion.)
- if (!is_null($cm) && $CFG->enablegroupmembersonly) {
+ // If groupmembersonly is turned on, then you can only add group
+ // restrictions on sections (which don't use groupmembersonly) and
+ // not on modules. This is to avoid confusion - otherwise
+ // there would be two ways to add restrictions based on groups.
+ if (is_null($section) && $CFG->enablegroupmembersonly) {
return false;
}
@@ -123,6 +123,22 @@ Feature: edit_availability
When I click on ".availability-item .availability-delete img" "css_element"
Then I should not see "or" in the "Restrict access" "fieldset"
+ # Add a nested restriction set with two dates so there will be inner connector.
+ When I click on "Add restriction..." "button"
+ And I click on "Restriction set" "button" in the "Add restriction..." "dialogue"
+ And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
+ And I click on "Date" "button" in the "Add restriction..." "dialogue"
+ And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element"
+ And I click on "Date" "button" in the "Add restriction..." "dialogue"
+ Then I should see "and" in the ".availability-children .availability-list .availability-connector" "css_element"
+
+ # Check changing the outer one does not affect the inner one.
+ When I set the field "Required restrictions" to "all"
+ Then I should not see "or" in the "Restrict access" "fieldset"
+ When I set the field "Required restrictions" to "any"
+ Then I should see "or" in the "Restrict access" "fieldset"
+ And I should not see "or" in the ".availability-children .availability-list .availability-connector" "css_element"
+
@javascript
Scenario: Edit availability using settings in section form
# Set up.
@@ -96,12 +96,16 @@ M.core_availability.form = {
// Get top-level tree as JSON.
var value = this.field.get('value');
- if (value === '') {
- this.rootList = new M.core_availability.List(null, true);
- } else {
- var data = Y.JSON.parse(value);
- this.rootList = new M.core_availability.List(data, true);
+ var data = null;
+ if (value !== '') {
+ try {
+ data = Y.JSON.parse(value);
+ } catch(x) {
+ // If the JSON data is not valid, treat it as empty.
+ this.field.set('value', '');
+ }
}
+ this.rootList = new M.core_availability.List(data, true);
this.mainDiv.appendChild(this.rootList.node);
// Update JSON value after loading (to reflect any changes that need
@@ -509,7 +513,7 @@ M.core_availability.List.prototype.updateHtml = function() {
} else {
connectorText = M.str.availability.or;
}
- this.inner.all('.availability-connector span.label').each(function(span) {
+ this.inner.all('> .availability-children > .availability-connector span.label').each(function(span) {
span.set('innerHTML', connectorText);
});
};
Oops, something went wrong.

0 comments on commit fded9b6

Please sign in to comment.