Index: openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl,v diff -u -r1.368.2.88 -r1.368.2.89 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 26 Apr 2021 13:59:00 -0000 1.368.2.88 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 25 May 2021 19:37:24 -0000 1.368.2.89 @@ -999,6 +999,18 @@ return [:pretty_link] } + FormPage ad_instproc extra_html_fields {} { + + Should be overloaded to provide extra content to some forms. This + method can be used to add additional (e.g. hidden) HTML input + fields to form pages. + + ::html::input -type hidden -name __object_name -value ${:name} + + } { + return "" + } + FormPage ad_instproc www-edit { {-validation_errors ""} {-disable_input_fields 0} @@ -1026,7 +1038,7 @@ #:log anon_instances=$anon_instances set field_names [:field_names -form $form] - #:msg field_names=$field_names + #:log field_names=$field_names set form_fields [:create_form_fields $field_names] if {$form eq ""} { @@ -1046,6 +1058,7 @@ # - if it is required but hidden, show it anyway # (might happen, when e.g. set via @cr_fields ... hidden) set name_field [:lookup_form_field -name _name $form_fields] + if {$anon_instances} { #$name_field config_from_spec hidden } else { @@ -1283,6 +1296,7 @@ ::html::input -type hidden -name __object_name -value ${:name} ::html::input -type hidden -name __form_action -value save-form-data ::html::input -type hidden -name __current_revision_id -value ${:revision_id} + :extra_html_fields ::html::CSRFToken } # @@ -1334,7 +1348,6 @@ :render_form_action_buttons -CSSclass [string trim "$button_class(wym) $button_class(xinha)"] } - if {$formNode ne ""} { if {[:exists_query_parameter "return_url"]} { @@ -2552,14 +2565,16 @@ specified, all form parameters are used. } { + #:log "===== Page get_form_data" + set validation_errors 0 set category_ids [list] array set containers [list] set cc [::${:package_id} context] if {![info exists field_names]} { set field_names [$cc array names form_parameter] - #:log "form-params=[$cc array get form_parameter]" + #:log "===== Page get_form_data field_names from form data: [$cc array names form_parameter *_.*]" } #:msg "fields $field_names // $form_fields" #foreach f $form_fields { :msg "... $f [$f name]" } @@ -2598,12 +2613,22 @@ } } default { - # user form content fields + # + # Application form content fields. + # if {[regexp {^(.+)[.](tmpfile|content-type)} $att _ file field]} { + # + # File related fields. + # set f [:lookup_form_field -name $file $form_fields] $f $field [string trim [$cc form_parameter $att]] #:msg "[$f name]: [list $f $field [string trim [$cc form_parameter $att]]]" + } else { + # + # Fields related to instance variables. + # + #:log "===== Page get_form_data calls lookup_form_field -name $att" set f [:lookup_form_field -name $att $form_fields] set value [$f value [string trim [$cc form_parameter $att]]] #:msg "value of $att ($f) = '$value' exists=[$cc exists_form_parameter $att]"