Moodle

AJAX Shifting of Blocks Incorrect - Movement doesn't match DB activity

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Won't Fix
  • Affects Version/s: 1.8, 1.8.1, 1.8.2
  • Fix Version/s: None
  • Component/s: AJAX
  • Labels:
    None
  • Environment:
    Windows Server 2003 (32 and 64-bit)
    Apache 2.2, IIS6
    PHP 5.2.2

Description

When AJAX is enabled globally (and in the user profile), when a section is moved from one area to another, instead of seeing the intended behavior of having the sections below shift down one to make room for the moved section, the section being moved seems to take on the value of the old section and the old section takes the value of the dropped section. In the database, they simply switch values. This causes much confusion to users in the interface when trying to re-arrange sections in the course. It just seems to be a misunderstanding of what should be happening between the AJAX interface (which appears to update correctly, as sections are shifted properly), and the database (which switches values between blocks being modified instead of changing them to reflect what's happening in AJAX). Hopefully this makes a little sense. If you need access to test this on our server, please contact me and we'll arrange it. I don't know how isolated this problem is, but because of the lack of it seeming to be widely known, I suspect it's something in my installation (which has no customizations to the AJAX interface or anything relating to section movement). Block movements are fine also.

Issue Links

Activity

Hide
Chris Potter added a comment - - edited

I should probably clarify also that the sections are the middle column, NOT the blocks on the left and/or right side of the page and that we're using Moodle 1.8.2.

Show
Chris Potter added a comment - - edited I should probably clarify also that the sections are the middle column, NOT the blocks on the left and/or right side of the page and that we're using Moodle 1.8.2.
Hide
Nicklas Lindgren added a comment -

The move_section function in course/lib.php is only designed to swap adjacent sections.

I've attached a patch that makes it behave correctly.

Show
Nicklas Lindgren added a comment - The move_section function in course/lib.php is only designed to swap adjacent sections. I've attached a patch that makes it behave correctly.
Hide
Chris Potter added a comment - - edited

I've had a little luck... now it works (almost) as expected. Now, if I drop an item onto another (ex: topic 5 onto topic 2), the one I'm moving shows it taking the place of topic 2, but in the database gets set to the one BELOW topic 2.

Show
Chris Potter added a comment - - edited I've had a little luck... now it works (almost) as expected. Now, if I drop an item onto another (ex: topic 5 onto topic 2), the one I'm moving shows it taking the place of topic 2, but in the database gets set to the one BELOW topic 2.
Hide
Nicklas Lindgren added a comment -

AJAX movement and backend database movement work the same for me. I tested, amongst other things, moving topic 5 onto topic 2 a number of times.

There are related problems that might cause confusion though, see MDL-11675.

I realized that the code i'm testing with contains some additional changes that might be pertinent. I've made the changes to the page layout to occur only after the AJAX request is successfully completed.

I'm attaching a patch with all the related changes included.

Show
Nicklas Lindgren added a comment - AJAX movement and backend database movement work the same for me. I tested, amongst other things, moving topic 5 onto topic 2 a number of times. There are related problems that might cause confusion though, see MDL-11675. I realized that the code i'm testing with contains some additional changes that might be pertinent. I've made the changes to the page layout to occur only after the AJAX request is successfully completed. I'm attaching a patch with all the related changes included.
Hide
Steve Bond added a comment -

Just a note to say that this problem persists in 1.9 (tested on 1.9 beta 4)

Show
Steve Bond added a comment - Just a note to say that this problem persists in 1.9 (tested on 1.9 beta 4)
Hide
Steve Bond added a comment -

I've been testing Nicklas' patches on 1.9, and still I'm seeing some odd behaviour. For example, I had numbered sections ordered as follows:

1,3,4,2,5

I dragged section 2 and dropped it between 1 and 3. The immediate effect was to change to this order:

2,3,1,4,5

The I clicked reload, and suddenly I had this:

1,5,3,2,4

Which is just baffling.

I've had a good look at Nicklas' section-moving patch and it seems OK to me, but I'm clueless about Ajax so I'm guessing that's where the problem lies...

Show
Steve Bond added a comment - I've been testing Nicklas' patches on 1.9, and still I'm seeing some odd behaviour. For example, I had numbered sections ordered as follows: 1,3,4,2,5 I dragged section 2 and dropped it between 1 and 3. The immediate effect was to change to this order: 2,3,1,4,5 The I clicked reload, and suddenly I had this: 1,5,3,2,4 Which is just baffling. I've had a good look at Nicklas' section-moving patch and it seems OK to me, but I'm clueless about Ajax so I'm guessing that's where the problem lies...
Hide
Nicolas Connault added a comment -

Please disregard this issue (and its patches), it is a clone of MDL-12198, which has a working patch assigned for 1.9 and HEAD.

Show
Nicolas Connault added a comment - Please disregard this issue (and its patches), it is a clone of MDL-12198, which has a working patch assigned for 1.9 and HEAD.
Hide
Wen Hao Chuang added a comment -

Nicolas in this case should we close this ticket as a duplicate? What do you think? Thanks!

Show
Wen Hao Chuang added a comment - Nicolas in this case should we close this ticket as a duplicate? What do you think? Thanks!
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
Michael de Raadt added a comment -

I'm closing this issue as it has become inactive and does not appear to affect a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Show
Michael de Raadt added a comment - I'm closing this issue as it has become inactive and does not appear to affect a current supported version. If you are encountering this problem or one similar, please launch a new issue.

Dates

  • Created:
    Updated:
    Resolved: