Extension talk:FreeMind

Latest comment: 10 years ago by RV1971 in topic Does anybody maintain this extension?

Could it possible to produce a Mind Map directly

edit

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

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

A bug and a suggestion

edit

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

Startup error with Tomcat

edit

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

edit

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

edit

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«

edit
  • 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)Reply
  • I solved this problem by embedding a swfObject 2 to load the visorFreemind-Flashbrowser. --Raul Böhm 14:01, 9 December 2008 (UTC)Reply
  • 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&ouml;hm

$wgExtensionFunctions[] = "wfFreemindExtension";
$wgExtensionCredits['parserhook'][] = array(
  'name' => 'FreeMind',
  'author' => 'Dimitry Polivaev, Raul B&ouml;hm',
  'description' => 'Insert Freemind Mindmaps into a MediaWiki. Adds <code>&lt;mm&gt;</code> 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 style="text-align:center;"><b>Ebbedded Mind Map Syntax error in </b>: <code>&lt;mm&gt;'.$input.'&lt;/mm&gt;</code></p><br>
<p><b>&nbsp;Syntax: </b>
<blockquote><b><code>&lt;mm&gt;[[{name}|{options}|parameters {parameters}]]&lt;/mm&gt;</code></b><br>
<b><code>&lt;mm&gt;[[:{name}|{options}|parameters {parameters}]]&lt;/mm&gt;</code></b></blockquote>
<b>&nbsp;Examples:</b>
<blockquote>
<ul>
<li><code>&lt;mm&gt;[[Hello.mm]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[Hello.mm|flash]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[Hello.mm|applet]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[Hello.mm|flash|80pt]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[Hello.mm|applet|150px|title example map]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[:Hello.mm]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[:Hello.mm|description]]&lt;/mm&gt;</code>
<li><code>&lt;mm&gt;[[:Hello.mm|flash|title the map in flash|map in flash]]&lt;/mm&gt;</code>
</ul></blockquote>
</div>';
}

function MindmapNotFoundError($input)
{
    return '<div style=\'border: solid red 1px\'>
<p style="text-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&ouml;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.style="text-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&ouml;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.style="text-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.

Java Applet ignores Port

edit

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.

  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

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

Need to patch MimeMagic.php

edit

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:

edit
$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)Reply

Support

edit

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

edit

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

Extension continues to be unstable.

edit

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

Works if you get the right files

edit

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

Confirm above working on 1.14 and hostgator --Phalseid 14:40, 21 November 2009 (UTC)Reply


Errors uploading file type mm FIXED by updating mime.types file...

edit

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

edit

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

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

Work around to upload problems: upload a simple one then manually overwrite with a complex one

edit

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

edit

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 file FreeMind.php:

<?php
// Freemind mindmap WikiMedia extension
// (C) Dimitry Polivaev 2006, Günter Gratzer 8.02.2012 (modifed for MediaWiki 18.1)
// Example:
$wgExtensionFunctions[] = "wfFreemindExtension";

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 = "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\'>
<p style="text-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 style="text-align:center;"><b>Error: Mind Map file <code>'.$input.'</code> not found </b> </p><br>
</div>';
}
?>

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)

Gunter - Very Senks!!!! It's Works on Ubuntu 11.04 + MW 18.1
Thanks Günter Gratzer! but in Version for Mediawiki 1.19.0 , I find that must replace "<mm>Hello.mm</mm>" by "<mm>File:Hello.mm</mm>" ! TaoJiang
Do not work in MW 19.1 :( Wikipro (talk) 09:01, 11 August 2012 (UTC)Reply
replacing $imageTitle = Title::makeTitleSafe("Image", $url); with $imageTitle = Title::makeTitleSafe(NS_IMAGE, $url); make it working with 1.19 for me XDmitry (talk)

1.18, bugs

edit

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

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></p>';
}
	$output.='
<script type="text/javascript" src="'.$path.'flashobject.js"></script>'
.'<div id="flashcontent'.$flashContentCounter.'"> Flash plugin or Javascript are turned off. Activate both  and reload to view the mindmap</div>
<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.'");
// ]]>
</script>';
	return $output;
}
?>

--Günter Gratzer 13:43, 27 February 2012 (UTC)

Version for Mediawiki 1.20.2

edit

If you want to run the freemind extension under the new 1.20.2 MediaWiki you have to change the follwowing line (about line 80):

$imageTitle = Title::makeTitleSafe("Image", $url);

to

$imageTitle = Title::makeTitleSafe(NS_FILE, $url);

--Günter Gratzer 14:13, 6 December 2012 (UTC)


Wikipro (talk) 21:27, 21 December 2012 (UTC) Danke Gunter!!Reply

Hello, I use "MediaWiki 1.21.4" and made the change in "FreeMind.php". But still get the error message "Error: Mind Map file name.mm not found"! I can upload mm files and made the changes in LocalSettings.php. What can I do else? Thanks Thomas: 23:39, 22 January 2014 (UTC)

MMHandler

edit

You can tru use MMHandler MMHandler. It use Flash.

Freemind for version 1.23.3 (works)

edit

Greetings. I just got this working, so I thougt I would tell everyone how I did it:

First Save the following code (by expanding it to the right first) as "FreeMind.php":

Source: "FreeMind.php"

edit
<?php
// Freemind mindmap WikiMedia extension
// (C) Dimitry Polivaev 2006, Günter Gratzer 8.02.2012 (modifed for MediaWiki 18.1)
// Example:
$wgExtensionFunctions[] = "wfFreemindExtension";

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 = "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;
  }
$img = wfFindFile($url);
	if ($img == false){
		return MindmapNotFoundError($url);
	}
$url = $img->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\'>
<p style="text-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 style="text-align:center;"><b>Error: Mind Map file <code>'.$input.'</code> not found </b> </p><br>
</div>';
}
?>

Otherwise, I have followed the instructions on the main page exactly.
--Gutesork (talk) 11:17, 5 November 2014 (UTC)Reply

Does anybody maintain this extension?

edit

I have found this extension very useful, but I would have appreciated if some of the fixes on the discussion page had been merged into the distribution. Does anybody currently maintain this extension? If not, I might consider taking over this task. - RV1971 (talk) 09:52, 1 December 2014 (UTC)Reply


Version for Mediawiki 1.24.0

edit

Does not work with the above modifications on mw1.24.0

MMHandler for MW 1.18-26

edit

For MW 1.18-26.2 use MMHandler.

Return to "FreeMind" page.