Index: openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl,v diff -u -N -r1.58 -r1.59 --- openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 10 Jan 2007 21:22:12 -0000 1.58 +++ openacs-4/packages/acs-tcl/tcl/form-processing-procs.tcl 14 May 2007 20:30:26 -0000 1.59 @@ -506,7 +506,6 @@ @see ad_set_form_values } { - set level [template::adp_level] # Are we extending the form? @@ -527,8 +526,8 @@ set valid_args { form method action mode html name select_query select_query_name new_data on_refresh edit_data validate on_submit after_submit confirm_template on_request new_request edit_request export cancel_url cancel_label - has_submit has_edit actions edit_buttons display_buttons show_required_p - on_validation_error }; + has_submit has_edit actions edit_buttons display_buttons show_required_p + on_validation_error fieldset }; ad_arg_parser $valid_args $args @@ -570,7 +569,7 @@ # and validation block to be extended, for now at least until I get more experience # with this ... - if { [lsearch { name form method action html validate export mode cancel_url has_edit has_submit actions edit_buttons display_buttons on_validation_error} $valid_arg ] == -1 } { + if { [lsearch { name form method action html validate export mode cancel_url has_edit has_submit actions edit_buttons display_buttons fieldset on_validation_error} $valid_arg ] == -1 } { set af_parts(${form_name}__extend) "" } } @@ -599,17 +598,17 @@ array set af_element_parameters [list] if { [info exists form] } { - + # Remove comment lines in form section (DanW) regsub -all -line -- {^\s*\#.*$} $form "" form - + foreach element $form { set element_name_part [lindex $element 0] # This can easily be generalized if we add more embeddable form commands ... if {$element_name_part eq "-section"} { - lappend af_element_names($form_name) "[list "-section" [uplevel [list subst [lindex $element 1]]]]" + lappend af_element_names($form_name) "[concat "-section" [uplevel [list subst [lrange $element 1 end]]]]" } else { set element_name_part [uplevel [list subst $element_name_part]] if { ![regexp {^([^ \t:]+)(?::([a-zA-Z0-9_,(|)]*))?$} $element_name_part match element_name flags] } { @@ -715,6 +714,10 @@ lappend create_command "-display_buttons" $display_buttons } + if { [info exists fieldset] } { + lappend create_command "-fieldset" $fieldset + } + if { [info exists show_required_p] } { lappend create_command "-show_required_p" $show_required_p } @@ -763,10 +766,24 @@ global af_sequence_name foreach element_name $element_names { - if { [llength $element_name] == 2 } { - switch [string range [lindex $element_name 0] 1 end] { - section { template::form section $form_name [lindex $element_name 1] } + if { [lindex $element_name 0] eq "-section" } { + set command [list template::form section] + foreach {option} [lrange $element_name 2 end] { + set switch [lindex $option 0] + set args [lindex $option 1] + switch $switch { + fieldset - + legendtext - + legend { + lappend command -$switch + lappend command $args + } + default {return -code error "\"$switch\" is not a legal -section option"} + } } + lappend command $form_name + lappend command [lindex $element_name 1] + eval $command } else { set form_command [list template::element create $form_name $element_name] foreach flag $af_flag_list(${form_name}__$element_name) { @@ -849,7 +866,6 @@ # Check that any acquire and get_property attributes are supported by their element's datatype # These are needed at submission and fill-the-form-with-db-values time - foreach element_name $af_element_names($form_name) { if { [llength $element_name] == 1 } { if { [info exists af_from_sql(${form_name}__$element_name)] } { @@ -977,7 +993,7 @@ return -code error "Couldn't get the next value from sequence: $errmsg\"" } set values(__new_p) 1 - + if { [info exists new_request] } { ad_page_contract_eval uplevel #$level $new_request # LARS: Set form values based on local vars in the new_request block @@ -1082,7 +1098,6 @@ lappend args [list $element_name [uplevel #$level [list set $element_name]]] } } - # This is serious abuse of ad_return_exception_template, but hell, I wrote it so I'm entitled ... ad_return_exception_template -status 200 -params $args $confirm_template