-
Bug
-
Resolution: Fixed
-
Major
-
2.3.1, 2.3.4, 2.4.1
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
MOODLE_23_STABLE, MOODLE_24_STABLE
-
wip-
MDL-34798_master-2 -
When AJAX drag and drop move is used with either the Topics or Weeks course formats and the sections (say on a new blank course) are moved down the default section names are updated correctly, however when the sections are moved up they do not.
Investigation of 'format.js' in the course format folder reveals that:
M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
|
var CSS = {
|
SECTIONNAME : 'sectionname'
|
};
|
|
if (response.action == 'move') {
|
// update titles in all affected sections
|
for (var i = sectionfrom; i <= sectionto; i++) {
|
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
|
}
|
}
|
}
|
Therefore the code should deal with the circumstance when 'sectionfrom' is greater than 'sectionto' which is the case when moving up (as proved though placement of debugging 'alert' statements).
Therefore the code should become:
M.course.format.process_sections = function(Y, sectionlist, response, sectionfrom, sectionto) {
|
var CSS = {
|
SECTIONNAME : 'sectionname'
|
};
|
|
if (response.action == 'move') {
|
if (sectionfrom > sectionto) {
|
// Swap.
|
var temp = sectionto;
|
sectionto = sectionfrom;
|
sectionfrom = temp;
|
}
|
// update titles in all affected sections
|
for (var i = sectionfrom; i <= sectionto; i++) {
|
sectionlist.item(i).one('.'+CSS.SECTIONNAME).setContent(response.sectiontitles[i]);
|
}
|
}
|
}
|
- has a non-specific relationship to
-
MDL-33623 Section highlighting does not stick with topic section with AJAX off
- Closed
- has been marked as being related by
-
MDL-49592 Click to move section is broken when moving section up
- Closed
- will help resolve
-
MDL-37901 Drag handle tooltip for sections is not updated
- Closed