Index: openacs-4/packages/xowiki/tcl/form-field-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/form-field-procs.tcl,v diff -u -r1.143 -r1.144 --- openacs-4/packages/xowiki/tcl/form-field-procs.tcl 2 Apr 2009 12:12:23 -0000 1.143 +++ openacs-4/packages/xowiki/tcl/form-field-procs.tcl 3 Apr 2009 14:58:15 -0000 1.144 @@ -519,7 +519,7 @@ } FormField instproc answer_is_correct {} { - #my msg "[my name] ([my info class]): value=[my value], answer=[expr {[my exists answer]?[my set answer]:{NONE}}]" + my msg "[my name] ([my info class]): value=[my value], answer=[expr {[my exists answer]?[my set answer]:{NONE}}]" if {[my exists correct_when]} { set op [lindex [my correct_when] 0] if {[my procsearch answer_check=$op] ne ""} { @@ -1485,7 +1485,7 @@ set package_id [[my object] package_id] set form_objs [::xowiki::Weblog instantiate_forms \ -default_lang [[my object] lang] \ - -entries_of $form_name -package_id $package_id] + -forms $form_name -package_id $package_id] #set form_obj [[my object] resolve_included_page_name $form_name] if {$form_objs eq ""} {error "Cannot lookup Form '$form_name'"} Index: openacs-4/packages/xowiki/tcl/includelet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/includelet-procs.tcl,v diff -u -r1.101 -r1.102 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 27 Mar 2009 09:06:48 -0000 1.101 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 3 Apr 2009 14:58:15 -0000 1.102 @@ -2932,6 +2932,7 @@ return_url {label_suffix ""} } + form-menu-button instproc render {} { my instvar package_id base form method return_url label_suffix link if {![info exists link]} { @@ -3040,13 +3041,16 @@ set return_url [::xo::cc url]?[::xo::cc actual_query] if {![info exists form_item_id]} { - set form_item_id [::xo::db::CrClass lookup -name $form -parent_id [$package_id folder_id]] - if {$form_item_id == 0} {error "Cannot lookup page $form"} + set form_item_ids [::xowiki::Weblog instantiate_forms -forms $form -package_id $package_id] + } else { + set form_item_ids [list $form_item_id] } - set form_item [::xo::db::CrClass get_instance_from_db -item_id $form_item_id] - set form_constraints [$form_item get_form_constraints -trylocal true] - #my msg fc=[$form_item get_form_constraints] + set form_constraints "" + foreach form_item $form_item_ids { + append form_constraints [$form_item get_form_constraints -trylocal true] \n + } + my msg fc=$form_constraints # load table properties; order_by won't work due to comma, but solve that later (TODO) set table_properties [::xowiki::PageInstance get_list_from_form_constraints \ @@ -3088,12 +3092,14 @@ if {$_ ne ""} {lappend field_names $_} } - set form_fields [::xowiki::FormPage get_table_form_fields \ - -base_item $form_item \ - -field_names $field_names \ - -form_constraints $form_constraints] - # $form_item show_fields $form_fields - foreach f $form_fields {set __ff([$f name]) $f} + foreach form_item $form_item_ids { + set form_fields [::xowiki::FormPage get_table_form_fields \ + -base_item $form_item \ + -field_names $field_names \ + -form_constraints $form_constraints] + # $form_item show_fields $form_fields + foreach f $form_fields {set __ff([$f name]) $f} + } # if {[info exists __ff(_creation_user)]} {$__ff(_creation_user) label "By User"} @@ -3166,7 +3172,7 @@ } set items [::xowiki::FormPage get_form_entries \ - -base_item_ids $form_item_id \ + -base_item_ids $form_item_ids \ -form_fields $form_fields \ -publish_status $publish_status \ -always_queried_attributes [list _name _last_modified _creation_user] \ @@ -3180,7 +3186,7 @@ } else { # difference to variable items: just the extra_where_clause set base_items [::xowiki::FormPage get_form_entries \ - -base_item_ids $form_item_id \ + -base_item_ids $form_item_ids \ -form_fields $form_fields \ -publish_status $publish_status \ -always_queried_attributes [list _name _last_modified _creation_user] \ @@ -3258,7 +3264,7 @@ # my instvar name set includelet_key "" - foreach var {name form_item_id form publish_states field_names unless} { + foreach var {name form_item_ids form publish_states field_names unless} { if {[info exists $var]} {append includelet_key $var : [set $var] ,} } Index: openacs-4/packages/xowiki/tcl/weblog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/weblog-procs.tcl,v diff -u -r1.41 -r1.42 --- openacs-4/packages/xowiki/tcl/weblog-procs.tcl 12 Feb 2009 15:07:15 -0000 1.41 +++ openacs-4/packages/xowiki/tcl/weblog-procs.tcl 3 Apr 2009 14:58:16 -0000 1.42 @@ -26,10 +26,10 @@ {compute_summary false} } - ::xowiki::Weblog proc instantiate_forms {{-default_lang ""} -entries_of:required -package_id:required} { + ::xowiki::Weblog proc instantiate_forms {{-default_lang ""} -forms:required -package_id:required} { set folder_id [::$package_id folder_id] - set form_items [list] - foreach t [split $entries_of |] { + set form_item_ids [list] + foreach t [split $forms |] { # Entry $t might contain a package prefix set form_item_id [$package_id lookup -default_lang $default_lang -name $t] if {$form_item_id == 0} { @@ -55,9 +55,9 @@ if {![my isobject ::$form_item_id]} { ::xo::db::CrClass get_instance_from_db -item_id $form_item_id } - lappend form_items $form_item_id + lappend form_item_ids $form_item_id } - return $form_items + return $form_item_ids } ::xowiki::Weblog instproc init {} { @@ -131,7 +131,7 @@ # we use a form as a filter my instvar form_items set form_items [::xowiki::Weblog instantiate_forms \ - -entries_of $entries_of \ + -forms $entries_of \ -package_id $package_id] append extra_where_clause " and bt.page_template in ('[join $form_items ',']') and bt.page_instance_id = bt.revision_id " set base_type ::xowiki::FormPage 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.341 -r1.342 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 2 Apr 2009 12:12:23 -0000 1.341 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 3 Apr 2009 14:58:16 -0000 1.342 @@ -1628,8 +1628,11 @@ } set names [list] foreach f $form_fields {lappend names [$f name]} - error "No form field with name $name found\ + my msg "No form field with name $name found\ (available fields: [lsort [array names ::_form_field_names]])" + set f [my create_form_fields_from_form_constraints [list $name:text]] + set $key $f + return $f } Page instproc lookup_cached_form_field { @@ -1955,6 +1958,12 @@ return "" } + #FormPage instproc save args { + # my debug_msg [my set instance attributes] + # my log "IA=[my set instance_attributes]" + # next + #} + FormPage instproc get_form_constraints {{-trylocal false}} { # We define it as a method to ease overloading. #my msg "is_form=[my isform]" 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.226 -r1.227 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 2 Apr 2009 12:12:24 -0000 1.226 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 3 Apr 2009 14:58:16 -0000 1.227 @@ -812,7 +812,7 @@ Get the values from the form and store it as instance attributes. } { - #my msg "get_form_data [self] [my name]" + #my msg "get_form_data [self] [my name] [self args]" set validation_errors 0 set category_ids [list] array set containers [list] @@ -825,6 +825,7 @@ if {![info exists field_names]} { set field_names [$cc array names form_parameter] + #my msg "form-params=[$cc array get form_parameter]" } #my msg "fields $field_names, " @@ -1224,7 +1225,7 @@ # Since we have no form, we create it on the fly # from the template variables and the form field specifications. # - set form "
" + set form "
" set formgiven 0 } else { set formgiven 1 Index: openacs-4/packages/xowiki/www/prototypes/news.page =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/prototypes/news.page,v diff -u -r1.12 -r1.13 --- openacs-4/packages/xowiki/www/prototypes/news.page 13 Sep 2008 19:27:08 -0000 1.12 +++ openacs-4/packages/xowiki/www/prototypes/news.page 3 Apr 2009 14:58:24 -0000 1.13 @@ -25,7 +25,7 @@ # Provide a tailored link for creating new pages in the wiki menu # set forms [::xowiki::Weblog instantiate_forms \ - -entries_of $entries_of \ + -forms $entries_of \ -package_id $package_id] set template_id [lindex $forms 0] set form_link [$package_id pretty_link [$template_id name]]