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.137 -r1.138 --- openacs-4/packages/xowiki/tcl/includelet-procs.tcl 21 Apr 2010 18:27:07 -0000 1.137 +++ openacs-4/packages/xowiki/tcl/includelet-procs.tcl 23 Apr 2010 11:29:08 -0000 1.138 @@ -3176,9 +3176,10 @@ # "Package require" is just a part of "Package initialize" creating # the package object if needed # - ::xowiki::Package require [$form package_id] + set form_package_id [$form logical_package_id] + ::xowiki::Package require $form_package_id set obj [form-menu-button-$button new -volatile -package_id $package_id \ - -base [[$form package_id] pretty_link [$form name]] -form $form] + -base [$form_package_id pretty_link [$form name]] -form $form] if {[info exists return_url]} {$obj return_url $return_url} lappend button_objs $obj } Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.199 -r1.200 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 18 Apr 2010 21:10:37 -0000 1.199 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 23 Apr 2010 11:29:08 -0000 1.200 @@ -275,14 +275,15 @@ # with e.g. //../image/* set package_prefix [my package_url] } - #my msg "lang=$lang, default_lang=$default_lang, name=$name, parent_id=$parent_id" + #my msg "lang=$lang, default_lang=$default_lang, name=$name, parent_id=$parent_id, package_prefix=$package_prefix" if {$parent_id eq -100} { return ${host}${package_prefix}$query$anchor } set encoded_name [string map [list %2d - %5f _ %2e .] [ns_urlencode $name]] set folder [my folder_path -parent_id $parent_id] + #my msg "folder_path = $folder" if {$folder ne ""} { # if folder has a different language than the content, we have to provide a prefix.... @@ -602,8 +603,8 @@ Package instproc make_form_link {-form -parent_id -name -nls_language -return_url} { my instvar id # use the same instantiate_forms as everywhere; TODO: will go to a different namespace - set form_id [::xowiki::Weblog instantiate_forms -forms $form -package_id $id] - if {$form_id != 0} { + set form_id [lindex [::xowiki::Weblog instantiate_forms -forms $form -package_id $id] 0] + if {$form_id ne ""} { ::xo::db::CrClass get_instance_from_db -item_id $form_id set form_link [my pretty_link -parent_id [$form_id parent_id] $form] return [my make_link -with_entities 0 -link $form_link $form_id \ @@ -765,6 +766,7 @@ set page [::xowiki::Package get_site_wide_page -name en:$object] if {$page ne ""} { + $page set_resolve_context -package_id [my id] -parent_id [my folder_id] return $page } @@ -1088,6 +1090,7 @@ if {!$(item_id) && $use_site_wide_pages} { set page [::xowiki::Package get_site_wide_page -name $(prefix):$(stripped_name)] if {$page ne ""} { + $page set_resolve_context -package_id [my id] -parent_id $parent_id return $page } } 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.387 -r1.388 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 15 Apr 2010 10:28:26 -0000 1.387 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 23 Apr 2010 11:29:08 -0000 1.388 @@ -887,6 +887,27 @@ return $name } + Page instproc set_resolve_context {-package_id:required -parent_id:required} { + my set logical_parent_id $parent_id + my set logical_package_id $package_id + } + + Page instproc logical_parent_id {} { + if {[my exists logical_parent_id]} { + return [my set logical_parent_id] + } else { + return [my parent_id] + } + } + + Page instproc logical_package_id {} { + if {[my exists logical_package_id]} { + return [my set logical_package_id] + } else { + return [my package_id] + } + } + # Page instproc init {} { # my log "--W " # ::xo::show_stack @@ -972,7 +993,7 @@ Page instproc instantiate_includelet {arg} { # we want to use package_id as proc-local variable, since the # cross package reference might alter it locally - set package_id [my package_id] + set package_id [my logical_package_id] # do we have a wellformed list? if {[catch {set page_name [lindex $arg 0]} errMsg]} { 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.250 -r1.251 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 13 Apr 2010 11:22:28 -0000 1.250 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 23 Apr 2010 11:29:08 -0000 1.251 @@ -92,9 +92,11 @@ # wiki pages (see include), since it contains full framing, etc. my instvar item_id ::xowiki::Page set recursion_count 0 - set page_package_id [my package_id] + set page_package_id [my logical_package_id] set context_package_id [::xo::cc package_id] + #my msg "page_package_id=$page_package_id, context_package_id=$context_package_id" + set template_file [my query_parameter "template_file" \ [::$context_package_id get_parameter template_file view-default]] @@ -106,7 +108,7 @@ # make use of the same templating machinery below. if {$content eq ""} { set content [my render] - #my log "--after render" + #my msg "--after render" } set footer [my htmlFooter -content $content] @@ -1892,8 +1894,7 @@ if {[my exists_query_parameter "package_instance"]} { set package_instance [my query_parameter "package_instance"] # - # Initialize the target package and set the local - # variable package_id. + # Initialize the target package and set the variable package_id. # if {[catch { ::xowiki::Package initialize \ @@ -1905,6 +1906,12 @@ "Page '[my name]' invalid provided package instance=$package_instance
$errorMsg
"] } if {![my exists parent_id]} {my parent_id [$package_id folder_id]} + } else { + set logical_package_id [my logical_package_id] + if {$logical_package_id ne $original_package_id} { + ::xowiki::Package require $logical_package_id + set package_id $logical_package_id + } } # @@ -1919,8 +1926,8 @@ # To create form_pages in different places than the form, provide # fp_parent_id and fp_package_id. - set fp_parent_id [my query_parameter "fp_parent_id" [my set parent_id]] - set fp_package_id [my query_parameter "fp_package_id" [my set package_id]] + set fp_parent_id [my query_parameter "fp_parent_id" [my logical_parent_id]] + set fp_package_id [my query_parameter "fp_package_id" [my logical_package_id]] set f [my create_form_page_instance \ -name $name \ @@ -1948,6 +1955,7 @@ [export_vars -base [$package_id pretty_link -parent_id [$f parent_id] [$f name]] \ [list [list m $view_method] return_url template_file title detail_link text]] + set package_od $original_package_id }