// you’re reading...

Open Source

dotProject file icons mod

dotproject icons preview

dotProject is an open source project management software that I’ve had a chance to work with a lot lately. I’ve gotten to be pretty active on the forums, but this is my first packaged open source contribution.

I wanted to easily distinguish between various uploaded files, and loading assosiated icons seemed like a neat trick. The preview is on the left. The icons are taken from the Tango Desktop Project – free and open sourced.

Upon upload, PHP determines file’s MIME type and picks the most appropriate icon. As of this version, 0.4, most of the common generic types are supported (application, audio, image, text, video). Microsoft’s Word, Powerpoint and Excel extensions are recognized as Document, Presentation and Spreadsheet document types. Additionally PDF, archives(ZIP, TAR, TAR.GZ), and web media (HTML, XML) extensions spot unique icons. PostScript files (such as Adobe’s Illustrator and Photoshop) are marked with an image icon.

dotProject team

I would like to thank the dotProject developers for comments, suggestions, feedback and support. Especially MacOfTheEast for all his contributions, and suggesting new type definitions.

Installation

It is assumed that the user has a clean 2.0.4 stable install.

Download .tar package and follow instructions in readme.txt. Just a few quick changes. Files affected:

  • dotproject.sql – don’t forget to apply the change to your current database
  • modules/files/files.class.php
  • modules/files/do_file_aed.php
  • modules/files/index_table.php

ChangeLog

version 0.4 (November 22, 2006)

- added text/html, /xml, application/x-tar, /x-gzip, /postscript support

version 0.3 (November 21, 2006)

- added application/zip support
- no longer relies on file_category (it’s a configurable lookup)
- new generic image (paper-clip)

version 0.2 (November 20, 2006)

- include PDF specific MIME type

do_file_aed.php
- recognition of PDF MIME type
- bugfix: file_category was never considered in default fallback

dotproject.sql
- ADD/UPDATE files table
- SQL to update existing file records to include icons

Enjoy!
– Tony

Read more



Discussion

  1. Posted by Keith Casey | November 18, 2006, 1:18 pm

    Tony,

    Thanks, I’ve been playing with this mod – as I was working on a similar one – and wanted to throw out my approach. Your system works on detecting the mime-type upon upload which is *very* reliable, but only works for files newly uploaded…

    Alternatively, since we’re storing this information anyway, why not detect it why the file list is displayed and choose which file to display then? Or – if you’re concerned about the performance hit in always doing this lookup – you could store the resulting image icon the first time it’s determined.

    That way you support large legacy installs with minimal effort.

    keith

    Reply to comment

  2. Posted by Tony | November 20, 2006, 11:45 am

    Keith,

    Thank you for taking a look at this, and your feedback.

    Instead of looking up the icon to use each time, and as suggested by MacOfTheEast on the dotProject forums – the is now a set of SQL to bring the existing files up to date.

    Reply to comment

Post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>