Merge branch 'MDL-55074-master' of git://github.com/damyon/moodle
authorDavid Monllao <davidm@moodle.com>
Mon, 24 Oct 2016 04:33:51 +0000 (12:33 +0800)
committerDavid Monllao <davidm@moodle.com>
Mon, 24 Oct 2016 04:33:51 +0000 (12:33 +0800)
1  2 
course/tests/externallib_test.php
lib/upgrade.txt
theme/bootstrapbase/style/moodle.css

@@@ -558,6 -558,7 +558,7 @@@ class core_course_externallib_testcase 
          $coursedata['summary'] = 'Course 1 description';
          $coursedata['summaryformat'] = FORMAT_MOODLE;
          $course1  = self::getDataGenerator()->create_course($coursedata);
          $generatedcourses[$course1->id] = $course1;
          $course2  = self::getDataGenerator()->create_course();
          $generatedcourses[$course2->id] = $course2;
          $generatedcourses = array();
          $coursedata1['fullname'] = 'FIRST COURSE';
          $course1  = self::getDataGenerator()->create_course($coursedata1);
+         $page = new moodle_page();
+         $page->set_course($course1);
+         $page->blocks->add_blocks([BLOCK_POS_LEFT => ['news_items'], BLOCK_POS_RIGHT => []], 'course-view-*');
          $coursedata2['fullname'] = 'SECOND COURSE';
          $course2  = self::getDataGenerator()->create_course($coursedata2);
+         $page = new moodle_page();
+         $page->set_course($course2);
+         $page->blocks->add_blocks([BLOCK_POS_LEFT => ['news_items'], BLOCK_POS_RIGHT => []], 'course-view-*');
          // Search by name.
          $results = core_course_external::search_courses('search', 'FIRST');
          $results = external_api::clean_returnvalue(core_course_external::search_courses_returns(), $results);
          // Hidden activity.
          $assign = self::getDataGenerator()->create_module('assign', $record, $options);
  
 +        $outcomescale = 'Distinction, Very Good, Good, Pass, Fail';
 +
 +        // Insert a custom grade scale to be used by an outcome.
 +        $gradescale = new grade_scale();
 +        $gradescale->name        = 'gettcoursemodulescale';
 +        $gradescale->courseid    = $course->id;
 +        $gradescale->userid      = 0;
 +        $gradescale->scale       = $outcomescale;
 +        $gradescale->description = 'This scale is used to mark standard assignments.';
 +        $gradescale->insert();
 +
 +        // Insert an outcome.
 +        $data = new stdClass();
 +        $data->courseid = $course->id;
 +        $data->fullname = 'Team work';
 +        $data->shortname = 'Team work';
 +        $data->scaleid = $gradescale->id;
 +        $outcome = new grade_outcome($data, false);
 +        $outcome->insert();
 +
 +        $outcomegradeitem = new grade_item();
 +        $outcomegradeitem->itemname = $outcome->shortname;
 +        $outcomegradeitem->itemtype = 'mod';
 +        $outcomegradeitem->itemmodule = 'assign';
 +        $outcomegradeitem->iteminstance = $assign->id;
 +        $outcomegradeitem->outcomeid = $outcome->id;
 +        $outcomegradeitem->cmid = 0;
 +        $outcomegradeitem->courseid = $course->id;
 +        $outcomegradeitem->aggregationcoef = 0;
 +        $outcomegradeitem->itemnumber = 1; // The activity's original grade item will be 0.
 +        $outcomegradeitem->gradetype = GRADE_TYPE_SCALE;
 +        $outcomegradeitem->scaleid = $outcome->scaleid;
 +        $outcomegradeitem->insert();
 +
 +        $assignmentgradeitem = grade_item::fetch(
 +            array(
 +                'itemtype' => 'mod',
 +                'itemmodule' => 'assign',
 +                'iteminstance' => $assign->id,
 +                'itemnumber' => 0,
 +                'courseid' => $course->id
 +            )
 +        );
 +        $outcomegradeitem->set_parent($assignmentgradeitem->categoryid);
 +        $outcomegradeitem->move_after_sortorder($assignmentgradeitem->sortorder);
 +
          // Test admin user can see the complete hidden activity.
          $result = core_course_external::get_course_module($assign->cmid);
          $result = external_api::clean_returnvalue(core_course_external::get_course_module_returns(), $result);
  
          $this->assertCount(0, $result['warnings']);
          // Test we retrieve all the fields.
 -        $this->assertCount(26, $result['cm']);
 +        $this->assertCount(27, $result['cm']);
          $this->assertEquals($record['name'], $result['cm']['name']);
          $this->assertEquals($options['idnumber'], $result['cm']['idnumber']);
          $this->assertEquals(100, $result['cm']['grade']);
          $this->assertEquals(0.0, $result['cm']['gradepass']);
          $this->assertEquals('submissions', $result['cm']['advancedgrading'][0]['area']);
          $this->assertEmpty($result['cm']['advancedgrading'][0]['method']);
 -        $this->assertArrayNotHasKey('outcomes', $result['cm']);
 +        $this->assertEquals($outcomescale, $result['cm']['outcomes'][0]['scale']);
  
          $student = $this->getDataGenerator()->create_user();
          $studentrole = $DB->get_record('role', array('shortname' => 'student'));
                  $navoptions->{$option['name']} = $option['available'];
              }
              if ($course['id'] == SITEID) {
-                 $this->assertCount(7, $course['options']);
+                 $this->assertCount(8, $course['options']);
                  $this->assertTrue($navoptions->blogs);
                  $this->assertFalse($navoptions->notes);
                  $this->assertFalse($navoptions->participants);
                  $this->assertTrue($navoptions->tags);
                  $this->assertFalse($navoptions->search);
                  $this->assertTrue($navoptions->calendar);
+                 $this->assertTrue($navoptions->competencies);
              } else {
-                 $this->assertCount(4, $course['options']);
+                 $this->assertCount(6, $course['options']);
                  $this->assertTrue($navoptions->blogs);
                  $this->assertFalse($navoptions->notes);
                  $this->assertTrue($navoptions->participants);
                  $this->assertTrue($navoptions->badges);
+                 $this->assertTrue($navoptions->grades);
+                 $this->assertTrue($navoptions->competencies);
              }
          }
      }
                  $this->assertFalse($adminoptions->publish);
                  $this->assertFalse($adminoptions->reset);
                  $this->assertFalse($adminoptions->roles);
