]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-16637 removing obsoleted spellchecker support
authorskodak <skodak>
Tue, 23 Sep 2008 15:12:07 +0000 (15:12 +0000)
committerskodak <skodak>
Tue, 23 Sep 2008 15:12:07 +0000 (15:12 +0000)
19 files changed:
admin/settings/appearance.php
lib/adminlib.php
lib/db/upgrade.php
lib/editor/tinymce/jscripts/tiny_mce/plugins/spellchecker/config.php
lib/editor/tinymce/moodle_readme.txt [new file with mode: 0644]
lib/javascript.php
lib/speller/blank.html [deleted file]
lib/speller/changes.txt [deleted file]
lib/speller/controlWindow.js [deleted file]
lib/speller/controls.html [deleted file]
lib/speller/lib.php [deleted file]
lib/speller/server-scripts/spellchecker.php [deleted file]
lib/speller/spell.gif [deleted file]
lib/speller/spellChecker.js [deleted file]
lib/speller/spellchecker.html [deleted file]
lib/speller/spellerStyle.css [deleted file]
lib/speller/wordWindow.js [deleted file]
lib/weblib.php
version.php

index b1ff88954d0197807afe6d470a166ee9e2eb3503..37123c4ac69a615ea8e7fbd2b647b226b313fd04 100644 (file)
@@ -68,10 +68,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $temp->add(new admin_setting_configtext('editorfontsize', get_string('editorfontsize', 'admin'), get_string('edhelpfontsize'), '', PARAM_NOTAGS));
     $temp->add(new admin_setting_special_editorfontlist());
     $temp->add(new admin_setting_configcheckbox('editorkillword', get_string('editorkillword', 'admin'), get_string('edhelpcleanword'), 1));
-    if (!empty($CFG->aspellpath)) { // make aspell settings disappear if path isn't set
-      $temp->add(new admin_setting_configcheckbox('editorspelling', get_string('editorspelling', 'admin'), get_string('editorspellinghelp', 'admin'), 0));
-      $temp->add(new admin_setting_special_editordictionary());
-    }
     $temp->add(new admin_setting_special_editorhidebuttons());
     $ADMIN->add('htmleditor', $temp);
 */
index 297e16c081ae8f3034eadc37dba20f8b61aa7413..2bcac9170104f14a3f226b5b68ccb0cf022b817a 100644 (file)
@@ -3862,72 +3862,6 @@ class admin_setting_emoticons extends admin_setting {
 
 }
 
-/**
- * Setting for spellchecker language selection.
- */
-class admin_setting_special_editordictionary extends admin_setting_configselect {
-
-    function admin_setting_special_editordictionary() {
-        $name = 'editordictionary';
-        $visiblename = get_string('editordictionary','admin');
-        $description = get_string('configeditordictionary', 'admin');
-        parent::admin_setting_configselect($name, $visiblename, $description, '', NULL);
-    }
-
-    function load_choices() {
-        // function borrowed from the old moodle/admin/editor.php, slightly modified
-        // Get all installed dictionaries in the system
-        if (is_array($this->choices)) {
-            return true;
-        }
-
-        $this->choices = array();
-
-        global $CFG;
-
-        clearstatcache();
-
-        // If aspellpath isn't set don't even bother ;-)
-        if (empty($CFG->aspellpath)) {
-            $this->choices['error'] = 'Empty aspell path!';
-            return true;
-        }
-
-        // Do we have access to popen function?
-        if (!function_exists('popen')) {
-            $this->choices['error'] = 'Popen function disabled!';
-            return true;
-        }
-
-        $cmd          = $CFG->aspellpath;
-        $output       = '';
-        $dictionaries = array();
-
-        if(!($handle = @popen(escapeshellarg($cmd).' dump dicts', 'r'))) {
-            $this->choices['error'] = 'Couldn\'t create handle!';
-        }
-
-        while(!feof($handle)) {
-            $output .= fread($handle, 1024);
-        }
-        @pclose($handle);
-
-        $dictionaries = explode(chr(10), $output);
-        foreach ($dictionaries as $dict) {
-            if (empty($dict)) {
-                continue;
-            }
-            $this->choices[$dict] = $dict;
-        }
-
-        if (empty($this->choices)) {
-            $this->choices['error'] = 'Error! Check your aspell installation!';
-        }
-        return true;
-    }
-}
-
-
 class admin_setting_special_editorhidebuttons extends admin_setting {
     var $items;
 
index f40ac1fd7cf983483a450bd179067cebbff1e662..8b70e7580d69026fe5d01f0e6aa2ee9fb5fdc7a3 100644 (file)
@@ -842,6 +842,14 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint($result, 2008091611);
     }
 
+    if ($result && $oldversion < 2008092300) {
+        unset_config('editorspelling');
+        unset_config('editordictionary');
+    /// Main savepoint reached
+        upgrade_main_savepoint($result, 2008092300);
+    }
+
+
     return $result;
 }
 
index 646d1b84c8ae4844f6d515ba1d680161358edbb9..5097cfd385d496b06331924241f7bd33c787122f 100644 (file)
@@ -1,4 +1,7 @@
 <?php\r
+\r
+    die('TODO implement moodle integration using CFG->aspell see MDL-16639');\r
+\r
        // General settings\r
        $config['general.engine'] = 'GoogleSpell';\r
        //$config['general.engine'] = 'PSpell';\r
diff --git a/lib/editor/tinymce/moodle_readme.txt b/lib/editor/tinymce/moodle_readme.txt
new file mode 100644 (file)
index 0000000..2ca2892
--- /dev/null
@@ -0,0 +1,6 @@
+Description of TinyMCE library import into Moodle
+
+Our changes:
+* TODO: spellchecker integration in spellchecker/config.php (MDL-16639)
+
+skodak
\ No newline at end of file
index 12656abda63b6af18c4865e8bdb426d74cb7a299..793b8dc00a6b44d7066494de49e78fbb5f3504f3 100644 (file)
@@ -6,10 +6,6 @@
         die('Direct access to this script is forbidden.');    ///  It must be included from a Moodle page
     }
 
