mirror of
https://github.com/moodle/moodle.git
synced 2025-08-10 03:16:42 +02:00
Merge branch 'MDL-82478-main' of https://github.com/aanabit/moodle
This commit is contained in:
commit
83a031e39f
6 changed files with 41 additions and 18 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -596,17 +596,31 @@ export default class extends BaseComponent {
|
|||
|
||||
let bodyText = null;
|
||||
let titleText = null;
|
||||
let delegatedsection = null;
|
||||
if (cmIds.length == 1) {
|
||||
const cmInfo = this.reactive.get('cm', cmIds[0]);
|
||||
titleText = getString('cmdelete_title', 'core_courseformat');
|
||||
bodyText = getString(
|
||||
'cmdelete_info',
|
||||
'core_courseformat',
|
||||
{
|
||||
type: cmInfo.modname,
|
||||
name: cmInfo.name,
|
||||
}
|
||||
);
|
||||
if (cmInfo.hasdelegatedsection) {
|
||||
delegatedsection = cmInfo.delegatesectionid;
|
||||
titleText = this.reactive.getFormatString('cmdelete_subsectiontitle');
|
||||
bodyText = getString(
|
||||
'sectiondelete_info',
|
||||
'core_courseformat',
|
||||
{
|
||||
type: cmInfo.modname,
|
||||
name: cmInfo.name,
|
||||
}
|
||||
);
|
||||
} else {
|
||||
titleText = this.reactive.getFormatString('cmdelete_title');
|
||||
bodyText = getString(
|
||||
'cmdelete_info',
|
||||
'core_courseformat',
|
||||
{
|
||||
type: cmInfo.modname,
|
||||
name: cmInfo.name,
|
||||
}
|
||||
);
|
||||
}
|
||||
} else {
|
||||
titleText = getString('cmsdelete_title', 'core_courseformat');
|
||||
bodyText = getString(
|
||||
|
@ -628,6 +642,13 @@ export default class extends BaseComponent {
|
|||
e.preventDefault();
|
||||
modal.destroy();
|
||||
this.reactive.dispatch('cmDelete', cmIds);
|
||||
if (cmIds.length == 1 && delegatedsection && target.baseURI.includes('section.php')) {
|
||||
// Redirect to the course main page if the subsection is the current page.
|
||||
let parameters = new URLSearchParams(window.location.search);
|
||||
if (parameters.has('id') && parameters.get('id') == delegatedsection) {
|
||||
this._dispatchSectionDelete([delegatedsection], target);
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -184,8 +184,7 @@ class delegatedcontrolmenu extends basecontrolmenu {
|
|||
}
|
||||
|
||||
// Delete deletes the module.
|
||||
// Only show the delete link if we are not already in the section view page.
|
||||
if (!$isheadersection && $hasmanageactivities) {
|
||||
if ($hasmanageactivities) {
|
||||
$url = clone($cmbaseurl);
|
||||
$url->param('delete', $cm->id);
|
||||
$url->param('sr', $cm->sectionnum);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue