application_group::closest_ancestor_application_group_site_node (public)

 application_group::closest_ancestor_application_group_site_node \
    [ -url url ] [ -node_id node_id ] [ -include_self ]

Defined in packages/acs-subsite/tcl/application-group-procs.tcl

Starting with the node with the given node_id (or URL), climb up the site map and return the node of the first non null application group

Switches:
-url (optional)
The URL of the node to start from. You must provide either URL or node_id. An empty URL is taken to mean the main site.
-node_id (optional)
The id of the node to start from. Takes precedence over any provided URL.
-include_self (optional, boolean)
If true, include the current package in the search
Returns:
The node of the first non-null application group in array get format.
Author:
Peter Marklund, Dave Bauer

Partial Call Graph (max 5 caller/called nodes):
%3 test_subsite_api subsite_api (test acs-subsite) application_group::closest_ancestor_application_group_site_node application_group::closest_ancestor_application_group_site_node test_subsite_api->application_group::closest_ancestor_application_group_site_node application_group::group_id_from_package_id application_group::group_id_from_package_id (public) application_group::closest_ancestor_application_group_site_node->application_group::group_id_from_package_id site_node::get site_node::get (public) application_group::closest_ancestor_application_group_site_node->site_node::get site_node::get_url site_node::get_url (public) application_group::closest_ancestor_application_group_site_node->site_node::get_url application_group::closest_ancestor_element application_group::closest_ancestor_element (public) application_group::closest_ancestor_element->application_group::closest_ancestor_application_group_site_node

Testcases:
subsite_api
Source code:
    # Make sure we have a URL to work with
    if { $url eq "" } {
          if { $node_id eq "" } {
              set url "/"
          } else {
              set url [site_node::get_url -node_id $node_id]
          }
    }

    set group_id ""
    while {$group_id eq "" && $url ne ""} {

        if { $include_self_p } {
            array set node_array [site_node::get -url $url]
            set group_id [application_group::group_id_from_package_id  -package_id $node_array(package_id)  -no_complain]
        }

        set include_self_p 1

        # move up a level
        set url [string trimright $url /]
        set url [string range $url 0 [string last / $url]]
    }
    if {$group_id eq ""} {
        array unset -no_complain node_array
    }
    set node_array(application_group_id) $group_id

    return [array get node_array]
XQL Not present:
Generic
PostgreSQL XQL file:
packages/acs-subsite/tcl/application-group-procs-postgresql.xql

Oracle XQL file:
packages/acs-subsite/tcl/application-group-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: