Forum OpenACS Development: ad_context_bar starting with current subsite

Not sure if this is a bug. I want the context bar not to start at the main site, but the current subsite. This means:

"my_subsite:forums" instead of "mainsite:my_subsite:forums"

My idea (in default-master.tcl):

set context_bar [ad_context_bar -from_node [site_node_closest_ancestor_package "acs-subsite"]]

alternatively

set context_bar [ad_context_bar -node_id [site_node::closest_ancestor_package -package_key "acs-subsite"]]

Result: Still starts at the main site (which, I agree is a subsite, but I assumed that closest_ancestor_package would resolv to the current node_id if it matches the package_key).

Help me please ....

Collapse
Posted by Tom Ayles on

Hi Malte,
I think your problem is that you're passing in the package ID (which is what closest_ancestor_package returns) rather than the node ID. I have a master template which achieves the functionality you want. The relevant code snippet is below (I think this was originally from group-master.tcl in acs-subsite):

# Find the subsite we belong to
array set subsite_sitenode [site_node::get_from_object_id \
                                -object_id [ad_conn subsite_id]]
set subsite_url $subsite_sitenode(url)
set subsite_node_id $subsite_sitenode(node_id)
set subsite_name $subsite_sitenode(instance_name)

# Context bar
if { [template::util::is_nil no_context_p] } {
    if { ![template::util::is_nil context] } {
        set context_bar [eval ad_context_bar -from_node $subsite_node_id $context]
    }
    if [template::util::is_nil context_bar] { 
        set context_bar [ad_context_bar -from_node $subsite_node_id]
    }
} else {
    set context_bar {}
}

HTH, Tom

Collapse
Posted by Vamsee Kanakala on
Hi Tom,

      What if I want the context bar to start from forums? That is, I want it to be in the form of:

community > forums > forum1 > message1 > reply1...

      I tried improvising on your subsite example, but it wouldn't work. Instead of the name of the community, I'm getting "Main Site"(which is the nearest subsite). How can I solve this?

Thanks,
Vamsee.