Actions

Plugins/Artefact/FreeMindFlash

From Mahara Wiki

< Plugins‎ | Artefact
Revision as of 03:12, 29 November 2012 by Geoffr (talk | contribs) (→‎Installation)

Mahara FreeMind mind map plugin

Freemind.png

Note that this is a static image of the embedded FreeMind plugin, the actual plugin has an interactive display of the mind map.


This is an artefact file blocktype plugin to allow Flash rendering of interactive FreeMind mind maps (.mm XML files) in Mahara Pages (Views).

http://freemind.sourceforge.net

It also works with .mm files generated by Freeplane (a fork of FreeMind). Other mind mapping software may also have the option to export in .mm format.

http://freeplane.sourceforge.net

It draws inspiration from the FreeMind filter for Moodle.

http://docs.moodle.org/en/FreeMind_filter

Development of this Mahara version was begun by a student, James Kerrigan, on the Foundation degree in Computing and Internet Technology at the University Centre Yeovil.

It uses the FreeMind/Freeplane Flash browser including SWFobject to render the FreeMind files (i.e. using a combination of JavaScript and Flash)

http://freemind.sourceforge.net/wiki/index.php/Flash_browser http://code.google.com/p/swfobject/

We also have (largely) working code rendering the mind maps using the FreeMind Java applet. If there is any interest, we can make available. However, in our hands this performed more sluggishly than Flash and also had some issues with applet security and Mahara page/view permissions.

Installation

The latest code, which should work with Mahara 1.2, 1.3, 1.4 and 1.5 may be downloaded from Github

https://github.com/geoffrowland/mahara-artefact_file_blocktype_freemindflash

After unpacking the download bundle, installation essentially involves copying the /freemindflash folder (and contents) into the /artefacts/file/blocktype folder of your Mahara installation to give /artefacts/file/blocktype/freemidflash (Note: after unpacking the bundle, you may find that you have a folder labeled geoffrowland-mahara-artefact_file_blocktype_freemindflash-cc1115d. You will need to open that folder and click down through a few folders to find the freemindflash folder. It is that folder that you will need to upload to your server.)

However, a few additional edits of Mahara core files are required for appropriate handling of FreeMind .mm files.

To /artefacts/file/filetypes.xml

add (e.g. just before <!-- General types -->)

<!-- FreeMind mind maps -->
   <filetype>
       <description>mm</description>
       <mimetypes>
           <mimetype>application/x-freemind</mimetype>
       </mimetypes>
   </filetype>

Then, increment the $config->version number in /artefacts/file/version.php and visit the Site Administration page to 'force' the update the artefact_file_mime_types table (Note: to "increment the $config->version number increase your current $config->version number by one. That is, if your current number is: 202020202, make the number 202020203)

Finally, edit /artefacts/file/lib.php to 'force' the correct file mime-type for .mm files. Note the differences for different Mahara versions.

For Mahara 1.6

Immediately after

       if (empty($data->filetype) || $data->filetype == 'application/octet-stream') {
           $data->filetype = $data->guess;
       }

Add

       // The browser may have been wrong, so use file extension to force some mime-types.
       $ext = $data->oldextension;
       switch ($ext) {
           case 'mm': $data->filetype = 'application/x-freemind';
           break;
       }

For Mahara 1.4 Immediately after

       if ($um->file['type'] == 'application/octet-stream') {
           // the browser wasn't sure, so use file_mime_type to guess
           require_once('file.php');
           $data->filetype = file_mime_type($um->file['tmp_name']);
       }
       else {
           $data->filetype = $um->file['type'];
       }

Add

       // The browser may have been wrong, so use file extension to force some mime-types.////
       require_once('file.php');
       switch ($um->original_filename_extension()) {
           case 'mm': $data->filetype = 'application/x-freemind';
           break;
       }

Note that the switch statement can be easily extended to force other mime-types (for other plugins) that are not reliably identified on upload by browsers.

Use

When editing the contents of a Page (View), drag the FreeMindFlash icon (thumb.png, below) from the Files, images and video tab into the Page. Then select/upload the .mm file of your choice. You can also set the width and height (default 450px x 300px).

Thumb-freemind.png For Mahara 1.5

Thumb.png For Mhara 1.2, 1.3 and 1.4 thumb.png - from Gregor Anželj

Freemind thumb.png For Mhara 1.2, 1.3 and 1.4 alternative thumb.png - from Geoff Rowland

Issues

If you can't upload or see FreeMind .mm files from the file-picker, then there may be problems with the file mime-type handling. Some browser/operating systems don't correctly identify .mm files as application/x-freemind during file upload. So, this has to be 'forced' in Mahara.

To do this, ensure you have applied the 'tweaks' to /artefact/file/filetypes.xml, /artefact/file/version.php and /artefact/file/lib.php detailed above.


On first adding a mind map to a Page, you may get a No Flash warning. A page refresh should show the embedded interactive mind map.

ToDo

  • Thorough review against Developer Area/Coding guidelines
  • The bundled SWFobject Flash/JavaScript library is duplicated in the video display libraries in Mahara. Perhaps rationalise this.
  • Research/develop HTML5/SVG alternative to Flash or Java applet for interactive display of .mm files. This would allow broader cross-platform support. Note that static mindmap images can be exported from FreeMind in a variety of formats (PNG, JPEG, SVG, PDF etc) and then uploaded to and embedded in Mahara pages