Extension talk:FreeMind
From MediaWiki.org
Contents |
[edit] Could it possible to produce a Mind Map directly
What a nice extension it is. But if we can produce a Mind Map directly by the data in wiki pages like followed, It would be batter. Right?
==Subject== *Item 1 *Item 2 **Item 2.1 **Item 2.2 *Item 3 |
|-Item 1
|-Item 2-|-Item 2.1
Subject-| |-Item 2.2
|-Item 3
|
--Roc michael 00:12, 20 September 2007 (UTC)
[edit] A bug and a suggestion
Bug: when I return to the page the mind map is displayed on, the cursor grabs hold of the map by the link (like a mother cat and kitten) and won't let go unless I right-click.
Also, could we have the option of setting the target of the link. Actually, that's probably a Free Mind issue, so I'll ask there.
Thanks 70.178.211.249 05:01, 23 September 2007 (UTC)
[edit] Startup error with Tomcat
I can't seem to make this extention work, and there is very little support over on sourceforge :(
I get the following error from Tomcat on startup: 2007/10/14 09:36:38 org.apache.catalina.startup.TldConfig tldScanJar SEVERE: Exception processing JAR at resource path C:\Program Files\xampp\tomcat\lib\freemindbrowser.jar in context /jsp-examples
Any ideas?
[edit] It's not working in my intranet
I have installed the extension and uploaded a simple example on my local server in my intranet.
Software:
- Linux
- lighttpd instead of apache
- MediaWiki: 1.9.3
- PHP: 5.2.3-1+b1 (cgi-fcgi)
- MySQL: 5.0.45-Debian_1-log
- Browser: I have tried firefox and conqueror:
When I open the page with the example from my server, I get:
"Flash plugin or Javascript are turned off. Activate both and reload to view the mindmap"
but they are turned on.
When I am calling some demo-sites in the Internet with freemind-examples I don't have problems.
What can I do?
Best regards Jan
[edit] The same happens to me
With the Java applet it works, though, but I would like the Flash version to work too. --Eduardo
[edit] »Flash plugin or Javascript are turned off. Activate both and reload to view the mindmap«
- I've got this error »Flash plugin or Javascript are turned off. Activate both and reload to view the mindmap« with flash player version 10. With Flash Player 9 it worked. --Raul Böhm 19:08, 8 December 2008 (UTC)
- I solved this problem by embedding a swfObject 2 to load the visorFreemind-Flashbrowser. --Raul Böhm 14:01, 9 December 2008 (UTC)
- Download swfObject 2 and copy file »swfobject.js« into <mediawiki>extensions/freemind/
- take this »FreeMind.php« file: (I made some minor changes to solve some problems with »openUrl« parameter and loading java applet on local systems.)
<?php ## Freemind mindmap WikiMedia extension ## (C) Dimitry Polivaev 2006 ## modified for swfObject 2 by Raul Böhm $wgExtensionFunctions[] = "wfFreemindExtension"; $wgExtensionCredits['parserhook'][] = array( 'name' => 'FreeMind', 'author' => 'Dimitry Polivaev, Raul Böhm', 'description' => 'Insert Freemind Mindmaps into a MediaWiki. Adds <tt><mm></tt> tag', 'url' => 'http://www.mediawiki.org/wiki/Extension:FreeMind', 'version' => '0.1' ); function wfFreemindExtension() { global $wgParser; // Defines the tag <mindmap> ... </mindmap> // The second parameter is the callback function for // processing the text between the tags $wgParser->setHook("mm", "renderMindmap"); } // The callback function for converting the input text to HTML output function renderMindmap($input) { // Default parameter values: $mm_height = "450"; $mm_type = "flash"; $mm_target = "embedded"; if (preg_match('/^\s*\[{2}\s*:\s*(\w.*)\]{2}\s*$/', $input, $matches)) { $mm_target = "link"; $input = $matches[1]; } else if (preg_match('/^\s*\[{2}\s*(\w.*)\]{2}\s*$/', $input, $matches)) { $mm_target = "embedded"; $input = $matches[1]; } else{ return MindmapHelp($input); } $mm_title = ""; $mm_description = ""; $paramVector = explode("|", $input); $url = $paramVector[0]; $paramNumber = count($paramVector); for ($i = 1; $i < $paramNumber; $i++) { $param = trim($paramVector[$i]); if (preg_match('/^\s*[0-9]+p[xt]$/', $param)) { $mm_height = $param; } else if (preg_match('/^(\w+)\s+(.*)$/', $param, $pair)) { if ("title" === $pair[1]) { $mm_title = $pair[2]; } else if ("parameters" === $pair[1]) { preg_match_all('/(\\w+?)\\s*=\\s*"(.+?)"/', $pair[2], $match, PREG_SET_ORDER); foreach ($match as $i) $params[$i[1]] = $i[2]; preg_match_all('/(\\w+?)\s*=\s*([^"\s]+?)/', $pair[2], $match, PREG_SET_ORDER); foreach ($match as $i) $params[$i[1]] = $i[2]; } else { if ($mm_description != "") $mm_description .= '|'; $mm_description .= $param; } } else { if ("flash" === $param || "applet" === $param) { $mm_type = $param; } elseif ("notitle" === $param) { $mm_notitle = 1; } else { $mm_description .= $param; } } } if ($mm_description === "") { $mm_description = $url; } if($mm_notitle){ $mm_title = ""; } elseif ($mm_title === "") { $mm_title = $url; } $imageTitle = Title::makeTitleSafe("Image", $url); if($imageTitle == NULL){ return MindmapNotFoundError($url); } $img = Image::newFromTitle($imageTitle); if($img->exists() != true){ return MindmapNotFoundError($url); } $url = $img->getViewURL(false); global $IP, $wgServer, $wgScriptPath, $wgTitle, $wgUrlProtocols, $wgUser; static $flashContentCounter = 0; if ($mm_type === "flash") { $params['initLoadFile'] = $url; if (! isset($params['openUrl'])) $params['openUrl'] = "_self"; if (! isset($params['startCollapsedToLevel'])) $params['startCollapsedToLevel'] = "5"; if (strcasecmp($mm_target, "embedded") == 0) { $flashContentCounter++; require_once("$IP/extensions/freemind/flashwindowFunction.php"); $output = getMindMapFlashOutput($mm_title, $params, $flashContentCounter, $mm_height, "$wgScriptPath/extensions/freemind/"); } else if (strcasecmp($mm_target, "link") == 0) { $Formcounter++; $ref = "$wgScriptPath/extensions/freemind/flashwindow.php?"; } else { $output = MindmapHelp($url); } } else if ($mm_type === "applet") { $params['browsemode_initial_map'] = "$wgServer$url"; if (isset($params['type'])) unset($params['type']); if (isset($params['scriptable'])) unset($params['scriptable']); if (isset($params['modes'])) unset($params['modes']); if (isset($params['initial_mode'])) unset($params['initial_mode']); if (strcasecmp($mm_target, "embedded") == 0) { require_once("$IP/extensions/freemind/appletwindowFunction.php"); $output = getMindMapAppletOutput($mm_title, $params, $mm_height, "$wgScriptPath/extensions/freemind/"); } else if (strcasecmp($mm_target, "link") == 0) { $ref = "$wgScriptPath/extensions/freemind/appletwindow.php?path=$wgScriptPath/extensions/freemind/&"; } else { $output = MindmapHelp($url); } } else { $output = MindmapHelp($url); } if (! isset($output) && $mm_target === "link") { $params['mm_title'] = rawurlencode($mm_title); foreach ($params as $key => $value) { $ref .= "$key=$value&"; } $ref = substr($ref, 0, -1); $output .= "<a href=$ref>$mm_description</a>"; } // print($output); if ($mm_target == "embedded") $output = "$output"; return $output; } function MindmapHelp($input) { return '<div style=\'border: solid red 1px\'> <p align=center><b>Ebbedded Mind Map Syntax error in </b>: <code><mm>'.$input.'</mm></code></p><br> <p><b> Syntax: </b> <blockquote><b><code><mm>[[{name}|{options}|parameters {parameters}]]</mm></code></b><br> <b><code><mm>[[:{name}|{options}|parameters {parameters}]]</mm></code></b></blockquote> <b> Examples:</b> <blockquote> <ul> <li><code><mm>[[Hello.mm]]</mm></code> <li><code><mm>[[Hello.mm|flash]]</mm></code> <li><code><mm>[[Hello.mm|applet]]</mm></code> <li><code><mm>[[Hello.mm|flash|80pt]]</mm></code> <li><code><mm>[[Hello.mm|applet|150px|title example map]]</mm></code> <li><code><mm>[[:Hello.mm]]</mm></code> <li><code><mm>[[:Hello.mm|description]]</mm></code> <li><code><mm>[[:Hello.mm|flash|title the map in flash|map in flash]]</mm></code> </ul></blockquote> </div>'; } function MindmapNotFoundError($input) { return '<div style=\'border: solid red 1px\'> <p align=center><b>Error: Mind Map file <code>'.$input.'</code> not found </b> </p><br> </div>'; } ?>
- Take this »flashwindowFunction.php« file: (It loads the swfObject 2)
<?php ## Freemind mindmap WikiMedia extension ## (C) Dimitry Polivaev 2006 ## modified for swfObject 2 by Raul Böhm function getMindMapFlashOutput($mm_title, $parameters, $flashContentCounter, $mm_height, $path) { ## Due to MediaWikis parser it is important ## to be careful with spaces or linebreaks ## in the javascript variable definitions ## ## build flashvars string $flashvars = 'var flashvars = {};'."\n\t"; foreach ($parameters as $key => $value) $flashvars.= 'flashvars.'.$key.'="'. $value.'";'."\n\t"; $flashvars = substr($flashvars, 0, -3); ## build output string $output = ''; if($mm_title != ""){ $output=' <p style="text-align:center"><a href="'.$parameters['initLoadFile'].'">'.$mm_title.'</a></p>'; } $output.=' <script type="text/javascript" src="'.$path.'swfobject.js"></script>'.' <script type="text/javascript"> // <![CDATA['; $output.=' '.$flashvars.' var params = {}; params.menu = "false"; params.bgcolor = "#FFFFFF"; params.scale = "exactfit"; params.quality = "best"; params.allowfullscreen = "false"; params.salign = "tl"; params.scale = "noscale"; var attributes = {}; attributes.align="center"; swfobject.embedSWF("'.$path.'visorFreemind.swf", "flashcontent'.$flashContentCounter.'", "100%", "'.$mm_height.'", "9.0.0","'.$path.'expressInstall.swf", flashvars, params, attributes); // ]]> </script> <div id="flashcontent'.$flashContentCounter.'" style="margin:0px"> <p>This content requires the Adobe Flash Player.</p> <p> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a> </p> </div>'; return $output; } ?>
- It does not work. I found the problem - you have to check output for wiki tags. These tags (like <pre>, <p> ..) are not supposed to be in <script> which generate errors. I fixed that so you can try it - flashwindowFunction.php:
<?php ## Freemind mindmap WikiMedia extension ## (C) Dimitry Polivaev 2006 ## modified for swfObject 2 by Raul Böhm // rev 2 by J.Holasek function getMindMapFlashOutput($mm_title, $parameters, $flashContentCounter, $mm_height, $path) { ## Due to MediaWikis parser it is important ## to be careful with spaces or linebreaks ## in the javascript variable definitions ## ## build flashvars string $flashvars = 'var flashvars = {};'."\n\t"; foreach ($parameters as $key => $value) $flashvars.= 'flashvars.'.$key.'="'. $value.'";'."\n\t"; $flashvars = substr($flashvars, 0, -3); ## build output string $output = ''; if($mm_title != ""){ $output='<p style="text-align:center"><a href="'.$parameters['initLoadFile'].'">'.$mm_title.'</a></p>'; } $output.='<script type="text/javascript" src="'.$path.'swfobject.js"></script>'.' <script type="text/javascript">// <![CDATA[ '; $output.=$flashvars.' var params = {}; params.menu = "false"; params.bgcolor = "#FFFFFF"; params.scale = "exactfit"; params.quality = "best"; params.allowfullscreen = "false"; params.salign = "tl"; params.scale = "noscale"; var attributes = {}; attributes.align="center"; swfobject.embedSWF("'.$path.'visorFreemind.swf", "flashcontent'.$flashContentCounter.'", "100%", "'.$mm_height.'", "9.0.0","'.$path.'expressInstall.swf", flashvars, params, attributes); // ]]> </script> <div id="flashcontent'.$flashContentCounter.'" style="margin:0px"> <p>This content requires the Adobe Flash Player.</p> <p> <a href="http://www.adobe.com/go/getflashplayer"> <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" /></a> </p> </div>'; return $output; } ?>
by Jakub Holasek, 2009-03-22.
[edit] Java Applet ignores Port
Hi, i have a localserver running on port 4001. Viewing an Mindmap using flash works but if i use the java applet the load of the map fails. File not found.
- Flash uses this path: http://127.0.0.1:4001/images/d/de/FreeMindFlashBrowser.mm
- Java this one : http://127.0.0.1/images/d/de/FreeMindFlashBrowser.mm
Any Idea?
- I use port 8800 an had to change in FreeMind.php:
-
$params['browsemode_initial_map'] = "$server$url";
- to this:
-
$params['browsemode_initial_map'] = "$wgServer$url";
[edit] Need to patch MimeMagic.php
To upload "*.mm" files is not sufficient to add "mm" to $wgFileExtensions, because you Mediawiki (version 1.12) still fail as «uploadcorrupt» ('The file is corrupt or has an incorrect extension. Please check the file and upload again.')
To fix it (some workaround), need to patch MimeMagic.php add line
application/xml mm
to definition of constant MM_WELL_KNOWN_MIME_TYPES
[edit] $wgExtensionCredits for this thing:
$wgExtensionCredits['other'][] = array( //MW 1.12 and above use 'media' 'name' => "FreeMind", 'description' => "Displays [http://freemind.sourceforge.net/wiki/index.php/Main_Page FreeMind] MindMaps as flash or java applet with full navigation.", //'version' => "", 'author' => "Dimitry Polivaev", 'url' => "http://www.mediawiki.org/wiki/Extension:FreeMind", );
--Flominator 07:45, 22 May 2008 (UTC)
[edit] Support
I found that getting support for this extension as well as the standalone application to be very tough. I have stumbled upon MindMeister which is easier to embed and I have written an extension for it available Extension:MindMeister.
[edit] Require_once Error on line 97
I got an error on line 97 in the require_once:
line 97: require_once("freemind/flashwindowFunction.php");
line 114: require_once("freemind/appletwindowFunction.php");
fixed:
line 97: require_once("extensions/freemind/flashwindowFunction.php");
line 114: require_once("extensions/freemind/appletwindowFunction.php");
- Aitherios 22:11, 1 October 2008 (UTC)
[edit] Extension continues to be unstable.
I've been using this extension for over a year, but suddenly is became unstable, exhibiting the misbehavior noted in previous comments.
I have reinstalled the extension, using the revised code indicated above, and still have had no luck.
The problem may be conflict with some other extension. Its hard to say. In the meantime, unfortunately, I've had to remove it from my wiki.
--C4duser 21:57, 28 June 2009 (UTC)
[edit] Works if you get the right files
I was able to get this to work by poking around on his site a bit... Boiled down, here is what you need to do (I'm using Ubuntu Linux, so season to your tastes):
cd <mediawiki dir>/extensions wget http://evamoraga.net/efectokiwano//mm/freeMindFlashBrowser.zip wget http://freemind.sourceforge.net/dimitry_mediawiki_freemind_extension/MediawikiExtension.zip unzip MediawikiExtension.zip cd freemind unzip ../freeMindFlashBrowser.zip wget http://freemind.sourceforge.net//wiki/extensions/freemind/freemindbrowser.jar
Then edit your LocalSettings and add this at the end:
require_once("$IP/extensions/FreeMind.php");
While you're still editing LocalSettings, make sure you have the following options set. Obviously, change the file extensions to suit your needs. The wgVerifyMimeType was needed, I found, because it tries to verify a type it knows nothing about.
$wgStrictFileExtensions=false;
$wgVerifyMimeType=false;
$wgEnableUploads = true;
$wgFileExtensions = array('pdf','mm','png','jpg','jpeg','ogg','doc','xls','ppt','mp3','sxc','nse');
The flash works (even on a linux server and linux client), but I couldn't get the java applet to work. I didn't mind this, because it took forever for the applet to fire up, but the flash is nice and fast. Hope this helps... --Xuru 21:06, 26 September 2009 (UTC)
-
- Confirm above working on 1.14 and hostgator --Phalseid 14:40, 21 November 2009 (UTC)