I think I've got GC to work with multiple subsites.
First: Mount GC in the subsite that I want
- go to /subsite1/admin/site-map
- add a folder under /subsite1, name it gc
- click mount
- scroll down until you see the Main site's general comments package and click on it
Second: fix the proc that figures out which general-comments package to use
in general-comments-procs.tcl, replace the general_comments_package_url proc with this one:
ad_proc -public general_comments_package_url {
{-url "/"}
} {
Returns a url pointing to the mounted general-comments package.
Uses util_memoize for caching.
} {
# find the closest subsite
set subsite_node_id [site_node::closest_ancestor_package -url $url \
-package_key acs-subsite \
-include_self \
-element node_id]
# loop upwards until we find a gc package
set gc_url ""
while { [empty_string_p $gc_url] } {
set gc_url [site_node::get_children -package_key general-comments \
-node_id $subsite_node_id]
set subsite_node_id [site_node::closest_ancestor_package -url $url \
-package_key "acs-subsite" \
-include_self \
-element node_id]
# vk: need to check if we go into infinite loop here
}
return $gc_url
}
This proc now takes a parameter (url) and finds the closest GC package url.
Third. go through and change any place that calls general_comments_package_url to add a parameter passing in the current url. There are a few in general-comments-procs.tcl, 1 in general-comments/www/test.tcl and 1 in lars-blogger/www/entry-chunk.tcl. There may be others, so do a grep search.
I'm not sure if this is the best way to do this, but it seems to work so far.