Closed (fixed)
Project:
Drupal core
Version:
6.9
Component:
block.module
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Aug 2008 at 02:19 UTC
Updated:
1 Sep 2009 at 11:49 UTC
Jump to comment: Most recent file
Comments
Comment #1
Babalu commentedi have more than 20 blocks and i can not sort them
Comment #2
maartenvg commentedThis is also present in HEAD. So let's fix it there first and then back port to 6.x-dev.
Attached is a screenshot which displayes the block ordering page with javascript disabled to visualize why ordering is irradic.
The blocks are being spread over the interval -10 to 10, and when there are more than 21 blocks in a single region, the last ones all receive a weight of 10. Those are ordered by alphabet if I'm not mistaken. It's not hard to imagine what happens when you move a block with a weight of 10 to a position also having weight 10: nothing.
A quick fix would be to broaden the range to something large like -100:100, but a more permanent fix would be to make the weight range adapt to the amount of blocks present.
Comment #3
swentel commentedGreat catch. Patch attached counts number of blocks, divides it by two and then rounds up. Looks good here now.
Comment #4
maartenvg commentedNice fix, didn't know about #delta.
Remarks
- Patch fixes the problem in d7 and d6.
- Introduces no problems as far as I can tell.
- Comments should end in a point.
- $number_of_blocks does not contain the number of blocks, but the (rounded) half of it. I suggest renaming it to something like $weight_delta.
- Isn't it better to do the determining of the delta in block_admin_display_form(), because $blocks is passed to that function anyway? That way you don't have to pass the variable, other modules/instances using block_admin_display_form() don't have to do their own calculations, and it is a smaller patch.
Attached is my proposal.
Comment #5
swentel commentedGood remarks, works still as intented, let's get this in !
Comment #6
Babalu commentedpatch #4
Hunk #1 FAILED at 36.
Hunk #2 succeeded at 67 (offset 2 lines).
against drupal 6.6
Comment #7
maartenvg commentedthe version in #4 does not apply against D6 anymore, we'll create a separate patch for D6 once it is fixed in D7.
Comment #8
swentel commented@babalu, that's normal, we first fix things in HEAD, then backport.
Comment #9
Babalu commentedoh ok, sorry
Comment #10
dries commentedLet's extend the comment to explain why we need to divide by 2 and round. I thought that was odd.
Comment #11
maartenvg commentedChanged to
Comment #12
dries commentedI've committed this patch to CVS HEAD. It didn't apply against DRUPAL-6 so it needs a reroll. Updating the issue accordingly.
Thanks for the CVS HEAD patch, now let's get it into DRUPAL-6 too.
Comment #13
swentel commentedReroll for D6
Comment #14
Babalu commentedjuhuuuuuu works
Comment #15
maartenvg commentedComment #16
dries commentedCommitted to DRUPAL-6. Thanks folks.
Comment #18
nattsI'm still having this problem with the latest Drupal version (6.9).
Comment #19
ssiaperas commentedI am having the same problem on a Drupal 6.9 site. I am unable to to change position by drag, drop, and save, or by weight and save. I am not receiving notification at the top of the blocks list page telling me that the blocks have been saved; it just refreshes the page. We have determined that this is a server issue of some sort, because we put a copy on a development server, and it worked perfectly. I have read some other forums that talk about the PHP Time Limit, which we had increased from 60 to 120, and that didn't seem to fix it. I've noticed some differences between our dev server and the live-site server; they are as follows:
dev server= Apache 2.2.11 and PHP 5.2.9 and MYSQL 5.0.67
live site server= Apache 1.3.41 and PHP 5.2.8 MYSQL 4.1.22
There are some other differences, but these are the big ones. Would these difference have anything to do with it?
Comment #20
ssiaperas commentedWe have solved this issue on our site. The server had PHPSuHosin (http://www.hardened-php.net/suhosin/). Once this was disabled, we were able to save blocks again.
Comment #21
gpk commentedResetting issue status, assuming that #18 is now resolved.
Comment #22
gpk commentedFollow-up at #565220: Fix Weight form element behavior.