Merge branch 'MDL-57161-master' of git://github.com/lameze/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Tue, 6 Dec 2016 05:06:39 +0000 (13:06 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Tue, 6 Dec 2016 05:06:39 +0000 (13:06 +0800)
13 files changed:
backup/backup.class.php
competency/classes/external/exporter.php
competency/tests/exporter_test.php
course/lib.php
grade/edit/tree/item_form.php
grade/report/user/lib.php
login/signup.php
message/amd/build/message_area_messages.min.js
message/amd/src/message_area_messages.js
mod/assign/submission/file/settings.php
theme/boost/scss/moodle/core.scss
theme/bootstrapbase/less/moodle/core.less
theme/bootstrapbase/style/moodle.css

index ee24aa9..3f36f96 100644 (file)
@@ -135,7 +135,7 @@ abstract class backup implements checksumable {
     /**
      * Usually same than major release zero version, mainly for informative/historic purposes.
      */
-    const RELEASE = '3.2';
+    const RELEASE = '3.3';
 }
 
 /*
index 1f8f7f7..d54c6c6 100644 (file)
@@ -158,7 +158,7 @@ abstract class exporter {
             } else if ($definition['type'] === PARAM_TEXT) {
                 if (!empty($definition['multiple'])) {
                     foreach ($data->$property as $key => $value) {
-                        $data->$property[$key] = external_format_string($value, $context->id);
+                        $data->{$property}[$key] = external_format_string($value, $context->id);
                     }
                 } else {
                     $data->$property = external_format_string($data->$property, $context->id);
index 101e1b4..a2d2c90 100644 (file)
@@ -111,6 +111,9 @@ class core_competency_exporter_testcase extends advanced_testcase {
         $output = $PAGE->get_renderer('tool_lp');
 
         $result = $exporter->export($output);
+
+        $this->assertSame('Another string', $result->otherstring);
+        $this->assertSame(array('String a', 'String b'), $result->otherstrings);
     }
 }
 
@@ -130,8 +133,8 @@ class core_competency_testable_exporter extends \core_competency\external\export
 
     protected function get_other_values(renderer_base $output) {
         return array(
-            'otherstring' => 'An other string',
-            'otherstrings' => array('String a', 'String b')
+            'otherstring' => 'Another <strong>string</strong>',
+            'otherstrings' => array('String a', 'String <strong>b</strong>')
         );
     }
 
index 699ec42..2262711 100644 (file)
@@ -3791,7 +3791,7 @@ function course_get_user_administration_options($course, $context) {
     $options->reports = has_capability('moodle/site:viewreports', $context);
     $options->backup = has_capability('moodle/backup:backupcourse', $context);
     $options->restore = has_capability('moodle/restore:restorecourse', $context);
-    $options->files = $course->legacyfiles == 2 and has_capability('moodle/course:managefiles', $context);
+    $options->files = ($course->legacyfiles == 2 && has_capability('moodle/course:managefiles', $context));
 
     if (!$isfrontpage) {
         $options->tags = has_capability('moodle/course:tag', $context);
index 572faa3..2313c63 100644 (file)
@@ -463,7 +463,8 @@ class edit_item_form extends moodleform {
         }
         if ($grade_item) {
             if ($grade_item->gradetype == GRADE_TYPE_VALUE) {
-                if (grade_floats_different($data['grademin'], $grade_item->grademin) ||
+                if ((((bool) get_config('moodle', 'grade_report_showmin')) &&
+                    grade_floats_different($data['grademin'], $grade_item->grademin)) ||
                     grade_floats_different($data['grademax'], $grade_item->grademax)) {
                     if ($grade_item->has_grades() && empty($data['rescalegrades'])) {
                         $errors['rescalegrades'] = get_string('mustchooserescaleyesorno', 'grades');
index c6978e4..e582b7a 100644 (file)
@@ -544,7 +544,7 @@ class grade_report_user extends grade_report {
                 }
 
                 if ($this->showgrade) {
-                    $gradeitemdata['graderaw'] = '';
+                    $gradeitemdata['graderaw'] = null;
                     $gradeitemdata['gradehiddenbydate'] = false;
                     $gradeitemdata['gradeneedsupdate'] = $grade_grade->grade_item->needsupdate;
                     $gradeitemdata['gradeishidden'] = $grade_grade->is_hidden();
index ad7d945..e145180 100644 (file)
@@ -44,8 +44,16 @@ $PAGE->https_required();
 $PAGE->set_url('/login/signup.php');
 $PAGE->set_context(context_system::instance());
 
-// Override wanted URL, we do not want to end up here again if user clicks "Login".
-$SESSION->wantsurl = $CFG->wwwroot . '/';
+// If wantsurl is empty or /login/signup.php, override wanted URL.
+// We do not want to end up here again if user clicks "Login".
+if (empty($SESSION->wantsurl)) {
+    $SESSION->wantsurl = $CFG->wwwroot . '/';
+} else {
+    $wantsurl = new moodle_url($SESSION->wantsurl);
+    if ($PAGE->url->compare($wantsurl, URL_MATCH_BASE)) {
+        $SESSION->wantsurl = $CFG->wwwroot . '/';
+    }
+}
 
 if (isloggedin() and !isguestuser()) {
     // Prevent signing up when already logged in.
index f9076d2..0451bee 100644 (file)
Binary files a/message/amd/build/message_area_messages.min.js and b/message/amd/build/message_area_messages.min.js differ
index c4ba17a..9410475 100644 (file)
@@ -242,13 +242,9 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
                     SELECTORS.LOADINGICON).remove();
                 // Check if we got something to do.
                 if (numberreceived > 0) {
-                    // Let's check if we can remove the block time.
-                    // First, get the block time that is currently being displayed.
-                    var blocktime = this.messageArea.node.find(SELECTORS.BLOCKTIME + ":first");
-                    var newblocktime = $(html).find(SELECTORS.BLOCKTIME + ":first").addBack();
-                    if (blocktime.html() == newblocktime.html()) {
-                        // Remove the block time as it's present above.
-                        blocktime.remove();
+                    var newHtml = $('<div>' + html + '</div>');
+                    if (this._hasMatchingBlockTime(this.messageArea.node, newHtml, true)) {
+                        this.messageArea.node.find(SELECTORS.BLOCKTIME + ':first').remove();
                     }
                     // Get height before we add the messages.
                     var oldheight = this.messageArea.find(SELECTORS.MESSAGES)[0].scrollHeight;
@@ -313,11 +309,12 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
             }.bind(this)).then(function(html, js) {
                 // Check if we got something to do.
                 if (numberreceived > 0) {
-                    html = $(html);
-                    // Remove the new block time as it's present above.
-                    html.find(SELECTORS.BLOCKTIME).remove();
+                    var newHtml = $('<div>' + html + '</div>');
+                    if (this._hasMatchingBlockTime(this.messageArea.node, newHtml, false)) {
+                        newHtml.find(SELECTORS.BLOCKTIME + ':first').remove();
+                    }
                     // Show the new content.
-                    Templates.appendNodeContents(this.messageArea.find(SELECTORS.MESSAGES), html, js);
+                    Templates.appendNodeContents(this.messageArea.find(SELECTORS.MESSAGES), newHtml, js);
                     // Scroll the new message into view.
                     if (shouldScrollBottom) {
                         this._scrollBottom();
@@ -810,6 +807,8 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
 
         /**
          * Hide the messaging area. This only applies on smaller screen resolutions.
+         *
+         * @private
          */
         Messages.prototype._hideMessagingArea = function() {
             this.messageArea.find(SELECTORS.MESSAGINGAREA)
@@ -817,6 +816,40 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/notification', 'core/cust
                 .addClass('hide-messages');
         };
 
