Extension talk:FreeMind

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?

...Yes! Since FM mindmaps are based on parent<->child relationships you could setup semantics in MW that could be converted to mindmap relationships, as demonstrated by the Graph as Freemind map example here: http://semanticgraph.sourceforge.net/ Calmo 21:33, 19 January 2010 (UTC)

{|width=100%
 * width=30% |

Subject
|-Item 1 |-Item 2-|-Item 2.1 Subject-|       |-Item 2.2 |-Item 3 --Roc michael 00:12, 20 September 2007 (UTC)
 * Item 1
 * Item 2
 * Item 2.1
 * Item 2.2
 * Item 3
 * }

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)

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?

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

The same happens to me
With the Java applet it works, though, but I would like the Flash version to work too. --Eduardo

»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)

 Syntax:       Examples:           '; }
 * 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 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.)

function MindmapNotFoundError($input) {   return ' Error: Mind Map file  not found  '; }

?>


 * Take this »flashwindowFunction.php« file: (It loads the swfObject 2)

by Jakub Holasek, 2009-03-22.
 * It does not work. I found the problem - you have to check output for wiki tags. These tags (like,  ..) are not supposed to be in which generate errors. I fixed that so you can try it - flashwindowFunction.php:

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. Any Idea?
 * 1) Flash uses this path: http://127.0.0.1:4001/images/d/de/FreeMindFlashBrowser.mm
 * 2) Java this one : http://127.0.0.1/images/d/de/FreeMindFlashBrowser.mm


 * 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";

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

$wgExtensionCredits for this thing:
--Flominator 07:45, 22 May 2008 (UTC)

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.

=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)

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)

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 /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)

Errors uploading file type mm FIXED by updating mime.types file...
It is all working great now. I can upload mm files and work them into Mediawiki pages! I love being able to combine MediaWiki and FreeMind! I had to add the following to /usr/share/mediawiki/includes/mime.types [in Ubuntu] to get it to work: application/xml mm Prior to this, mm uploads were failing even though... 1. Edited the MimeMagic.php file to include: application/xml mm 2. Included the following in my LocalSettings.php $wgEnableUploads      = true; $wgStrictFileExtensions=false; $wgVerifyMimeType=false; $wgFileExtensions = array('png', 'gif', 'jpg', 'jpeg', 'pdf', 'tiff', 'bmp', 'txt', 'ps', 'mm' ); focaccio 20100729-1917 PDT

Serious funny business with uploading mm file type files
I wonder what makes an mm file get rejected during upload with the error message: This file contains HTML or script code that may be erroneously interpreted by a web browser. If I try to upload the file NEXUS.mm it fails with the error message above, but if I paste the entire NEXUS mindmap into test1.mm, which was previously successfully uploaded, then a re-upload of test1.mm still works. If I save NEXUS.mm with filename test1.mm then try to upload it, it fails with the error message above. focaccio 20100729-2000 PDT


 * remove the rich content and this error goes away..--24.143.68.194 05:57, 10 December 2011 (UTC)

I have the same problem. I have checked all the mime settings and also the LocalSettings.php file for mis configured variables. here are the settings $wgEnableUploads = true;

$wgFileExtensions = array( 'png', 'gif', 'jpg', 'jpeg', 'ppt', 'pdf', 'xls', 'xlsx', 'swf', 'doc', 'docx', 'mm', 'xml' );

$wgStrictFileExtensions = false;

$wgVerifyMimeType = false; in mime i have added an application xml for mm

Anybody has a solution. --Kirtimansharma 09:08, 25 May 2011 (UTC)

Work around to upload problems: upload a simple one then manually overwrite with a complex one
1. You should always be able to successfully upload a one node default mindmap. Call this the placeholder. 2. Use locate to discover the directory where Mediawiki stored the placeholder. 3. Copy the complex mindmap you really want to see in your Mediawiki to that directory. 4. Overwrite the simple placeholder file with the complex file by using the exact name of the placeholder. focaccio 20100818-1506 PDT

