Make default list value configurable per field.
gordon - December 14, 2006 - 05:09
| Project: | FileField |
| Version: | 4.7.x-1.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
Default for files should be to list and not be hidden.

#1
I for myself use CCK via Views so I don't need or want "List files" as default. May be it should be configurable?
#2
It would be nice if it were configurable. We definitely will use it in a context where the default should be to list.
#3
fixing the title. I'm not going to work on this myself currenlty. I'd gladly accept a patch.
#4
Where would it be put into the code? At what stage of processing?
I tried to set default_value for list to 1 in the form widget thing, but it accomplished nothing.
#5
yeah, because the module isn't inserting records into the {file_revision} table which is where the 'list' field is. it seems like a pretty big bug not to be adding revisions records...
#6
Actually, its pretty simple.
Go to filefield.module near line 310.
In filefield_widget() it has
// prepare file array.$file['fid'] = 'upload';
add the line :
$file['list'] = 1;and voila!
it can be changed to set the value from a configurable variable easily. I don't see a need myself. Why would anyone upload a file if they didn't want it listed?
#7
Thanks, but this doesn't work.
The problem is that because the form is being posted and this field did not exist it assumes that the field was unchecked and then makes the change.
Attached it a patch which fudges the formapi so that it will pick the right default.
#8
#9
Thanks . . . this seems to working just great!
#10
version 5 already does this. not sure if version 4.7 does, or if that's being actively maintained anymore. i'd recommend closing this issue, but just bumping it for better eyes than mine.
#11
aaron: Did you also check the case for disabled JavaScript (no AJAX uploads)? I believe this was where Form API fell down.
#12
status update. i guess the patch won't get us very far for 5.x anyways, so the "needs more info" part is more important right now.
#13
Definitely fixed in 6.x. I mean, it's still not configurable, but really, who actually wants to have their files not listed by default? Right. And if someone needs to do that, I'm going to provide means for overriding the 'list' == 1 default. This issue has been bugging around for a long time, and even 5.x-2.x does it correctly in most (if not all) cases. Everything going further than that is a wontfix, as 6.x makes the whole wish obsolete anyways. Closing as "closed", because I don't know if it's actually "fixed" in D5 or just a "won't fix".