Hi All,
Maybe someone can offer me some guidence. I've successfully got Fcditor working with Coldfusion via the cfc. I have tested the ieSpell and it works fine but I need cross browser compatiblility so I have to use Spellerpages.
I installed Aspell for Windows (as this is what my server runs) and then downloaded the en dictionary and installed that. I'm not sure Aspell is working correctly as I have done some tests fro mthe command link using the following code:
C:\Program Files\Aspell\bin>aspell.exe -c testdoc.doc
But I get the following error:
Unhandled Error: The file "/C:/Program Files/Aspell/data/en-only.rws opened for reading.
This application has requested the Runtime to terminate it in an unusual way.Please contact the application's support team for more information.
When i try and access the spell check via the FCKeditor (I have set the config file to Spellerpages and changed the local path for the Aspell installation in the spellchecker.cfm in the editor/dialog/spellerpages/server-scripts folder), the spell check pop up opens fine but the top section shows the following text
$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 = '" . preg_replace( "/['\\\\]/", "\\\\$0", $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] ); // Strip all tags for the text. (by FredCK - #339 / #681) $text = preg_replace( "/<[^>]+>/", " ", $text ) ; $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 ); } ?>
Can anyone help out?
Thanks Mark
Maybe someone can offer me some guidence. I've successfully got Fcditor working with Coldfusion via the cfc. I have tested the ieSpell and it works fine but I need cross browser compatiblility so I have to use Spellerpages.
I installed Aspell for Windows (as this is what my server runs) and then downloaded the en dictionary and installed that. I'm not sure Aspell is working correctly as I have done some tests fro mthe command link using the following code:
C:\Program Files\Aspell\bin>aspell.exe -c testdoc.doc
But I get the following error:
Unhandled Error: The file "/C:/Program Files/Aspell/data/en-only.rws opened for reading.
This application has requested the Runtime to terminate it in an unusual way.Please contact the application's support team for more information.
When i try and access the spell check via the FCKeditor (I have set the config file to Spellerpages and changed the local path for the Aspell installation in the spellchecker.cfm in the editor/dialog/spellerpages/server-scripts folder), the spell check pop up opens fine but the top section shows the following text
$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 = '" . preg_replace( "/['\\\\]/", "\\\\$0", $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] ); // Strip all tags for the text. (by FredCK - #339 / #681) $text = preg_replace( "/<[^>]+>/", " ", $text ) ; $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 ); } ?>
Can anyone help out?
Thanks Mark