Index: openacs-4/packages/xowf/tcl/test-item-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test-item-procs.tcl,v
diff -u -r1.7.2.261 -r1.7.2.262
--- openacs-4/packages/xowf/tcl/test-item-procs.tcl 15 Dec 2022 19:28:21 -0000 1.7.2.261
+++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 10 Jan 2023 13:17:21 -0000 1.7.2.262
@@ -6838,6 +6838,7 @@
#
# @result list of dicts describing the form fields.
#
+ set describe_infos {}
if {[$form_obj property item_type] eq "Composite"} {
#
@@ -6851,11 +6852,16 @@
set form_objs [[$form_obj package_id] instantiate_forms \
-forms [join [split $selection \n] |] \
-default_lang en]
- return [join [lmap form_obj $form_objs {:describe_form -asHTML=$asHTML -field_name $field_name $form_obj}]]
+
+ set describe_infos [join [lmap form_obj_tmp $form_objs {
+ set describe_info [join [:describe_form -field_name $field_name $form_obj_tmp]]
+ list [lappend describe_info is_composite_subquestion 1]
+ }]]
+ set fc {selection:form_page}
+ } else {
+ set fc [$form_obj property form_constraints]
}
- set fc [$form_obj property form_constraints]
-
#
# We might be willing in the future to get the full set of all
# options, i.e. remove "show_max" constraints etc.
@@ -6867,12 +6873,12 @@
set form_fields [$form_obj create_form_fields_from_form_constraints \
-lookup $fc]
- set describe_infos [lmap form_field $form_fields {
+ set ff_describe_infos [lmap form_field $form_fields {
$form_field describe -field_name $field_name
}]
#ns_log notice "describe_form [$form_obj name]: $question_infos"
- set describe_infos [:pretty_nr_alternatives $describe_infos]
+ set describe_infos [:pretty_nr_alternatives "$ff_describe_infos $describe_infos"]
if {!$asHTML} {
#ns_log notice "OOO [$form_obj name] early exit $describe_infos"
return $describe_infos
@@ -7166,35 +7172,40 @@
set chunks {}
foreach form_obj $form_objs {
- set chunk [lindex [:describe_form $form_obj] 0]
- set structure ""
- foreach att {
- question_structure choice_options sub_questions
- } {
- if {[dict exists $chunk $att]} {
- append structure [dict get $chunk $att]
- break
+ foreach chunk [:describe_form $form_obj] {
+ set structure ""
+ foreach att {
+ question_structure choice_options sub_questions
+ } {
+ if {[dict exists $chunk $att]} {
+ append structure [dict get $chunk $att]
+ break
+ }
}
+ if {[dict exists $chunk available_pool_items]} {
+ append structure \
+ " " [dict get $chunk available_pool_items] " " #xowf.questions# \
+ " " ([dict get $chunk available_pool_item_stats])
+ }
+ if {[dict exists $chunk nrcorrect]} {
+ append structure " " [:pretty_ncorrect [dict get $chunk nrcorrect]]
+ }
+ if {[dict exists $chunk is_composite_subquestion]} {
+ dict set chunk title_value " [ns_quotehtml [dict get $chunk question_title]]"
+ } else {
+ if {[$obj state] in {done submission_review}
+ && ![dict exists $chunk available_pool_items]
+ } {
+ dict set chunk title_value [subst {
+ [ns_quotehtml [$form_obj title]]
+ }]
+ } else {
+ dict set chunk title_value [ns_quotehtml [$form_obj title]]
+ }
+ }
+ dict set chunk structure $structure
+ lappend chunks $chunk
}
- if {[dict exists $chunk available_pool_items]} {
- append structure \
- " " [dict get $chunk available_pool_items] " " #xowf.questions# \
- " " ([dict get $chunk available_pool_item_stats])
- }
- if {[dict exists $chunk nrcorrect]} {
- append structure " " [:pretty_ncorrect [dict get $chunk nrcorrect]]
- }
- if {[$obj state] in {done submission_review}
- && ![dict exists $chunk available_pool_items]
- } {
- dict set chunk title_value [subst {
- [ns_quotehtml [$form_obj title]]
- }]
- } else {
- dict set chunk title_value [ns_quotehtml [$form_obj title]]
- }
- dict set chunk structure $structure
- lappend chunks $chunk
}
@@ -7633,6 +7644,9 @@
::xowiki::formfield::file {
set type Upload
}
+ ::xowiki::formfield::form_page {
+ set type Composite
+ }
default {
set type [:info class]
@@ -7641,6 +7655,7 @@
}
dict set d type $type
#ns_log notice "describe [:info class] [${:object} name] -> $d"
+ dict set d question_title [${:object} title]
return $d
}