Closed (fixed)
Project:
Views (for Drupal 7)
Version:
6.x-2.3
Component:
files/upload data
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2009 at 22:06 UTC
Updated:
21 Apr 2009 at 23:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
yrocq commentedComment #2
merlinofchaos commentedThat's not a global. All fields should be able to use that alter, otherwise checking the 'rewrite output' won't work either, so this is not the proper solution.
Comment #3
yrocq commentedI tested the patch with a lot of different options (Rewrite output, Output this field as a link, Trim,...) and I didn't encounter any issue. By "global", I meant that the $this->options['alter'] table is associated to the handler, not to the data. IMHO, changing this information while rendering the data is a bad thing. For example, the following lines in the current code of the views_handler_field_upload_fid class :
will behave exactly the same way as if the user had checked the box "Output this field as a link" in the field options, and had entered an arbitrary file url (the url of the uploaded file of the last row of the view result) as a link. I don't understand this logic. This code is not necessary for the "Rewrite the output of this field" and the "Output this field as a link" options to work + it breaks the "Link this field to download the file" option.
Comment #4
merlinofchaos commentedIt *is* necessary for the 'rewrite this field' while using it as a link to the file.
Comment #5
yrocq commentedOK. I didn't understand that the problem with the patch occurs when both the "Rewrite the output of this field" and "Output this field as a link" options are selected. I wrote a new patch which returns the field as a link only if "Output this field as a link" and "Trim this field to a maximum length" haven't been set (trimming the link can cause problems even if "Field can contain HTML" is checked).
Another solution would be to create a new token containing the full path of the file ([upload_fid] only contains the file name). With this method, we could keep the current version by inserting the token in the alter table like this :
I also realize that if we created this new token, we would have the possibility to just remove the option "Link this field to download the file", because this feature would be implementable with the option "Output this field as a link".
What do you think about that ?
Comment #6
yrocq commentedComment #7
Jim Ruby commentedsubscribe, please can you let me know when this is decided and I could try and apply the patch, my first time doing this so i'll learn as I go.
Thank you
Comment #8
lilou commentedsubscribe to
Comment #9
arnd commentedsubscribing
Comment #10
mariagwyn commentedI recently ran into this error, I think after my last upgrade of Views. On my install, it is NEW. I have a view set-up which lists nodes and their attached file, linking directly to the file for download (only ONE file for each node), and this has been working just fine.
I just added a display to this view, listing a set of nodes that have more that one file attached. I set it up the same as previous displays, simply linking to the downloaded file. In this display, the lists of files for ALL nodes and ALL the attached files link to ONE file. The files appear listed correctly, each with their own title, but are linked to a single file. The file happens to be the first one I uploaded today, but not the first one listed in the view.
I am not sure if this helps, but once this is settled I can upload the patch (or even test now if that would be helpful). It just seems strange behavior since this features was working fine previously, and is still working on displays not created with the most current Views update.
Comment #11
Branjawn commentedJust want to add that I am having a same or similar problem.
I made a content type of PDF to give a title, teaser, and then upload a pdf.
I then made a view to display the title and link to attached file on a page.
Visually, it displays exactly like I want it. But all attached file links are the same.
Subscribing :o)
my page: http://www.carolinaunmanned.com/?q=pdfdoclist
Comment #12
merlinofchaos commentedJust to check, have you tried this with the current -dev? This is particularly important if you're using the table style.
Comment #13
Branjawn commentedI just downloaded VIEWS today, so it is the latest available.
Comment #14
FrankT commentedCould anybody tell me if the patch provided in #5 is ready to be used?
Comment #15
Branjawn commentedI hope this issue hasn't been forgotten. It's a pretty big deal! All my links are the same, not good!
Comment #16
texasgopher commentedI am also having the same problem. I thought it was just me. I hope this can get fixed soon.
Comment #17
FrankT commented...as I do not have too many views and there was no database change I switched back to 2.2 now, no problems so far...
Comment #18
Branjawn commentedAgreed, switching back to views-6.x-2.2 fixes problem.
Comment #19
nevets commentedI found the source of the problem and have a "band aid" people can use.
The problem is the class views_handler_field_upload_fid is using pre_render to set up the attachments and optionally link them. It does this for all data rows at once over writing the previous link information. It's code is loosely based on how the node links a title to it's node. There is a major difference in that for nodes there is a one to one mapping of node to title, on the other hand nodes can have many attachments so views built in code for handling links will not work.
My band aid version of the removes pre_render() from the class, adds render() to the class and restructures render_link() to return an actual link (if needed). To use this solution place the file under views/modules/upload.
I call this a band aid because I am unsure if this an appropriate solution.
Comment #20
Jim Ruby commentedIf I want to go back to views version 2.2, how hard is it and what can I do so I do not mess up my current views?
If this might be fixed soon then I can wait.
Thanks
Comment #21
crbassett commented@nevets Thank you for that file. It fixed it for me as well. I appreciate your help. You coders do what I can never do, and for that I am very grateful.
Comment #22
FrontBurner commentedsubscribing having same problem.
Comment #23
ato10 commented@nevets If I check 'Rewrite the output of this field' the link disappear
Comment #24
nevets commentedFrom my understanding that makes sense (I think 'Rewrite the output of this field' takes over rendering of the field).
Comment #25
mariagwyn commented@nevets: I uploaded the file into views>handlers>views_handler_field_upload_fid.inc, to no avail. Should I put this somewhere else? It was the only folder that looked right, but there was no such file in the folder. I also tried "rewrite output...." No luck.
This is pretty important to me since it killed about half of my views. Any help appreciated.
Thanks,
Maria
Comment #26
nevets commentedDid you put it in views/modules/upload? Are you running the latest (non-dev) version of views? The file was tested against 6.2.3.
Comment #27
petrescs commentedsubscribing, having same problem
Comment #28
zila commentedsubscribe
@nevets patch basically working, without using the Output rewrite option (thx. nevets :)
Comment #29
wrburgess commentedsubscribing, same problem for all views
Comment #30
mariagwyn commented@nevets: OF COURSE I had it in the wrong place! Uploaded correctly, works. Many many thanks!!!
Can this get committed to next version of views? Kinda important feature...
m
Comment #31
oseldman commentedsubscribing, having same problem
Comment #32
Ouphfta commentedsame issue here, only fixed for me by going back to v2.2
Comment #33
mbiddlecombe commentedsubscribing
Comment #34
shaisachs commentednevets - No idea if this is the right approach, but it works for me, in the one view I've tested it with. Thanks!
Comment #35
k3vin commentedsubscribing
Comment #36
eric_a commentedI looked at the differences in views/modules/upload between between 6.x-2.2 and 6.x-2.3 and decided to try to revert just this folder rather than completely reverting to views 6.x-2.2 as discussed in #10, #17, #18, #20, #32. Works for me...
Comment #37
gregarios commentedsubscribing
This doesn't seem to be limited to just uploaded files links. But, when you link to something other than a file, like a node, it totally breaks them.
This appears to be the same problem as the one I am having with views links in this issue: http://drupal.org/node/420230
Branjawn's links on his example page look exactly like my Blog Author list page. Eagerly awaiting a fix.
Comment #38
kierduros commentedJust another person eagerly awaiting the resolution of this issue.
Comment #39
merlinofchaos commentedFixed in -dev.