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.14 -r1.14.2.1 --- openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl 29 Jan 2004 15:46:09 -0000 1.14 +++ openacs-4/packages/acs-templating/tcl/spellcheck-procs.tcl 12 Dec 2004 20:15:59 -0000 1.14.2.1 @@ -28,6 +28,7 @@ ns_set delkey $__form__ $element_id.merge_text if { [empty_string_p $merge_text] } { + return {} } @@ -41,14 +42,14 @@ ns_set cput $__form__ $element_id $merge_text ns_set cput $__form__ $element_id.spellcheck ":nospell:" - return $merge_text } ad_proc -public template::data::transform::spellcheck { -element_ref:required -values:required } { + upvar $element_ref element # case 1, initial submission of non-checked text: returns {}. @@ -65,17 +66,17 @@ set contents [template::util::richtext::get_property contents [lindex $values 0]] } else { if { ![empty_string_p $merge_text] } { - return [list $merge_text] + return [list $merge_text] } set contents [lindex $values 0] } if { [empty_string_p $contents] } { return $values } + # if language is empty string don't spellcheck + set spellcheck_p [ad_decode [set language [ns_queryget $element(id).spellcheck]] ":nospell:" 0 "" 0 1] - set spellcheck_p [ad_decode [set language [ns_queryget $element(id).spellcheck]] ":nospell:" 0 1] - # perform spellchecking or not? if { $spellcheck_p } { @@ -89,15 +90,23 @@ -html if { $error_num > 0 } { + # there was at least one error. + # disable element validation since that will conflict with + # the spellchecking DAVEB + template::element::set_properties $element(form_id) $element(id) -validate [list] + template::element::set_error $element(form_id) $element(id) " [ad_decode $error_num 1 "Found one error." "Found $error_num errors."] Please correct, if necessary." # switch to display mode so we can show our inline mini-form with suggestions. template::element::set_properties $element(form_id) $element(id) mode display if { $richtext_p } { + # mutate datatype to prevent validation of spellcheck + # form data by richtext validation DAVEB + template::element::set_properties $element(form_id) $element(id) -datatype text append formtext_to_display " " } @@ -126,7 +135,6 @@ @param the_list The list of possibly duplicate elements. } { - set sorted_list [lsort -dictionary $the_list] set new_list [list] @@ -349,7 +357,6 @@ || [empty_string_p [nsv_get spellchecker path]] } { set spellcheck_p 0 - } else {