+        /**
+         * Checks if a day separator needs to be removed.
+         *
+         * Example - scrolling up and loading previous messages that belong to the
+         * same day as the last message that was previously shown, meaning we can
+         * remove the original separator.
+         *
+         * @param {jQuery} domHtml The HTML in the DOM.
+         * @param {jQuery} newHtml The HTML to compare to the DOM
+         * @param {boolean} loadingPreviousMessages Are we loading previous messages?
+         * @return {boolean}
+         * @private
+         */
+        Messages.prototype._hasMatchingBlockTime = function(domHtml, newHtml, loadingPreviousMessages) {
+            var blockTime, blockTimePos, newBlockTime, newBlockTimePos;
+
+            if (loadingPreviousMessages) {
+                blockTimePos = ':first';
+                newBlockTimePos = ':last';
+            } else {
+                blockTimePos = ':last';
+                newBlockTimePos = ':first';
+            }
+
+            blockTime = domHtml.find(SELECTORS.BLOCKTIME + blockTimePos);
+            newBlockTime = newHtml.find(SELECTORS.BLOCKTIME + newBlockTimePos);
+
+            if (blockTime.length && newBlockTime.length) {
+                return blockTime.data('blocktime') == newBlockTime.data('blocktime');
+            }
+
+            return false;
+        };
+
         return Messages;
     }
 );
