Merge branch 'MDL-47243-master' of git://github.com/xow/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 15 Oct 2014 15:14:39 +0000 (16:14 +0100)
committerDan Poltawski <dan@moodle.com>
Wed, 15 Oct 2014 15:14:39 +0000 (16:14 +0100)
15 files changed:
grade/report/user/lib.php
grade/report/user/version.php
grade/tests/report_graderlib_test.php
lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js
lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js
lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js
lib/editor/atto/plugins/managefiles/yui/src/usedfiles/js/usedfiles.js
lib/editor/tinymce/plugins/managefiles/tinymce/editor_plugin.js
lib/navigationlib.php
lib/tests/cronlib_test.php
lib/tests/filelib_test.php
mod/wiki/pagelib.php
mod/wiki/renderer.php
mod/wiki/search.php
mod/wiki/tests/behat/wiki_search.feature

index 562703a..3d4c7e6 100644 (file)
@@ -118,10 +118,10 @@ class grade_report_user extends grade_report {
     public $showfeedback = true;
 
     /**
-     * Show grade weighting in the report, default false
+     * Show grade weighting in the report, default true.
      * @var bool
      */
-    public $showweight = false;
+    public $showweight = true;
 
     /**
      * Show letter grades in the report, default false
@@ -133,7 +133,7 @@ class grade_report_user extends grade_report {
      * Show the calculated contribution to the course total column.
      * @var bool
      */
-    public $showcontributiontocoursetotal = false;
+    public $showcontributiontocoursetotal = true;
 
     /**
      * Show average grades in the report, default false.
@@ -205,8 +205,13 @@ class grade_report_user extends grade_report {
         $this->showgrade       = grade_get_setting($this->courseid, 'report_user_showgrade',       !empty($CFG->grade_report_user_showgrade));
         $this->showrange       = grade_get_setting($this->courseid, 'report_user_showrange',       !empty($CFG->grade_report_user_showrange));
         $this->showfeedback    = grade_get_setting($this->courseid, 'report_user_showfeedback',    !empty($CFG->grade_report_user_showfeedback));
-        $this->showweight      = grade_get_setting($this->courseid, 'report_user_showweight',      !empty($CFG->grade_report_user_showweight));
-        $this->showcontributiontocoursetotal      = grade_get_setting($this->courseid, 'report_user_showcontributiontocoursetotal',      !empty($CFG->grade_report_user_showcontributiontocoursetotal));
+
+        $this->showweight = grade_get_setting($this->courseid, 'report_user_showweight',
+            empty($CFG->grade_report_user_showweight));
+
+        $this->showcontributiontocoursetotal = grade_get_setting($this->courseid, 'report_user_showcontributiontocoursetotal',
+            empty($CFG->grade_report_user_showcontributiontocoursetotal));
+
         $this->showlettergrade = grade_get_setting($this->courseid, 'report_user_showlettergrade', !empty($CFG->grade_report_user_showlettergrade));
         $this->showaverage     = grade_get_setting($this->courseid, 'report_user_showaverage',     !empty($CFG->grade_report_user_showaverage));
 
@@ -1018,9 +1023,9 @@ function grade_report_user_settings_definition(&$mform) {
     $mform->addElement('select', 'report_user_showfeedback', get_string('showfeedback', 'grades'), $options);
 
     if (empty($CFG->grade_report_user_showweight)) {
-        $options[-1] = get_string('defaultprev', 'grades', $options[0]);
-    } else {
         $options[-1] = get_string('defaultprev', 'grades', $options[1]);
+    } else {
+        $options[-1] = get_string('defaultprev', 'grades', $options[0]);
     }
 
     $mform->addElement('select', 'report_user_showweight', get_string('showweight', 'grades'), $options);
@@ -1042,7 +1047,7 @@ function grade_report_user_settings_definition(&$mform) {
 
     $mform->addElement('select', 'report_user_showlettergrade', get_string('showlettergrade', 'grades'), $options);
     if (empty($CFG->grade_report_user_showcontributiontocoursetotal)) {
-        $options[-1] = get_string('defaultprev', 'grades', $options[0]);
+        $options[-1] = get_string('defaultprev', 'grades', $options[1]);
     } else {
         $options[-1] = get_string('defaultprev', 'grades', $options[$CFG->grade_report_user_showcontributiontocoursetotal]);
     }
index e9a88f7..8e44488 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2014051200;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version   = 2014101400;        // The current plugin version (Date: YYYYMMDDXX)
 $plugin->requires  = 2014050800;        // Requires this Moodle version
 $plugin->component = 'gradereport_user'; // Full name of the plugin (used for diagnostics)
index 8c39066..cf3d498 100644 (file)
@@ -65,6 +65,7 @@ class core_grade_report_graderlib_testcase extends advanced_testcase {
         $data = new stdClass();
         $data->id = $course->id;
         $data->report = 'grader';
+        $data->timepageload = time();
 
         $data->grade = array();
         $data->grade[$student->id] = array();
index 69a3695..91cdb17 100644 (file)
Binary files a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js and b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-debug.js differ
index 3894cba..016fc2c 100644 (file)
Binary files a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js and b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles-min.js differ
index 30447d6..ed1b8db 100644 (file)
Binary files a/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js and b/lib/editor/atto/plugins/managefiles/yui/build/moodle-atto_managefiles-usedfiles/moodle-atto_managefiles-usedfiles.js differ
index 79bfc2f..92778d0 100644 (file)
@@ -153,7 +153,7 @@ M.atto_managefiles.usedfiles = M.atto_managefiles.usedfiles || {
             usedFiles = {};
 
         while ((match = pattern.exec(content.get('innerHTML'))) !== null) {
-            filename = unescape(match[1]);
+            filename = decodeURI(match[1]);
             usedFiles[filename] = true;
         }
 
index f3bb3e9..5b3c102 100644 (file)
@@ -83,7 +83,7 @@
                     patt = new RegExp(base.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&') + "(.+?)[\\?\"']", 'gm'),
                     arr = [], match, filename;
                 while ((match = patt.exec(text)) !== null) {
-                    filename = unescape(match[1]);
+                    filename = decodeURI(match[1]);
                     if (arr.indexOf(filename) === -1) {
                         arr[arr.length] = filename;
                     }
index 5359b56..7f58d5a 100644 (file)
@@ -2092,7 +2092,7 @@ class global_navigation extends navigation_node {
         $featuresfunc = $cm->modname.'_supports';
         if (function_exists($featuresfunc) && $featuresfunc(FEATURE_ADVANCED_GRADING)) {
             require_once($CFG->dirroot.'/grade/grading/lib.php');
-            $gradingman = get_grading_manager($cm->context, $cm->modname);
+            $gradingman = get_grading_manager($cm->context,  'mod_'.$cm->modname);
             $gradingman->extend_navigation($this, $activity);
         }
 
@@ -3970,7 +3970,7 @@ class settings_navigation extends navigation_node {
         $featuresfunc = $this->page->activityname.'_supports';
         if (function_exists($featuresfunc) && $featuresfunc(FEATURE_ADVANCED_GRADING) && has_capability('moodle/grade:managegradingforms', $this->page->cm->context)) {
             require_once($CFG->dirroot.'/grade/grading/lib.php');
-            $gradingman = get_grading_manager($this->page->cm->context, $this->page->activityname);
+            $gradingman = get_grading_manager($this->page->cm->context, 'mod_'.$this->page->activityname);
             $gradingman->extend_settings_navigation($this, $modulenode);
         }
 
index 6696111..4d7a1b5 100644 (file)
@@ -43,7 +43,7 @@ class cronlib_testcase extends basic_testcase {
         $time = 0;
 
         // Relative time stamps. Did you know data providers get executed during phpunit init?
-        $lastweekstime = -(7 * 24 * 60 * 60);
+        $lastweekstime = strtotime('-1 week') - time();
         $beforelastweekstime = $lastweekstime - 60;
         $afterlastweekstime = $lastweekstime + 60;
 
@@ -54,8 +54,8 @@ class cronlib_testcase extends basic_testcase {
         // New Directory to keep.
         $nodes[] = $this->generate_test_path('/dir1/dir1_2/', true, $time, true);
 
-        // Directory exactly 1 week old, keep.
-        $nodes[] = $this->generate_test_path('/dir2/', true, $lastweekstime, true);
+        // Directory a little less than 1 week old, keep.
+        $nodes[] = $this->generate_test_path('/dir2/', true, $afterlastweekstime, true);
 
         // Directory older than 1 week old, remove.
         $nodes[] = $this->generate_test_path('/dir3/', true, $beforelastweekstime, false);
index aa07dc5..004dc8b 100644 (file)
@@ -241,10 +241,20 @@ class core_filelib_testcase extends advanced_testcase {
         $this->assertSame(2, $curl->info['redirect_count']);
         $this->assertSame('done', $contents);
 
+        // This test was failing for people behind Squid proxies. Squid does not
+        // fully support HTTP 1.1, so converts things to HTTP 1.0, where the name
+        // of the status code is different.
+        reset($response);
+        if (key($response) === 'HTTP/1.0') {
+            $responsecode302 = '302 Moved Temporarily';
+        } else {
+            $responsecode302 = '302 Found';
+        }
+
         $curl = new curl();
         $contents = $curl->get("$testurl?redir=3", array(), array('CURLOPT_FOLLOWLOCATION'=>0));
         $response = $curl->getResponse();
-        $this->assertSame('302 Found', reset($response));
+        $this->assertSame($responsecode302, reset($response));
         $this->assertSame(0, $curl->get_errno());
         $this->assertSame(302, $curl->info['http_code']);
         $this->assertSame('', $contents);
@@ -253,7 +263,7 @@ class core_filelib_testcase extends advanced_testcase {
         $curl->emulateredirects = true;
         $contents = $curl->get("$testurl?redir=3", array(), array('CURLOPT_FOLLOWLOCATION'=>0));
         $response = $curl->getResponse();
-        $this->assertSame('302 Found', reset($response));
+        $this->assertSame($responsecode302, reset($response));
         $this->assertSame(0, $curl->get_errno());
         $this->assertSame(302, $curl->info['http_code']);
         $this->assertSame('', $contents);
index be29771..6097e37 100644 (file)
@@ -111,7 +111,7 @@ abstract class page_wiki {
         $PAGE->set_activity_record($wiki);
         // the search box
         if (!empty($subwiki->id)) {
-            $search = optional_param('searchstring', null, PARAM_ALPHANUMEXT);
+            $search = optional_param('searchstring', null, PARAM_TEXT);
             $PAGE->set_button(wiki_search_form($cm, $search, $subwiki));
         }
     }
index 560c7c7..0e34a3d 100644 (file)
@@ -310,7 +310,7 @@ class mod_wiki_renderer extends plugin_renderer_base {
                     array('wid' => $wiki->id, 'title' => $page->title, 'pageid' => $page->id));
             break;
         case 'search':
-            $search = optional_param('searchstring', null, PARAM_ALPHANUMEXT);
+            $search = optional_param('searchstring', null, PARAM_TEXT);
             $searchcontent = optional_param('searchwikicontent', 0, PARAM_INT);
             $baseurl = new moodle_url('/mod/wiki/search.php',
                     array('cmid' => $cm->id, 'courseid' => $cm->course,
index ef1f6c8..17b8d2d 100644 (file)
@@ -26,7 +26,7 @@ require_once($CFG->dirroot . '/mod/wiki/lib.php');
 require_once($CFG->dirroot . '/mod/wiki/locallib.php');
 require_once($CFG->dirroot . '/mod/wiki/pagelib.php');
 
-$search = optional_param('searchstring', null, PARAM_ALPHANUMEXT);
+$search = optional_param('searchstring', null, PARAM_TEXT);
 $courseid = optional_param('courseid', 0, PARAM_INT);
 $searchcontent = optional_param('searchwikicontent', 0, PARAM_INT);
 $cmid = optional_param('cmid', 0, PARAM_INT);
index ee0a687..3f564c9 100644 (file)
@@ -52,6 +52,10 @@ Feature: Users can search wikis
     And I press "Search wikis"
     And I should not see "New page created by student1"
     And I should see "Collaborative teacher1 page"
+    And I set the field "searchstring" to "teacher1 page"
+    And I press "Search wikis"
+    And I should not see "New page created by student1"
+    And I should see "Collaborative teacher1 page"
     And I log out