• Do not register here on develop.twiki.org, login with your twiki.org account.
• Use View topic Item7848 for generic doc work for TWiki-6.1.1. Use View topic Item7851 for doc work on extensions that are not part of a release. More... Close
• Anything you create or change in standard webs (Main, TWiki, Sandbox etc) will be automatically reverted on every SVN update.
Does this site look broken?. Use the LitterTray web for test cases.
Cairo had pub/icn/_filetypes.txt to map from icon name to icon file. This functionality is now missing. Test case using %ICON{...}%:

  • jpg JPEG
  • jpeg JPEG
  • zip Compressed Zip archive
  • tz Compressed Zip archive
  • tar Compressed Zip archive
  • taz Compressed Zip archive
  • z Compressed Zip archive
  • xls Microsoft Excel Spreadsheet
  • xla Microsoft Excel Spreadsheet
  • xlb Microsoft Excel Spreadsheet
  • xlc Microsoft Excel Spreadsheet

-- PTh

The functionality is still there - nothing has changed for attachments. The ICON syntax is based on name mapping, not on filetype mapping. -- AC
Fair point, ICON{} was never supported for file attachment icons. Wondering where is the mapping done now? There is no pub/icn directory anymore.

Since ICON{} can now be used to render file attachment icons it is natural to assume that %ICON{tar}% etc works since those extensions are very common. Re-classified as Enhancement.

-- PTh

  • Render.filenameToIcon does the filetype mapping and reads _filetypes.txt
  • Render.getIconHTML does the ICON name mapping

You could try to first map the name to a filetype. For instance %ICON{jpeg}% would lead to reading from _filetypes.txt that jpg should be used and creates html for jpg.gif. Only the defaulting to else.gif should be circumvented when no mapping name is found.

I was thinking about optimization - wouldn't caching be a good idea for this? Because the icon html is generated again and again.


Performance is important. ICON{} is currently fast since it assumes that the icon file exists (and simply generates an image tag to a non-existing file if not). I do not want to initiate file exist check since this is slow. The _filetypes.txt content could be read once per script invocation (or once per compile in mod_perl) and cached in memory. If extension is not found ("else") one can assume that it is an existing attachment. The complete list of attachments can also be cached.

It looks like some more coding is needed, therefore better to defer this to Edinburgh.

-- PTh

Closing stale & obsolete item.

-- PeterThoeny - 2010-11-06

Summary Missing icon mapping based on _filetypes.txt
ReportedBy PeterThoeny

SVN Range

AppliesTo Engine

Priority Enhancement
CurrentState No Action Required


TargetRelease major

Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View |  Raw edit | More topic actions
Topic revision: r9 - 2010-11-06 - PeterThoeny
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback