The default display for the list of attachments is a table with the name of the attachment in one column, and the 'file size' in another, e.g. http://www.pineridgeskiclub.ca/?q=node/104. I would prefer to get rid of the "Size" column and just have the file name, but haven't managed to figure out what I should be editing in order to do that. I'm using a phptemplate-based theme.

The information for the Attachments table seems to originate from modules/upload.module, but I still don't know enough about the inner workings of Drupal to figure out what happens between there and the end display to know what to edit. Anyone know?

-- T.

Comments

archatas’s picture

At first you should read this, which deals about user friendliness, web standards and similar things:
http://www.pixy.cz/dogma/dogmaw41/en/details-06.html

If you still want to change your attachments' view, for Drupal 4.6.3 open file modules/upload.module, find the function upload_nodeapi, seek for a block of code starting with

case 'view':

and change the following:

  1. $header = array(t('Attachment'), t('Size'));
    

    into

    $header = array(t('Attachment'));
    

    and

  2.             $rows[] = array(
                  '<a href="/'. check_url(($file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path())))) .'">'. check_plain($file->filename) .'</a>',
                  format_size($file->filesize)
                );
    

    into

                $rows[] = array(
                  '<a href="/'. check_url(($file->fid ? file_create_url($file->filepath) : url(file_create_filename($file->filename, file_create_path())))) .'">'. check_plain($file->filename) .'</a>'
                );
    

Good Luck!

tiff’s picture

That worked. Point well taken about file size, and I understand the rationale behind it. However, if I leave the size information there, is it really necessary to let people know how large the file is to 2 decimal places?

Also, size information is still somewhat cryptic for many non-technical users (i.e., the vast majority of people who might access my site). I expect many wouldn't notice whether the 'size' said 41.56Kb or 41.56Gb, and some wouldn't know that one would mean download in seconds and the other in hours.

For my purposes, I think a plain-language, non technical warning would be more appropriate. Only a couple of people can upload documents on this site, so we can include some kind of note in any post that has large attachments, like "NOTE: this attachment is quite large, and will take about 1/2 an hour to download if you are on dial-up internet".

Thanks for pointing me to where to edit this.

-- T.

archatas’s picture

I am glad, it helped you. Thank you for the explanation, how it will be used. After some work it would be possible to write the explanations about file sizes automaticaly at the file names.
For example, "this file would fit into three floppy disks", "the size of this file is equal to the size of five common mp3 songs", and so on.

Good luck!

tiff’s picture

Something like the "fuzzy clock" settings for the taskbar clock in KDE, which lets you set ranges from low fuzzyness ("Ten to Five"), middle fuzzyness ("Afternoon") to high fuzzyness ("Middle of the Week"). Something similar could be done for file sizes.... A project for a rainy afternoon.

-- T.