Merge branch 'MDL-45256-master' of git://github.com/FMCorz/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 30 Apr 2014 06:58:56 +0000 (14:58 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 30 Apr 2014 06:58:56 +0000 (14:58 +0800)
18 files changed:
blocks/news_items/version.php
course/moodleform_mod.php
filter/activitynames/db/install.php
filter/mathjaxloader/db/install.php [new file with mode: 0644]
lib/db/upgrade.php
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js
lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js
lib/editor/atto/yui/src/editor/js/selection.js
lib/filterlib.php
lib/tests/admintree_test.php
lib/tests/other/executable.php [deleted file]
lib/upgrade.txt
mod/assign/classes/event/feedback_updated.php [deleted file]
mod/assign/feedback/offline/locallib.php
mod/assign/tests/events_test.php
mod/lesson/locallib.php
version.php

index 6c8db3f..2684fe7 100644 (file)
@@ -24,6 +24,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2013110500;         // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version   = 2013110501;         // The current plugin version (Date: YYYYMMDDXX)
 $plugin->requires  = 2013110500;         // Requires this Moodle version
 $plugin->component = 'block_news_items'; // Full name of the plugin (used for diagnostics)
+$plugin->dependencies = array('mod_forum' => 2013110500);
index 7dc4436..70d8fdc 100644 (file)
@@ -496,6 +496,11 @@ abstract class moodleform_mod extends moodleform {
                 $mform->disabledIf('completionusegrade', 'completion', 'ne', COMPLETION_TRACKING_AUTOMATIC);
                 $mform->addHelpButton('completionusegrade', 'completionusegrade', 'completion');
                 $gotcompletionoptions = true;
+
+                // If using the rating system, there is no grade unless ratings are enabled.
+                if ($this->_features->rating) {
+                    $mform->disabledIf('completionusegrade', 'assessed', 'eq', 0);
+                }
             }
 
             // Automatic completion according to module-specific rules
index ea065a5..cc0a794 100644 (file)
@@ -26,6 +26,6 @@ function xmldb_filter_activitynames_install() {
     global $CFG;
     require_once("$CFG->libdir/filterlib.php");
 
-    filter_set_global_state('activitynames', TEXTFILTER_ON);
+    filter_set_global_state('activitynames', TEXTFILTER_ON, 1);
 }
 
