mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 12:32:08 +02:00
MDL-73117 calendar: Final deprecation of threemonth_cal
This commit is contained in:
parent
b2fa19f45d
commit
3d301abcec
13
calendar/amd/build/calendar_threemonth.min.js
vendored
13
calendar/amd/build/calendar_threemonth.min.js
vendored
@ -1,13 +0,0 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
define("core_calendar/calendar_threemonth",["jquery","core/notification","core_calendar/selectors","core_calendar/events","core/templates","core_calendar/view_manager"],(function($,Notification,CalendarSelectors,CalendarEvents,Templates,CalendarViewManager){return{init:function(root){!function(root){$("body").on([CalendarEvents.monthChanged,CalendarEvents.dayChanged].join(" "),(function(e,year,month,courseId,categoryId){root.queue((function(next){return processRequest(e,year,month,courseId,categoryId).then((function(){return next()})).fail(Notification.exception)}))}));var processRequest=function(e,year,month,courseId,categoryId){var newParent=root.find('[data-year="'+year+'"][data-month="'+month+'"]').closest(CalendarSelectors.calendarPeriods.month),allMonths=root.find(CalendarSelectors.calendarPeriods.month),previousMonth=$(allMonths[0]),nextMonth=$(allMonths[2]),placeHolder=$("<span>");placeHolder.attr("data-template","core_calendar/threemonth_month"),placeHolder.attr("data-includenavigation",!1),placeHolder.attr("data-mini",!0);var requestYear,requestMonth,oldMonth,placeHolderContainer=$("<div>");if(placeHolderContainer.hide(),placeHolderContainer.append(placeHolder),newParent.is(previousMonth))placeHolderContainer.insertBefore(previousMonth),requestYear=previousMonth.data("previousYear"),requestMonth=previousMonth.data("previousMonth"),oldMonth=nextMonth;else{if(!newParent.is(nextMonth))return $.Deferred().resolve();placeHolderContainer.insertAfter(nextMonth),requestYear=nextMonth.data("nextYear"),requestMonth=nextMonth.data("nextMonth"),oldMonth=previousMonth}return CalendarViewManager.refreshMonthContent(placeHolder,requestYear,requestMonth,courseId,categoryId,placeHolder).then((function(){var slideUpPromise=$.Deferred(),slideDownPromise=$.Deferred();return oldMonth.slideUp("fast",(function(){$(this).remove(),slideUpPromise.resolve()})),placeHolderContainer.slideDown("fast",(function(){slideDownPromise.resolve()})),$.when(slideUpPromise,slideDownPromise)}))};root.on("click",CalendarSelectors.links.miniDayLink,(function(e){var miniDayLink=$(e.target),year=miniDayLink.data("year"),month=miniDayLink.data("month"),day=miniDayLink.text(),courseId=miniDayLink.data("courseid"),categoryId=miniDayLink.data("categoryid"),calendarRoot=$("body").find(CalendarSelectors.calendarMain);CalendarViewManager.refreshDayContent(calendarRoot,year,month,day,courseId,categoryId,calendarRoot.find('[id^="calendar-"][data-template^="core_calendar/"]'),"core_calendar/calendar_day"),e.preventDefault(),CalendarViewManager.updateUrl("?view=day")}))}(root=$(root))}}}));
|
||||
|
||||
//# sourceMappingURL=calendar_threemonth.min.js.map
|
File diff suppressed because one or more lines are too long
@ -1,148 +0,0 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
define([
|
||||
'jquery',
|
||||
'core/notification',
|
||||
'core_calendar/selectors',
|
||||
'core_calendar/events',
|
||||
'core/templates',
|
||||
'core_calendar/view_manager',
|
||||
],
|
||||
function(
|
||||
$,
|
||||
Notification,
|
||||
CalendarSelectors,
|
||||
CalendarEvents,
|
||||
Templates,
|
||||
CalendarViewManager
|
||||
) {
|
||||
|
||||
/**
|
||||
* Listen to and handle any calendar events fired by the calendar UI.
|
||||
*
|
||||
* @method registerCalendarEventListeners
|
||||
* @param {object} root The calendar root element
|
||||
*/
|
||||
var registerCalendarEventListeners = function(root) {
|
||||
var body = $('body');
|
||||
body.on([CalendarEvents.monthChanged, CalendarEvents.dayChanged].join(' '), function(e, year, month, courseId, categoryId) {
|
||||
// We have to use a queue here because the calling code is decoupled from these listeners.
|
||||
// It's possible for the event to be called multiple times before one call is fully resolved.
|
||||
root.queue(function(next) {
|
||||
return processRequest(e, year, month, courseId, categoryId)
|
||||
.then(function() {
|
||||
return next();
|
||||
})
|
||||
.fail(Notification.exception)
|
||||
;
|
||||
});
|
||||
});
|
||||
|
||||
var processRequest = function(e, year, month, courseId, categoryId) {
|
||||
var newCurrentMonth = root.find('[data-year="' + year + '"][data-month="' + month + '"]');
|
||||
var newParent = newCurrentMonth.closest(CalendarSelectors.calendarPeriods.month);
|
||||
var allMonths = root.find(CalendarSelectors.calendarPeriods.month);
|
||||
|
||||
var previousMonth = $(allMonths[0]);
|
||||
var nextMonth = $(allMonths[2]);
|
||||
|
||||
var placeHolder = $('<span>');
|
||||
placeHolder.attr('data-template', 'core_calendar/threemonth_month');
|
||||
placeHolder.attr('data-includenavigation', false);
|
||||
placeHolder.attr('data-mini', true);
|
||||
var placeHolderContainer = $('<div>');
|
||||
placeHolderContainer.hide();
|
||||
placeHolderContainer.append(placeHolder);
|
||||
|
||||
var requestYear;
|
||||
var requestMonth;
|
||||
var oldMonth;
|
||||
|
||||
if (newParent.is(previousMonth)) {
|
||||
// Fetch the new previous month.
|
||||
placeHolderContainer.insertBefore(previousMonth);
|
||||
|
||||
requestYear = previousMonth.data('previousYear');
|
||||
requestMonth = previousMonth.data('previousMonth');
|
||||
oldMonth = nextMonth;
|
||||
} else if (newParent.is(nextMonth)) {
|
||||
// Fetch the new next month.
|
||||
placeHolderContainer.insertAfter(nextMonth);
|
||||
requestYear = nextMonth.data('nextYear');
|
||||
requestMonth = nextMonth.data('nextMonth');
|
||||
oldMonth = previousMonth;
|
||||
} else {
|
||||
return $.Deferred().resolve();
|
||||
}
|
||||
|
||||
return CalendarViewManager.refreshMonthContent(
|
||||
placeHolder,
|
||||
requestYear,
|
||||
requestMonth,
|
||||
courseId,
|
||||
categoryId,
|
||||
placeHolder
|
||||
)
|
||||
.then(function() {
|
||||
var slideUpPromise = $.Deferred();
|
||||
var slideDownPromise = $.Deferred();
|
||||
oldMonth.slideUp('fast', function() {
|
||||
$(this).remove();
|
||||
slideUpPromise.resolve();
|
||||
});
|
||||
placeHolderContainer.slideDown('fast', function() {
|
||||
slideDownPromise.resolve();
|
||||
});
|
||||
|
||||
return $.when(slideUpPromise, slideDownPromise);
|
||||
});
|
||||
};
|
||||
|
||||
// Listen for a click on the day link in the three month block to load the day view.
|
||||
root.on('click', CalendarSelectors.links.miniDayLink, function(e) {
|
||||
|
||||
var miniDayLink = $(e.target);
|
||||
var year = miniDayLink.data('year'),
|
||||
month = miniDayLink.data('month'),
|
||||
day = miniDayLink.text(),
|
||||
courseId = miniDayLink.data('courseid'),
|
||||
categoryId = miniDayLink.data('categoryid'),
|
||||
calendarRoot = $('body').find(CalendarSelectors.calendarMain);
|
||||
CalendarViewManager.refreshDayContent(calendarRoot, year, month, day, courseId, categoryId,
|
||||
calendarRoot.find('[id^="calendar-"][data-template^="core_calendar/"]'), 'core_calendar/calendar_day');
|
||||
e.preventDefault();
|
||||
CalendarViewManager.updateUrl('?view=day');
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
init: function(root) {
|
||||
root = $(root);
|
||||
|
||||
registerCalendarEventListeners(root);
|
||||
}
|
||||
};
|
||||
});
|
@ -51,63 +51,10 @@ class core_calendar_renderer extends plugin_renderer_base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Produces the content for the three months block (pretend block)
|
||||
*
|
||||
* 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);
|
||||
|
||||
$current = $calendar->time;
|
||||
$prevmonthyear = $calendartype->get_prev_month($time['year'], $time['mon']);
|
||||
$prev = $calendartype->convert_to_timestamp(
|
||||
$prevmonthyear[1],
|
||||
$prevmonthyear[0],
|
||||
1
|
||||
);
|
||||
$nextmonthyear = $calendartype->get_next_month($time['year'], $time['mon']);
|
||||
$next = $calendartype->convert_to_timestamp(
|
||||
$nextmonthyear[1],
|
||||
$nextmonthyear[0],
|
||||
1
|
||||
);
|
||||
|
||||
$content = '';
|
||||
|
||||
// Previous.
|
||||
$calendar->set_time($prev);
|
||||
list($previousmonth, ) = calendar_get_view($calendar, 'minithree', false, true);
|
||||
|
||||
// Current month.
|
||||
$calendar->set_time($current);
|
||||
list($currentmonth, ) = calendar_get_view($calendar, 'minithree', false, true);
|
||||
|
||||
// Next month.
|
||||
$calendar->set_time($next);
|
||||
list($nextmonth, ) = calendar_get_view($calendar, 'minithree', false, true);
|
||||
|
||||
// Reset the time back.
|
||||
$calendar->set_time($current);
|
||||
|
||||
$data = (object) [
|
||||
'previousmonth' => $previousmonth,
|
||||
'currentmonth' => $currentmonth,
|
||||
'nextmonth' => $nextmonth,
|
||||
];
|
||||
|
||||
$template = 'core_calendar/calendar_threemonth';
|
||||
$content .= $this->render_from_template($template, $data);
|
||||
return $content;
|
||||
public function fake_block_threemonths() {
|
||||
throw new coding_exception(__FUNCTION__ . '() has been removed.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,52 +0,0 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_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.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
}
|
||||
}}
|
||||
<div id="calendar-multi-{{uniqid}}">
|
||||
{{#previousmonth}}
|
||||
{{> core_calendar/threemonth_month}}
|
||||
{{/previousmonth}}
|
||||
{{#currentmonth}}
|
||||
{{> core_calendar/threemonth_month}}
|
||||
{{/currentmonth}}
|
||||
{{#nextmonth}}
|
||||
{{> core_calendar/threemonth_month}}
|
||||
{{/nextmonth}}
|
||||
</div>
|
||||
{{#js}}
|
||||
require(['jquery', 'core_calendar/calendar_threemonth'], function($, CalendarThreeMonth) {
|
||||
CalendarThreeMonth.init($("#calendar-multi-{{uniqid}}"));
|
||||
});
|
||||
{{/js}}
|
@ -1,42 +0,0 @@
|
||||
{{!
|
||||
This file is part of Moodle - http://moodle.org/
|
||||
|
||||
Moodle is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Moodle is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
}}
|
||||
{{!
|
||||
@template core_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.
|
||||
|
||||
Classes required for JS:
|
||||
* none
|
||||
|
||||
Data attributes required for JS:
|
||||
* none
|
||||
|
||||
Example context (json):
|
||||
{
|
||||
}
|
||||
}}
|
||||
<div data-period="month" class="calendarwrapper"{{!
|
||||
}} data-previous-year="{{previousperiod.year}}" data-previous-month="{{previousperiod.mon}}" {{!
|
||||
}} data-next-year="{{nextperiod.year}}" data-next-month="{{nextperiod.mon}}" {{!
|
||||
}}>
|
||||
{{> core_calendar/calendar_mini}}
|
||||
</div>
|
@ -122,16 +122,6 @@ class behat_calendar extends behat_base {
|
||||
$this->i_hover_over_day_of_this_month_in_mini_calendar_block($todaysday);
|
||||
}
|
||||
|
||||
/**
|
||||
* Hover over today in the calendar.
|
||||
*
|
||||
* @Given /^I hover over today in the calendar$/
|
||||
*/
|
||||
public function i_hover_over_today_in_the_calendar() {
|
||||
$todaysday = date('j');
|
||||
return $this->i_hover_over_day_of_this_month_in_calendar($todaysday);
|
||||
}
|
||||
|
||||
/**
|
||||
* Navigate to a specific month in the calendar.
|
||||
*
|
||||
|
48
calendar/tests/behat/behat_calendar_deprecated.php
Normal file
48
calendar/tests/behat/behat_calendar_deprecated.php
Normal file
@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// NOTE: no MOODLE_INTERNAL test here, this file may be required by behat before including /config.php.
|
||||
|
||||
require_once(__DIR__ . '/../../../lib/behat/behat_deprecated_base.php');
|
||||
|
||||
/**
|
||||
* Steps definitions that are now deprecated and will be removed in the next releases.
|
||||
*
|
||||
* This file only contains the steps that previously were in the behat_*.php files in the SAME DIRECTORY.
|
||||
* When deprecating steps from other components or plugins, create a behat_COMPONENT_deprecated.php
|
||||
* file in the same directory where the steps were defined.
|
||||
*
|
||||
* @package core_calendar
|
||||
* @category test
|
||||
* @copyright 2024 Mathew May <mathew.solutions>
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
class behat_calendar_deprecated extends behat_deprecated_base {
|
||||
/**
|
||||
* Hover over today in the calendar.
|
||||
*
|
||||
* @Given /^I hover over today in the calendar$/
|
||||
*
|
||||
* @deprecated since 4.4 MDL-73117.
|
||||
* @TODO MDL-79721: This will be deleted in Moodle 4.8.
|
||||
*/
|
||||
public function i_hover_over_today_in_the_calendar() {
|
||||
$this->deprecated_message('behat_calendar::i_hover_over_today_in_the_calendar');
|
||||
$todaysday = date('j');
|
||||
// Note: This step was removed via MDL-71733 but this step was not deprecated alongside it.
|
||||
return $this->i_hover_over_day_of_this_month_in_calendar($todaysday);
|
||||
}
|
||||
}
|
@ -5,6 +5,17 @@ information provided here is intended especially for developers.
|
||||
* The following previously deprecated methods have been removed and can no longer be used:
|
||||
- `calendar_process_subscription_row`
|
||||
- `calendar_import_icalendar_events`
|
||||
- `fake_block_threemonths`
|
||||
- `i_click_day_of_this_month_in_calendar`
|
||||
- `i_hover_over_today_in_the_calendar`
|
||||
|
||||
* The following previously deprecated files have been removed and can no longer be used:
|
||||
- `calendar_threemonth.js`
|
||||
- `calendar_threemonth.mustache`
|
||||
- `threemonth_month.mustache`
|
||||
|
||||
* The following have been deprecated:
|
||||
- Behat step definition `i_hover_over_today_in_the_calendar`
|
||||
|
||||
=== 4.3 ===
|
||||
* The `navigation` property has been removed from `\core_calendar\external\day_exporter` as it is not being used by any of the
|
||||
|
Loading…
x
Reference in New Issue
Block a user