Index: openacs-4/packages/acs-subsite/www/admin/site-map/package-new.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/site-map/package-new.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-subsite/www/admin/site-map/package-new.tcl 14 Apr 2003 14:02:07 -0000 1.7 +++ openacs-4/packages/acs-subsite/www/admin/site-map/package-new.tcl 14 Apr 2003 15:03:59 -0000 1.8 @@ -30,17 +30,19 @@ } db_transaction { - set context_id [db_string context_id { - select parent.object_id as context_id - from site_nodes parent, site_nodes child - where child.node_id = :node_id - and parent.node_id = child.parent_id - }] + + # Set the context_id to the object_id of the parent node # If the parent node didn't have anything mounted, use the current package_id as context_id - if { [empty_string_p $context_id] } { - set context_id [ad_conn package_id] - } + set context_id [ad_conn package_id] + array set node [site_node::get -node_id $node_id] + if { ![empty_string_p $node(parent_id)] } { + array set parent_node [site_node::get -node_id $node(parent_id)] + if { ![empty_string_p $parent_node(object_id)] } { + set context_id $parent_node(object_id) + } + } + if { $new_node_p } { # Create a new node under node_id and mount the package there set package_id [site_node::instantiate_and_mount -package_id $new_package_id \