Dienstag, 9. November 2010

Confluence: Freemind mindmaps embedded in pages

If you want to embed freemind (*.mm) mindmaps into your confluence page (which is not possible by default) just follow these steps and you're ready to go.


mindmap macro setup
  1. Get the Freemind browser applet from here Freemind at Sourceforge
  2. Create a page in your confluence that can be access by an anonymous user and attach the freemindbrowser.jar to it.
  3. Login as Confluence Administrator and create a new user macro
  4. Put the following code into the template textbox:

#set($width= $param1)
#if (!$width)
  #set ($width=600)
#end
#set($height= $param2)
#if (!$height)
  #set ($height=450)
#end
#set($attachmentUrl="$action.getGlobalSettings().getBaseUrl()$content.getAttachmentNamed($param0).getDownloadPathWithoutEncoding()")
<applet code="freemind.main.FreeMindApplet.class" 
    archive="http://your.company.confluence.server/download/attachments/2687383/freemindbrowser.jar"       width="$width" height="$height">
    <param name="type" value="application/x-java-applet;version=1.4">
    <param name="scriptable" value="false">
    <param name="modes" value="freemind.modes.browsemode.BrowseMode">
    <param name="browsemode_initial_map"
         value="$attachmentUrl">
    <param name="initial_mode" value="Browse">
    <param name="selection_method" value="selection_method_direct">
</applet>
Just replace http://your.company.confluence.server/download/attachments/2687383/freemindbrowser.jar with the url of the attached freemindbrowser.jar

Now you can use the macro with the following syntax to embed freemind mindmaps:
{mindmap:<attachment_filename>[|<width>[|<height>]]}

Example:
{mindmap:my_mindmap.mm|650|500}


Enjoy it! :-)