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.542.2.86 -r1.542.2.87 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 25 Sep 2020 09:30:55 -0000 1.542.2.86 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 27 Sep 2020 11:26:08 -0000 1.542.2.87 @@ -3347,9 +3347,10 @@ if {$source_item_id ne ""} { set source [FormPage get_instance_from_db -item_id $source_item_id] $f copy_content_vars -from_object $source - set name "[::xowiki::autoname new -parent_id $source_item_id -name ${:name}]" - ::$package_id get_lang_and_name -name $name lang name - $f set name $name + #set name "[::xowiki::autoname new -parent_id $source_item_id -name ${:name}]" + #::$package_id get_lang_and_name -name $name lang name + #$f set name $name + #ns_log notice "FINAL NAME <$name>" #:msg nls=[$f nls_language],source-nls=[$source nls_language] } foreach {att value} $default_variables { @@ -3394,7 +3395,7 @@ return [:substitute_markup $html] } PlainPage instproc set_content {text} { - :text $text + set :text $text } PlainPage instproc substitute_markup {raw_content} { @@ -3822,6 +3823,14 @@ } } + FormPage instproc set_content {text} { + if {$text eq ""} { + set :text $text + } else { + next + } + } + PageInstance ad_instproc get_from_template {var {default ""}} { Get a property from the parent object (template). The parent object might by either an ::xowiki::Form or an ::xowiki::FormPage 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.73 -r1.368.2.74 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 25 Sep 2020 08:53:59 -0000 1.368.2.73 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 27 Sep 2020 11:26:08 -0000 1.368.2.74 @@ -326,7 +326,7 @@ } } - # load the instance attributes from the form parameters + # Load the instance attributes from the form parameters set instance_attributes [list] foreach {_att _value} [::xo::cc get_all_form_parameter] { if {[string match _* $_att]} continue @@ -371,6 +371,32 @@ :log "FINAL publish_status $publish_status" } + # + # Provide "p.configure" hook to programmatically configure pages + # + if {[:exists_query_parameter p.configure]} { + set configure_method [:query_parameter p.configure:wordchar] + if {[$f procsearch configure_page=$configure_method] ne ""} { + #ns_log notice "call [$f procsearch configure_page=$configure_method] // [$f info class]" + $f configure_page=$configure_method $name + } else { + ns_log notice "cannot find configure_page=$configure_method on [$f info precedence]" + } + } + + # + # Provide "p.source" hook to configure pages by copying variables + # from other pages (e.g. sitewide pages) + # + set source_item_id 0 + if {[:exists_query_parameter p.source]} { + set source_page [:query_parameter p.source:token] + set source_item_id [::${:package_id} lookup -use_site_wide_pages true -name $source_page] + } + if {$source_item_id == 0} { + set source_item_id [:query_parameter source_item_id:integer ""] + } + ::xo::Package require $fp_package_id set f [:create_form_page_instance \ -name $name \ @@ -379,12 +405,12 @@ -package_id $fp_package_id \ -default_variables $default_variables \ -instance_attributes $instance_attributes \ - -source_item_id [:query_parameter source_item_id:integer ""]] + -source_item_id $source_item_id] if {$publish_status ne "" && $publish_status in {"production" "ready" "live" "expired"}} { $f publish_status $publish_status } - + if {$name eq ""} { $f save_new } else { @@ -398,16 +424,17 @@ $f save } } + $f notification_notify foreach var {return_url:localurl template_file title detail_link:localurl text} { regexp {^([^:]+):?} $var . key if {[:exists_query_parameter $key]} { set $key [:query_parameter $var] - :log "set instance var from queray param '$key' -> '[set $key]'" + :log "set instance var from query param '$key' -> '[set $key]'" } } - + if {[info exists template_file]} { # # strip the leading "/" added by ns_normalizepath.