Index: openacs-4/bin/webspell =================================================================== RCS file: /usr/local/cvsroot/openacs-4/bin/webspell,v diff -u -r1.1 -r1.2 --- openacs-4/bin/webspell 30 Sep 2003 19:27:48 -0000 1.1 +++ openacs-4/bin/webspell 23 Oct 2003 10:52:06 -0000 1.2 @@ -1,13 +1,20 @@ #!/bin/sh - -# Wrapper for aspell/ispell that sets the HOME environment variable. -# Can't seem to do this from AOLserver Tcl. -# Takes three arguments: file to spellcheck, dictionary file, language. # +# webspell - Wrapper for Aspell/Ispell that sets the HOME environment variable +# to [ns_info home] ... can't seem to do this from AOLserver Tcl. +# +# Takes five arguments: +# +# $1) AOLserver home. +# $2) Spellcheck binary (Aspell or Ispell). +# $3) Language, in lang or locale format. (Aspell only - Ispell gets "".) +# $4) Local dictionary file (additional words you don't want to get caught by.) +# $5) tmpfile +# # Root must be able to execute this file if AOLserver runs as root # (which it does if it runs on a privileged port, e.g., port 80) -#HOME=/usr/local/aolserver -HOME=$4 +HOME=$1 export HOME -exec $3 $5 -a -p $2 < $1 + +exec $2 $3 -a -p $4 < $5 Index: openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl 22 Oct 2003 16:37:54 -0000 1.7 +++ openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl 23 Oct 2003 10:52:06 -0000 1.8 @@ -175,9 +175,11 @@ close $f set lines [split $text "\n"] - - set dictionaryfile [file join [acs_package_root_dir acs-templating] resources forms ispell-words] + # Support for local, localized, dictionaries (UI to add to them is not implemented yet!) + set suffix [ad_decode $language "" "" "-$language"] + set dictionaryfile [file join [acs_package_root_dir acs-templating] resources forms webspell-local-dict$suffix] + # The webspell wrapper is necessary because ispell requires # the HOME environment set, and setting env(HOME) doesn't appear # to work from AOLserver. @@ -192,8 +194,12 @@ set language "--lang=$language" } - set ispell_proc [open "|$spelling_wrapper $tmpfile $dictionaryfile $spellchecker_path [ns_info home] $language" r] - + if { [catch { set ispell_proc [open "|$spelling_wrapper [ns_info home] $spellchecker_path $language $dictionaryfile $tmpfile" r] } errmsg] } { + ad_return_error "Webspell could not be executed" "Spell-checking is enabled but the spell-check wrapper ([acs_root_dir]/bin/webspell) could not be executed. Check that the wrapper exists, and that its permissions are correct.
Here is the error message:
$errmsg" + ad_script_abort + } + + # read will occasionally error out with "interrupted system call", # so retry a few times in the hopes that it will go away. set try 0 @@ -204,8 +210,8 @@ ns_log Notice "spellchecker had a problem: $errmsg" } - if { [catch [close $ispell_proc] errmsg] } { - ad_return_error "No Dictionary Found" "Spell-checking is enabled but the spell-check program could not be executed. Check the permissions on the spell-check program (_server_root_/bin/webspell).
Here is the error message:
$errmsg" + if { [catch { close $ispell_proc } errmsg] } { + ad_return_error "No dictionary found" "Spell-checking is enabled but the spell-check dictionary could not be reached. Check that the dictionary exists, and that its permissions are correct.
Here is the error message:
$errmsg" ad_script_abort }