Freemind (mindmap)
Freemind (mindmap)
Posted:Tue 07 of Dec, 2004 (18:35 UTC)Can anyone see what's wrong with this?
changes to format.tikiwiki.php
I added the following under line 926 (under the images formatting)
[code:1] //MindMap Mod (Freemind -> http://freemind.sf.net)
preg_match_all("/(\{mm [^\}]+})/i", $data, $pages);
foreach (array_unique($pages[1])as $page_parse) {
$parts = explode(" ", $page_parse);
$mmdata = array();
$mmdata["src"] = '';
$mmdata["height"] = '';
$mmdata["width"] = '';
foreach ($parts as $part) {
$part = str_replace('}', '', $part);
$part = str_replace('{', '', $part);
$part = str_replace('\'', '', $part);
$part = str_replace('"', '', $part);
if (strstr($part, '=')) {
$subs = explode("=", $part, 2);
$mmdata[$subs[0]] = $subs[1];
}
}
$repl =
"<script language=\"JavaScript\">".
"<!--".
" if(!navigator.javaEnabled()) {".
" document.write('Please install a <a href=\"http://www.java.com/\">Java Runtime Environment</a> on your computer.');".
" }".
"//-->".
"</script>".
//Remove this for now
/*if ($mmdata["height"])
$repl .= ' height="' . $mmdata["height"] . '"';
if ($mmdata["width"])
$repl .= ' height="' . $mmdata["width"] . '"'; */
"<applet code=\"freemind.main.FreeMindApplet.class\" archive=\"../mindmap/freemindbrowser.jar\" width=\"100%\" height=\"600\">".
" <param name=\"type\" value=\"application/x-java-applet;version=1.4\" />".
" <param name=\"scriptable\" value=\"false\" />".
" <param name=\"modes\" value=\"freemind.modes.browsemode.BrowseMode\" />";
if ($mmdata["src"]) {
$repl = '<param name=\"browsemode_initial_map\" value=\"' . $mmdata["src"] . '\" />"';
}
$repl .=
"<param name=\"initial_mode\" value=\"Browse\" />".
"</applet>".
"<br />";
if ($mmdata["src"]) {
$repl = '<span class=\"notes\">Download <a href=\"' . $mmdata["src"] . '\">this mind map</a> and use the desktop application of <a href=\"http://freemind.sourceforge.net/\">Freemind</a> to edit it.</span>';
}
$data = str_replace($page_parse, $repl, $data);
}
//End MindMap [/code:1]
And I uploaded the freemind.jar to the root bitweaver directory under a new folder called mindmap
Thanks,
Unfortunately wikka's far too different from bitweaver to use most of that code.
I should clarify however -- the code above should work, but the links generated by that script get messed up somehow.
intead of outputting "http://mymindmap.com/mindmap.mm" it outputs "http://yourwebsite.com/wiki/\"http://mymindmap.com/mindmap.mm"\"
I can't figure out why this is happening.
Thanks tho' EzyBiz
![]()
Re: Freemind (mindmap)
Posted:Fri 10 of Dec, 2004 (13:20 UTC)Can anyone see what's wrong with this?
changes to format.tikiwiki.phpI added the following under line 926 (under the images formatting)
[code:1]
if ($mmdata["src"]) {
$repl = '<param name=\"browsemode_initial_map\" value=\"' . $mmdata["src"] . '\" />"';
}
if ($mmdata["src"]) {
$repl = '<span class=\"notes\">Download <a href=\"' . $mmdata["src"] . '\">this mind map</a> and use the desktop application of <a href=\"http://freemind.sourceforge.net/\">Freemind</a> to edit it.</span>';
}
[/code:1]
I helped answer this with Southpawz on IRC, however, to prevent anyone else from pondering this, i post the answer here too:
there are backlslash double quotes in a single quoted string causing the URL to appear to be relative
Thanks spider ![]()
here's more or less the final code
[code:1] //MindMap Mod (Freemind: http://freemind.sf.net)
preg_match_all("/\{mm ([^\}]+)}/i", $data, $pages);
foreach (array_unique($pages[1])as $page_parse) {
$parts = explode(" ", $page_parse);
$mmdata = array();
$mmdata["src"] = '';
/* Remove for now
$mmdata["height"] = '';
$mmdata["width"] = '';
*/
foreach ($parts as $part) {
$part = str_replace('}', '', $part);
$part = str_replace('{', '', $part);
$part = str_replace('\'', '', $part);
$part = str_replace('"', '', $part);
if (strstr($part, '=')) {
$subs = explode("=", $part, 2);
$mmdata[$subs[0]] = $subs[1];
}
}
$repl =
'<script language="JavaScript">'.
'<!--'.
' if(!navigator.javaEnabled()) {'.
' document.write(\'Please install a <a href="http://www.java.com/">Java Runtime Environment</a> on your computer.\');'.
' }'.
'//-->'.
'</script>'.
'<applet code="freemind.main.FreeMindApplet.class" archive="../mindmap/freemindbrowser.jar" width="100%" height="600">'.
//Add the if ($mmdata["width"]) stuff here later
' <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="' . $mmdata["src"] . '" >'.
' <param name="initial_mode" value="Browse" >'.
'</applet>'.
'<br>'.
'<span class="">Download <a href="' . $mmdata["src"] . '">this mind map</a> and use this application to edit it: <a href="http://freemind.sourceforge.net/">Freemind </a> </span>';
$data = str_replace($page_parse, $repl, $data);
}
//Man this took far too long to figure out -_-" hehe
//End MindMap [/code:1]