index 4f38fee..4d7eb22 100644 (file)
@@ -41,7 +41,7 @@ if (isset($CFG->maxbytes)) {
     $element = new admin_setting_configselect('assignsubmission_file/maxbytes',
                                               $name,
                                               $description,
-                                              1048576,
+                                              $CFG->maxbytes,
                                               get_max_upload_sizes($CFG->maxbytes, 0, 0, $maxbytes));
     $settings->add($element);
 }
index b162892..b1e7b3d 100644 (file)
@@ -1642,41 +1642,6 @@ table.collection {
     @extend .table-striped;
 }
 
-table.collection .name {
-    text-align: left;
-    vertical-align: middle;
-}
-
-table.collection .awards {
-    width: 10%;
-    text-align: center;
-    vertical-align: middle;
-}
-
-table.collection .criteria {
-    width: 40%;
-    text-align: left;
-    vertical-align: top;
-}
-
-table.collection .badgeimage,
-table.collection .status {
-    width: 15%;
-    text-align: center;
-    vertical-align: middle;
-}
-
-table.collection .description {
-    width: 25%;
-    text-align: left;
-}
-
-table.collection .actions {
-    width: 11em;
-    text-align: center;
-    vertical-align: middle;
-}
-
 a.criteria-action {
     padding: 0 3px;
     float: right;
index 09bea2a..ea2ac8e 100644 (file)
@@ -1761,36 +1761,34 @@ table.collection {
     .table-bordered;
     .table-striped;
 }
-table.collection .name {
+table.collection td.name {
     text-align: left;
     vertical-align: middle;
 }
-table.collection .awards {
-    width: 10%;
+table.collection td.awards {
+    width: 15%;
     text-align: center;
     vertical-align: middle;
 }
-table.collection .criteria {
+table.collection td.criteria {
     width: 40%;
     text-align: left;
     vertical-align: top;
 }
-table.collection .badgeimage,
-table.collection .status {
+table.collection td.status {
     width: 15%;
     text-align: center;
     vertical-align: middle;
 }
-table.collection .description {
+table.collection td.description {
     width: 25%;
     text-align: left;
 }
-table.collection .actions {
+table.collection td.actions {
     width: 11em;
     text-align: center;
     vertical-align: middle;
 }
-
 a.criteria-action {
     padding: 0 3px;
     float: right;
index 04745b8..0e16b43 100644 (file)
@@ -1896,31 +1896,30 @@ table.collection tbody > tr:nth-child(odd) > td,
 table.collection tbody > tr:nth-child(odd) > th {
   background-color: #f9f9f9;
 }
-table.collection .name {
+table.collection td.name {
   text-align: left;
   vertical-align: middle;
 }
-table.collection .awards {
-  width: 10%;
+table.collection td.awards {
+  width: 15%;
   text-align: center;
   vertical-align: middle;
 }
-table.collection .criteria {
+table.collection td.criteria {
   width: 40%;
   text-align: left;
   vertical-align: top;
 }
-table.collection .badgeimage,
-table.collection .status {
+table.collection td.status {
   width: 15%;
   text-align: center;
   vertical-align: middle;
 }
-table.collection .description {
+table.collection td.description {
   width: 25%;
   text-align: left;
 }
-table.collection .actions {
+table.collection td.actions {
   width: 11em;
   text-align: center;
   vertical-align: middle;