Version for Mediawiki 1.18.1
The FreeMind extension is not working with MediaWiki >= 1.18 because the Image class has been removed. So I change the code. It's working in my wiki. Here is the modified code: setHook("mm", "renderMindmap"); } // The callback function for converting the input text to HTML output function renderMindmap($input) {   // Default parameter values: $mm_height = "800"; $mm_type = "flash"; $mm_target = "embedded"; $mm_notitle = 0;

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); } $file = wfLocalFile($imageTitle);

if($file->exists == NULL){ return MindmapNotFoundError($url); }   $url = $file->getViewURL(false);

global $wgServer, $wgScriptPath, $wgTitle, $wgUrlProtocols, $wgUser; static $flashContentCounter = 0; if ($mm_type === "flash") { $params['initLoadFile'] = $url; if (isset($params['openUrl'])) unset($params['openUrl']); if (! isset($params['startCollapsedToLevel'])) $params['startCollapsedToLevel'] = "5"; if (strcasecmp($mm_target, "embedded") == 0) { $flashContentCounter++; require_once("freemind/flashwindowFunction.php"); $output = getMindMapFlashOutput($mm_title, $params, $flashContentCounter, $mm_height, "$wgScriptPath/extensions/freemind/"); } else if (strcasecmp($mm_target, "link") == 0) { $ref = "$wgScriptPath/extensions/freemind/flashwindow.php?"; } else { $output = MindmapHelp($url); }   } else if ($mm_type === "applet") { $server = $_SERVER['SERVER_NAME']; $params['browsemode_initial_map'] = "http://$server$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("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?"; } else { $output = MindmapHelp($url); }   } else { $output = MindmapHelp($url); }   if (! isset($output) && $mm_target === "link") { $params['mm_title'] = rawurlencode($mm_title); $params['mm_height'] = $mm_height; foreach ($params as $key => $value) { $ref .= "$key=$value&"; }       $ref = substr($ref, 0, -1); $output .= "<a href=$ref>$mm_description</a>"; }   if ($mm_target == "embedded") $output = "$output"; return $output; }

function MindmapHelp($input) {   return '<div style=\'border: solid red 1px\'> Ebbedded Mind Map Syntax error in :  Syntax:       Examples:  <li> <li> <li> <li> <li> <li> <li> <li> </ul> '; }

function MindmapNotFoundError($input) {   return '<div style=\'border: solid red 1px\'> Error: Mind Map file  not found  '; } ?> I'm not an expert, so I don't know if the code is ok. Maybe one of the experts can have a look at the code.

--Günter Gratzer 16:35, 8 February 2012 (UTC)

1.18, bugs
Thanks that ALMOST works now. The Mindmap does not show, that was due to me using IIS, please see below, but the MM controls does.

I STILL get this error in php-errors.log:

[22-Feb-2012 16:57:55 UTC] PHP Notice: Undefined variable: mm_bgcolor .. in C:\inetpub\FSWiki181-ny\extensions\freemind\flashwindowFunction.php on line 13

--Asset (talk) 17:02, 22 February 2012 (UTC)

In IIS you need to specify the mimetype (whatever that is) as mm and application/xml

I don't have the problem with undefined variable. Maybe I have different flashwindowFunction.php. This is my code: <?php function getMindMapFlashOutput($mm_title, $parameters, $flashContentCounter, $mm_height, $path) { $output = ''; $mm_bgcolor = '';

if($mm_title != ""){ $output=' <p style="text-align:center"><a href="'.$parameters['initLoadFile'].'">'.$mm_title.'</a> '; }	$output.=' <script type="text/javascript" src="'.$path.'flashobject.js"> ' .'<div id="flashcontent'.$flashContentCounter.'"> Flash plugin or Javascript are turned off. Activate both and reload to view the mindmap <script type="text/javascript"> // <![CDATA[ var fo = new FlashObject("'.$path.'visorFreemind.swf", "'.$path.'visorFreeMind", "100%", "'.$mm_height.'", 6, "'.$mm_bgcolor.'"); fo.addParam("quality", "high"); fo.addParam("bgcolor", "#ffffff"); ';	foreach ($parameters as $key => $value) $output.="fo.addVariable(\"$key\", \"$value\");\n"; $output.='fo.addVariable("openUrl", "_blank"); fo.write("flashcontent'.$flashContentCounter.'"); // ]]> ';	return $output; } ?> --Günter Gratzer 13:43, 27 February 2012 (UTC)