Merge branch 'w41_MDL-42054_m26_phpmailertesting_i' of https://github.com/skodak...
authorDan Poltawski <dan@moodle.com>
Wed, 9 Oct 2013 10:16:56 +0000 (18:16 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 9 Oct 2013 10:16:56 +0000 (18:16 +0800)
29 files changed:
badges/criteria/award_criteria_courseset.php
badges/index.php
badges/newbadge.php
badges/renderer.php
badges/view.php
config-dist.php
enrol/cohort/lib.php
lib/db/upgrade.php
lib/filelib.php
lib/outputrequirementslib.php
lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader-debug.js
lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader.js
lib/yui/build/moodle-core-dock/moodle-core-dock-debug.js
lib/yui/build/moodle-core-dock/moodle-core-dock.js
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js
lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js
lib/yui/src/dock/js/block.js
lib/yui/src/dock/js/dock.js
lib/yui/src/dock/js/dockeditem.js
lib/yui/src/dock/js/loader.js
lib/yui/src/dock/js/panel.js
lib/yui/src/dock/js/tabheightmanager.js
lib/yui/src/formautosubmit/js/formautosubmit.js
mod/assign/feedback/editpdf/classes/document_services.php
mod/assign/feedback/editpdf/tests/editpdf_test.php
question/behaviour/manualgraded/tests/walkthrough_test.php
question/type/essay/tests/walkthrough_test.php
version.php

index 8144a38..a20e70b 100644 (file)
@@ -160,10 +160,11 @@ class award_criteria_courseset extends award_criteria {
         // In courseset, print out only the ones that were already selected.
         foreach ($this->params as $p) {
             if ($course = $DB->get_record('course', array('id' => $p['course']))) {
+                $coursecontext = context_course::instance($course->id);
                 $param = array(
                         'id' => $course->id,
                         'checked' => true,
-                        'name' => ucfirst($course->fullname),
+                        'name' => ucfirst(format_string($course->fullname, true, array('context' => $coursecontext))),
                         'error' => false
                 );
 
index a0d2f17..d476cfc 100644 (file)
@@ -82,10 +82,11 @@ if ($type == BADGE_TYPE_SITE) {
     navigation_node::override_active_url(new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_SITE)));
 } else {
     require_login($course);
+    $coursecontext = context_course::instance($course->id);
     $title = get_string('coursebadges', 'badges');
-    $PAGE->set_context(context_course::instance($course->id));
+    $PAGE->set_context($coursecontext);
     $PAGE->set_pagelayout('course');
-    $PAGE->set_heading($course->fullname . ': ' . $hdr);
+    $PAGE->set_heading(format_string($course->fullname, true, array('context' => $coursecontext)) . ': ' . $hdr);
     navigation_node::override_active_url(
         new moodle_url('/badges/index.php', array('type' => BADGE_TYPE_COURSE, 'id' => $course->id))
     );
index 756ef91..d83ce59 100644 (file)
@@ -45,11 +45,13 @@ $title = get_string('create', 'badges');
 
 if (($type == BADGE_TYPE_COURSE) && ($course = $DB->get_record('course', array('id' => $courseid)))) {
     require_login($course);
-    $PAGE->set_context(context_course::instance($course->id));
+    $coursecontext = context_course::instance($course->id);
+    $PAGE->set_context($coursecontext);
     $PAGE->set_pagelayout('course');
     $PAGE->set_url('/badges/newbadge.php', array('type' => $type, 'id' => $course->id));
-    $PAGE->set_heading($course->fullname . ": " . $title);
-    $PAGE->set_title($course->fullname . ": " . $title);
+    $heading = format_string($course->fullname, true, array('context' => $coursecontext)) . ": " . $title;
+    $PAGE->set_heading($heading);
+    $PAGE->set_title($heading);
 } else {
     $PAGE->set_context(context_system::instance());
     $PAGE->set_pagelayout('admin');
index b3fa735..2fa2614 100644 (file)
@@ -493,8 +493,8 @@ class core_badges_renderer extends plugin_renderer_base {
 
         // Local badges.
         $localhtml = html_writer::start_tag('fieldset', array('id' => 'issued-badge-table', 'class' => 'generalbox'));
-        $localhtml .= html_writer::tag('legend',
-                    $this->output->heading_with_help(get_string('localbadges', 'badges', $SITE->fullname), 'localbadgesh', 'badges'));
+        $heading = get_string('localbadges', 'badges', format_string($SITE->fullname, true, array('context' => context_system::instance())));
+        $localhtml .= html_writer::tag('legend', $this->output->heading_with_help($heading, 'localbadgesh', 'badges'));
         if ($badges->badges) {
             $table = new html_table();
             $table->attributes['class'] = 'statustable';
index 33f2b91..d623c81 100644 (file)
@@ -68,7 +68,8 @@ if ($type == BADGE_TYPE_SITE) {
     $PAGE->set_heading($title);
 } else {
     require_login($course);
-    $title = $course->fullname . ': ' . get_string('coursebadges', 'badges');
+    $coursename = format_string($course->fullname, true, array('context' => context_course::instance($course->id)));
+    $title = $coursename . ': ' . get_string('coursebadges', 'badges');
     $PAGE->set_context(context_course::instance($course->id));
     $PAGE->set_pagelayout('course');
     $PAGE->set_heading($title);
index e57a61d..c5bf4be 100644 (file)
@@ -489,6 +489,24 @@ $CFG->admin = 'admin';
 // Prevent JS caching
 // $CFG->cachejs = false; // NOT FOR PRODUCTION SERVERS!
 //
+// Restrict which YUI logging statements are shown in the browser console.
+// For details see the upstream documentation:
+//   http://yuilibrary.com/yui/docs/api/classes/config.html#property_logInclude
+//   http://yuilibrary.com/yui/docs/api/classes/config.html#property_logExclude
+// $CFG->yuiloginclude = array(
+//     'moodle-core-dock-loader' => true,
+//     'moodle-course-categoryexpander' => true,
+// );
+// $CFG->yuilogexclude = array(
+//     'moodle-core-dock' => true,
+//     'moodle-core-notification' => true,
+// );
+//
+// Set the minimum log level for YUI logging statements.
+// For details see the upstream documentation:
+//   http://yuilibrary.com/yui/docs/api/classes/config.html#property_logLevel
+// $CFG->yuiloglevel = 'debug';
+//
 // Prevent core_string_manager application caching
 // $CFG->langstringcache = false; // NOT FOR PRODUCTION SERVERS!
 //
index 6ab0402..ef6d5ae 100644 (file)
@@ -46,6 +46,9 @@ class enrol_cohort_plugin extends enrol_plugin {
         } else if (empty($instance->name)) {
             $enrol = $this->get_name();
             $cohort = $DB->get_record('cohort', array('id'=>$instance->customint1));
+            if (!$cohort) {
+                return get_string('pluginname', 'enrol_'.$enrol);
+            }
             $cohortname = format_string($cohort->name, true, array('context'=>context::instance_by_id($cohort->contextid)));
             if ($role = $DB->get_record('role', array('id'=>$instance->roleid))) {
                 $role = role_get_name($role, context_course::instance($instance->courseid, IGNORE_MISSING));
index 99e2b81..282ba44 100644 (file)
@@ -2674,5 +2674,20 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2013100900.00);
     }
 
+    if ($oldversion < 2013100901.00) {
+        // Fixing possible wrong MIME type for Java Network Launch Protocol (JNLP) files.
+        $select = $DB->sql_like('filename', '?', false);
+        $DB->set_field_select(
+            'files',
+            'mimetype',
+            'application/x-java-jnlp-file',
+            $select,
+            array('%.jnlp')
+        );
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2013100901.00);
+    }
+
     return true;
 }
index 3674d5c..364e43f 100644 (file)
@@ -1451,6 +1451,7 @@ function &get_mimetypes_array() {
         'jcw'  => array ('type'=>'text/xml', 'icon'=>'markup'),
         'jmt'  => array ('type'=>'text/xml', 'icon'=>'markup'),
         'jmx'  => array ('type'=>'text/xml', 'icon'=>'markup'),
+        'jnlp' => array ('type'=>'application/x-java-jnlp-file', 'icon'=>'markup'),
         'jpe'  => array ('type'=>'image/jpeg', 'icon'=>'jpeg', 'groups'=>array('image', 'web_image'), 'string'=>'image'),
         'jpeg' => array ('type'=>'image/jpeg', 'icon'=>'jpeg', 'groups'=>array('image', 'web_image'), 'string'=>'image'),
         'jpg'  => array ('type'=>'image/jpeg', 'icon'=>'jpeg', 'groups'=>array('image', 'web_image'), 'string'=>'image'),
index 3c62282..acf5dd9 100644 (file)
@@ -249,6 +249,17 @@ class page_requirements_manager {
             $this->YUI_config->debug = false;
         }
 
+        // Include the YUI config log filters.
+        if (!empty($CFG->yuilogexclude) && is_array($CFG->yuilogexclude)) {
+            $this->YUI_config->logExclude = $CFG->yuilogexclude;
+        }
+        if (!empty($CFG->yuiloginclude) && is_array($CFG->yuiloginclude)) {
+            $this->YUI_config->logInclude = $CFG->yuiloginclude;
+        }
+        if (!empty($CFG->yuiloglevel)) {
+            $this->YUI_config->logLevel = $CFG->yuiloglevel;
+        }
+
         // Add the moodle group's module data.
         $this->YUI_config->add_moodle_metadata();
 
index dac8f38..2d954ca 100644 (file)
Binary files a/lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader-debug.js and b/lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader-debug.js differ
index a84e123..e560694 100644 (file)
Binary files a/lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader.js and b/lib/yui/build/moodle-core-dock-loader/moodle-core-dock-loader.js differ
index 632f1bd..525c389 100644 (file)
Binary files a/lib/yui/build/moodle-core-dock/moodle-core-dock-debug.js and b/lib/yui/build/moodle-core-dock/moodle-core-dock-debug.js differ
index 25c83d7..bef5e34 100644 (file)
Binary files a/lib/yui/build/moodle-core-dock/moodle-core-dock.js and b/lib/yui/build/moodle-core-dock/moodle-core-dock.js differ
index 00f2bcf..55abf69 100644 (file)
Binary files a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js and b/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-debug.js differ
index 5c7b88a..8b5f752 100644 (file)
Binary files a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js and b/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit-min.js differ
index c812697..098b6a3 100644 (file)
Binary files a/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js and b/lib/yui/build/moodle-core-formautosubmit/moodle-core-formautosubmit.js differ
index ffb8e6a..e203f77 100644 (file)
@@ -64,7 +64,7 @@ BLOCK.prototype = {
             return false;
         }
 
-        Y.log('Initialised block with instance id:'+this.get('id'), 'note', LOGNS);
+        Y.log('Initialised block with instance id:'+this.get('id'), 'debug', LOGNS);
 
         M.core.dock.ensureMoveToIconExists(node);
 
@@ -129,7 +129,7 @@ BLOCK.prototype = {
             return;
         }
 
-        Y.log('Moving block to the dock:'+this.get('id'), 'note', LOGNS);
+        Y.log('Moving block to the dock:'+this.get('id'), 'debug', LOGNS);
 
         this.recordBlockState();
 
@@ -200,7 +200,7 @@ BLOCK.prototype = {
         var id = this.get('id'),
             commands;
 
-        Y.log('Moving block out of the dock:'+this.get('id'), 'note', LOGNS);
+        Y.log('Moving block out of the dock:'+this.get('id'), 'debug', LOGNS);
 
         // Enable the skip anchor when going back to block mode
         if (this.contentskipanchor) {
index fa193a3..f73ddea 100644 (file)
@@ -329,7 +329,7 @@ DOCK.prototype = {
      * @method initializer
      */
     initializer : function() {
-        Y.log('Dock initialising', 'note', LOGNS);
+        Y.log('Dock initialising', 'debug', LOGNS);
 
         // Publish the events the dock has
         /**
@@ -531,7 +531,7 @@ DOCK.prototype = {
                         warned = true;
                     }
                     // Damn, the've set something.
-                    Y.log('Note for customise_dock_for_theme code: M.core_dock.cfg.'+key+' is now dock.set(\''+key+'\', value)', 'info', LOGNS);
+                    Y.log('Note for customise_dock_for_theme code: M.core_dock.cfg.'+key+' is now dock.set(\''+key+'\', value)', 'debug', LOGNS);
                     this.set(cfgmap[key], value);
                 }
             }
@@ -547,7 +547,7 @@ DOCK.prototype = {
                         warned = true;
                     }
                     // Damn, they've set something.
-                    Y.log('Note for customise_dock_for_theme code: M.core_dock.css.'+key+' is now CSS.'+key+' = value', 'info', LOGNS);
+                    Y.log('Note for customise_dock_for_theme code: M.core_dock.css.'+key+' is now CSS.'+key+' = value', 'debug', LOGNS);
                     CSS[key] = value;
                 }
             }
@@ -829,7 +829,7 @@ DOCK.prototype = {
     add : function(item) {
         // Set the dockitem id to the total count and then increment it.
         item.set('id', this.totalcount);
-        Y.log('Adding block '+item._getLogDescription()+' to the dock.', 'info', LOGNS);
+        Y.log('Adding block '+item._getLogDescription()+' to the dock.', 'debug', LOGNS);
         this.count++;
         this.totalcount++;
         this.dockeditems[item.get('id')] = item;
@@ -864,7 +864,7 @@ DOCK.prototype = {
         if (!this.dockeditems[id]) {
             return false;
         }
-        Y.log('Removing block '+this.dockeditems[id]._getLogDescription()+' from the dock.', 'info', LOGNS);
+        Y.log('Removing block '+this.dockeditems[id]._getLogDescription()+' from the dock.', 'debug', LOGNS);
         this.dockeditems[id].remove();
         delete this.dockeditems[id];
         this.count--;
@@ -888,7 +888,7 @@ DOCK.prototype = {
      * @return {Boolean}
      */
     removeAll : function() {
-        Y.log('Undocking all '+this.dockeditems.length+' blocks', 'note', LOGNS);
+        Y.log('Undocking all '+this.dockeditems.length+' blocks', 'debug', LOGNS);
         var i;
         for (i in this.dockeditems) {
             if (Y.Lang.isNumber(i) || Y.Lang.isString(i)) {
index 62f49a4..406f4e0 100644 (file)
@@ -77,7 +77,7 @@ DOCKEDITEM.prototype = {
             this.set('title', title);
             this.set('titlestring', titlestring);
         }
-        Y.log('Initialised dockeditem for block with title "'+this._getLogDescription(), 'note', LOGNS);
+        Y.log('Initialised dockeditem for block with title "'+this._getLogDescription(), 'debug', LOGNS);
     },
     /**
      * This function draws the item on the dock.
@@ -130,7 +130,7 @@ DOCKEDITEM.prototype = {
 
         dock.hideActive();
         this.fire('dockeditem:showstart');
-        Y.log('Showing '+this._getLogDescription(), 'info', LOGNS);
+        Y.log('Showing '+this._getLogDescription(), 'debug', LOGNS);
         panel.setHeader(this.get('titlestring'), this.get('commands'));
         panel.setBody(Y.Node.create('<div class="block_'+this.get('blockclass')+' block_docked"></div>').append(this.get('contents')));
         panel.show();
@@ -151,7 +151,7 @@ DOCKEDITEM.prototype = {
      */
     hide : function() {
         this.fire('dockeditem:hidestart');
-        Y.log('Hiding "'+this._getLogDescription(), 'info', LOGNS);
+        Y.log('Hiding "'+this._getLogDescription(), 'debug', LOGNS);
         if (this.active) {
             // No longer active
             this.active = false;
@@ -313,4 +313,4 @@ Y.extend(DOCKEDITEM, Y.Base, DOCKEDITEM.prototype, {
         }
     }
 });
-Y.augment(DOCKEDITEM, Y.EventTarget);
\ No newline at end of file
+Y.augment(DOCKEDITEM, Y.EventTarget);
index c574f02..a3dbb82 100644 (file)
@@ -87,17 +87,17 @@ M.core.dock.loader.delegationEvents = [];
  * @method initLoader
  */
 M.core.dock.loader.initLoader = function() {
-    Y.log('Dock loader initialising', 'note', LOADERNAME);
+    Y.log('Dock loader initialising', 'debug', LOADERNAME);
     var dockedblocks = Y.all('.block[data-instanceid][data-dockable]'),
         body = Y.one(document.body),
         callback;
     dockedblocks.each(function() {
         var id = parseInt(this.getData('instanceid'), 10);
-        Y.log('Dock loader watching block with instance id: '+id, 'note', LOADERNAME);
+        Y.log('Dock loader watching block with instance id: '+id, 'debug', LOADERNAME);
         M.core.dock.ensureMoveToIconExists(this);
     });
     if (dockedblocks.some(function(node){return node.hasClass('dock_on_load');})) {
-        Y.log('Loading dock module', 'note', LOADERNAME);
+        Y.log('Loading dock module', 'debug', LOADERNAME);
         Y.use('moodle-core-dock', function() {
             M.core.dock.init();
         });
@@ -113,7 +113,7 @@ M.core.dock.loader.initLoader = function() {
                 }
             }
             block.addClass('dock_on_load');
-            Y.log('Loading dock module', 'note', LOADERNAME);
+            Y.log('Loading dock module', 'debug', LOADERNAME);
             Y.use('moodle-core-dock', function(){
                 M.util.set_user_preference('docked_block_instance_'+instanceid, 1);
                 M.core.dock.init();
@@ -122,4 +122,4 @@ M.core.dock.loader.initLoader = function() {
         M.core.dock.loader.delegationEvents.push(body.delegate('click', callback, '.moveto'));
         M.core.dock.loader.delegationEvents.push(body.delegate('key', callback, '.moveto', 'enter'));
     }
-};
\ No newline at end of file
+};
index 6d87427..1ccc677 100644 (file)
@@ -31,7 +31,7 @@ DOCKPANEL.prototype = {
      * @method initializer
      */
     initializer : function() {
-        Y.log('Panel initialising', 'note', LOGNS);
+        Y.log('Panel initialising', 'debug', LOGNS);
         /**
          * Fired before the panel is shown.
          * @event dockpane::beforeshow
index 3e18b31..4fc5895 100644 (file)
@@ -69,7 +69,7 @@ TABHEIGHTMANAGER.prototype = {
             runningcount = 0,
             usedheight = 0,
             id, itemtitle, itemheight, offsetheight;
-        Y.log('Enabling the dock tab sizer.', 'note', LOGNS);
+        Y.log('Enabling the dock tab sizer.', 'debug', LOGNS);
         this.set('enabled', true);
         for (id in items) {
             if (Y.Lang.isNumber(id) || Y.Lang.isString(id)) {
index e78d50b..ac5e1b6 100644 (file)
@@ -34,8 +34,8 @@ Y.extend(FORMAUTOSUBMIT, Y.Base, {
                 // Macintosh webkit browsers like change events, but non-macintosh webkit browsers don't.
                 applyto.delegate('change', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this);
             }
-            if (Y.UA.ios) {
-                // IOS doesn't trigger click events because it's touch-based.
+            if (Y.UA.touchEnabled) {
+                // IOS and Android trigger touch events.
                 applyto.delegate('change', this.process_changes, 'select.' + CSS.AUTOSUBMIT, this);
             }
         }
index e956208..9fe930a 100644 (file)
@@ -117,7 +117,7 @@ class document_services {
             if ($plugin->is_enabled() && $plugin->is_visible()) {
                 $pluginfiles = $plugin->get_files($submission, $user);
                 foreach ($pluginfiles as $filename => $file) {
-                    if ($file->get_mimetype() === 'application/pdf') {
+                    if (($file instanceof \stored_file) && ($file->get_mimetype() === 'application/pdf')) {
                         $files[$filename] = $file;
                     }
                 }
index 1e64c5e..6afe93f 100644 (file)
@@ -54,7 +54,8 @@ class assignfeedback_editpdf_testcase extends mod_assign_base_testcase {
 
     protected function create_assign_and_submit_pdf() {
         global $CFG;
-        $assign = $this->create_instance(array('assignsubmission_file_enabled' => 1,
+        $assign = $this->create_instance(array('assignsubmission_onlinetext_enabled' => 1,
+                                               'assignsubmission_file_enabled' => 1,
                                                'assignsubmission_file_maxfiles' => 1,
                                                'assignfeedback_editpdf_enabled' => 1,
                                                'assignsubmission_file_maxsizebytes' => 1000000));
index 2a3aaea..1207ad7 100644 (file)
@@ -41,6 +41,7 @@ require_once(dirname(__FILE__) . '/../../../engine/tests/helpers.php');
 class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthrough_test_base {
     public function test_manual_graded_essay() {
 
+        // The current text editor depends on the users profile setting - so it needs a valid user.
         $this->setAdminUser();
 
         // Create an essay question.
@@ -110,6 +111,7 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug
 
     public function test_manual_graded_essay_not_answered() {
 
+        // The current text editor depends on the users profile setting - so it needs a valid user.
         $this->setAdminUser();
 
         // Create an essay question.
@@ -272,6 +274,7 @@ class qbehaviour_manualgraded_walkthrough_testcase extends qbehaviour_walkthroug
 
     public function test_manual_graded_essay_can_grade_0() {
 
+        // The current text editor depends on the users profile setting - so it needs a valid user.
         $this->setAdminUser();
 
         // Create an essay question.
index 242951b..e0a099f 100644 (file)
@@ -74,6 +74,7 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base
 
     public function test_deferred_feedback_html_editor() {
 
+        // The current text editor depends on the users profile setting - so it needs a valid user.
         $this->setAdminUser();
 
         // Create an essay question.
@@ -180,6 +181,7 @@ class qtype_essay_walkthrough_testcase extends qbehaviour_walkthrough_test_base
 
     public function test_responsetemplate() {
 
+        // The current text editor depends on the users profile setting - so it needs a valid user.
         $this->setAdminUser();
 
         // Create an essay question.
index c5bcfaf..2b875e9 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2013100900.00;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2013100901.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.