Index: openacs-4/packages/acs-templating/tcl/widget-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/widget-procs.tcl,v
diff -u -N -r1.60 -r1.61
--- openacs-4/packages/acs-templating/tcl/widget-procs.tcl 25 Apr 2018 19:23:26 -0000 1.60
+++ openacs-4/packages/acs-templating/tcl/widget-procs.tcl 1 May 2018 08:23:06 -0000 1.61
@@ -166,9 +166,9 @@
unset -nocomplain element(options)
- template::element::set_error $element(form_id) $element_id "
- No matches were found for \"$search_string\".
Please
- try again."
+ template::element::set_error $element(form_id) $element_id [subst {
+ No matches were found for "[ns_quotehtml $search_string]".
Please try again.
+ }]
} else {
# we need to return a select list
@@ -177,11 +177,10 @@
if { [llength $persons] > 0 } {
set options $persons
- set options [concat $options [list [list "---" ""]]]
+ lappend options [list "---" ""]
}
if { [llength $groups_relsegs] > 0 } {
- set options [concat $options $groups_relsegs]
- set options [concat $options [list [list "---" ""]]]
+ lappend options {*}$groups_relsegs [list "---" ""]
}
set element(options) [concat $options { { "Search again..." ":search:" } }]
if { ![info exists value] } {
@@ -194,8 +193,8 @@
}
}
- if { [info exists element(result_datatype)] &&
- [ns_queryexists $element_id:select] } {
+ if { [info exists element(result_datatype)]
+ && [ns_queryexists $element_id:select] } {
set element(datatype) $element(result_datatype)
}
@@ -246,9 +245,10 @@
# include an extra hidden element to indicate that the
# value is being selected as opposed to entered
- set output "\n"
- append output [select element $tag_attributes]
-
+ set output ""
+ append output \
+ [subst {\n}] \
+ [select element $tag_attributes]
}
@@ -329,7 +329,7 @@
if { $value ne "" } {
append output \
[ns_quotehtml $value] \
- ""
+ [subst {}]
}
} else {
if {$tag ne "textarea"} {
@@ -388,15 +388,19 @@
array set attributes $tag_attributes
- if { ( $type eq "checkbox" || $type eq "radio" ) && [info exists element(value)] } {
+ if { ( $type eq "checkbox" || $type eq "radio" )
+ && [info exists element(value)]
+ } {
# This can be used in the form template in a tag.
set attributes(id) "$element(form_id):elements:$element(name):$element(value)"
} elseif { $type in {"password" "text" "button" "file" }} {
set attributes(id) "$element(name)"
}
# Handle display mode of visible normal form elements, i.e. not hidden, not submit, not button, not clear
- if { $element(mode) ne "edit" && $type ni { hidden submit button clear checkbox radio } } {
+ if { $element(mode) ne "edit"
+ && $type ni { hidden submit button clear checkbox radio }
+ } {
set output ""
if { [info exists element(value)] } {
append output [ns_quotehtml $element(value)]
@@ -405,7 +409,9 @@
} else {
set output [subst {[_ acs-templating.Spellcheck]:
[menu "$element(id).spellcheck" [nsv_get spellchecker lang_options] $spellcheck(selected_option) {}]"
} else {
@@ -514,7 +522,9 @@
# were ignored, preventing the export of multiple values by hidden formfields.
# I changed this by saying that field is multiple whenever element(values)
# exists and is not null.
- if { [info exists element(values)] && $element(values) ne "" } {
+ if { [info exists element(values)]
+ && $element(values) ne ""
+ } {
#ns_log notice "hidden form element with multiple values: <$element(values)>"
set output {}
set count 0
@@ -686,7 +696,7 @@
append output [subst { [ns_quotehtml $label]
\n}]
@@ -835,7 +845,7 @@
}
template::element::set_error $element(form_id) $element_id \
- "No matches were found for \"$value\".
Please\ntry again."
+ [subst {No matches were found for "[ns_quotehtml $value]".
Please\ntry again.}]
} elseif { $option_count == 1 } {
@@ -847,14 +857,15 @@
# need to return a select list
set element(options) [concat $options { { "Search again..." ":search:" } }]
template::element::set_error $element(form_id) $element_id \
- "More than one match was found for \"$value\".
Please\nchoose one from the list."
+ [subst {More than one match was found for "[ns_quotehtml $value]".
+ Please choose one from the list.}]
set value [lindex $options 0 1]
}
}
- if { [info exists element(result_datatype)] &&
- [ns_queryexists $element_id:select] } {
+ if { [info exists element(result_datatype)]
+ && [ns_queryexists $element_id:select] } {
set element(datatype) $element(result_datatype)
}
@@ -894,7 +905,9 @@
append output [textarea $element_reference $tag_attributes]
- if { [info exists element(format_element)] && [info exists element(format_options)] } {
+ if { [info exists element(format_element)]
+ && [info exists element(format_options)]
+ } {
append output "
Format: [menu $element(format_element) $element(format_options) {} {}]"
}
}
@@ -940,19 +953,26 @@
}
append output ""
} elseif {$count == 1} {
- append output "