[drupal-devel] [feature] Give file uploads titles
m3avrck
drupal-devel at drupal.org
Sun Sep 18 17:45:02 UTC 2005
Issue status update for
http://drupal.org/node/30775
Post a follow up:
http://drupal.org/project/comments/add/30775
Project: Drupal
Version: cvs
Component: upload.module
Category: feature requests
Priority: normal
Assigned to: Souvent22
Reported by: timcn
Updated by: m3avrck
-Status: patch (code needs work)
+Status: patch (ready to be committed)
Attachment: http://drupal.org/files/issues/drupal_20.patch (6.41 KB)
Updated patch against current HEAD.
m3avrck
Previous comments:
------------------------------------------------------------------------
Fri, 09 Sep 2005 14:38:57 +0000 : timcn
Attachment: http://drupal.org/files/issues/upload.zip (1.33 KB)
With this patch, you can rename your file uploads. Normally, only the
file name shows up. This adds an additional input field to supply a
title for the file that is displayed instead.
------------------------------------------------------------------------
Fri, 09 Sep 2005 15:33:48 +0000 : Souvent22
Attachment: http://drupal.org/files/issues/upload_3.patch (6.37 KB)
Made a better patch in the correct format. But, this is a good patch.
DEF helps to be able to "describe" your file via a label instead of via
the filename. I hope this gets to head soon. It's the little things that
matter. :). I also made the label size larger, from 128 to 255.
------------------------------------------------------------------------
Fri, 09 Sep 2005 15:39:59 +0000 : Bèr Kessels
Hi,
please read http://drupal.org/node/22568 for how to submit patches.
But besides that, I do not think this feature will make it into drupal.
The current upload system is aimed at simplicity. If you need a differnt
name, you should rename it locally, or use a contributed file managing
module. But that is just my opinion. Others might like it!
------------------------------------------------------------------------
Fri, 09 Sep 2005 18:39:15 +0000 : Boris Mann
It's a good idea. Does it make sense to have filename --> filepath
mapping as part of the file API? I would certainly say that that should
be part of the information stored (i.e. there is a column for "name" in
the table), but it would be up to modules to implement this.
------------------------------------------------------------------------
Fri, 09 Sep 2005 19:25:57 +0000 : drumm
I don't see a way to edit the description.
------------------------------------------------------------------------
Fri, 09 Sep 2005 21:25:36 +0000 : Souvent22
Yes, if you go to the node, and you edit the node, you can edit the
descriptions of the attachments.
------------------------------------------------------------------------
Sun, 11 Sep 2005 20:07:29 +0000 : m3avrck
Ber, in contrast, this patch doesn't make uploads anymore complex,
rather provides some much needed functionality. When a file is uploaded
right now, it's name is whatever the name of the document is plus
extension... which as we know how file names are, can sometimes be
quite unreadable. How many people are going to take the time to rename
the file? Not too many people I've noticed (I deal with a client that
has 100s of files, filenames is a *big* issue).
So all this patch does introduce a field to put a name for the file,
makes 100% sense and I think this is *much* needed.
Tested patch, works great.
However, the title field (drumm where did you get description??? this
is only a title field) should have a default value initially after the
upload and this should be set to the filename, as that is how Drupal
works currently. Then, if the user chooses, they can change the display
name of the file, otherwise the default will be the filename, not
breaking nor interfering with how Drupal currently handles files. Very
smooth transition :)
Also, getting a small 'fuzzy' problem when appyling patch on line 404,
please check and reroll clean patch against head, thanks!
------------------------------------------------------------------------
Mon, 12 Sep 2005 06:03:17 +0000 : Goba
+1 on the functionality. We still use a custom file upload module on one
of our sites, since the upload module allows no title (which we use as a
caption) to be associated with an upload.
------------------------------------------------------------------------
Mon, 12 Sep 2005 07:49:12 +0000 : timcn
"However, the title field (drumm where did you get description??? this
is only a title field) should have a default value initially after the
upload and this should be set to the filename, as that is how Drupal
works currently.
"
First, I had this kind of functionality but I removed it because there
could be a redudancy in the database. Now, if the title-field is empty,
the module uses the filename. If it is not empty, thus contains a
string, it uses the string. If you leave the field empty (the default
setting), the filename is *automatically* used.
------------------------------------------------------------------------
Mon, 12 Sep 2005 08:45:18 +0000 : timcn
Attachment: http://drupal.org/files/issues/uplodad.patch (6.38 KB)
Hope this patch is better. I tried the patch from Souvent22 and patch
said the following:
patching file database/database.mysql
patching file database/database.pgsql
patching file database/updates.inc
patching file modules/upload.module
patch unexpectedly ends in middle of line
Hunk #6 succeeded at 404 with fuzz 1.
The new patch runs without this fuzziness.
------------------------------------------------------------------------
Mon, 12 Sep 2005 09:12:17 +0000 : Bèr Kessels
I fail to see any need for this. Thus I -1 on this. Can we not rather
improve the filenaming on the file.inc level?
I like the simplicity of the current upload module a lot, and I fear
this will only add clutter for nearly all people using this module.
Tose taht need advanced file tools, should use an advanced module IMO.
And last, but not least, i've looked all file handling mechanisms I
know, last days, and not one has a filed to change the name. I checked
gmail, gmx, squirrelmail, ccmixter, mp3.com (alikes) etc.
So I stick with my -1 ,for IMO it only adds clutter yet I cannot see
anyone using it.
What about a joint effort to get a single good advanced-uplaod.module
from the ground? One that takes te best of all the alternatives around
in a single project? And offers features like file renaming etc.
------------------------------------------------------------------------
Mon, 12 Sep 2005 10:20:38 +0000 : timcn
"Can we not rather improve the filenaming on the file.inc level?
I like the simplicity of the current upload module a lot, and I fear
this will only add clutter for nearly all people using this module.
Tose taht need advanced file tools, should use an advanced module IMO.
"
First of all, I think improving the filenaming is not a very good
solution and I doubt that it's simpler than just adding a title field
for every file. You would also have to provide a proper file name for
every file but the disadvantage is that you still have the file
extension (i.e. *.pdf).
"And last, but not least, i've looked all file handling mechanisms I
know, last days, and not one has a filed to change the name. I checked
gmail, gmx, squirrelmail, ccmixter, mp3.com (alikes) etc.
"
Well, that would be an argument against file renaming on file.inc-level
- not against giving files a title. The reason why e-mail services do
not provide an option to change the /title/ of a file is, that there is
no possibility to transmit this title while sending an e-mail.
"So I stick with my -1 ,for IMO it only adds clutter yet I cannot see
anyone using it.
"
Well, in this thread are already some people who appreciate a
functionality like this (Souvent22, Boris Mann, m3avrck, Goba and of
course me). As m3avrck said, this patch does not complicate or clutter
anything.
"What about a joint effort to get a single good advanced-uplaod.module
from the ground? One that takes te best of all the alternatives around
in a single project? And offers features like file renaming etc.
"
Again, I do not think that this is a good idea. I really think there is
a need for titling files for almost every user. Also, my solution does
not complicate anything if you don't want to give your files a title -
just leave the title field blank and the filename is used
automatically.
And one last question: Did you install this patch or did you just read
the description and decided that you don't need/want this
functionality?
------------------------------------------------------------------------
Mon, 12 Sep 2005 10:54:45 +0000 : Bèr Kessels
"And one last question: Did you install this patch or did you just read
the description and decided that you don't need/want this
functionality?
"
Both. But if i so strongly object, I first want to have a good look,
thus I applied it and tried it, and saw no real use for it. Sorry.
------------------------------------------------------------------------
Mon, 12 Sep 2005 14:16:13 +0000 : m3avrck
Ber while I agree with what your saying, I do see real value in this
simple patch. I also agree that we should work collaboratively on a
better upload manager for sure.
But the benefit of this patch is this: I have a client A who attachs a
bunch of files to a node. At the bottom it says:
Attachments:
something_working 23_version2.pdf
coolNew features.wow.socool_3.doc
and etc...
Now what the heck does that mean??? Can't we just use a simple title
field to setup an "alias"? That would make much sense. Then it'll be
readable by all, ya see what I mean?
And timnc, I would still vote for having the title field in by default
with the filename. This makes it clear to the user that this is what
the title will be. Othewise, if it is blank, I wasn't sure what the
title would be, if there would be one. It was *not* clear at all.
Also, this isn't a redunancy in the database. The filename and title
can be the same thing or different, this isn't a redunancy, since they
both have seperate and distinct meanings. Sure they might share the
same name, but this *technically* isn't redudant, as there is no way to
normalize this occurence. So I say put it back in for practicality's
sake and to clear up any confusion :)
------------------------------------------------------------------------
Mon, 12 Sep 2005 14:18:36 +0000 : robertDouglass
I have been following m3avrck's arguments and am in total agreement.
I'll test the patch as soon as I can.
------------------------------------------------------------------------
Mon, 12 Sep 2005 18:57:20 +0000 : timcn
"Also, this isn't a redunancy in the database. The filename and title
can be the same thing or different, this isn't a redunancy, since they
both have seperate and distinct meanings. Sure they might share the
same name, but this *technically* isn't redudant, as there is no way to
normalize this occurence.
"
Well, you have convinced me. :)
------------------------------------------------------------------------
Mon, 12 Sep 2005 18:59:11 +0000 : m3avrck
Awesome! Care to reroll a patch with this fix? I think we can get this
in tomorrow ;)
------------------------------------------------------------------------
Tue, 13 Sep 2005 09:33:06 +0000 : timcn
Attachment: http://drupal.org/files/issues/upload_4.patch (6.4 KB)
This patch automatically sets the file name as title if no title is
provided. Also fixed a fuzzy problem due to cvs database update.
This patch is ready to be committed.
------------------------------------------------------------------------
Tue, 13 Sep 2005 09:44:02 +0000 : Bèr Kessels
Did anyone test this on an installation using other modules that use the
files table, such as image module, to see if that not completely breaks?
For they have no access to the title, nor care to set one.
------------------------------------------------------------------------
Tue, 13 Sep 2005 09:48:52 +0000 : timcn
I have tested it with image.module and it works fine. No issues. The
field in the database is defined as not null default ''. And if a
module does not provide a title for the file, the field is simply
empty. And if the field is empty, the filename is used by default.
So no problems here.
------------------------------------------------------------------------
Tue, 13 Sep 2005 14:43:12 +0000 : Souvent22
I reviewed this patch also. All seems well, I believe this is ready to
go. +1.
------------------------------------------------------------------------
Tue, 13 Sep 2005 15:35:07 +0000 : m3avrck
Patch works great! However, please change the updates.inc to conform to
the note at the top of the file. Updates have changed now since MySQLi
support was added. Use the switch() syntax. Then this patch will be
ready to be committed and I'll get it the famous +1 ;)
------------------------------------------------------------------------
Wed, 14 Sep 2005 13:55:53 +0000 : timcn
Attachment: http://drupal.org/files/issues/upload_5.patch (6.37 KB)
added mysqli to updates.inc
------------------------------------------------------------------------
Wed, 14 Sep 2005 14:45:15 +0000 : m3avrck
Looks good to me!
------------------------------------------------------------------------
Wed, 14 Sep 2005 20:26:31 +0000 : Dries
Coding style needs work -- incorrect use of spaces.
------------------------------------------------------------------------
Wed, 14 Sep 2005 21:58:38 +0000 : m3avrck
Also needs to be rolled for HEAD.
------------------------------------------------------------------------
Thu, 15 Sep 2005 13:58:34 +0000 : timcn
Attachment: http://drupal.org/files/issues/upload_6.patch (6.34 KB)
Corrected the database stuff.
Dries: I see no wrong coding style that comes from my patch. I ran the
code-style.pl-script and it said that some spaces are wrong, but that
was not on the locations where this patch changes something. I checked
all places the script found fault but they are all ok as that are
things like multi-line array definitions.
------------------------------------------------------------------------
Thu, 15 Sep 2005 14:59:17 +0000 : m3avrck
Attachment: http://drupal.org/files/issues/upload_6_0.patch (6.35 KB)
timcn, I noticed a two small spacing issues which I have corrected in
this patch. Dries, I went through line by line, no coding style issues
stand out, I believe this is ready to go now.
------------------------------------------------------------------------
Sun, 18 Sep 2005 17:24:23 +0000 : Dries
Patch no longer applies.
More information about the drupal-devel
mailing list