diff --git a/filter/mathjaxloader/db/install.php b/filter/mathjaxloader/db/install.php
new file mode 100644 (file)
index 0000000..8a9724b
--- /dev/null
@@ -0,0 +1,33 @@
+<?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/>.
+
+/**
+ * Mathjax filter post install hook
+ *
+ * @package    filter
+ * @subpackage mathjaxloader
+ * @copyright  2014 onwards Andrew Davis (andyjdavis)
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+function xmldb_filter_mathjaxloader_install() {
+    global $CFG;
+    require_once("$CFG->libdir/filterlib.php");
+
+    filter_set_global_state('mathjaxloader', TEXTFILTER_ON, -1);
+}
index 4443c9b..2f244ee 100644 (file)
@@ -3205,13 +3205,6 @@ function xmldb_main_upgrade($oldversion) {
 
         // Check we actually have themes to remove.
         if (count($themes) > 0) {
-            list($insql, $inparams) = $DB->get_in_or_equal($themes, SQL_PARAMS_NAMED);
-
-            // Replace the theme usage.
-            $DB->set_field_select('course', 'theme', 'clean', "theme $insql", $inparams);
-            $DB->set_field_select('course_categories', 'theme', 'clean', "theme $insql", $inparams);
-            $DB->set_field_select('user', 'theme', 'clean', "theme $insql", $inparams);
-            $DB->set_field_select('mnet_host', 'theme', 'clean', "theme $insql", $inparams);
 
             // Replace the theme configs.
             if (in_array(get_config('core', 'theme'), $themes)) {
@@ -3226,11 +3219,6 @@ function xmldb_main_upgrade($oldversion) {
             if (in_array(get_config('core', 'themetablet'), $themes)) {
                 set_config('themetablet', 'clean');
             }
-
-            // Hacky emulation of plugin uninstallation.
-            foreach ($themes as $theme) {
-                unset_all_config_for_plugin('theme_' . $theme);
-            }
         }
 
         // Main savepoint reached.
index 75ede19..f9ea941 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-debug.js differ
index 2b4110d..94bce42 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor-min.js differ
index 50973bd..240361b 100644 (file)
Binary files a/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js and b/lib/editor/atto/yui/build/moodle-editor_atto-editor/moodle-editor_atto-editor.js differ
index 10e90c5..1156277 100644 (file)
@@ -108,6 +108,11 @@ EditorSelection.prototype = {
             return false;
         }
 
+        // We can't be active if the editor doesn't have focus at the moment.
+        if (!document.activeElement || document.activeElement !== this.editor) {
+            return false;
+        }
+
         // Check whether the range intersects the editor selection.
         range.selectNode(this.editor.getDOMNode());
         return range.intersectsRange(selection.getRangeAt(0));
index 0f6072c..5aca116 100644 (file)
@@ -527,7 +527,7 @@ function filter_get_all_installed() {
  *
  * @param string $filtername The filter name, for example 'tex'.
  * @param int $state One of the values TEXTFILTER_ON, TEXTFILTER_OFF or TEXTFILTER_DISABLED.
- * @param int $move 1 means up, 0 means the same, -1 means down
+ * @param int $move -1 means up, 0 means the same, 1 means down
  */
 function filter_set_global_state($filtername, $state, $move = 0) {
     global $DB;
index 623199f..82b5d17 100644 (file)
@@ -129,11 +129,16 @@ class core_admintree_testcase extends advanced_testcase {
         $this->assertRegexp('/class="patherror"/', $result);
 
         // Check for a file which is not executable.
-        $result = $executable->output_html($CFG->dirroot . '/config.php');
+        $result = $executable->output_html($CFG->dirroot . '/filter/tex/readme_moodle.txt');
         $this->assertRegexp('/class="patherror"/', $result);
 
         // Check for an executable file.
-        $result = $executable->output_html($CFG->dirroot . '/lib/tests/other/executable.php');
+        if ($CFG->ostype == 'WINDOWS') {
+            $filetocheck = 'mimetex.exe';
+        } else {
+            $filetocheck = 'mimetex.darwin';
+        }
+        $result = $executable->output_html($CFG->dirroot . '/filter/tex/' . $filetocheck);
         $this->assertRegexp('/class="pathok"/', $result);
 
         // Check for no file specified.
diff --git a/lib/tests/other/executable.php b/lib/tests/other/executable.php
deleted file mode 100755 (executable)
index e69de29..0000000
index a244f75..93b1367 100644 (file)
@@ -10,6 +10,8 @@ Events and Logging:
 * Significant changes in Logging API. For upgrading existing events_trigger() and
   add_to_log() see http://docs.moodle.org/dev/Migrating_logging_calls_in_plugins
   For accessing logs from plugins see http://docs.moodle.org/dev/Migrating_log_access_in_reports
+* The validation of the following events is now stricter:
+    - \core\event\course_section_updated
 
 DEPRECATIONS:
 * $module uses in mod/xxx/version.php files is now deprecated. Please use $plugin instead. It will be removed in Moodle 2.10.
diff --git a/mod/assign/classes/event/feedback_updated.php b/mod/assign/classes/event/feedback_updated.php
deleted file mode 100644 (file)
index 2bab6fe..0000000
+++ /dev/null
@@ -1,110 +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/>.
-
-/**
- * The mod_assign feedback updated event.
- *
- * @package    mod_assign
- * @copyright  2014 Mark Nelson <markn@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-namespace mod_assign\event;
-
-defined('MOODLE_INTERNAL') || die();
-
-/**
- * The mod_assign feedback updated event.
- *
- * @property-read array $other {
- *      Extra information about event.
- *
- *      - int assignid: the id of the assignment.
- * }
- *
- * @package    mod_assign
- * @since      Moodle 2.7
- * @copyright  2014 Mark Nelson <markn@moodle.com>
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class feedback_updated extends base {
-    /**
-     * Create instance of event.
-     *
-     * @param \assign $assign
-     * @param \stdClass $grade
-     * @return feedback_updated
-     */
-    public static function create_from_grade(\assign $assign, \stdClass $grade) {
-        $data = array(
-            'objectid' => $grade->id,
-            'relateduserid' => $grade->userid,
-            'context' => $assign->get_context(),
-            'other' => array(
-                'assignid' => $assign->get_instance()->id,
-            ),
-        );
-        /** @var feedback_updated $event */
-        $event = self::create($data);
-        $event->set_assign($assign);
-        $event->add_record_snapshot('assign_grades', $grade);
-        return $event;
-    }
-
-    /**
-     * Init method.
-     */
-    protected function init() {
-        $this->data['crud'] = 'r';
-        $this->data['edulevel'] = self::LEVEL_TEACHING;
-    }
-
-    /**
-     * Returns localised general event name.
-     *
-     * @return string
-     */
-    public static function get_name() {
-        return get_string('eventfeedbackupdated', 'mod_assign');
-    }
-
-    /**
-     * Returns description of what happened.
-     *
-     * @return string
-     */
-    public function get_description() {
-        return "The user with the id {$this->userid} updated the feedback for the user with the id {$this->relateduserid}
-            for the assignment with the id {$this->other['assignid']}.";
-    }
-
-    /**
-     * Custom validation.
-     *
-     * @throws \coding_exception
-     */
-    protected function validate_data() {
-        parent::validate_data();
-
-        if (!isset($this->relateduserid)) {
-            throw new \coding_exception('The \'relateduserid\' must be set.');
-        }
-
-        if (!isset($this->other['assignid'])) {
-            throw new \coding_exception('The \'assignid\' must be set in other.');
-        }
-    }
-}
index cc5c5d8..798fd3e 100644 (file)
@@ -187,17 +187,7 @@ class assign_feedback_offline extends assign_feedback_plugin {
                         $updatecount += 1;
                         $grade = $this->assignment->get_user_grade($record->user->id, true);
                         $this->assignment->notify_grade_modified($grade);
-                        if ($plugin->set_editor_text($field, $newvalue, $grade->id)) {
-                            $logdesc = new lang_string('feedbackupdate', 'assignfeedback_offline',
-                                                  array('field'=>$description,
-                                                        'student'=>$userdesc,
-                                                        'text'=>$newvalue));
-
-                            // Trigger event for updating the feedback.
-                            $event = \mod_assign\event\feedback_updated::create_from_grade($this->assignment, $grade);
-                            $event->set_legacy_logdata('save grading feedback', $logdesc);
-                            $event->trigger();
-                        }
+                        $plugin->set_editor_text($field, $newvalue, $grade->id);
 
                         // If this is the gradebook comments plugin - post an update to the gradebook.
                         if (($plugin->get_subtype() . '_' . $plugin->get_type()) == $gradebookplugin) {
index ac391b9..4c44002 100644 (file)
@@ -648,40 +648,6 @@ class assign_events_testcase extends mod_assign_base_testcase {
         $this->assertEventContextNotUsed($event);
     }
 
-    /**
-     * Test the feedback_updated event.
-     */
-    public function test_feedback_updated() {
-        $assign = $this->create_instance();
-
-        $logdesc = get_string('feedbackupdate', 'assignfeedback_offline',
-            array('field' => 'The description',
-                  'student' => 'The student\'s name',
-                  'text' => 'Text'));
-        $event = \mod_assign\event\feedback_updated::create(array(
-            'userid' => 2,
-            'relateduserid' => 2,
-            'context' => $assign->get_context(),
-            'other' => array(
-                'assignid' => $assign->get_instance()->id
-            )
-        ));
-        $event->set_legacy_logdata('save grading feedback', $logdesc);
-
-        // Trigger and capture the event.
-        $sink = $this->redirectEvents();
-        $event->trigger();
-        $events = $sink->get_events();
-        $event = reset($events);
-
-        $this->assertInstanceOf('\mod_assign\event\feedback_updated', $event);
-        $this->assertEquals($assign->get_context(), $event->get_context());
-        $expectedlog = array($assign->get_course()->id, 'assign', 'save grading feedback', 'view.php?id=' . $assign->get_course_module()->id,
-            $logdesc, $assign->get_course_module()->id);
-        $this->assertEventLegacyLogData($expectedlog, $event);
-        $this->assertEventContextNotUsed($event);
-    }
-
     /**
      * Test the grading_form_viewed event.
      */
index 0eb7e06..e9945af 100644 (file)
@@ -2765,7 +2765,7 @@ class lesson_page_type_manager {
     public function load_all_pages(lesson $lesson) {
         global $DB;
         if (!($pages =$DB->get_records('lesson_pages', array('lessonid'=>$lesson->id)))) {
-            print_error('cannotfindpages', 'lesson');
+            return array(); // Records returned empty.
         }
         foreach ($pages as $key=>$page) {
             $pagetype = get_class($this->types[$page->qtype]);
index 813522e..8ddd0d6 100644 (file)
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2014042400.00;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2014042900.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.
 
-$release  = '2.7beta+ (Build: 20140424)'; // Human-friendly version name
+$release  = '2.7beta+ (Build: 20140429)'; // Human-friendly version name
 
 $branch   = '27';                       // This version's branch.
 $maturity = MATURITY_BETA;             // This version's maturity level.