Attachment Viewer plus Dojo make for better platform support

Thanks to everyone who have installed, played with, and have given me feedback on the viewer!

I have actually done a pretty large rewrite of the project – mostly to be more of a real project that is mostly web based and will work on all platforms (hopefully).  I have moved the project to use Dojo and currently use the Google CDN so you have to be online (for now) to use this viewer.  I need to figure out if I will just package Dojo with the project – which will make it more stable but will greatly enhance the footprint.  Currently the code is about 15KB installed and with the full Dojo it jumps to over 3MB.

Dojo gives me the ability to not worry about the different browsers or platforms for the different file types.  And since it is so darn easy I was able to add Quicktime support in a snap.  I use the dojox.embed.Quicktime API to achieve this.  Once I get the project updated on OpenNTF you will see how simple the case looks.  Here is a snippet of the code:

		else if (att.type.toLowerCase() == 'mp4' ||
				att.type.toLowerCase() == 'avi' ||
				att.type.toLowerCase() == 'mov' ||
				att.type.toLowerCase() == 'm4v' ||
				att.type.toLowerCase() == '3gp' ||
				att.type.toLowerCase() == 'm2v' ){

			if (statusArea != null)
				statusArea.innerHTML += "Found Quicktime: " +;

			var node = document.createElement("div");
			node.setAttribute('id','attachment_' + a);

			new dojox.embed.Quicktime({
			}, node);

I really love Dojo because it makes doing things like this a snap, versus the first version I had to scour the net for the right and <object> elements for the various formats and browsers – what a pain!


Once the code is published on OpenNTF you will see a considerable package change in the plugin.  Here is a brief walk through of the new structure:

  1. – this is the main servlet that serves up the files from the Notes cache.  Attachments are actually stored in temporary files and come and go.  The servlet allows the embedded browser to access those files securely.
  2. – this is the Eclipse SWT view part.  It is a thin wrapper that bridges the Eclipse Workbench Selection with the web part.
  3. atviewer.js – the main JavaScript code to process selections, Dojo, and the modification of the DOM.
  4. viewer.html – the main user interface of the viewer.  All HTML using Dojo and dynamic DIV’s
  5. web_files – the directory used by the local web container as the root directory for web based content.

The web_files directory is actually just a simple extension (org.eclipse.equinox.http.registry.resources) to the local container.  The extension tells the local web server any files under this directory should be considered to be at the root of the alias supplied.  Here is the snippet from that extension:

<extension point="org.eclipse.equinox.http.registry.resources">      <resource alias="/atviewer" base-name="/web_files"/></extension>

3 thoughts on “Attachment Viewer plus Dojo make for better platform support

  1. Sounds great!
    Btw: I had an image attachment that did not get displayed in the Mac client. The file extension was .JPG. Maybe you don’t compare case-insensitive? .jpg worked without problems.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.