[drupal-devel] [bug] form_weight should use dleta:15 in book outline admin

Steven Wittens steven at acko.net
Wed Jan 19 22:13:36 UTC 2005

Boris Mann wrote:

>On Wed, 19 Jan 2005 16:17:33 +0100, Bèr Kessels <drupal-devel at drupal.org> wrote:
>>This is a useability improvement *with code*  ;)
>>In book-pages node forms we use a delta of fifteen (-15 to +15)  but in
>>the book-outline admin we dont dewfine this, resulting in a default
>>delta of ten. This should be consistent and thus both 15.
>>Bèr Kessels
>Actually, the delta should be infinite, weight should only be used
>internally, and we should have +/-, up/down arrows :P
>(And a javascript, drag-and-drop version from Chris Messina)
I've done a lot of experiments with draggable stuff lately. My 
conclusions so far:

- DOM manipulations with rows containing form data (other than the 
weights) is a no-no, as this will corrupt when using the back button in 
several browsers. This means practically every instance of weights in 
Drupal. A solution is to do the dragging through JS, but do a 
refresh/submit after every operation. But of course, this is not so elegant.

- JS mouse events are completely different between browser flavours, 
hence the code for this would be ugly and hard to maintain. Although I 
do think there is a script out there which brings the broken browsers up 
to DOM Event Model specs, but it would mean being dependant on yet 
another external author. Look at what happened with xmlrpc.inc...

- Drag-and-drop is hard to do with tables, as you cannot simply set a 
table row to position: relative (well you can, but it won't work). All 
the DOM-drag examples I've seen so far use ul's. I'm not sure if this is 
only if border-collapse: collapse is set, but it is what we use 
everywhere, so a lot of stuff is ruled out.

Basically, all those elegant and short examples tend to work nicely as 
simple prototypes, but as soon as you try something like that in a 
flexible environment like Drupal, the excrement will hit the proverbial 
ventilation device.

Steven Wittens

More information about the drupal-devel mailing list