Moodle

Moving resources with AJAX into sections that contain UL tags in the summary

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4
  • Fix Version/s: None
  • Component/s: AJAX
  • Labels:
    None
  • Environment:
    NA
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE

Description

When moving resources by drag and drop, there is a strange behavior if the summary of the section contains ul tags. The problem comes from the fact that the resources_ul is identified as the first ul in the content_td. The fix consists of finding the first ul which has a classname of section and use it as the resources_ul.

This snippet shows the place where the problem comes from as well as the proposed fix.

In file /lib/ajax/section_classes.js
In function section_class.prototype.process_section

Line 139:
// Find/edit resources
//this.resources_ul = this.content_td.getElementsByTagName('ul')[0];

// Fix:
var all_uls = this.content_td.getElementsByTagName('ul');
i = 0;
while (i < all_uls.length) {
if (all_uls[i].className == 'section') { this.resources_ul = all_uls[i]; break; }
i++;
}

Issue Links

Activity

Hide
Nicklas Lindgren added a comment -

The issue still exists in 1.9 and the development version.

The fix proposed by Patrick works in principle. Another css class has been added to the ul elements in question so a slight update is needed. A patch is provided.

Show
Nicklas Lindgren added a comment - The issue still exists in 1.9 and the development version. The fix proposed by Patrick works in principle. Another css class has been added to the ul elements in question so a slight update is needed. A patch is provided.
Hide
Wen Hao Chuang added a comment -

I verified this still exist in 1.9.x. so updating

Show
Wen Hao Chuang added a comment - I verified this still exist in 1.9.x. so updating
Hide
Anthony Borrow added a comment -

I applied the patch proposed by Nicklas which works when I show all of the sections; however, if I just show the section I want to move the resource to I get AJAX in the section 0 and non-AJAX move in the shown section making it impossible to move things from section 0 to the shown section. Peace - Anthony

Show
Anthony Borrow added a comment - I applied the patch proposed by Nicklas which works when I show all of the sections; however, if I just show the section I want to move the resource to I get AJAX in the section 0 and non-AJAX move in the shown section making it impossible to move things from section 0 to the shown section. Peace - Anthony
Hide
Michael de Raadt added a comment -

Thanks for reporting this issue.

We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported.

If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed.

Michael d;

lqjjLKA0p6

Show
Michael de Raadt added a comment - Thanks for reporting this issue. We have detected that this issue has been inactive for over a year has been recorded as affecting versions that are no longer supported. If you believe that this issue is still relevant to current versions (2.1 and beyond), please comment on the issue. Issues left inactive for a further month will be closed. Michael d; lqjjLKA0p6
Hide
Anthony Borrow added a comment -

As I recall, wasn't AJAX experimental in 1.9? I think it is OK to close this issue. Looks like it may have been related to MDL-21727. Peace - Anthony

Show
Anthony Borrow added a comment - As I recall, wasn't AJAX experimental in 1.9? I think it is OK to close this issue. Looks like it may have been related to MDL-21727. Peace - Anthony

Dates

  • Created:
    Updated: