I’m currently trying out the open source document management system Alfresco. I anticipate Alfresco becoming a widely used open source product in the field of enterprise document management much like typo3 is currently for web CMSes. To get to know it I decided to run it on a debian server and throw some of my documents on it. The CIFS (a integrated samba server) makes it easy to access the files over the windows network while still being versioned and access controlled in the repository.
The main reason I’m writing this post though is, that I’d like to share how I integrated freemind mindmaps into Alfresco. The freemind mindmaps are .mm-files which can already be stored in alfresco but are "unknown binary" files. What we have to do is tell alfresco what .mm-files are by defining them as mime-types. The Alfresco wiki describes how to add a mime-type so I did this accordingly:
<config condition="Mimetype Map" evaluator="string-compare">
The result of including the preceding xml files as tomcat\shared\classes\alfresco\mimetype\mimetype-custom-extensions.xml is that the new content type Freemind appears in the Add Content Dialog.
The next step would be adding the icons for the freemind documents. To achieve this you simply have to copy a file named mm.gif into the alfresco/images/filetypes (16×16 pixels) and alfresco/images/filetypes32 (32×32 pixels) folder in the web application. The new file is automatically recognized after a restart of the web-app and the new icon is available.
Then I thought it would be nifty to have a preview of the mindmap right in the web interface. Fortunately freemind provides a java applet and a flash viewer. I decided to use the flash viewer and found the alfresco templates as a extremely easily way to integrate custom display logic. For my viewer I would only have to include the html code to open the flash object in a freemaker template. Alfresco provides a template directory within the data dictionary (a space in the repository) where I included the following code in the file freemind.fts:
<div id="flashcontent" style="height: 500px;">
Activate both and reload to view the mindmap
var fo = new FlashObject("/alfresco/custom/freemind/visorFreemind.swf", "visorFreeMind", "100%", "100%", 6, "#9999ff");
No document found!
This is basically the code that freemind generates when exporting to flash. More information on templates can also be found in the alfresco wiki in the Template Guide. The template can be easily edited right from the web interface:
Using this template as a custom view in the details page of the mindmap file, which we added earlier, produces this interactive preview of the mindmap:
Using "Preview in Template" the viewer can also be used without the menu on the right:
This little customization has took me not much longer than writing this post which is pretty amazing. Most if the impressiveness of the result is due to the ready-to-use functionality of the freemind flash viewer though
Anyway it shows that the templates are a very powerful feature of Alfresco and allow to create custom views without a lot of friction as they allow the integration of arbitrary applets, flash objects or even external sites via iframes. For now I’m pretty happy with alfresco and look into deploying it more solidly on my home-server and look into backup options.