Merge branch 'MDL-72810-master' of git://github.com/mickhawkins/moodle

This commit is contained in:
Jun Pataleta 2021-11-29 17:19:28 +08:00
commit 5438a3944a
13 changed files with 76 additions and 73 deletions

File diff suppressed because one or more lines are too long

View File

@ -17,6 +17,8 @@
* This module handles display of multiple mini calendars in a view, and
* movement through them.
*
* @deprecated since 4.0 MDL-72810.
* @todo MDL-73117 This will be deleted in Moodle 4.4.
* @module core_calendar/calendar_threemonth
* @copyright 2017 Andrew Nicols <andrew@nicols.co.uk>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

View File

@ -1307,11 +1307,6 @@ class calendar_information {
$filters->title = get_string('eventskey', 'calendar');
$renderer->add_pretend_calendar_block($filters, BLOCK_POS_RIGHT);
}
$block = new block_contents;
$block->content = $renderer->fake_block_threemonths($this);
$block->footer = '';
$block->title = get_string('monthlyview', 'calendar');
$renderer->add_pretend_calendar_block($block, BLOCK_POS_RIGHT);
}
/**

View File

@ -55,10 +55,15 @@ class core_calendar_renderer extends plugin_renderer_base {
*
* This includes the previous month, the current month, and the next month
*
* @deprecated since 4.0 MDL-72810.
* @todo MDL-73117 This will be deleted in Moodle 4.4.
*
* @param calendar_information $calendar
* @return string
*/
public function fake_block_threemonths(calendar_information $calendar) {
debugging('This method is no longer used as the three month calendar block has been removed', DEBUG_DEVELOPER);
// Get the calendar type we are using.
$calendartype = \core_calendar\type_factory::get_calendar_instance();
$time = $calendartype->timestamp_to_date_array($calendar->time);

View File

@ -17,6 +17,9 @@
{{!
@template calendar/calendar_threemonth
@deprecated since 4.0 MDL-72810.
@todo MDL-73117 This will be deleted in Moodle 4.4.
Calendar view to show three months as a block.
The purpose of this template is to render a set of three months of calendar_mini in a block.

View File

@ -17,6 +17,9 @@
{{!
@template calendar/threemonth_month
@deprecated since 4.0 MDL-72810.
@todo MDL-73117 This will be deleted in Moodle 4.4.
Calendar view to show three months as a block.
The purpose of this template is to render a set of three months of calendar_mini in a block.

View File

@ -89,51 +89,6 @@ class behat_calendar extends behat_base {
}
}
/**
* Click a specific day in the calendar.
*
* @Given /^I click day "(?P<dayofmonth>\d+)" of this month in the calendar$/
* @param int $day The day of the current month
*/
public function i_click_day_of_this_month_in_calendar($day) {
$summarytitle = userdate(time(), get_string('strftimemonthyear'));
// The current month table.
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
// Strings for the class cell match.
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$day} ')]";
$daycell = "td[{$cellclasses}]";
$dayofmonth = "a[{$daycontains}]";
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
$this->execute("behat_general::wait_until_the_page_is_ready");
$this->execute("behat_general::i_click_on", array($xpath, "xpath_element"));
$this->execute("behat_general::wait_until_the_page_is_ready");
}
/**
* Hover over a specific day in the calendar.
*
* @Given /^I hover over day "(?P<dayofmonth>\d+)" of this month in the calendar$/
* @param int $day The day of the current month
*/
public function i_hover_over_day_of_this_month_in_calendar($day) {
$summarytitle = userdate(time(), get_string('strftimemonthyear'));
// The current month table.
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
// Strings for the class cell match.
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$day} ')]";
$daycell = "td[{$cellclasses}]";
$dayofmonth = "a[{$daycontains}]";
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
$this->execute("behat_general::i_hover", [$xpath, "xpath_element"]);
}
/**
* Hover over a specific day in the mini-calendar.
*

View File

@ -35,23 +35,6 @@ Feature: Open calendar popup
And I should see "Event 1:1"
And I should see "Event 1:2"
@javascript
Scenario: I view a day event then another day event
Given I follow "Full calendar"
And I create a calendar event:
| Type of event | site |
| Event title | Event 3:1 |
| timestart[day] | 3 |
And I create a calendar event:
| Type of event | site |
| Event title | Event 4:1 |
| timestart[day] | 4 |
And I reload the page
When I click day "3" of this month in the calendar
Then I should see "Event 3:1" in the ".eventlist" "css_element"
And I click day "4" of this month in the calendar
And I should see "Event 4:1" in the ".eventlist" "css_element"
@javascript
Scenario: I view calendar details for today
Given I follow "Full calendar"

View File

@ -12,7 +12,11 @@ information provided here is intended especially for developers.
- calendar_import_icalendar_events()
* The following has been removed after being deprecated in 3.8
* CALENDAR_EVENT_GLOBAL
* The following have been deprecated because the three-month pseudo block has been removed:
- fake_block_threemonths() renderer method.
- calendar_threemonth.js.
- calendar_threemonth and threemonth_month templates.
- Behat step definitions i_hover_over_day_of_this_month_in_calendar and i_click_day_of_this_month_in_calendar.
=== 3.10 ===
* The core_calendar\local\event\value_objects\times_interface class now has new method get_usermidnight_time() which

View File

@ -183,7 +183,6 @@ $string['manyevents'] = '{$a} events';
$string['mon'] = 'Mon';
$string['monday'] = 'Monday';
$string['monthly'] = 'Monthly';
$string['monthlyview'] = 'Monthly view';
$string['monthnext'] = 'Next month';
$string['monthprev'] = 'Previous month';
$string['monththis'] = 'This month';
@ -286,6 +285,7 @@ $string['yoursubscriptions'] = 'Imported calendars';
// Deprecated since Moodle 4.0.
$string['calendarurl'] = 'Calendar URL: {$a}';
$string['importfrominstructions'] = 'Please provide either a URL to a remote calendar, or upload a file.';
$string['monthlyview'] = 'Monthly view';
// Deprecated since Moodle 3.8.
$string['global'] = 'Global';

View File

@ -163,3 +163,4 @@ mediapluginswf,core_admin
mediapluginswfnote,core_admin
createuserandpass,core
supplyinfo,core
monthlyview,core_calendar

View File

@ -95,4 +95,57 @@ class behat_deprecated extends behat_base {
$this->i_open_flat_navigation_drawer();
$this->execute('behat_general::i_click_on_in_the', [$link, 'link', '#nav-drawer', 'css_element']);
}
/**
* Hover over a specific day in the calendar.
*
* @Given /^I hover over day "(?P<dayofmonth>\d+)" of this month in the calendar$/
* @param int $day The day of the current month
*
* @deprecated since 4.0 MDL-72810. This tested the three-month calendar pseudo block, which has been removed.
* @todo MDL-73117 This will be deleted in Moodle 4.4.
*/
public function i_hover_over_day_of_this_month_in_calendar($day) {
$this->deprecated_message('Check information in the course or timeline calendar blocks or full calendar, as appropriate.');
$summarytitle = userdate(time(), get_string('strftimemonthyear'));
// The current month table.
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
// Strings for the class cell match.
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$day} ')]";
$daycell = "td[{$cellclasses}]";
$dayofmonth = "a[{$daycontains}]";
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
$this->execute("behat_general::i_hover", [$xpath, "xpath_element"]);
}
/**
* Click a specific day in the calendar.
*
* @Given /^I click day "(?P<dayofmonth>\d+)" of this month in the calendar$/
* @param int $day The day of the current month
*
* @deprecated since 4.0 MDL-72810. This tested the three-month calendar pseudo block, which has been removed.
* @todo MDL-73117 This will be deleted in Moodle 4.4.
*/
public function i_click_day_of_this_month_in_calendar($day) {
$this->deprecated_message('Check information in the course or timeline calendar blocks or full calendar, as appropriate.');
// The current month table.
$currentmonth = "table[descendant::*[self::caption[contains(concat(' ', normalize-space(.), ' '), ' {$summarytitle} ')]]]";
// Strings for the class cell match.
$cellclasses = "contains(concat(' ', normalize-space(@class), ' '), ' day ')";
$daycontains = "text()[contains(concat(' ', normalize-space(.), ' '), ' {$day} ')]";
$daycell = "td[{$cellclasses}]";
$dayofmonth = "a[{$daycontains}]";
$xpath = '//' . $currentmonth . '/descendant::' . $daycell . '/' . $dayofmonth;
$this->execute("behat_general::wait_until_the_page_is_ready");
$this->execute("behat_general::i_click_on", array($xpath, "xpath_element"));
$this->execute("behat_general::wait_until_the_page_is_ready");
}
}

View File

@ -56,9 +56,8 @@ Feature: Set availability dates for an assignment
And I log out
And I am on the "C1" Course page logged in as student1
And I follow "Full calendar"
When I hover over day "2" of this month in the calendar
Then I should see "C1: Assignment name is due"
When I hover over day "2" of this month in the mini-calendar block
Then I should see "Assignment name is due"
@_file_upload
Scenario: Student can submit an assignment before the due date