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 -N -r1.199.2.2 -r1.199.2.3 --- openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 26 Nov 2008 23:05:41 -0000 1.199.2.2 +++ openacs-4/packages/xowiki/tcl/xowiki-www-procs.tcl 8 Jan 2009 15:38:33 -0000 1.199.2.3 @@ -321,15 +321,25 @@ set action_vars [expr {$new ? "{edit-new 1} object_type return_url" : "{m edit} return_url"}] #my log "--formclass=[$object_type getFormClass -data [self]] ot=$object_type" - # Use always the name of the frist xowiki instance (required for sub-packages, - # which might not have the script dir) - set first_instance_id [::xowiki::Package first_instance -party_id [::xo::cc user_id] -privilege read] - if {$first_instance_id ne ""} { - ::xowiki::Package require $first_instance_id - set folder_spec [list script_dir [$first_instance_id package_url]] - #my msg using-[$first_instance_id package_url]-for-[::xo::cc user_id] + # + # Determine the package_id of some mounted xowiki instance to find + # the directory + URL, from where the scripts called from xinha + # can be used. + if {[$package_id info class] eq "::xowiki::Package"} { + # The actual instance is a plain xowiki instance, we can use it + set folder_spec [list script_dir [$package_id package_url]] + } else { + # The actual instance is not a plain xowiki instance, so, we try + # to find one, where the current user has at least read + # permissions. This act is required for sub-packages, which + # might not have the script dir. + set first_instance_id [::xowiki::Package first_instance -party_id [::xo::cc user_id] -privilege read] + if {$first_instance_id ne ""} { + ::xowiki::Package require $first_instance_id + set folder_spec [list script_dir [$first_instance_id package_url]] + } } - + if {$fs_folder_id ne ""} {lappend folder_spec folder_id $fs_folder_id} [$object_type getFormClass -data [self]] create ::xowiki::f1 -volatile \