Index: openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml,v diff -u -r1.50 -r1.51 --- openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 24 Nov 2008 14:06:06 -0000 1.50 +++ openacs-4/packages/xowiki/catalog/xowiki.en_US.ISO-8859-1.xml 30 Dec 2008 16:24:12 -0000 1.51 @@ -89,6 +89,7 @@ Page Title %errorMsg% Another item with the name '%value%' exists already in this folder + Page Order invalid; might only contain upper and lower case letters, underscore, digits and dots Page Type Instance Attributes Page Instance Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v diff -u -r1.113 -r1.114 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 17 Dec 2008 23:00:56 -0000 1.113 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 30 Dec 2008 16:24:12 -0000 1.114 @@ -23,9 +23,12 @@ {f.text "= richtext,editor=xinha"} {f.description "="} {f.nls_language "="} - {validate - {{name {\[::xowiki::validate_name\]} {Another item with this name exists \ - already in this folder}}}} + {validate { + {name {\[::xowiki::validate_name\]} {Another item with this name exists \ + already in this folder}} + {page_order {\[::xowiki::validate_form_field page_order\]} {Page Order invalid; \ + might only contain upper and lower case letters, underscore, digits and dots}} + }} {with_categories true} {submit_link "view"} {folderspec ""} @@ -255,20 +258,28 @@ return 1 } - - proc ::xowiki::validate_form_constraints {} { - upvar form_constraints form_constraints + proc ::xowiki::validate_form_field {field_name} { + # + # Generic ad_compliant validator using validation methods from + # form_fields + # + upvar $field_name $field_name my instvar data - set f [$data lookup_form_field -name form_constraints [my set form_fields]] - $f value $form_constraints + # + # Get the form-field and set its value.... + # + set f [$data lookup_form_field -name $field_name [my set form_fields]] + $f value [set $field_name] set validation_error [$f validate $data] + # + # If we get an error, we report it as well via util-user message + # + #my msg "***** field_name = $field_name, cls=[$f info class] validation_error=$validation_error" if {$validation_error ne ""} { - util_user_message -message "Error in form constraints: $validation_error" - set success 0 - } else { - set success 1 + util_user_message -message "Error in field [$f label]: $validation_error" + return 0 } - return $success + return 1 } ## We could strip the language prefix from the name, since it is essentially @@ -437,9 +448,11 @@ {html {size 30}} }} {validate { {upload_file {\[::xowiki::validate_file\]} {For new entries, \ - a upload file must be provided}} + a upload file must be provided}} + {page_order {\[::xowiki::validate_form_field page_order\]} {Page Order invalid; + might only contain upper and lower case letters, underscore, digits and dots}} {name {\[::xowiki::validate_name\]} {Another item with this name exists \ - already in this folder}} + already in this folder}} }} } FileForm instproc tidy {} { @@ -504,9 +517,11 @@ description}} {validate { {upload_file {\[::xowiki::validate_file\]} {For new entries, \ - a upload file must be provided}} + a upload file must be provided}} {name {\[::xowiki::validate_name\]} {Another item with this name exists \ - already in this folder}} + already in this folder}} + {page_order {\[::xowiki::validate_form_field page_order\]} {Page Order invalid; + might only contain upper and lower case letters, underscore, digits and dots}} {duration {\[::xowiki::validate_duration\]} {Check duration and provide default}} }} } @@ -788,8 +803,10 @@ {name {\[::xowiki::validate_name\]} {Another item with this name exists \ already in this folder}} {text {\[::xowiki::validate_form_text\]} {Form must contain a valid template}} + {page_order {\[::xowiki::validate_form_field page_order\]} {Page Order invalid; + might only contain upper and lower case letters, underscore, digits and dots}} {form {\[::xowiki::validate_form_form\]} {Form must contain a toplevel HTML form element}} - {form_constraints {\[::xowiki::validate_form_constraints\]} {Invalid form constraints}} + {form_constraints {\[::xowiki::validate_form_field form_constraints\]} {Invalid form constraints}} }} } Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.316 -r1.317 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 29 Dec 2008 02:42:40 -0000 1.316 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 30 Dec 2008 16:24:12 -0000 1.317 @@ -1377,6 +1377,7 @@ if {[my exists page_order]} { set page_order [string trim $value " ."] my page_order $page_order + return [expr {![regexp {[^0-9a-zA-Z_]} $page_order]}] } return 1 }