Index: openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl 10 Oct 2003 11:34:51 -0000 1.7 +++ openacs-4/packages/acs-subsite/www/admin/subsite-add.tcl 15 Nov 2003 22:31:15 -0000 1.7.2.1 @@ -26,7 +26,7 @@ {help_text "The name of the new community you're setting up."} {html {size 30}} } - {folder:text,optional + {folder:url_element(text),optional {label "URL folder name"} {help_text "This should be a short string, all lowercase, with hyphens instead of spaces, whicn will be used in the URL of the new application. If you leave this blank, we will generate one for you from name of the application."} {html {size 30}} 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 -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