-    if (!empty($CFG->aspellpath)) {      // Enable global access to spelling feature.
-        echo '<script type="text/javascript" src="'.$CFG->httpswwwroot.'/lib/speller/spellChecker.js"></script>'."\n";
-    }
-
     if (!empty($CFG->editorsrc) ) {
         foreach ( $CFG->editorsrc as $scriptsource ) {
             echo '<script type="text/javascript" src="'. $scriptsource .'"></script>'."\n";
diff --git a/lib/speller/blank.html b/lib/speller/blank.html
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/lib/speller/changes.txt b/lib/speller/changes.txt
deleted file mode 100644 (file)
index 4e99bf7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-Add $CFG->aspellpath = '/path/to/aspell' to config.php
-
-copy speller folder to /moodle/lib/
-
-weblib.php
-function use_html_editor($name="",$courseid=0) {
-
-/// Sets up the HTML editor on textareas in the current page.
-/// If a field name is provided, then it will only be
-/// applied to that field - otherwise it will be used
-/// on every textarea in the page.
-///
-/// In most cases no arguments need to be supplied
-
-// Modification by Ludo ( Marc Alier to provide Spell Checking to the
-// html editor. August 2004 malier@lsi.upc.es
-/// START LUDO
-    global $CFG;
-    if(!empty($CFG->aspellpath)) {
-        echo "<script src=\"".$CFG->wwwroot."/lib/speller/spellChecker.js\"></script>";
-    }
-
-/// END LUDO
-
-    echo "<script language=\"javascript\" type=\"text/javascript\" defer=\"1\">\n";
-    if (empty($name)) {
-        echo "HTMLArea.replaceAll();\n";
-    } else {
-        if(!empty($CFG->aspellpath)) {
-        //START LUDO
-            echo "function clickHandler(editor, buttonId) {";
-            echo "editor._textArea.value = editor.getHTML();";
-            echo "var speller = new spellChecker( editor._textArea );";
-            echo "speller.popUpUrl ='$CFG->wwwroot/lib/speller/spellchecker.html';";
-            echo "speller.spellCheckScript = '$CFG->wwwroot/lib/speller/server-scripts/spellchecker.php?id=$courseid';";
-            echo "speller._moogle_edit=1;";
-            echo "speller._editor=editor;";
-            echo "speller.openChecker();";
-            //echo "    editor.setHTML(editor._textArea.value);";
-            echo "}\n"  ;
-            echo "var config = new HTMLArea.Config();\n";
-            echo "config.registerButton(\"spell-check\",  \"spell-check\", \"".$CFG->wwwroot."/lib/speller/spell.gif\", false, clickHandler);";
-            echo "config.toolbar.push([\"spell-check\"]);\n";
-            echo "HTMLArea.replace('$name', config);\n";
-        // FI LUDO */
-        } else {
-            echo "HTMLArea.replace('$name');\n";
-        }
-    }
-    echo "</script>\n";
-}
\ No newline at end of file
diff --git a/lib/speller/controlWindow.js b/lib/speller/controlWindow.js
deleted file mode 100644 (file)
index db9ea4a..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-////////////////////////////////////////////////////
-// controlWindow object
-////////////////////////////////////////////////////
-function controlWindow( controlForm ) {
-       // private properties
-       this._form = controlForm;
-
-       // public properties
-       this.windowType = "controlWindow";
-       this.noSuggestionSelection = "- No suggestions -";
-       // set up the properties for elements of the given control form
-       this.suggestionList  = this._form.sugg;
-       this.evaluatedText   = this._form.misword;
-       this.replacementText = this._form.txtsugg;
-       this.undoButton      = this._form.btnUndo;
-
-       // public methods
-       this.addSuggestion = addSuggestion;
-       this.clearSuggestions = clearSuggestions;
-       this.selectDefaultSuggestion = selectDefaultSuggestion;
-       this.resetForm = resetForm;
-       this.setSuggestedText = setSuggestedText;
-       this.enableUndo = enableUndo;
-       this.disableUndo = disableUndo;
-}
-
-function resetForm() {
-       if( this._form ) {
-               this._form.reset();
-       }
-}
-
-function setSuggestedText() {
-       var slct = this.suggestionList;
-       var txt = this.replacementText;
-       var str = "";
-       if( (slct.options[0].text) && slct.options[0].text != this.noSuggestionSelection ) {
-               str = slct.options[slct.selectedIndex].text;
-       }
-       txt.value = str;
-}
-
-function selectDefaultSuggestion() {
-       var slct = this.suggestionList;
-       var txt = this.replacementText;
-       if( slct.options.length == 0 ) {
-               this.addSuggestion( this.noSuggestionSelection );
-       } else {
-               slct.options[0].selected = true;
-       }
-       this.setSuggestedText();
-}
-
-function addSuggestion( sugg_text ) {
-       var slct = this.suggestionList;
-       if( sugg_text ) {
-               var i = slct.options.length;
-               var newOption = new Option( sugg_text, 'sugg_text'+i );
-               slct.options[i] = newOption;
-        }
-}
-
-function clearSuggestions() {
-       var slct = this.suggestionList;
-       for( var j = slct.length - 1; j > -1; j-- ) {
-               if( slct.options[j] ) {
-                       slct.options[j] = null;
-               }
-       }
-}
-
-function enableUndo() {
-       if( this.undoButton ) {
-               if( this.undoButton.disabled == true ) {
-                       this.undoButton.disabled = false;
-               }
-       }
-}
-
-function disableUndo() {
-       if( this.undoButton ) {
-               if( this.undoButton.disabled == false ) {
-                       this.undoButton.disabled = true;
-               }
-       }
-}
diff --git a/lib/speller/controls.html b/lib/speller/controls.html
deleted file mode 100644 (file)
index 6f2831a..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-<html>
-<head>
-<link rel="stylesheet" type="text/css" href="spellerStyle.css"/>
-
-<script src="controlWindow.js"></script>
-
-<script type="text/javascript">
-var spellerObject;
-var controlWindowObj;
-
-if( parent.opener ) {
-       spellerObject = parent.opener.speller;
-}
-
-function ignore_word() {
-       if( spellerObject ) {
-               spellerObject.ignoreWord();
-       }
-}
-
-function ignore_all() {
-       if( spellerObject ) {
-               spellerObject.ignoreAll();
-       }
-}
-
-function replace_word() {
-       if( spellerObject ) {
-               spellerObject.replaceWord();
-       }
-}
-
-function replace_all() {
-       if( spellerObject ) {
-               spellerObject.replaceAll();
-       }
-}
-
-function end_spell() {
-       if( spellerObject ) {
-               spellerObject.terminateSpell();
-       }
-}
-
-function undo() {
-       if( spellerObject ) {
-               spellerObject.undo();
-       }
-}
-
-function suggText() {
-       if( controlWindowObj ) {
-               controlWindowObj.setSuggestedText();
-       }
-}
-
-function init_spell() {
-       var controlForm = document.getElementById('spellcheck');
-
-       // create a new controlWindow object
-       controlWindowObj = new controlWindow( controlForm );
-
-       // call the init_spell() function in the parent frameset
-       if( parent.frames.length ) {
-               parent.init_spell( controlWindowObj );
-       } else {
-               alert( 'This page was loaded outside of a frameset. It might not display properly' );
-       }
-}
-
-</script>
-
-</head>
-
-<body class="controlWindowBody" onLoad="init_spell();">
-
-<form id="spellcheck">
-
-<table border="0" cellpadding="0" cellspacing="0" border="0">
-<tr>
-       <td colspan="3" class="normalLabel">Not in dictionary:</td>
-</tr>
-<tr>
-       <td colspan="3"><input class="readonlyInput" type="text" name="misword" readonly /></td>
-</tr>
-<tr>
-       <td colspan="3" height="5"></td>
-</tr>
-<tr>
-       <td class="normalLabel">Change to:</td>
-</tr>
-<tr valign="top">
-       <td>
-               <table border="0" cellpadding="0" cellspacing="0" border="0">
-               <tr>
-                       <td class="normalLabel">
-                       <input class="textDefault" type="text" name="txtsugg" />
-                       </td>
-               </tr>
-               <tr>
-                       <td>
-                       <select class="suggSlct" name="sugg" size="7" onChange="suggText();" onDblClick="replace_word();">
-                               <option></option>
-                       </select>
-                       </td>
-               </tr>
-               </table>
-       </td>
-       <td>&nbsp;&nbsp;</td>
-       <td>
-               <table border="0" cellpadding="0" cellspacing="0" border="0">
-               <tr>
-                       <td>
-                       <input class="buttonDefault" type="button" value="Ignore" onClick="ignore_word();" />
-                       </td>
-                       <td>&nbsp;&nbsp;</td>
-                       <td>
-                       <input class="buttonDefault" type="button" value="Ignore All" onClick="ignore_all();" />
-                       </td>
-               </tr>
-               <tr>
-                       <td colspan="3" height="5"></td>
-               </tr>
-               <tr>
-
-                       <td>
-                       <input class="buttonDefault" type="button" value="Replace" onClick="replace_word();" />
-                       </td>
-                       <td>&nbsp;&nbsp;</td>
-                       <td>
-                       <input class="buttonDefault" type="button" value="Replace All" onClick="replace_all();" />
-                       </td>
-               </tr>
-               <tr>
-                       <td colspan="3" height="5"></td>
-               </tr>
-               <tr>
-                       <td>
-                       <input class="buttonDefault" type="button" name="btnUndo" value="Undo" onClick="undo();" disabled />
-                       </td>
-                       <td>&nbsp;&nbsp;</td>
-                       <td>
-                       <input class="buttonDefault" type="button" value="Close" onClick="end_spell();" />
-                       </td>
-               </tr>
-               </table>
-       </td>
-</tr>
-</table>
-
-</form>
-</body>
-</html>
diff --git a/lib/speller/lib.php b/lib/speller/lib.php
deleted file mode 100644 (file)
index 9a655f8..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<?php // $Id$
-
-function speller_enable (&$CFG) {
-    echo "function spellClickHandler(editor, buttonId) {\n";
-    echo "\teditor._textArea.value = editor.getHTML();\n";
-    echo "\tvar speller = new spellChecker( editor._textArea );\n";
-    echo "\tspeller.popUpUrl = \"" . $CFG->httpswwwroot ."/lib/speller/spellchecker.html\";\n";
-    echo "\tspeller.spellCheckScript = \"". $CFG->httpswwwroot ."/lib/speller/server-scripts/spellchecker.php?id=$courseid\";\n";
-    echo "\tspeller._moogle_edit=1;\n";
-    echo "\tspeller._editor=editor;\n";
-    echo "\tspeller.openChecker();\n";
-    echo "}\n";
-    echo "config.registerButton(\"spell-check\",  \"spell-check\", \"". $CFG->wwwroot ."/lib/speller/spell.gif\", false, spellClickHandler);\n";
-    echo "config.toolbar.push([\"spell-check\"]);\n";
-}
-
-?>
diff --git a/lib/speller/server-scripts/spellchecker.php b/lib/speller/server-scripts/spellchecker.php
deleted file mode 100644 (file)
index 3747288..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php // $Id$
-    include_once("../../../config.php");
-    require_login();
-
-if (empty($CFG->aspellpath)) {
-    print_error('spellcheckernotconf');
-}
-
-header('Content-type: text/html; charset=utf-8');
-
-// Speller pages script http://spellerpages.sourceforge.net/
-// Modified by Marc Alier on August 2004 for the integration with moodle
-
-$aspell_prog = escapeshellarg($CFG->aspellpath);
-$spellercss = $CFG->wwwroot .'/lib/speller/spellerStyle.css';
-$word_win_src = $CFG->wwwroot .'/lib/speller/wordWindow.js';
-
-
-$textinputs = $_POST['textinputs']; // array
-
-if(!($lang = check_language($aspell_prog))) {
-    error_handler("No suitable dictionary found installed on your server!");
-    exit;
-}
-
-$aspell_opts = '-a -H --lang='. $lang .' --encoding=utf-8';
-if (!empty($CFG->aspellextradicts)) {   // eg /usr/bin/.aspell.en.pws
-    $aspell_opts .= ' --add-extra-dicts='.$CFG->aspellextradicts;
-}
-$tempfiledir = $CFG->dataroot; // Use dataroot since it must be writable
-$input_separator = 'A';
-
-function check_language($cmd) {
-/// return users current language if its
-/// dictionary is found installed in system
-/// and always return english if user's own
-/// language is not in the list. If english dictionary
-/// isn't found, then false is returned.
-
-    global $CFG;
-
-    clearstatcache();
-    $current_lang = str_replace('_utf8', '', current_language());
-    $output = '';
-
-    if(!($handle = popen($cmd .' dump dicts', 'r'))) {
-        error_handler("Couldn't create handle!");
-        exit;
-    }
-
-    while(!feof($handle)) {
-        $output .= fread($handle, 1024);
-    }
-    @pclose($handle);
-
-    $dicts = explode(chr(10), strtolower($output));
-
-    if(is_array($dicts)) {
-        if(in_array($current_lang,$dicts)) {
-            return $current_lang;
-        }
-    }
-
-    if (!empty($CFG->editordictionary)) {
-        return $CFG->editordictionary;
-    }
-
-    return false;
-
-}
-
-// set the JavaScript variable to the submitted text.
-// textinputs is an array, each element corresponding to the (url-encoded)
-// value of the text control submitted for spell-checking
-function print_textinputs_var() {
-    global $textinputs;
-    foreach( $textinputs as $key=>$val ) {
-        // $val = str_replace( "'", "%27", $val );
-        echo "textinputs[$key] = decodeURIComponent(\"" . $val . "\");\n";
-    }
-}
-
-// make declarations for the text input index
-function print_textindex_decl( $text_input_idx ) {
-    echo "words[$text_input_idx] = [];\n";
-    echo "suggs[$text_input_idx] = [];\n";
-}
-
-// set an element of the JavaScript 'words' array to a misspelled word
-function print_words_elem( $word, $index, $text_input_idx ) {
-    echo "words[$text_input_idx][$index] = '" . escape_quote( $word ) . "';\n";
-}
-
-
-// set an element of the JavaScript 'suggs' array to a list of suggestions
-function print_suggs_elem( $suggs, $index, $text_input_idx ) {
-    echo "suggs[$text_input_idx][$index] = [";
-    foreach( $suggs as $key=>$val ) {
-        if( $val ) {
-            echo "'" . escape_quote( $val ) . "'";
-            if ( $key+1 < count( $suggs )) {
-                echo ", ";
-            }
-        }
-    }
-    echo "];\n";
-}
-
-// escape single quote
-function escape_quote( $str ) {
-    return preg_replace ( "/'/", "\\'", $str );
-}
-
-
-// handle a server-side error.
-function error_handler( $err ) {
-    echo "error = '" . escape_quote( $err ) . "';\n";
-}
-
-// get the list of misspelled words. Put the results in the javascript words array
-// for each misspelled word, get suggestions and put in the javascript suggs array
-function print_checker_results() {
-
-    global $aspell_prog;
-    global $aspell_opts;
-    global $tempfiledir;
-    global $textinputs;
-    global $input_separator;
-    $aspell_err = "";
-    // create temp file
-    $tempfile = tempnam( $tempfiledir, 'aspell_data_' );
-
-    // open temp file, add the submitted text.
-    if( $fh = fopen( $tempfile, 'w' )) {
-        for( $i = 0; $i < count( $textinputs ); $i++ ) {
-            $text = urldecode( $textinputs[$i] );
-            $lines = explode( "\n", $text );
-            fwrite ( $fh, "%\n" ); // exit terse mode
-            fwrite ( $fh, "^$input_separator\n" );
-            fwrite ( $fh, "!\n" ); // enter terse mode
-            foreach( $lines as $key=>$value ) {
-                // use carat on each line to escape possible aspell commands
-                fwrite( $fh, "^$value\n" );
-            }
-        }
-        fclose( $fh );
-
-        // exec aspell command - redirect STDERR to STDOUT
-        $cmd = "$aspell_prog $aspell_opts < $tempfile 2>&1";
-        if( $aspellret = shell_exec( $cmd )) {
-            $linesout = explode( "\n", $aspellret );
-            $index = 0;
-            $text_input_index = -1;
-            // parse each line of aspell return
-            foreach( $linesout as $key=>$val ) {
-                $chardesc = substr( $val, 0, 1 );
-                // if '&', then not in dictionary but has suggestions
-                // if '#', then not in dictionary and no suggestions
-                // if '*', then it is a delimiter between text inputs
-                // if '@' then version info
-                if( $chardesc == '&' || $chardesc == '#' ) {
-                    $line = explode( " ", $val, 5 );
-                    print_words_elem( $line[1], $index, $text_input_index );
-                    if( isset( $line[4] )) {
-                        $suggs = explode( ", ", $line[4] );
-                    } else {
-                        $suggs = array();
-                    }
-                    print_suggs_elem( $suggs, $index, $text_input_index );
-                    $index++;
-                } elseif( $chardesc == '*' ) {
-                    $text_input_index++;
-                    print_textindex_decl( $text_input_index );
-                    $index = 0;
-                } elseif( $chardesc != '@' && $chardesc != "" ) {
-                    // assume this is error output
-                    $aspell_err .= $val;
-                }
-            }
-            if( $aspell_err ) {
-                $aspell_err = "Error executing `$cmd`\\n$aspell_err";
-                error_handler( $aspell_err );
-            }
-        } else {
-            error_handler( "System error: Aspell program execution failed (`$cmd`)" );
-        }
-    } else {
-        error_handler( "System error: Could not open file '$tempfile' for writing" );
-    }
-
-    // close temp file, delete file
-    unlink( $tempfile );
-}
-
-
-?>
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="stylesheet" type="text/css" href="<?php echo $spellercss ?>" />
-<script type="text/javascript" src="<?php echo $word_win_src ?>"></script>
-<script type="text/javascript">
-//<![CDATA[
-var suggs = new Array();
-var words = new Array();
-var textinputs = new Array();
-var error;
-<?php
-
-print_textinputs_var();
-
-print_checker_results();
-
-?>
-
-var wordWindowObj = new wordWindow();
-wordWindowObj.originalSpellings = words;
-wordWindowObj.suggestions = suggs;
-wordWindowObj.textInputs = textinputs;
-
-function init_spell() {
-    // check if any error occured during server-side processing
-    if( error ) {
-        alert( error );
-    } else {
-        // call the init_spell() function in the parent frameset
-        if (parent.frames.length) {
-            parent.init_spell( wordWindowObj );
-        } else {
-            alert('This page was loaded outside of a frameset. It might not display properly');
-        }
-    }
-}
-
-//]]>
-</script>
-
-</head>
-<body onLoad="init_spell();">
-
-<script type="text/javascript">
-//<![CDATA[
-wordWindowObj.writeBody();
-//]]>
-</script>
-
-</body>
-</html>
diff --git a/lib/speller/spell.gif b/lib/speller/spell.gif
deleted file mode 100644 (file)
index 29bd11a..0000000
Binary files a/lib/speller/spell.gif and /dev/null differ
diff --git a/lib/speller/spellChecker.js b/lib/speller/spellChecker.js
deleted file mode 100644 (file)
index 8e80a88..0000000
+++ /dev/null
@@ -1,458 +0,0 @@
-////////////////////////////////////////////////////
-// spellChecker.js
-//
-// spellChecker object
-//
-// This file is sourced on web pages that have a textarea object to evaluate
-// for spelling. It includes the implementation for the spellCheckObject.
-//
-// Modified by LUDO (Marc Alier) for integration with the moogle environment
-// august 2004 malier@lsi.upc.es
-//
-////////////////////////////////////////////////////
-
-
-// constructor
-function spellChecker( textObject) {
-    // public properties - configurable
-    //this.popUpUrl = '/moodle/lib/speller/spellchecker.html';
-    this.popUpName = 'spellchecker';
-    this.popUpProps = "menu=no,width=440,height=350,top=70,left=120,resizable=yes,status=yes";
-    //this.spellCheckScript = '/moodle/lib/speller/server-scripts/spellchecker.php';
-    //this.spellCheckScript = '/cgi-bin/spellchecker.pl';
-
-    // values used to keep track of what happened to a word
-    this.replWordFlag = "R";    // single replace
-    this.ignrWordFlag = "I";    // single ignore
-    this.replAllFlag = "RA";    // replace all occurances
-    this.ignrAllFlag = "IA";    // ignore all occurances
-    this.fromReplAll = "~RA";   // an occurance of a "replace all" word
-    this.fromIgnrAll = "~IA";   // an occurance of a "ignore all" word
-    // properties set at run time
-    this.wordFlags = new Array();
-    this.currentTextIndex = 0;
-    this.currentWordIndex = 0;
-    this.spellCheckerWin = null;
-    this.controlWin = null;
-    this.wordWin = null;
-    this.textArea = textObject; // deprecated
-    this.textInputs = arguments;
-
-    this._editor=""; //  BY LUDO
-    // private methods
-    this._spellcheck = _spellcheck;
-    this._getSuggestions = _getSuggestions;
-    this._setAsIgnored = _setAsIgnored;
-    this._getTotalReplaced = _getTotalReplaced;
-    this._setWordText = _setWordText;
-    this._getFormInputs = _getFormInputs;
-
-    // public methods
-    this.openChecker = openChecker;
-    this.startCheck = startCheck;
-    this.checkTextBoxes = checkTextBoxes;
-    this.checkTextAreas = checkTextAreas;
-    this.spellCheckAll = spellCheckAll;
-    this.ignoreWord = ignoreWord;
-    this.ignoreAll = ignoreAll;
-    this.replaceWord = replaceWord;
-    this.replaceAll = replaceAll;
-    this.terminateSpell = terminateSpell;
-    this.undo = undo;
-
-    // set the current window's "speller" property to the instance of this class.
-    // this object can now be referenced by child windows/frames.
-    window.speller = this;
-}
-
-// call this method to check all text boxes (and only text boxes) in the HTML document
-function checkTextBoxes() {
-    this.textInputs = this._getFormInputs( "^text$" );
-    this.openChecker();
-}
-
-// call this method to check all textareas (and only textareas ) in the HTML document
-function checkTextAreas() {
-    this.textInputs = this._getFormInputs( "^textarea$" );
-    this.openChecker();
-}
-
-// call this method to check all text boxes and textareas in the HTML document
-function spellCheckAll() {
-    this.textInputs = this._getFormInputs( "^text(area)?$" );
-    this.openChecker();
-}
-
-// call this method to check text boxe(s) and/or textarea(s) that were passed in to the
-// object's constructor or to the textInputs property
-function openChecker() {
-    this.spellCheckerWin = window.open( this.popUpUrl, this.popUpName, this.popUpProps );
-    if( !this.spellCheckerWin.opener ) {
-        this.spellCheckerWin.opener = window;
-    }
-}
-
-function startCheck( wordWindowObj, controlWindowObj ) {
-
-    // set properties from args
-    this.wordWin = wordWindowObj;
-    this.controlWin = controlWindowObj;
-
-    // reset properties
-    this.wordWin.resetForm();
-    this.controlWin.resetForm();
-    this.currentTextIndex = 0;
-    this.currentWordIndex = 0;
-    // initialize the flags to an array - one element for each text input
-    this.wordFlags = new Array( this.wordWin.textInputs.length );
-    // each element will be an array that keeps track of each word in the text
-    for( var i=0; i<this.wordFlags.length; i++ ) {
-        this.wordFlags[i] = [];
-    }
-
-    // start
-    this._spellcheck();
-
-    return true;
-}
-
-function ignoreWord() {
-    var wi = this.currentWordIndex;
-    var ti = this.currentTextIndex;
-    if( !this.wordWin ) {
-        alert( 'Error: Word frame not available.' );
-        return false;
-    }
-    if( !this.wordWin.getTextVal( ti, wi )) {
-        alert( 'Error: "Not in dictionary" text is missing.' );
-        return false;
-    }
-    // set as ignored
-    if( this._setAsIgnored( ti, wi, this.ignrWordFlag )) {
-        this.currentWordIndex++;
-        this._spellcheck();
-    }
-}
-
-function ignoreAll() {
-    var wi = this.currentWordIndex;
-    var ti = this.currentTextIndex;
-    if( !this.wordWin ) {
-        alert( 'Error: Word frame not available.' );
-        return false;
-    }
-    // get the word that is currently being evaluated.
-    var s_word_to_repl = this.wordWin.getTextVal( ti, wi );
-    if( !s_word_to_repl ) {
-        alert( 'Error: "Not in dictionary" text is missing' );
-        return false;
-    }
-
-    // set this word as an "ignore all" word.
-    this._setAsIgnored( ti, wi, this.ignrAllFlag );
-
-    // loop through all the words after this word
-    for( var i = ti; i < this.wordWin.textInputs.length; i++ ) {
-        for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
-            if(( i == ti && j > wi ) || i > ti ) {
-                // future word: set as "from ignore all" if
-                // 1) do not already have a flag and
-                // 2) have the same value as current word
-                if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl )
-                && ( !this.wordFlags[i][j] )) {
-                    this._setAsIgnored( i, j, this.fromIgnrAll );
-                }
-            }
-        }
-    }
-
-    // finally, move on
-    this.currentWordIndex++;
-    this._spellcheck();
-}
-
-function replaceWord() {
-    var wi = this.currentWordIndex;
-    var ti = this.currentTextIndex;
-    if( !this.wordWin ) {
-        alert( 'Error: Word frame not available.' );
-        return false;
-    }
-    if( !this.wordWin.getTextVal( ti, wi )) {
-        alert( 'Error: "Not in dictionary" text is missing' );
-        return false;
-    }
-    if( !this.controlWin.replacementText ) {
-        return;
-    }
-    var txt = this.controlWin.replacementText;
-    if( txt.value ) {
-        var newspell = new String( txt.value );
-        if( this._setWordText( ti, wi, newspell, this.replWordFlag )) {
-            this.currentWordIndex++;
-            this._spellcheck();
-        }
-    }
-}
-
-function replaceAll() {
-    var ti = this.currentTextIndex;
-    var wi = this.currentWordIndex;
-    if( !this.wordWin ) {
-        alert( 'Error: Word frame not available.' );
-        return false;
-    }
-    var s_word_to_repl = this.wordWin.getTextVal( ti, wi );
-    if( !s_word_to_repl ) {
-        alert( 'Error: "Not in dictionary" text is missing' );
-        return false;
-    }
-    var txt = this.controlWin.replacementText;
-    if( !txt.value ) return;
-    var newspell = new String( txt.value );
-
-    // set this word as a "replace all" word.
-    this._setWordText( ti, wi, newspell, this.replAllFlag );
-
-    // loop through all the words after this word
-    for( var i = ti; i < this.wordWin.textInputs.length; i++ ) {
-        for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
-            if(( i == ti && j > wi ) || i > ti ) {
-                // future word: set word text to s_word_to_repl if
-                // 1) do not already have a flag and
-                // 2) have the same value as s_word_to_repl
-                if(( this.wordWin.getTextVal( i, j ) == s_word_to_repl )
-                && ( !this.wordFlags[i][j] )) {
-                    this._setWordText( i, j, newspell, this.fromReplAll );
-                }
-            }
-        }
-    }
-
-    // finally, move on
-    this.currentWordIndex++;
-    this._spellcheck();
-}
-
-function terminateSpell() {
-    // called when we have reached the end of the spell checking.
-    var msg = "Spell check complete:\n\n";
-    var numrepl = this._getTotalReplaced();
-    if( numrepl == 0 ) {
-        // see if there were no misspellings to begin with
-        if( !this.wordWin ) {
-            msg = "";
-        } else {
-            if( this.wordWin.totalMisspellings() ) {
-                msg += "No words changed.";
-            } else {
-                msg += "No misspellings found.";
-            }
-        }
-    } else if( numrepl == 1 ) {
-        msg += "One word changed.";
-    } else {
-        msg += numrepl + " words changed.";
-    }
-    if( msg ) {
-        msg += "\n";
-        alert( msg );
-    }
-
-    if( numrepl > 0 ) {
-        // update the text field(s) on the opener window
-        for( var i = 0; i < this.textInputs.length; i++ ) {
-            // this.textArea.value = this.wordWin.text;
-            if( this.wordWin ) {
-                if( this.wordWin.textInputs[i] ) {
-                    this.textInputs[i].value = this.wordWin.textInputs[i];
-                }
-            }
-        }
-        // START LUDO
-        try {
-            this._editor.setHTML(this._editor._textArea.value);
-        } catch (e) {
-                // If were not in editor, just continue.
-            }
-        //LUDO END
-    }
-
-    // return back to the calling window
-    this.spellCheckerWin.close();
-
-    return true;
-}
-
-function undo() {
-    // skip if this is the first word!
-    var ti = this.currentTextIndex;
-    var wi = this.currentWordIndex
-
-    if( this.wordWin.totalPreviousWords( ti, wi ) > 0 ) {
-        this.wordWin.removeFocus( ti, wi );
-
-        // go back to the last word index that was acted upon
-        do {
-            // if the current word index is zero then reset the seed
-            if( this.currentWordIndex == 0 && this.currentTextIndex > 0 ) {
-                this.currentTextIndex--;
-                this.currentWordIndex = this.wordWin.totalWords( this.currentTextIndex )-1;
-                if( this.currentWordIndex < 0 ) this.currentWordIndex = 0;
-            } else {
-                if( this.currentWordIndex > 0 ) {
-                    this.currentWordIndex--;
-                }
-            }
-        } while (
-            this.wordWin.totalWords( this.currentTextIndex ) == 0
-            || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromIgnrAll
-            || this.wordFlags[this.currentTextIndex][this.currentWordIndex] == this.fromReplAll
-        );
-
-        var text_idx = this.currentTextIndex;
-        var idx = this.currentWordIndex;
-        var preReplSpell = this.wordWin.originalSpellings[text_idx][idx];
-
-        // if we got back to the first word then set the Undo button back to disabled
-        if( this.wordWin.totalPreviousWords( text_idx, idx ) == 0 ) {
-            this.controlWin.disableUndo();
-        }
-
-        // examine what happened to this current word.
-        switch( this.wordFlags[text_idx][idx] ) {
-            // replace all: go through this and all the future occurances of the word
-            // and revert them all to the original spelling and clear their flags
-            case this.replAllFlag :
-                for( var i = text_idx; i < this.wordWin.textInputs.length; i++ ) {
-                    for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
-                        if(( i == text_idx && j >= idx ) || i > text_idx ) {
-                            var origSpell = this.wordWin.originalSpellings[i][j];
-                            if( origSpell == preReplSpell ) {
-                                this._setWordText ( i, j, origSpell, undefined );
-                            }
-                        }
-                    }
-                }
-                break;
-
-            // ignore all: go through all the future occurances of the word
-            // and clear their flags
-            case this.ignrAllFlag :
-                for( var i = text_idx; i < this.wordWin.textInputs.length; i++ ) {
-                    for( var j = 0; j < this.wordWin.totalWords( i ); j++ ) {
-                        if(( i == text_idx && j >= idx ) || i > text_idx ) {
-                            var origSpell = this.wordWin.originalSpellings[i][j];
-                            if( origSpell == preReplSpell ) {
-                                this.wordFlags[i][j] = undefined;
-                            }
-                        }
-                    }
-                }
-                break;
-
-            // replace: revert the word to its original spelling
-            case this.replWordFlag :
-                this._setWordText ( text_idx, idx, preReplSpell, undefined );
-                break;
-        }
-
-        // For all four cases, clear the wordFlag of this word. re-start the process
-        this.wordFlags[text_idx][idx] = undefined;
-        this._spellcheck();
-    }
-}
-
-function _spellcheck() {
-    var ww = this.wordWin;
-
-    // check if this is the last word in the current text element
-    if( this.currentWordIndex == ww.totalWords( this.currentTextIndex) ) {
-        this.currentTextIndex++;
-        this.currentWordIndex = 0;
-        // keep going if we're not yet past the last text element
-        if( this.currentTextIndex < this.wordWin.textInputs.length ) {
-            this._spellcheck();
-            return;
-        } else {
-            this.terminateSpell();
-            return;
-        }
-    }
-
-    // if this is after the first one make sure the Undo button is enabled
-    if( this.currentWordIndex > 0 ) {
-        this.controlWin.enableUndo();
-    }
-
-    // skip the current word if it has already been worked on
-    if( this.wordFlags[this.currentTextIndex][this.currentWordIndex] ) {
-        // increment the global current word index and move on.
-        this.currentWordIndex++;
-        this._spellcheck();
-    } else {
-        var evalText = ww.getTextVal( this.currentTextIndex, this.currentWordIndex );
-        if( evalText ) {
-            this.controlWin.evaluatedText.value = evalText;
-            ww.setFocus( this.currentTextIndex, this.currentWordIndex );
-            this._getSuggestions( this.currentTextIndex, this.currentWordIndex );
-        }
-    }
-}
-
-function _getSuggestions( text_num, word_num ) {
-    this.controlWin.clearSuggestions();
-    // add suggestion in list for each suggested word.
-    // get the array of suggested words out of the
-    // three-dimensional array containing all suggestions.
-    var a_suggests = this.wordWin.suggestions[text_num][word_num];
-    if( a_suggests ) {
-        // got an array of suggestions.
-        for( var ii = 0; ii < a_suggests.length; ii++ ) {
-            this.controlWin.addSuggestion( a_suggests[ii] );
-        }
-    }
-    this.controlWin.selectDefaultSuggestion();
-}
-
-function _setAsIgnored( text_num, word_num, flag ) {
-    // set the UI
-    this.wordWin.removeFocus( text_num, word_num );
-    // do the bookkeeping
-    this.wordFlags[text_num][word_num] = flag;
-    return true;
-}
-
-function _getTotalReplaced() {
-    var i_replaced = 0;
-    for( var i = 0; i < this.wordFlags.length; i++ ) {
-        for( var j = 0; j < this.wordFlags[i].length; j++ ) {
-            if(( this.wordFlags[i][j] == this.replWordFlag )
-            || ( this.wordFlags[i][j] == this.replAllFlag )
-            || ( this.wordFlags[i][j] == this.fromReplAll )) {
-                i_replaced++;
-            }
-        }
-    }
-    return i_replaced;
-}
-
-function _setWordText( text_num, word_num, newText, flag ) {
-    // set the UI and form inputs
-    this.wordWin.setText( text_num, word_num, newText );
-    // keep track of what happened to this word:
-    this.wordFlags[text_num][word_num] = flag;
-    return true;
-}
-
-function _getFormInputs( inputPattern ) {
-    var inputs = new Array();
-    for( var i = 0; i < document.forms.length; i++ ) {
-        for( var j = 0; j < document.forms[i].elements.length; j++ ) {
-            if( document.forms[i].elements[j].type.match( inputPattern )) {
-                inputs[inputs.length] = document.forms[i].elements[j];
-            }
-        }
-    }
-    return inputs;
-}
diff --git a/lib/speller/spellchecker.html b/lib/speller/spellchecker.html
deleted file mode 100644 (file)
index 0a303ac..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-
-<script type="text/javascript">
-
-var wordWindow = null;
-var controlWindow = null;
-
-function init_spell( spellerWindow ) {
-
-       if( spellerWindow ) {
-               if( spellerWindow.windowType == "wordWindow" ) {
-                       wordWindow = spellerWindow;
-               } else if ( spellerWindow.windowType == "controlWindow" ) {
-                       controlWindow = spellerWindow;
-               }
-       }
-
-       if( controlWindow && wordWindow ) {
-               // populate the speller object and start it off!
-               var speller = opener.speller;
-               wordWindow.speller = speller;
-               speller.startCheck( wordWindow, controlWindow );
-       }
-}
-
-// encodeForPost
-function encodeForPost( str ) {
-       var s = new String( str );
-       s = encodeURIComponent( s );
-       // additionally encode single quotes to evade any PHP 
-       // magic_quotes_gpc setting (it inserts escape characters and 
-       // therefore skews the btye positions of misspelled words)
-       return s.replace( /\'/g, '%27' );
-}
-
-// post the text area data to the script that populates the speller
-function postWords() {
-       var bodyDoc = window.frames[0].document;
-       bodyDoc.open();
-       bodyDoc.write('<html>');
-       bodyDoc.write('<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');
-       bodyDoc.write('<link rel="stylesheet" type="text/css" href="spellerStyle.css"/>');
-       if (opener) {
-               var speller = opener.speller;
-               bodyDoc.write('<body class="normalText" onLoad="document.forms[0].submit();">');
-               bodyDoc.write('<p>Spell check in progress...</p>');
-               bodyDoc.write('<form action="'+speller.spellCheckScript+'" method="post">');
-               for( var i = 0; i < speller.textInputs.length; i++ ) {
-                       bodyDoc.write('<input type="hidden" name="textinputs[]" value="'+encodeForPost(speller.textInputs[i].value)+'" />');
-               }
-               bodyDoc.write('</form>');
-               bodyDoc.write('</body>');
-       } else {
-               bodyDoc.write('<body class="normalText">');
-               bodyDoc.write('<p><b>This page cannot be displayed</b></p><p>The window was not opened from another window.</p>');
-               bodyDoc.write('</body>');
-       }
-       bodyDoc.write('</html>');
-       bodyDoc.close();
-}
-</script>
-
-<html>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<head>
-<title>Speller Pages</title>
-</head>
-<frameset rows="*,201" onLoad="postWords();">
-<frame src="blank.html">
-<frame src="controls.html">
-</frameset>
-</html>
diff --git a/lib/speller/spellerStyle.css b/lib/speller/spellerStyle.css
deleted file mode 100644 (file)
index 01f3b7f..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-.blend {
-       font-family: courier new;
-       font-size: 10pt;
-       border: 0;
-       margin-bottom:-1;
-}
-.normalLabel {
-       font-size:8pt;
-}
-.normalText {
-       font-family:arial, helvetica, sans-serif;
-       font-size:10pt;
-       color:000000;
-       background-color:FFFFFF;
-}
-.plainText {
-       font-family: courier new, courier, monospace;
-       font-size: 10pt;
-       color:000000;
-       background-color:FFFFFF;
-}
-.controlWindowBody {
-       font-family:arial, helvetica, sans-serif;
-       font-size:8pt;
-       color:000000;
-       background-color:DADADA;
-}
-.readonlyInput {
-       background-color:DADADA;
-       color:000000;
-       font-size:8pt;
-       width:392px;
-}
-.textDefault {
-       font-size:8pt;
-       width: 200px;
-}
-.buttonDefault {
-       width:90px;
-       height:22px;
-       font-size:8pt;
-}
-.suggSlct {
-       width:200px;
-       margin-top:2;
-       font-size:8pt;
-}
\ No newline at end of file
diff --git a/lib/speller/wordWindow.js b/lib/speller/wordWindow.js
deleted file mode 100644 (file)
index 553b9c4..0000000
+++ /dev/null
@@ -1,269 +0,0 @@
-////////////////////////////////////////////////////
-// wordWindow object
-////////////////////////////////////////////////////
-function wordWindow() {
-       // private properties
-       this._forms = [];
-
-       // private methods
-       this._getWordObject = _getWordObject;
-       //this._getSpellerObject = _getSpellerObject;
-       this._wordInputStr = _wordInputStr;
-       this._adjustIndexes = _adjustIndexes;
-       this._isWordChar = _isWordChar;
-       this._lastPos = _lastPos;
-       
-       // public properties
-       this.wordChar = /[a-zA-Z]/;
-       this.windowType = "wordWindow";
-       this.originalSpellings = new Array();
-       this.suggestions = new Array();
-       this.checkWordBgColor = "pink";
-       this.normWordBgColor = "white";
-       this.text = "";
-       this.textInputs = new Array();
-       this.indexes = new Array();
-       //this.speller = this._getSpellerObject();
-
-       // public methods
-       this.resetForm = resetForm;
-       this.totalMisspellings = totalMisspellings;
-       this.totalWords = totalWords;
-       this.totalPreviousWords = totalPreviousWords;
-       //this.getTextObjectArray = getTextObjectArray;
-       this.getTextVal = getTextVal;
-       this.setFocus = setFocus;
-       this.removeFocus = removeFocus;
-       this.setText = setText;
-       //this.getTotalWords = getTotalWords;
-       this.writeBody = writeBody;
-       this.printForHtml = printForHtml;
-}
-
-function resetForm() {
-       if( this._forms ) {
-               for( var i = 0; i < this._forms.length; i++ ) {
-                       this._forms[i].reset();
-               }
-       }
-       return true;
-}
-
-function totalMisspellings() {
-       var total_words = 0;
-       for( var i = 0; i < this.textInputs.length; i++ ) {
-               total_words += this.totalWords( i );
-       }
-       return total_words;
-}
-
-function totalWords( textIndex ) {
-       return this.originalSpellings[textIndex].length;
-}
-
-function totalPreviousWords( textIndex, wordIndex ) {
-       var total_words = 0;
-       for( var i = 0; i <= textIndex; i++ ) {
-               for( var j = 0; j < this.totalWords( i ); j++ ) {
-                       if( i == textIndex && j == wordIndex ) {
-                               break;
-                       } else {
-                               total_words++;
-                       }       
-               }
-       }
-       return total_words;
-}
-
-//function getTextObjectArray() {
-//     return this._form.elements;
-//}
-
-function getTextVal( textIndex, wordIndex ) {
-       var word = this._getWordObject( textIndex, wordIndex );
-       if( word ) {
-               return word.value;
-       }
-}
-
-function setFocus( textIndex, wordIndex ) {
-       var word = this._getWordObject( textIndex, wordIndex );
-       if( word ) {
-               if( word.type == "text" ) {
-                       word.focus();
-                       word.style.backgroundColor = this.checkWordBgColor;
-               }
-       }
-}
-
-function removeFocus( textIndex, wordIndex ) {
-       var word = this._getWordObject( textIndex, wordIndex );
-       if( word ) {
-               if( word.type == "text" ) {
-                       word.blur();
-                       word.style.backgroundColor = this.normWordBgColor;
-               }
-       }
-}
-
-function setText( textIndex, wordIndex, newText ) {
-       var word = this._getWordObject( textIndex, wordIndex );
-       var beginStr;
-       var endStr;
-       if( word ) {
-               var pos = this.indexes[textIndex][wordIndex];
-               var oldText = word.value;
-               // update the text given the index of the string
-               beginStr = this.textInputs[textIndex].substring( 0, pos );
-               endStr = this.textInputs[textIndex].substring( 
-                       pos + oldText.length, 
-                       this.textInputs[textIndex].length 
-               );
-               this.textInputs[textIndex] = beginStr + newText + endStr;
-               
-               // adjust the indexes on the stack given the differences in 
-               // length between the new word and old word. 
-               var lengthDiff = newText.length - oldText.length;
-               this._adjustIndexes( textIndex, wordIndex, lengthDiff );
-               
-               word.size = newText.length;
-               word.value = newText;
-               this.removeFocus( textIndex, wordIndex );
-       }
-}
-
-
-function writeBody() {
-       var d = window.document;
-       var is_html = false;
-
-       d.open();
-
-       // iterate through each text input.
-       for( var txtid = 0; txtid < this.textInputs.length; txtid++ ) { 
-               var end_idx = 0;
-               var begin_idx = 0;      
-               d.writeln( '<form name="textInput'+txtid+'">' );
-               var wordtxt = this.textInputs[txtid];
-               this.indexes[txtid] = [];
-
-               if( wordtxt ) {                 
-                       var orig = this.originalSpellings[txtid];
-                       if( !orig ) break;
-
-                       //!!! plain text, or HTML mode?
-                       d.writeln( '<div class="plainText">' );
-                       // iterate through each occurrence of a misspelled word. 
-                       for( var i = 0; i < orig.length; i++ ) {
-                               // find the position of the current misspelled word,
-                               // starting at the last misspelled word. 
-                               // and keep looking if it's a substring of another word
-                               do {
-                                       begin_idx = wordtxt.indexOf( orig[i], end_idx );
-                                       end_idx = begin_idx + orig[i].length;
-                                       // word not found? messed up!
-                                       if( begin_idx == -1 ) break; 
-                                       // look at the characters immediately before and after 
-                                       // the word. If they are word characters we'll keep looking.
-                                       var before_char = wordtxt.charAt( begin_idx - 1 );
-                                       var after_char = wordtxt.charAt( end_idx );
-                               } while ( 
-                                       this._isWordChar( before_char ) 
-                                       || this._isWordChar( after_char )
-                               );
-
-                               // keep track of its position in the original text. 
-                               this.indexes[txtid][i] = begin_idx;
-
-                               // write out the characters before the current misspelled word
-                               for( var j = this._lastPos( txtid, i ); j < begin_idx; j++ ) {
-                                       // !!! html mode? make it html compatible
-                                       d.write( this.printForHtml( wordtxt.charAt( j )));
-                               }
-
-                               // write out the misspelled word. 
-                               d.write( this._wordInputStr( orig[i] ));
-
-                               // if it's the last word, write out the rest of the text
-                               if( i == orig.length-1 ){
-                                       d.write( printForHtml( wordtxt.substr( end_idx )));
-                               }                       
-                       }
-
-                       d.writeln( '</div>' );
-                       
-               }
-               d.writeln( '</form>' );
-       }
-       //for ( var j = 0; j < d.forms.length; j++ ) {
-       //      alert( d.forms[j].name );
-       //      for( var k = 0; k < d.forms[j].elements.length; k++ ) {
-       //              alert( d.forms[j].elements[k].name + ": " + d.forms[j].elements[k].value );
-       //      }
-       //}     
-       
-       // set the _forms property
-       this._forms = d.forms;
-       d.close();
-}
-
-// return the character index in the full text after the last word we evaluated
-function _lastPos( txtid, idx ) {
-       if( idx > 0 )
-               return this.indexes[txtid][idx-1] + this.originalSpellings[txtid][idx-1].length;
-       else
-               return 0;
-}
-
-function printForHtml( n ) {
-       var htmlstr = n;
-       if( htmlstr.length == 1 ) {
-               // do simple case statement if it's just one character
-               switch ( n ) {
-                       case "\n":
-                               htmlstr = '<br/>';
-                               break;
-                       case "<":
-                               htmlstr = '&lt;';
-                               break;
-                       case ">":
-                               htmlstr = '&gt;';
-                               break;
-               }
-               return htmlstr;
-       } else {
-               htmlstr = htmlstr.replace( /</g, '&lt' );
-               htmlstr = htmlstr.replace( />/g, '&gt' );
-               htmlstr = htmlstr.replace( /\n/g, '<br/>' );
-               return htmlstr;
-       }
-}
-
-function _isWordChar( letter ) {
-       if( letter.search( this.wordChar ) == -1 ) {
-               return false;
-       } else {
-               return true;
-       }
-}
-
-function _getWordObject( textIndex, wordIndex ) {
-       if( this._forms[textIndex] ) {
-               if( this._forms[textIndex].elements[wordIndex] ) {
-                       return this._forms[textIndex].elements[wordIndex];
-               }
-       }
-       return null;
-}
-
-function _wordInputStr( word ) {
-       var str = '<input readonly ';
-       str += 'class="blend" type="text" value="' + word + '" size="' + word.length + '" />';
-       return str;
-}
-
-function _adjustIndexes( textIndex, wordIndex, lengthDiff ) {
-       for( var i = wordIndex + 1; i < this.originalSpellings[textIndex].length; i++ ) {
-               this.indexes[textIndex][i] = this.indexes[textIndex][i] + lengthDiff;
-       }
-}
index ab1c1cef83c6b64a1820752588e09abea03118f4..1cbaa0517e4ea821955fc323fc5c5f71406b8340 100644 (file)
@@ -6577,53 +6577,6 @@ function print_side_block_end($attributes = array(), $title='') {
 }
 
 
-/**
- * Prints out code needed for spellchecking.
- * Original idea by Ludo (Marc Alier).
- *
- * Opening CDATA and <script> are output by weblib::use_html_editor()
- * @uses $CFG
- * @param boolean $usehtmleditor Normally set by $CFG->htmleditor, can be overriden here
- * @param boolean $return If false, echos the code instead of returning it
- * @todo Find out if lib/editor/htmlarea/htmlarea.class.php::print_speller_code() is still used, and delete if not
- */
-function print_speller_code ($usehtmleditor=false, $return=false) {
-    global $CFG;
-    $str = '';
-
-    if(!$usehtmleditor) {
-        $str .= 'function openSpellChecker() {'."\n";
-        $str .= "\tvar speller = new spellChecker();\n";
-        $str .= "\tspeller.popUpUrl = \"" . $CFG->httpswwwroot ."/lib/speller/spellchecker.html\";\n";
-        $str .= "\tspeller.spellCheckScript = \"". $CFG->httpswwwroot ."/lib/speller/server-scripts/spellchecker.php\";\n";
-        $str .= "\tspeller.spellCheckAll();\n";
-        $str .= '}'."\n";
-    } else {
-        $str .= "function spellClickHandler(editor, buttonId) {\n";
-        $str .= "\teditor._textArea.value = editor.getHTML();\n";
-        $str .= "\tvar speller = new spellChecker( editor._textArea );\n";
-        $str .= "\tspeller.popUpUrl = \"" . $CFG->httpswwwroot ."/lib/speller/spellchecker.html\";\n";
-        $str .= "\tspeller.spellCheckScript = \"". $CFG->httpswwwroot ."/lib/speller/server-scripts/spellchecker.php\";\n";
-        $str .= "\tspeller._moogle_edit=1;\n";
-        $str .= "\tspeller._editor=editor;\n";
-        $str .= "\tspeller.openChecker();\n";
-        $str .= '}'."\n";
-    }
-
-    if ($return) {
-        return $str;
-    }
-    echo $str;
-}
-
-/**
- * Print button for spellchecking when editor is disabled
- */
-function print_speller_button () {
-    echo '<input type="button" value="Check spelling" onclick="openSpellChecker();" />'."\n";
-}
-
-
 function page_id_and_class(&$getid, &$getclass) {
     // Create class and id for this page
     global $CFG, $ME;
index d71f51b7585d31a0bef59188de44bb10fc0fd06a..186f2021b126cc342a2fa30c85c5ffd6193b85f7 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2008091611;  // YYYYMMDD   = date of the last version bump
+    $version = 2008092300;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20080923)';  // Human-friendly version name