freemind plugin by Patrick Maué
Display Freemind Mindmaps in your wiki.
Last updated on 2006-04-02.
No compatibility info given!
Requires command.
This command enables the display of Freemind mind maps in your Wiki. Freemind is a handy, easy to use java mind-mapping software. You can find more information about it here (including some screen shots). And here is an example for the java applet. The following list shows examples of this dokuwiki plugin
This command integrates a java applet into your Wiki, which means that your visitors need to have the Java Plug-in installed in order to browse through your mind maps. This plugin does also provide a flash viewer with some additional features, if you want to avoid the standard java applet. The code for this command comes from another great Wiki software, the Wikka Wikki.
And thanks to the Freemind folks for this great application.
An example would be:
#freemind?width=300&javalink=false(namespace:mindmap.mm)#
You can only show mind maps as a block outside paragraphs using #, in-line embedding with % is not intended. Mind maps are media files, use the media file selector to upload your mind maps and to paste the name of the file into your Wiki code.
Command: freemind
Example:
#freemind?width=200&type=flash(namespace:myMindmap.mm)#
Description:
Shows a Freemind mindmap.
Content:
Needs to be a valid ID of the mindmap. An empty string or 'help' shows this help.
Parameter:
type (=flash|java): Type of display. For now, we allow flash and java (default)
width (=Number): Width of the displayed mindmap
height (=Number): Height of the displayed mindmap
downloadlink (=false|true): Display the download link below the mindmap? (enabled by default)
freemindlink (=false|true): Display the link to the Freemind Homepage? (enabled by default)
javalink (=false|true): Display the link to the Java Homepage? (enabled by default)
You need to have the Command Plug-in installed. Go here to find more information.
Installation consists of two steps:
Open the file
conf/mime.conf
in the DokuWiki directory and add the following line at the end:
mm text/xml
Download the file freemind.zip from this location, unzip it and place all the files (freemind.php, freemindbrowser.jar for java applet support and flashobject.js, visorFreemind.swf for flash support) into the following directory in your DokuWiki directory.
lib/plugins/command/ext
<?php /** * freemind Command: Displays a freemind mindmap * * The code used for this plugin comes from the Wikka Wikki: http://wikka.jsnx.com/FreeMind * For a full description of this Command Plugin command, see: http://www.splitbrain.org/plugin:tagged * * @license GPL2 and later (http://www.gnu.org/licenses/gpl.html) * @author Patrick Maué <http://www.q14.net>, Christophe Ambroise <http://www.hds.utc.fr/~ambroise> * * Changes: * 11/15/05 Added Flash support */ class CommandPluginExtension_freemind extends CommandPluginExtension { function getCachedData($embedding, $params, $paramHash, $content, &$errorMessage) // STATIC { /* remove { or } brackets */ $content = preg_replace('/{|}/','', $content); /* display usage if no mindmap is given as content */ if((strcmp($content, "help") == 0) || (strcmp($content, "") == 0)) { return CommandPluginExtension_freemind::getUsage(); } /* TODO: How to check if id is valid? if(! check url? ) { $errorMessage = "INVALID_FILE_ID: ".$content; return null; } */ /* get url to freemind map */ $id = cleanId($content); $protocol = ( $_SERVER['HTTPS'] ) ? 'https' : 'http'; $mindmap_url = $protocol .'://'. $_SERVER['HTTP_HOST'] .ml($id,'',true); // should work now /* path to the libraries for the display, file path does not work */ $path2libs = DOKU_BASE.'lib/plugins/command/ext/'; /* the links are enabled by default (but can be disabled by parameter) */ $downloadlink = '<li class="level1"><div class="li"> Download the file <a class="wikilink1" title="'.$id.'" href="'.$mindmap_url.'"> '.$id.'</a></div></li>'; $freemindlink = '<li class="level1"><div class="li">Use <a href="http://freemind.sourceforge.net/">Freemind</a> to edit it</div></li>'; /* java is the default view */ $object = CommandPluginExtension_freemind::generate_java($path2libs, $mindmap_url); /* switch though through parameter */ if(@count($params) > 0) { foreach($params as $var) { switch($var[0]) { case 'type': if(strcmp($var[1],"java") == 0) { // might add other display possibilites here (eg. SVG) $object = CommandPluginExtension_freemind::generate_java($path2libs, $mindmap_url); $javalink = '<li class="level1"><div class="li">Get the latest Java Plug-in <a href="http://java.com/"> here.</a></div></li>'; } else if(strcmp($var[1],"flash") == 0) { $object = CommandPluginExtension_freemind::generate_flash($path2libs, $mindmap_url); } else { $object = CommandPluginExtension_freemind::generate_java($path2libs, $mindmap_url); // java in every other case } break; case 'height': $style.='height:'.$var[1].'px;'; $flashstyle .= 'height:'.$var[1].'px;'; break; case 'width': $style.='width:'.$var[1].'px;'; $flashstyle .= 'height:'.$var[1].'px;'; break; case 'downloadlink': if(strcmp($var[1],"false") == 0) unset($downloadlink); break; case 'javalink': if(strcmp($var[1],"false") == 0) unset($javalink); break; case 'freemindlink': if(strcmp($var[1],"false") == 0) unset($freemindlink); break; /* add other parameter here */ default: break; } } } // if (height or weight) and flash is requested, we add height to #flashid (has de be done here, because order of parametes is not defined) if(isset($flashstyle)) { $object = str_replace("<div ","<div style=\"".$flashstyle."\" " ,$object); } // set other style attributes for surrounding layer $style.="clear:both;"; /* output for java applet */ $output = "<div class=\"freemind\" id=\"flashcontent\" style=\"".$style."\">". $object. // additional links "<ul>"; if(isset($javalink)) $output .= $javalink."\n"; if(isset($downloadlink)) $output .= $downloadlink."\n"; if(isset($freemindlink)) $output .= $freemindlink ."\n"; $output .= "</ul></div>"; return $output; } function getUsage() { $help= '<pre class="code">'; $help.="Command: freemind \n \n"; $help.="Example: \n #freemind?width=200&type=flash(namespace:myMindmap.mm)# \n \n"; $help.="Description: \n Shows a Freemind mindmap. \n \n"; $help.="Content: \n Needs to be a valid ID of the mindmap. An empty string or 'help' shows this help. \n \n"; $help.="Parameter: \n"; $help.=" type (=flash|java): Type of display. For now, we allow flash and java (default)\n"; $help.=" width (=Number): Width of the displayed mindmap\n"; $help.=" height (=Number): Height of the displayed mindmap\n"; $help.=" downloadlink (=false|true): Display the download link below the mindmap? (enabled by default)\n"; $help.=" freemindlink (=false|true): Display the link to the Freemind Homepage? (enabled by default)\n"; $help.=" javalink (=false|true): Display the link to the Java Homepage? (enabled by default)\n"; $help.="</pre>"; return $help; } function generate_java($path2libs, $mindmap_url) { $output = "<script type=\"text/javascript\">\n". "<!--\n". " if(!navigator.javaEnabled()) {\n". " document.write('<div class=\"freeminderror\"> Please install a <a href=\"http://www.java.com\">Java Runtime Environment<\/a> on your computer.</div>');\n". " }\n". "//-->\n". "</script>\n". "<applet code=\"freemind.main.FreeMindApplet.class\" archive=\"".$path2libs."freemindbrowser.jar\" width=\"100%\" height=\"100%\">\n". " <param name=\"type\" value=\"application/x-java-applet;version=1.4\" />\n". " <param name=\"scriptable\" value=\"false\" />\n". " <param name=\"modes\" value=\"freemind.modes.browsemode.BrowseMode\" />\n". " <param name=\"browsemode_initial_map\" value=\"".$mindmap_url."\" />\n". " <param name=\"initial_mode\" value=\"Browse\" />\n". " <param name=\"selection_method\" value=\"selection_method_direct\" />\n". "</applet>\n</div>"; return $output; } function generate_flash($path2libs, $mindmap_url) { $output = "<script type=\"text/javascript\" src=\"".$path2libs."flashobject.js\"></script>". "<div id=\"flashcontent\">". " Flash plugin or Javascript are turned off.". " Activate both and reload to view the mindmap". "</div>". "<script type=\"text/javascript\">". " var fo = new FlashObject(\"".$path2libs."visorFreemind.swf\", \"".$path2libs."visorFreeMind\", \"100%\", \"100%\", 6, \"#9999ff\");". " fo.addParam(\"quality\", \"high\");". " fo.addParam(\"bgcolor\", \"#ffffff\");". " fo.addVariable(\"openUrl\", \"_blank\");". " fo.addVariable(\"initLoadFile\", \"".$mindmap_url."\");". " fo.addVariable(\"startCollapsedToLevel\",\"5\");". " fo.addVariable(\"mainNodeShape\",\"rectangle\");". " fo.write(\"flashcontent\");". "</script>"; return $output; } }
Tested it with dokuwiki-2006-03-09b and “better navigation template” 2006-03-11. While the flash-Include workes fine, in my installation it somehow breaks the layout below the plugin code, if the java-Version is included: Elements below the code are shown as with switched off CSS (at least with firefox and opera). — Hella Breitkopf 2006-06-21–20:30
I am using Firefox 2.0.0.7, Modify freemind.php line 115, remove code </div> to solve the problem. — Jonathan Tsai 2007-10-12 05:56
function getCachedData($embedding, $params, $paramHash, $content, &$errorMessage) // STATIC { : : : if(isset($freemindlink)) $output .= $freemindlink ."\n"; $output .= "</ul>"; ///>>>>>>Original Code "</ul></dev>"; return $output; }
I have the same problem and am using the same better navigation plugin. Additional I experienced that my wikitext below the mind map overlaps with the link to the mind map and the stuff which is by default generated by the plugin. Additionaly the browser does not realise that there is any contend below the flash part if there is only the data generated by the plugin itself ( link to freemind and stuff like mentioned before). So if you have one big freemind map on a page and made it for example 800*800 big you can not scroll to the aer ea of the page where the additional information from the plugin is placed, because the browser does not recognize this content. I am using Firefox 1.5.0.6
For above thre is solution: IN function
function generate_java($path2libs, $mindmap_url) { $output = "<script type=\"text/javascript\">\n". "<!--\n". " if(!navigator.javaEnabled()) {\n". " document.write('<div class=\"freeminderror\"> Please install a <a href=\"http://www.java.com\">Java Runtime Environment<\/a> on your computer.</div>');\n". " }\n". "//-->\n". "</script>\n". "<applet code=\"freemind.main.FreeMindApplet.class\" archive=\"".$path2libs."freemindbrowser.jar\" width=\"100%\" height=\"100%\">\n". " <param name=\"type\" value=\"application/x-java-applet;version=1.4\" />\n". " <param name=\"scriptable\" value=\"false\" />\n". " <param name=\"modes\" value=\"freemind.modes.browsemode.BrowseMode\" />\n". " <param name=\"browsemode_initial_map\" value=\"".$mindmap_url."\" />\n". " <param name=\"initial_mode\" value=\"Browse\" />\n". " <param name=\"selection_method\" value=\"selection_method_direct\" />\n". "</applet>\n</div>"; ///>>>>>>CHANGE TO "</applet>\n"; return $output; }
change the last line before outpup to
"</applet>\n";
Would it possible to create the PHP files into a 'real' plugin that can be managed through the Plugin Manager ?
Thanks in advance - charlieMOGUL 06-12-2006 10:00 GMT +01:00
Hey, charlieMOGUL I am not activly maintaining this plugin anymore (not even using dokuwiki anymore, sorry ;) ). I did choose the command plugin when I started this plugin due to its simplicity, and I didn't really bother to learn more about the 'real' plugin engine behind dokuwiki. And when it was implemented there was no such thing like a Plugin Manager. Anyway, of course it would be great if someone more skilled in dokuwiki plugins can copy my code (which is nothing special) and creates a plugin which can be handled by the Plugin Mangager. (Patrick Maué, who doesn't even know is login anymore)
Hi, HTTPS support does not work on my W2K IIS with PHP 4.4.1 installed. After changeing Line 43 in freemind.php from
$protocol = ( $_SERVER['HTTPS'] ) ? 'https' : 'http';
to
$protocol = ( $_SERVER['HTTPS'] == "on" ) ? 'https' : 'http';
it works for me. I dont know if this works on an apache webserver and linux as well. Maybe someone can test it. — andi 01.02.2006 17:30 MEZ —
not working for me on Linux/Apache, do I need fopen to be anabled? - happy dokuwiki user-
Hi guys, thanks for this great piece of work. I am using this plugin to display meeting notes catched using Freemind. But the problem is that this plugin needs a huge place in the page to be really a usable viewer. And if you give it a huge place, it is destroying the page layout.
So I wrote a very simple and quick translator from Freemind XML (native format in the mm file) to basic Dokuwiki syntax, using headers and bullet lists. You can give it a try at this location : http://prog.13.free.fr/freemind2dokuwiki/ Source code is published under GPL, right click to see and download it and change anything you want.
Hope this will help :) Frederic Monjo
Here is the wiki Wadooa. They use the freemind plugin to publish mindmaps and use it as navigation bar. http://wadooa.com/doku.php
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported