Skip to content

Commit

Permalink
MDL-82341 core_course: deprecate yui modules
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranrecio committed Nov 4, 2024
1 parent 0493cee commit eb0099b
Show file tree
Hide file tree
Showing 22 changed files with 157 additions and 8 deletions.
4 changes: 3 additions & 1 deletion course/amd/build/actions.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion course/amd/build/actions.min.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions course/amd/src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/**
* Various actions on modules and sections in the editing mode - hiding, duplicating, deleting, etc.
*
* TODO remove this module as part of MDL-83627.
*
* @module core_course/actions
* @copyright 2016 Marina Glancy
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Expand Down Expand Up @@ -58,6 +60,7 @@ define(
InplaceEditableEvents,
CourseEvents
) {
log.debug('The course/actions module is deprecated. Please, add support_components to your course format.');

// Eventually, core_courseformat/local/content/actions will handle all actions for
// component compatible formats and the default actions.js won't be necessary anymore.
Expand Down
10 changes: 10 additions & 0 deletions course/dnduploadlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,23 @@
/**
* Add the Javascript to enable drag and drop upload to a course page
*
* @deprecated since Moodle 5.0
* @todo Remove this method in Moodle 6.0 (MDL-83627).
* @param object $course The currently displayed course
* @param array $modnames The list of enabled (visible) modules on this site
* @return void
*/
#[\core\attribute\deprecated(
since: '5.0',
mdl: 'MDL-82341',
reason: 'Moodle 3.9 course editoris deprecated. Make you format compatible with use_component.',
final: true,
)]
function dndupload_add_to_course($course, $modnames) {
global $CFG, $PAGE;

\core\deprecation::emit_deprecation_if_present(__FUNCTION__);

$showstatus = optional_param('notifyeditingon', false, PARAM_BOOL);

// Get all handlers.
Expand Down
12 changes: 9 additions & 3 deletions course/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2765,20 +2765,26 @@ function course_ajax_enabled($course) {
* * pageparams Additional parameters to pass through in the post
* @return bool
*/
function include_course_ajax($course, $usedmodules = array(), $enabledmodules = null, $config = null) {
function include_course_ajax($course, $usedmodules = [], $enabledmodules = null, $config = null) {
global $CFG, $PAGE, $SITE;

// Init the course editor module to support UI components.
$format = course_get_format($course);
include_course_editor($format);

// TODO remove this if as part of MDL-83627.
// Ensure that ajax should be included
if (!course_ajax_enabled($course)) {
return false;
}

// TODO remove this if as part of MDL-83627.
// Component based formats don't use YUI drag and drop anymore.
if (!$format->supports_components() && course_format_uses_sections($course->format)) {
debugging(
'The old course editor will be removed in Moodle 6.0. Ensure your format return true to supports_components',
DEBUG_DEVELOPER
);

if (!$config) {
$config = new stdClass();
Expand Down Expand Up @@ -2854,9 +2860,9 @@ function include_course_ajax($course, $usedmodules = array(), $enabledmodules =
// Load drag and drop upload AJAX.
require_once($CFG->dirroot.'/course/dnduploadlib.php');
dndupload_add_to_course($course, $enabledmodules);
}

$PAGE->requires->js_call_amd('core_course/actions', 'initCoursePage', array($course->format));
$PAGE->requires->js_call_amd('core_course/actions', 'initCoursePage', [$course->format]);
}

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ YUI.add('moodle-course-coursebase', function (Y, NAME) {
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-coursebase
*/
var COURSEBASENAME = 'course-coursebase';
Expand All @@ -12,6 +14,8 @@ var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
};

Y.log('This module is deprecated. Please, add support_components to your course format.', 'warn', 'moodle-course-coursebase');

/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ YUI.add('moodle-course-coursebase', function (Y, NAME) {
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-coursebase
*/
var COURSEBASENAME = 'course-coursebase';
Expand All @@ -12,6 +14,7 @@ var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
};


/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,17 @@ YUI.add('moodle-course-dragdrop', function (Y, NAME) {
/**
* Drag and Drop for course sections and course modules.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-dragdrop
*/

Y.log(
'YUI moodle-course-dragdrop is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

var CSS = {
ACTIONAREA: '.actions',
ACTIVITY: 'activity',
Expand All @@ -33,13 +41,22 @@ M.course = M.course || {};
/**
* Section drag and drop.
*
* TODO: remove this module as part of MDL-83627.
*
* @class M.course.dragdrop.section
* @constructor
* @extends M.core.dragdrop
*/
var DRAGSECTION = function() {
DRAGSECTION.superclass.constructor.apply(this, arguments);
};

Y.log(
'YUI M.course.dragdrop.section is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

Y.extend(DRAGSECTION, M.core.dragdrop, {
sectionlistselector: null,

Expand Down Expand Up @@ -331,13 +348,22 @@ M.course.init_section_dragdrop = function(params) {
/**
* Resource drag and drop.
*
* TODO: remove this module as part of MDL-83627.
*
* @class M.course.dragdrop.resource
* @constructor
* @extends M.core.dragdrop
*/
var DRAGRESOURCE = function() {
DRAGRESOURCE.superclass.constructor.apply(this, arguments);
};

Y.log(
'YUI M.course.dragdrop.resource is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

Y.extend(DRAGRESOURCE, M.core.dragdrop, {
initializer: function() {
// Set group for parent class
Expand Down
11 changes: 11 additions & 0 deletions course/yui/build/moodle-course-dragdrop/moodle-course-dragdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ YUI.add('moodle-course-dragdrop', function (Y, NAME) {
/**
* Drag and Drop for course sections and course modules.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-dragdrop
*/


var CSS = {
ACTIONAREA: '.actions',
ACTIVITY: 'activity',
Expand All @@ -33,13 +36,17 @@ M.course = M.course || {};
/**
* Section drag and drop.
*
* TODO: remove this module as part of MDL-83627.
*
* @class M.course.dragdrop.section
* @constructor
* @extends M.core.dragdrop
*/
var DRAGSECTION = function() {
DRAGSECTION.superclass.constructor.apply(this, arguments);
};


Y.extend(DRAGSECTION, M.core.dragdrop, {
sectionlistselector: null,

Expand Down Expand Up @@ -327,13 +334,17 @@ M.course.init_section_dragdrop = function(params) {
/**
* Resource drag and drop.
*
* TODO: remove this module as part of MDL-83627.
*
* @class M.course.dragdrop.resource
* @constructor
* @extends M.core.dragdrop
*/
var DRAGRESOURCE = function() {
DRAGRESOURCE.superclass.constructor.apply(this, arguments);
};


Y.extend(DRAGRESOURCE, M.core.dragdrop, {
initializer: function() {
// Set group for parent class
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ YUI.add('moodle-course-util-base', function (Y, NAME) {
/**
* The Moodle.core_course.util classes provide course-related utility functions.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-util
* @main
*/

Y.namespace('Moodle.core_course.util');

Y.log(
'YUI Moodle.core_course.util is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

/**
* A collection of general utility functions for use in course.
*
Expand All @@ -17,5 +25,4 @@ Y.namespace('Moodle.core_course.util');
*/



}, '@VERSION@');
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ YUI.add('moodle-course-util-base', function (Y, NAME) {
/**
* The Moodle.core_course.util classes provide course-related utility functions.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-util
* @main
*/

Y.namespace('Moodle.core_course.util');


/**
* A collection of general utility functions for use in course.
*
Expand All @@ -17,5 +20,4 @@ Y.namespace('Moodle.core_course.util');
*/



}, '@VERSION@');
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ YUI.add('moodle-course-util-cm', function (Y, NAME) {
/**
* A collection of utility classes for use with course modules.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-util
* @submodule moodle-course-util-cm
*/

Y.namespace('Moodle.core_course.util.cm');

Y.log(
'YUI Moodle.core_course.util.cm is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

/**
* A collection of utility classes for use with course modules.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ YUI.add('moodle-course-util-cm', function (Y, NAME) {
/**
* A collection of utility classes for use with course modules.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-util
* @submodule moodle-course-util-cm
*/

Y.namespace('Moodle.core_course.util.cm');


/**
* A collection of utility classes for use with course modules.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@ YUI.add('moodle-course-util-section', function (Y, NAME) {
/**
* A collection of utility classes for use with course sections.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-util
* @submodule moodle-course-util-section
*/

Y.namespace('Moodle.core_course.util.section');

Y.log(
'YUI Moodle.core_course.util.cm is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

/**
* A collection of utility classes for use with course sections.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ YUI.add('moodle-course-util-section', function (Y, NAME) {
/**
* A collection of utility classes for use with course sections.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-util
* @submodule moodle-course-util-section
*/

Y.namespace('Moodle.core_course.util.section');


/**
* A collection of utility classes for use with course sections.
*
Expand Down
4 changes: 4 additions & 0 deletions course/yui/src/coursebase/js/coursebase.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
* The coursebase class to provide shared functionality to Modules within
* Moodle.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-coursebase
*/
var COURSEBASENAME = 'course-coursebase';
Expand All @@ -10,6 +12,8 @@ var COURSEBASE = function() {
COURSEBASE.superclass.constructor.apply(this, arguments);
};

Y.log('This module is deprecated. Please, add support_components to your course format.', 'warn', 'moodle-course-coursebase');

/**
* The coursebase class to provide shared functionality to Modules within
* Moodle.
Expand Down
8 changes: 8 additions & 0 deletions course/yui/src/dragdrop/js/dragdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
/**
* Drag and Drop for course sections and course modules.
*
* TODO: remove this module as part of MDL-83627.
*
* @module moodle-course-dragdrop
*/

Y.log(
'YUI moodle-course-dragdrop is deprecated. Please, add support_components to your course format.',
'warn',
'moodle-course-coursebase'
);

var CSS = {
ACTIONAREA: '.actions',
ACTIVITY: 'activity',
Expand Down
Loading

0 comments on commit eb0099b

Please sign in to comment.