-                 $this->assertFalse($adminoptions->grades);
              } else {
-                 $this->assertCount(15, $course['options']);
+                 $this->assertCount(14, $course['options']);
                  $this->assertFalse($adminoptions->update);
                  $this->assertFalse($adminoptions->filters);
                  $this->assertFalse($adminoptions->reports);
                  $this->assertFalse($adminoptions->publish);
                  $this->assertFalse($adminoptions->reset);
                  $this->assertFalse($adminoptions->roles);
-                 $this->assertTrue($adminoptions->grades);
              }
          }
      }
diff --combined lib/upgrade.txt
@@@ -3,6 -3,7 +3,7 @@@ information provided here is intended e
  
  === 3.2 ===
  
+ * Admin setting "Show My courses expanded on Dashboard" has been removed.
  * MForms element 'submitlink' has been deprecated.
  * Node.js versions >=4 are now required to run grunt.
  * JQuery has been updated to 3.1.0. JQuery migrate plugins are no longer shipped - please read
@@@ -37,7 -38,6 +38,7 @@@
    - get_logs()            - See MDL-43681 for more information
    - get_logs_usercourse() - See MDL-43681 for more information
    - get_logs_userday()    - See MDL-43681 for more information
 +  - prevent_form_autofill_password() Please do not use anymore.
  * The password_compat library was removed as it is no longer required.
  * Phpunit has been upgraded to 5.4.x and following has been deprecated and is not used any more:
    - setExpectedException(), use @expectedException or $this->expectException() and $this->expectExceptionMessage()
@@@ -6195,9 -6195,6 +6195,9 @@@ a.ygtvspacer:hover 
    border-radius: 4px;
    position: relative;
  }
 +.messaging-area-container .messaging-area .messages-area .messages .message .content .text {
 +  display: block;
 +}
  .messaging-area-container .messaging-area .messages-area .messages .message .content .text p {
    margin: 0;
  }
@@@ -14352,11 -14349,6 +14352,11 @@@ input[size] 
  textarea[data-auto-rows] {
    overflow-x: hidden;
  }
 +div[data-passwordunmask="wrapper"] {
 +  height: 30px;
 +  line-height: 30px;
 +  margin-bottom: 10px;
 +}
  body.modal-open {
    overflow: hidden;
  }
@@@ -18628,6 -18620,9 +18628,9 @@@ body.behat-site .navbar-fixed-top 
  #page-footer .performanceinfo .cachesused .cache-definition-stats .cache-store-stats.hihits {
    background-color: #dff0d8;
  }
+ #page-footer .performanceinfo li {
+   list-style-type: none;
+ }
  #page-footer,
  #page-footer .validators,
  #page-footer .purgecaches,