Index: openacs-4/packages/acs-templating/tcl/data-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/data-procs.tcl,v diff -u -N -r1.11 -r1.11.2.1 --- openacs-4/packages/acs-templating/tcl/data-procs.tcl 15 Oct 2003 12:35:51 -0000 1.11 +++ openacs-4/packages/acs-templating/tcl/data-procs.tcl 15 Nov 2003 22:31:15 -0000 1.11.2.1 @@ -173,6 +173,31 @@ return $result } +ad_proc -public template::data::validate::url_element { value_ref message_ref } { + + Beautiful URL elements that may only contain lower case + characters, numbers and hyphens. + +

+ + + @see util_text_to_url if you want to offer auto-generation of URLs based on a pretty name + + @author Tilmann Singer + +} { + upvar 2 $message_ref message $value_ref value + + set expr {^[a-z0-9-]+$} + set result [regexp $expr $value] + + if { ! $result } { + set message "Invalid url \"$value\". Please use only lowercase characters, numbers and hyphens, e.g. \"foo-bar\"." + } + + return $result +} + ad_proc -public template::data::validate::date { value_ref message_ref } { upvar 2 $message_ref message $value_ref value