Drop-in override for Upload.module's attachments list

bensheldon's picture
public
bensheldon - Sun, 2008-08-10 19:03

Below is a custom override for Drupal 6.x's Upload.module's attachments table that is displayed at the bottom of a node when you create file attachments. Below is an example of the before and after:

Example of override

I think my implementation conforms to what the Themer pack is going for: unzip and drop the included folder into your active theme's directory (e.g. /sites/default/all/garland), it should take effect without any other modifications---though you may have to reset the theme cache (goto admin/build/themes and click save without making any other changes).

Click Here to Download (shiny_upload.zip)

The icon code is based on the CCK filefield module---but the current 6.0 version is kind've clunky and I wanted to port it to the standard Upload module. The namespace is "shiny_upload".

I'd love any feedback you have or how I can make it more extensible. Also, please feel free to take it and maintain it and make it yours.


Nice.

webthingee's picture
webthingee - Sun, 2008-08-10 21:48

I think this looks very nice. Seeing as how I am using filefield module on a new project, I think I might just drop this in.. thanks.


Styling the filename and file size; and opening in a new window

maranjo - Fri, 2008-10-03 12:28

A great modification, thank you. I made a slight alteration to the code, to allow me to separately style the filename and file size - this wasn't possible as the file-name span tag (on line 23 of upload_attachments.tpl.php) didn't close properly.

Here's the original line:

  $file_metadata = '<div class="file-metadata"><span class="file-name">' . $file->filename . ' <span class="file-size" >' . format_size($file->filesize) .  '</span></div>';

Here's my replacement line:

  $file_metadata = '<div class="file-metadata"><span class="file-name">' . $file->filename . ' </span><span class="file-size" >(' . format_size($file->filesize) . '</span></div>';

Then in the CSS I was able to alter the appearance of both file name and file size, including removing filename altogether by adding display: none.

Separate comment: How would you alter this so the document opened in a new browser window?

Thanks again

D.5 version?

jonahan@drupal.org - Fri, 2008-10-10 19:04

This is awesome.

Any tips on how to get going on a D5 version?

Question

cmurockstar - Thu, 2008-12-04 23:30

This is amazing! Quick Question, how ever did you get the titles associated with your attachments?

Fixed the CRON problem

demeester_roel@drupal.org's picture
demeester_roel@... - Fri, 2008-12-12 13:39

See http://island94.org/articles/overriding#comment-3783 for the cron-breaking problem when using this 'package'.

I can't seem to upload the module so please grab it on http://krimson.be/en/shiny-upload-almost-converted-a-module.

Install the 'shiny_upload' module and move an included tpl to your theme to get it running.

Good luck

Belgian Drupal User Group lover - http://drupal.be