Changing the list attribute or description of an uploaded file doesn't work. This is most likely related to the new forms API or node revision changes (or both). I'll attach a patch that fixes the list attribute problem, but the fix for description is more difficult.
In _upload_form(), description is in $form['current']['description'] which has the #tree attribute set to TRUE. The value of description is set within a foreach loop. The list and delete (called remove in the form) checkboxes are set outside that foreach loop. When the form from _upload_form() is returned to upload_from(), it's put into $form['attachments']. When the form is submitted, list and remove are $node['list'] and $node['remove'] whereas description is $node['attachments']['current']['description'].
Part of the bug is that upload_save() expects to access description as $file->description. That should be $node->description. However, with the forms the way they are, that won't work either.
Comment | File | Size | Author |
---|---|---|---|
#2 | drupal-head.junyor.upload2.patch | 2.61 KB | Junyor |
#1 | drupal-head.junyor.upload.patch | 2.59 KB | Junyor |
Comments
Comment #1
Junyor CreditAttribution: Junyor commentedAttaching partial patch that fixes the list attribute problem. This patch also makes preparations to fix the the description problem. I also fixed a logical error, which caused an UPDATE query to fire before it could be used.
Comment #2
Junyor CreditAttribution: Junyor commentedLooks like someone fixed the tree problem. List and description now both work. :)
I've rerolled the patch to keep up with head.
Comment #3
Robin Monks CreditAttribution: Robin Monks commentedLooks good, +1
Robin
Comment #4
m3avrck CreditAttribution: m3avrck commentedPatch looks good and works great here. Dries if you can commit this initial patch, we can start work on the description problem.
Also, this problem is related to (and even possibly a fix for): http://drupal.org/node/31102 ... need to get both of these resolved ASAP!
Comment #5
m3avrck CreditAttribution: m3avrck commentedPatch looks good and works great here. Dries if you can commit this initial patch, we can start work on the description problem.
Also, this problem is related to (and even possibly a fix for): http://drupal.org/node/31102 ... need to get both of these resolved ASAP!
Comment #6
Junyor CreditAttribution: Junyor commentedThis does fix the description problem.
Comment #7
moshe weitzman CreditAttribution: moshe weitzman commentedseems like this is ready to go. any objection from CVS review team?
Comment #8
m3avrck CreditAttribution: m3avrck commentedNone here ;-) But yes, I really *need* this patch so we can fix other related problems, these problems are keeping a few of my sites from going live!
Comment #9
Dries CreditAttribution: Dries commentedCommitted to HEAD. Can you update the referenced issue, if that is taken care of now? Thanks.
Comment #10
m3avrck CreditAttribution: m3avrck commentedWill do, we have a tangle of related file issues we are looking into :-)
Comment #11
(not verified) CreditAttribution: commented