David Lippman created nice asciimathml and asciisvg plugins for tinymce http://www.imathas.com/editordemo/demo.html and I have modified them to work in moodle. First version of AsciiSVG plugin with the latest version of TinyMCE included with theme based integration is now ready, can be translated to any language of moodle and new features will be added later. This package should work with all versions of moodle 1.7-1.9, all modern browsers including Safari and Opera.
Download the package from http://korpelainen.net/asciisvg.zip and unzip it. Move the files from folder asciisvg to corresponding folders inside your moodle - no files of moodle get overwritten.
Folder lib/editor/tinymath has the latest version of TinyMCE - all plugins are not included but you can download the full package from http://tinymce.moxiecode.com/ and I will add new plugins like asciimaths, dragmath, latexmaths, unicode and media later.
Folder lib/editor/common is the place for common files, theme/math has math theme (you can for example select this theme to your course theme - check Administration > Appearance > Themes > Theme settings - or modify your custom theme with following code.
Files lang/en_utf8/asciisvg.php and lang/en_utf8/colors.php are language files that need to / can be translated to any language of moodle from Administration > Language > Language editing > (Choose your language) Edit words or phrases > asciisvg.php ... and colors.php
In theme/math/config.php $CFG->htmleditor = false; turns HTMLArea off and $CFG->emoticons = '...';
sets emoticons to avoid smiley coflicts. $THEME->metainclude = true; sets math theme to read meta.php.
In theme/math/footer.html <?php
if (!empty($USER->id)) {$eprof = intval($USER->htmleditor); if (!empty($COURSE->id) and has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $COURSE->id))) {include_once($CFG->dirroot .'/theme/math/editor'.$eprof.'t.php');} else {include_once($CFG->dirroot .'/theme/math/editor'.$eprof.'s.php');}} ?>
selects the correct tinymce configuration for those people who have capability to manage course files (integration files editor1t.php and editor1s.php - init code is here)
In theme/math/meta.php you need
<script type="text/javascript" src="<?php echo $CFG->httpswwwroot ?>/lib/editor/common/ASCIIsvgPI.js"></script>
<script type="text/javascript">
var AScgiloc = "<?php echo $CFG->wwwroot ?>/lib/editor/common/php/svgimg.php";
</script>
to tell moodle where renderers for asciisvg ASCIIsvgPI.js and svgimg.php are. Don't use the old version of asciisvg or asciimathml together with these plugin graphs - depending on order of scripts either old one or the new one works but not both at the same time because they use same functions in a different way. If you want to use this theme based integration with your custom themes you can copy the previous code to your custom theme (just use name of your theme instead of math)
One problem with current code is <embed> tags that are not valid XHTML tags - we should use object tags instead of them to add any svg files. I will add later the modified media plugin (that should be also moodle 2.0 compatible) - therefore current TinyMCE does not have plugin media included. Capability to add svg tags can be given to teachers only - not for students (security issue)
---------------------------------------------------------------
Before you start testing there is another important security issue that you need to take care:
Open lib/editor/common/php/svgimg.php and change the imgdir (second row)
$imgdir = 'imgs/'; //relative to current dir, CHANGE ME!!!
to something like
$imgdir = 'shdtrgrkgfidlofjd/'; //relative to current dir, CHANGE ME!!!
and rename folder lib/editor/common/php/imgs to 'shdtrgrkgfidlofjd'
You most likely need to give this folder permissions 777 but the script does not show the folder name anywhere so the only way to find that folder name is to guess it somehow. So don't use imgs/ !!!
You can also change in meta.php
var AScgiloc = "<?php echo $CFG->wwwroot ?>/lib/editor/common/php/svgimg.php";
to
var AScgiloc = "http://korpelainen.net/plugindemo/lib/editor/common/php/svgimg.php";
and
if you want to fill my test site with nice graphs... this graph image folder should be moved to moodledata but for some reason I got only empty graphs when I tested moving the folder outside web root - if I can't find a good solution I hope someone of core developers has time to look at code of those files in /lib/editor/common/php.
---------------------------------
It would be nice if some moodlers had time to test this marvellous plugin originally created by David Lippman and send me some translations of asciisvg.php and colors.php - an open demo is available in http://korpelainen.net/plugindemo/ with limited functionalities (some activities available for testing). Username 'test' and 'password 'test' are well known...
I will start writing some documentation next week and try to finish first versions of those other plugins. They should work on all environments and with all modern browsers (also in moodle 2.0 with different setup later) but not necessarely using the same files in IE and other browsers.