Index: openacs-4/packages/acs-templating/acs-templating.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/acs-templating.info,v
diff -u -r1.18 -r1.19
--- openacs-4/packages/acs-templating/acs-templating.info 1 Oct 2003 14:32:48 -0000 1.18
+++ openacs-4/packages/acs-templating/acs-templating.info 4 Oct 2003 12:12:01 -0000 1.19
@@ -32,9 +32,8 @@
-
+
-
Index: openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/acs-templating/tcl/spellcheck-init.tcl 4 Oct 2003 12:12:01 -0000 1.1
@@ -0,0 +1,20 @@
+ad_library {
+
+ Set up the path to the spell-checker in an nsv cache.
+
+ @cvs-id $Id: spellcheck-init.tcl,v 1.1 2003/10/04 12:12:01 olah Exp $
+ @author Ola Hansson (ola@polyxena.net)
+ @creation-date 2003-10-04
+
+}
+
+# Find the aspell or, second best, the ispell binary.
+# In case neither one is found, spell-checking will be disabled.
+
+set bin [ad_decode [catch {exec which aspell}] \
+ 0 [exec which aspell] \
+ [ad_decode [catch {exec which ispell}] \
+ 0 [exec which ispell] \
+ ""]]
+
+nsv_set spellchecker path $bin
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.2 -r1.3
--- openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl 2 Oct 2003 15:46:33 -0000 1.2
+++ openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl 4 Oct 2003 12:12:01 -0000 1.3
@@ -171,10 +171,7 @@
set spelling_wrapper [file join [acs_root_dir] bin webspell]
- set spellchecker_path [parameter::get_from_package_key \
- -package_key acs-templating \
- -parameter SpellcheckerPath \
- -default /usr/bin/aspell]
+ set spellchecker_path [nsv_get spellchecker path]
set language [parameter::get_from_package_key \
-package_key acs-templating \
@@ -324,15 +321,24 @@
# That's either because spell-checking is disabled for this element, or we're not dealing with a submit.
# Whichever it is, let's see if, and then how, we should render the spellcheck "sub widget".
- array set widget_info [string trim [parameter::get_from_package_key -package_key acs-templating \
- -parameter SpellcheckFormWidgets \
- -default ""]]
+ if { [empty_string_p [nsv_get spellchecker path]] } {
+
+ # The aspell or ispell bibary was not found during server startup - turn spell-checking off.
+ set spellcheck_p 0
+
+ } else {
+
+ array set widget_info [string trim [parameter::get_from_package_key -package_key acs-templating \
+ -parameter SpellcheckFormWidgets \
+ -default ""]]
+
+ set spellcheck_p [expr [array size widget_info] \
+ && ![info exists element(nospell)] \
+ && ([string equal $element(widget) "richtext"] || [string equal $element(widget) "textarea"] || [string equal $element(widget) "text"]) \
+ && [lsearch -exact [array names widget_info] $element(widget)] != -1]
+
+ }
- set spellcheck_p [expr [array size widget_info] \
- && ![info exists element(nospell)] \
- && ([string equal $element(widget) "richtext"] || [string equal $element(widget) "text"] || [string equal $element(widget) "textarea"]) \
- && [lsearch -exact [array names widget_info] $element(widget)] != -1]
-
if { $spellcheck_p } {
# This is not a submit; we are rendering the form element for the first time.
# Since the spellcheck "sub widget" is to be displayed we'll also want to know