Actions

Plugins/Artefact/FreeMindFlash: Difference between revisions

From Mahara Wiki

< Plugins‎ | Artefact
 
(25 intermediate revisions by 2 users not shown)
Line 3: Line 3:
[[File:freemind.png]]
[[File:freemind.png]]


This is an artefact file blocktype plugin to allow Flash rendering of interactive FreeMind mind maps in Mahara Views.
''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
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.
It draws inspiration from the FreeMind filter for Moodle.
Line 13: Line 20:
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.
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 Flash browser including SWFobject to render the FreeMind files (i.e. using a combination of JavaScript and Flash)
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://freemind.sourceforge.net/wiki/index.php/Flash_browser
http://code.google.com/p/swfobject/
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 view permissions.
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 ==
== Installation ==


The latest code, which should work with Mahara 1.2, 1.3 and 1.4 may be downloaded from Github
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
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
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.
However, a few additional edits of Mahara core files are required for appropriate handling of FreeMind .mm files.
Line 32: Line 39:
To /artefacts/file/filetypes.xml
To /artefacts/file/filetypes.xml


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


    <!-- FreeMind mind maps -->
<nowiki><!-- FreeMind mind maps --></nowiki>
     <filetype>
     <filetype>
         <description>mm</description>
         <description>mm</description>
Line 42: Line 49:
     </filetype>
     </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
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, in /artefacts/file/lib.php
Finally, edit /artefacts/file/lib.php to 'force' the correct file mime-type for .mm files. Note the differences for different Mahara versions.


Immediately after
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') {
         if ($um->file['type'] == 'application/octet-stream') {
Line 68: Line 88:
== Use ==
== Use ==


When editing the contents of a View, drag the FreeMindFlash icon (below) from the Files,images and video tab into your Page (View). Then select/upload the .mm file of your choice. You can also set the width and height (default 450px x 300px).
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.png - from Gregor Anželj
[[File:thumb-freemind.png]] For Mahara 1.5 and later
   
   
[[File:thumb.png]]
[[File:thumb.png]] For Mahara 1.2, 1.3 and 1.4 thumb.png - from Gregor Anželj
 
Alternative thumb.png - from Geoff Rowland


[[File:Freemind thumb.png]]
[[File:Freemind thumb.png]] For Mahara 1.2, 1.3 and 1.4 alternative thumb.png - from Geoff Rowland


== Issues ==
== Issues ==


If you can't upload/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.
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.
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 View, you may get a No Flash warning. A page refresh should show the embedded interactive mind map.
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 ==
== ToDo ==
Line 91: Line 109:
* Thorough review against [[Developer Area/Coding guidelines]]
* 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.
* 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 to support ''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


[[Category:Plugins]][[Category:Artefact Plugins]]
[[Category:Plugins]][[Category:Artefact Plugins]]

Latest revision as of 02:41, 26 March 2013

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 and later

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

Freemind thumb.png For Mahara 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 to support 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