subsite::auto_mount_application (public)

 subsite::auto_mount_application [ -instance_name instance_name ] \
    [ -pretty_name pretty_name ] [ -node_id node_id ] package_key

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

Mounts a new instance of the application specified by package_key beneath node_id. This proc makes sure that the instance_name (the name of the new node) is unique before invoking site_node::instantiate_and_mount.

Switches:
-instance_name
(optional)
The name to use for the url in the site-map. Defaults to the package_key plus a possible digit to serve as a unique identifier (e.g. news-2)
-pretty_name
(optional)
The english name to use for the site-map and for things like context bars. Defaults to the name of the object mounted at this node + the package pretty name (e.g. Intranet News)
-node_id
(optional)
Defaults to [ad_conn node_id]
Parameters:
package_key
Returns:
The package id of the newly mounted package
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
2001-02-28
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 test_subsite_api subsite_api (test acs-subsite) subsite::auto_mount_application subsite::auto_mount_application test_subsite_api->subsite::auto_mount_application acs_object_name acs_object_name (public) subsite::auto_mount_application->acs_object_name ad_conn ad_conn (public) subsite::auto_mount_application->ad_conn db_string db_string (public) subsite::auto_mount_application->db_string site_node::get_from_node_id site_node::get_from_node_id (public) subsite::auto_mount_application->site_node::get_from_node_id site_node::instantiate_and_mount site_node::instantiate_and_mount (public) subsite::auto_mount_application->site_node::instantiate_and_mount packages/acs-subsite/www/admin/site-map/auto-mount.tcl packages/acs-subsite/ www/admin/site-map/auto-mount.tcl packages/acs-subsite/www/admin/site-map/auto-mount.tcl->subsite::auto_mount_application packages/edit-this-page/www/etp-create-extlink.tcl packages/edit-this-page/ www/etp-create-extlink.tcl packages/edit-this-page/www/etp-create-extlink.tcl->subsite::auto_mount_application packages/edit-this-page/www/etp-subtopic-create.tcl packages/edit-this-page/ www/etp-subtopic-create.tcl packages/edit-this-page/www/etp-subtopic-create.tcl->subsite::auto_mount_application

Testcases:
subsite_api
Source code:
    if { $node_id eq "" } {
        set node_id [ad_conn node_id]
    }

    set ctr 2
    if { $instance_name eq "" } {
        # Default the instance name to the package key. Add a number,
        # if necessary, until we find a unique name
        set instance_name $package_key
        while { [subsite::instance_name_exists_p $node_id $instance_name] } {
            set instance_name "$package_key-$ctr"
            incr ctr
        }
    }

    if { $pretty_name eq "" } {
        # Get the name of the object mounted at this node
        set package_name [db_string get_package_name {
            select pretty_name from apm_package_types
            where package_key = :package_key
        }]
        set node [site_node::get_from_node_id -node_id $node_id]
        set object_name [acs_object_name [dict get $node object_id]]
        set pretty_name "$object_name $package_name"
        if { $ctr > 2 } {
            # This was a duplicate pkg name... append the ctr used in the instance name
            append pretty_name " [expr {$ctr - 1}]"
        }
    }

    return [site_node::instantiate_and_mount -parent_node_id $node_id  -node_name $instance_name  -package_name $pretty_name  -package_key $package_key]
XQL Not present:
Generic
PostgreSQL XQL file:
packages/acs-subsite/tcl/subsite-procs-postgresql.xql

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

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