Index: openacs-4/packages/xowf/xowf.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v diff -u -N -r1.12.2.25 -r1.12.2.26 --- openacs-4/packages/xowf/xowf.info 8 Dec 2020 19:53:01 -0000 1.12.2.25 +++ openacs-4/packages/xowf/xowf.info 15 Dec 2020 19:22:55 -0000 1.12.2.26 @@ -10,16 +10,16 @@ t xowf - + Gustaf Neumann XoWiki Content Flow - an XoWiki based workflow system implementing state-based behavior of wiki pages and forms 2017-08-06 WU Vienna BSD-Style 2 - - + + Index: openacs-4/packages/xowf/lib/inclass-exam-answer.wf =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/lib/Attic/inclass-exam-answer.wf,v diff -u -N -r1.1.2.22 -r1.1.2.23 --- openacs-4/packages/xowf/lib/inclass-exam-answer.wf 7 Oct 2020 13:45:13 -0000 1.1.2.22 +++ openacs-4/packages/xowf/lib/inclass-exam-answer.wf 15 Dec 2020 19:22:55 -0000 1.1.2.23 @@ -201,8 +201,24 @@ # # Load the form. # - set form_obj [::xowf::test_item::question_manager nth_question_obj $parent_obj $position] + set form_info [::xowf::test_item::question_manager nth_question_form \ + -with_numbers \ + -with_title=false \ + -titleless_form \ + -with_minutes \ + -position $position \ + -item_nr $item_nr \ + $parent_obj] + + set form_obj [::xowiki::Form new \ + -destroy_on_cleanup \ + -name en:one_question \ + -title [dict get [lindex [dict get $form_info title_infos] 0] full_title] \ + -form [list [dict get $form_info form] text/html] \ + -text {} \ + -anon_instances t \ + -form_constraints [dict get $form_info form_constraints]] # # Update IP address each time the form is loaded. # @@ -213,7 +229,7 @@ # # Update the title of the page # - :set_title $obj -position $position -item_nr $item_nr -for_question -with_minutes + :set_title $obj -position $position -item_nr $item_nr -for_question -with_minutes -form_info $form_info # # Disallow paste if required @@ -264,16 +280,10 @@ -item_nr:integer {-for_question:switch false} {-with_minutes:switch false} + {-form_info ""} } { set parent_obj [::xo::db::CrClass get_instance_from_db -item_id [$obj parent_id]] if {$for_question && [$obj state] in {initial working}} { - set form_info [::xowf::test_item::question_manager nth_question_form \ - -with_numbers \ - -with_title=false \ - -with_minutes=$with_minutes \ - -position $position \ - -item_nr $item_nr \ - $parent_obj] set title_info [lindex [dict get $form_info title_infos] 0] set titleString [dict get $title_info full_title] set title [list [string trim $titleString]] @@ -316,14 +326,14 @@ template::set_css_property -class footer -property display -value none template::set_css_property -class community_title -property display -value none } - #template::set_css_property -querySelector ".context a" -property pointerEvents -value none + #template::set_css_property -querySelector ".context a" -property pointerEvents -value none template::set_css_property -class pagetitle -property display -value none template::set_css_property -class sidebar -property display -value none } # # Form loader for summary (shows all submission data of a user) # -# This form loader is also called indirectly by www-print-answers of +# This form loader is e.g. called indirectly by www-print-answers of # oneline-exam.wf # :proc summary_form {ctx form_title} { 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 -N -r1.7.2.95 -r1.7.2.96 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 8 Dec 2020 15:37:26 -0000 1.7.2.95 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 15 Dec 2020 19:22:55 -0000 1.7.2.96 @@ -674,7 +674,7 @@ dict set fc_dict options $options dict set fc_dict answer $answer dict set fc_dict grading exact - + append form \ "
\n" \ "
\n" \ @@ -801,7 +801,7 @@ set autoCorrectSpec "" } #:msg autoCorrectSpec=$autoCorrectSpec - # {correct {boolean_checkbox,horizontal=true,label=#xowf.Correct#,form_item_wrapper_CSSclass=form-inline}} + # {correct {boolean_checkbox,horizontal=true,label=#xowf.Correct#,form_item_wrapper_CSSclass=form-inline}} :create_components [subst { {text {$widget,height=50px,label=#xowf.choice_option#,plugins=OacsFs}} {correct {boolean_checkbox,horizontal=true,label=#xowf.Correct#,form_item_wrapper_CSSclass=form-inline}} @@ -2647,6 +2647,8 @@ {-with_title:switch false} {-with_minutes:switch false} {-with_points:switch false} + {-titleless_form:switch false} + {-obj:object} form_objs } { set full_form {} @@ -2679,8 +2681,23 @@ append title " - [:points_string $form_obj]" } - append full_form "

$title

\n" - append full_form [$form_obj property form] \n + if {!$titleless_form} { + append full_form \ + "

$title

\n" + } + # + # Resolve links in the context of the resolve_object + # + append full_form \ + [$obj substitute_markup \ + -context_obj $form_obj \ + [$form_obj property form]] + + #append full_form \ + # [$form_obj substitute_markup -context_obj $form_obj [$form_obj property form]] + + #ns_log notice "FORM=$full_form" + lappend title_infos [list full_title $title \ title $form_title \ minutes $minutes \ @@ -2821,6 +2838,7 @@ -with_minutes=$with_minutes \ -with_points=$with_points \ {*}$extra_flags \ + -obj $obj \ $form_objs] } @@ -2939,6 +2957,7 @@ {-item_nr:integer} {-with_numbers:switch false} {-with_title:switch false} + {-titleless_form:switch false} {-with_minutes:switch false} obj:object } { @@ -2963,8 +2982,10 @@ } return [:question_info \ -with_title=$with_title \ + -titleless_form=$titleless_form \ -with_minutes=$with_minutes \ {*}$extra_flags \ + -obj $obj \ $form_objs] } Index: openacs-4/packages/xowiki/xowiki.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/xowiki.info,v diff -u -N -r1.180.2.52 -r1.180.2.53 --- openacs-4/packages/xowiki/xowiki.info 23 Nov 2020 21:00:53 -0000 1.180.2.52 +++ openacs-4/packages/xowiki/xowiki.info 15 Dec 2020 19:22:55 -0000 1.180.2.53 @@ -10,7 +10,7 @@ t xowiki - + Gustaf Neumann A xotcl-based enterprise wiki system with multiple object types 2017-08-06 @@ -55,7 +55,7 @@ BSD-Style 2 - + 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 -N -r1.542.2.95 -r1.542.2.96 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 11 Dec 2020 13:54:46 -0000 1.542.2.95 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 15 Dec 2020 19:22:55 -0000 1.542.2.96 @@ -2612,38 +2612,55 @@ } - Page instproc substitute_markup {content} { + Page instproc substitute_markup {{-context_obj ""} content} { if {${:mime_type} eq "text/enhanced"} { set content [ad_enhanced_text_to_html $content] } - if {![:do_substitutions]} {return $content} + if {!${:do_substitutions}} { + return $content + } # # The provided content and the returned result are strings # containing HTML (unless we have other rich-text encodings). # - # First get the right regular expression definitions + # First get the potentially class sepcific regular expression + # definitions. # set baseclass [expr {[[:info class] exists RE] ? [:info class] : [self class]}] $baseclass instvar RE markupmap #:log "-- baseclass for RE = $baseclass" # - # secondly, iterate line-wise over the text + # Secondly, iterate line-wise over the text. # set output "" set l "" - foreach l0 [split $content \n] { - append l [string map $markupmap(escape) $l0] - if {[string first \{\{ $l] > -1 && [string first \}\} $l] == -1} {append l " "; continue} - set l [:regsub_eval $RE(anchor) $l {:anchor "\1"} "1"] - set l [:regsub_eval $RE(div) $l {:div "\1"}] - set l [:regsub_eval $RE(include) $l {:include_content "\1" "\2"}] - #regsub -all $RE(clean) $l {\1} l - regsub -all $RE(clean2) $l { \1} l - set l [string map $markupmap(unescape) $l] - append output $l \n - set l "" + + try { + if {$context_obj ne ""} { + :set_resolve_context \ + -package_id [$context_obj package_id] -parent_id [$context_obj item_id] + } + + foreach l0 [split $content \n] { + append l [string map $markupmap(escape) $l0] + if {[string first \{\{ $l] > -1 && [string first \}\} $l] == -1} {append l " "; continue} + set l [:regsub_eval $RE(anchor) $l {:anchor "\1"} "1"] + set l [:regsub_eval $RE(div) $l {:div "\1"}] + set l [:regsub_eval $RE(include) $l {:include_content "\1" "\2"}] + #regsub -all $RE(clean) $l {\1} l + regsub -all $RE(clean2) $l { \1} l + set l [string map $markupmap(unescape) $l] + append output $l \n + set l "" + } + } on error {errorMsg} { + error $errorMsg + } finally { + if {$context_obj ne ""} { + :reset_resolve_context + } } #:log "--substitute_markup returns $output" return $output @@ -3422,24 +3439,36 @@ set :text $text } - PlainPage instproc substitute_markup {raw_content} { + PlainPage instproc substitute_markup {{-context_obj ""} raw_content} { # # The provided text is a raw text that is transformed into HTML # markup for links etc. # [self class] instvar RE markupmap - if {![:do_substitutions]} { + if {!${:do_substitutions}} { return $raw_content } set html "" - foreach l [split $raw_content \n] { - set l [string map $markupmap(escape) $l] - set l [:regsub_eval $RE(anchor) $l {:anchor "\1"}] - set l [:regsub_eval $RE(div) $l {:div "\1"}] - set l [:regsub_eval $RE(include) $l {:include_content "\1" ""}] - #regsub -all $RE(clean) $l {\1} l - set l [string map $markupmap(unescape) $l] - append html $l \n + try { + if {$context_obj ne ""} { + :set_resolve_context \ + -package_id [$context_obj package_id] -parent_id [$context_obj item_id] + } + foreach l [split $raw_content \n] { + set l [string map $markupmap(escape) $l] + set l [:regsub_eval $RE(anchor) $l {:anchor "\1"}] + set l [:regsub_eval $RE(div) $l {:div "\1"}] + set l [:regsub_eval $RE(include) $l {:include_content "\1" ""}] + #regsub -all $RE(clean) $l {\1} l + set l [string map $markupmap(unescape) $l] + append html $l \n + } + } on error {errorMsg} { + error $errorMsg + } finally { + if {$context_obj ne ""} { + :reset_resolve_context + } } return $html } @@ -4084,7 +4113,7 @@ # #:log "-- text='${:text}'" if {[lindex ${:text} 0] ne ""} { - :do_substitutions 0 + set :do_substitutions 0 set html ""; set mime "" lassign ${:text} html mime set content [:substitute_markup $html]