-
Notifications
You must be signed in to change notification settings - Fork 12
Installing WikiMindMap to work with your own wiki
Written by John Moorhouse
WikiMindMap can be installed to display data from your own installation of mediawiki, in this step by step guide the wiki and WikiMindMap have been installed on a default Ubuntu Server based LAMP server, and the wiki and WikiMindMap have been installed in the default Apache server using /var/www/ as the document root for the web server.
As we are running other resources on this server as well as the wiki, the wiki has been installed to
http://servername.domain/wiki/
and the mind map has been installed in
http://servername.domain/mindmap
The WikiMindMap software does not have to be in any specific location relative to the wiki, and indeed can be installed on a completely separate server, one install of WikiMindMap can display data from multiple wiki’s
The WikiMindMap software was downloaded from git as a zip file [ https://github.com/nyfelix/wikimindmap ] and up-zipped on the server, although you can do this on your PC and then upload it to webserver via FTP. The software is in to main folders:
- Actionscript - this contains the source code for the mindmap browser and is not needed for WikiMindMap to work.
- Public - this contains the WikiMindMap installation files:
/public/viewmap.php :This generates the map webpage - needs editing - can be renamed /public/inc/config.inc.php : Config file for accessing Wikis - needs editing /public/getpages.php : This is the core of WikiMindMap /public/visorFreemind.swf : The binary of the flash browser /public/js/flashobject.js : Needed by the flash browser /public/getfreemind.php : This allows the mindmap to be downloaded
There are additionally some image and CSS files used when rendering viewmap.php
There are four main PHP files
viewmap.php generates the web page containing the mindmap browser and you will need to edit this script so that the server name for the wiki that you want to map appears in the dropdown list for the selection box. This script also renders the flash browser, using data fed to it by getpages.php viewmap.php submits three variables to getpages.php
- $wiki - the server part of the URL, in my case this is the IP address of the test server 192.168.0.18, for the english wikipedia it is en.wikipedia.org etc.
- $topic - the topic / article name entered in the search box. (‘Mind map’ in my example)
- $rootName - This is the name of the this script file, allows the file to be renamed. Note - This file can be renamed as need, for example to index.php, without effecting the functioning of WikiMindMap.
This is the main script that accesses the wiki and parses the links, it then hands the data onto the flash browser for display.
getfreemind.php can be accessed from the viewmap.php page by clicking on the [Download this mindmap as Freemind file] link. It downloads the data from your mind map in a .mm file that can be opened by the open-source FreeMind desktop tool
For each wiki you want to generate mind maps for you will need enter two variables, $index_path
and
$access_path
within config.inc.php
Mediawiki by default runs user friendly URL’s so that for example, the full URL of
http://server_name/wiki/index.php/index.php?title=Mind_map
can be displayed as
http://server_name/wiki/index.php/Mind_map
or even as
http://server_name/wiki/Mind_map
This variable is used by getpages.php when it queries the wiki to return a ‘raw’ copy of the page, i.e. the pure wiki text, without any html codes so that it can strip out everything and just leave all the links and sections. To do this getpages.php need to know the part in the full URL between the server_name and the index.php page, this will just be the folder route you created, from your web root, when you installed mediawiki.
For my installation $index_path was simply /wiki
as I only added on folder level below the site root.
It will be used with the variables $wiki
and $topic
to build the $url
using
$url = 'http://'.$wiki.$index_path.'/index.php?title='.$topic.'&action=raw';
with my data it gives us
$url = http://192.168.0.18/wiki/index.php?title=Mind_map&action=raw
(&action=raw
on the end returns the raw wiki text, rather than rendered html)
This variable is used by WikiMindMap when you click on the page link in the mindmap to open the relevant mediawiki page in a new window.
The simplest way to to work out what it should be is to open your mediawiki site and navigate to a page
(don’t use the URL for the home page for this), my install for example shows a URL of
http://192.168.0.18/wiki/index.php/Mind_map
We can ignore the http://192.168.0.18
part and the /Mind_map
as these are $wiki and $topic,
so we want the bit between; for my installation then $access_path
was /wiki/index.php
It will be used with the variables $wiki and $topic to build the $wikilink
$wikilink = 'http://'.$wiki.$access_path.'/'.$topic;
becoming with my data
$wikilink = http://192.168.0.18/wiki/index.php/Mind_map
$index_path
and $access_path
are set in the switch statement starting at the beginning of
config_inc.php, you will need to create a new case ---> break section for each mediawiki installation
you want to generate mindmaps for, the default section at the bottom will be applied if none of the case
sections match the selected installation, and these are the correct settings for the wikipedia sites.
switch ($wiki) {
case "192.168.0.18":
$index_path = "/wiki";
$access_path = "/wiki/index.php";
break;
default:
$index_path = "/w";
$access_path = "/wiki";
break;
}
The default installation of WikiMindMap should work automatically, provided all the LAMP perquisites and PHP components are installed on your server, we would recommend that you should:
- Upload the WikiMindMap to your webserver
- At this stage do not make any changes to the php files.
- Browse to http://your_server_name_or_ip/WikiMindMap_path/viewmap.php
- Select one of the wikipedia sites from the drop down, enter a search term, and click on [search].
- The WikiMindMap should work against wikipedia as downloaded, if it does not, then you should review your apache / webserver logs to see what errors have been generated (in my case curl was not installed)
- Once you have WikiMindMap working with wikipedia, use the information above to edit (1) viewmap.php and (2) config.inc.php so that WikiMindMap will now access your own wiki.
- Once the system is working correctly, you can now if you wish to, rename viewmap.php, for example to index.php, if this is better for your website.
Using these steps will allow you be able to easily see if the problems you are having relate to the basic installation of WikiMindMap on your server or the configuration of $access_path and $index_path for accessing your wiki.