1 Add $CFG->aspellpath = '/path/to/aspell' to config.php
3 copy speller folder to /moodle/lib/
6 function use_html_editor($name="",$courseid=0) {
8 /// Sets up the HTML editor on textareas in the current page.
9 /// If a field name is provided, then it will only be
10 /// applied to that field - otherwise it will be used
11 /// on every textarea in the page.
13 /// In most cases no arguments need to be supplied
15 // Modification by Ludo ( Marc Alier to provide Spell Checking to the
16 // html editor. August 2004 malier@lsi.upc.es
19 if(!empty($CFG->aspellpath)) {
20 echo "<script src=\"".$CFG->wwwroot."/lib/speller/spellChecker.js\"></script>";
25 echo "<script language=\"javascript\" type=\"text/javascript\" defer=\"1\">\n";
27 echo "HTMLArea.replaceAll();\n";
29 if(!empty($CFG->aspellpath)) {
31 echo "function clickHandler(editor, buttonId) {";
32 echo "editor._textArea.value = editor.getHTML();";
33 echo "var speller = new spellChecker( editor._textArea );";
34 echo "speller.popUpUrl ='$CFG->wwwroot/lib/speller/spellchecker.html';";
35 echo "speller.spellCheckScript = '$CFG->wwwroot/lib/speller/server-scripts/spellchecker.php?id=$courseid';";
36 echo "speller._moogle_edit=1;";
37 echo "speller._editor=editor;";
38 echo "speller.openChecker();";
39 //echo " editor.setHTML(editor._textArea.value);";
41 echo "var config = new HTMLArea.Config();\n";
42 echo "config.registerButton(\"spell-check\", \"spell-check\", \"".$CFG->wwwroot."/lib/speller/spell.gif\", false, clickHandler);";
43 echo "config.toolbar.push([\"spell-check\"]);\n";
44 echo "HTMLArea.replace('$name', config);\n";
47 echo "HTMLArea.replace('$name');\n";