Index: openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl,v diff -u -r1.1.1.1 -r1.1.1.1.4.1 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 13 Mar 2001 22:59:26 -0000 1.1.1.1 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 9 Mar 2003 22:56:23 -0000 1.1.1.1.4.1 @@ -15,24 +15,63 @@ } -ad_proc -public acs_subsite_post_instantiation { - package_id +ad_proc -public subsite::after_mount { + {-package_id:required} + {-node_id:required} } { This is the TCL proc that is called automatically by the APM - whenever a new instance of the subsites application is created. + whenever a new instance of the subsites application is mounted. - @author Michael Bryzek (mbryzek@arsdigita.com) - @creation-date 2000-03-05 + We do three things: - @param package_id The package_id of the newly mounted subsites - application +
[ad_conn package_id]
will be used.
-
- } {
-
- if {[ad_conn isconnected]} {
- if {[empty_string_p $package_id]} {
- set package_id [ad_conn package_id]
- }
- }
-
- if {[empty_string_p $package_id]} {
- error "subsite::configure - package_id not specified"
- }
-
- set subsite_name [db_string subsite_name_query {
- select instance_name
- from apm_packages
- where package_id = :package_id
- }]
-
- set truncated_subsite_name [string range $subsite_name 0 89]
-
- db_transaction {
-
- # Create subsite application group
- set group_name "$truncated_subsite_name Parties"
- set subsite_group_id [application_group::new \
- -package_id $package_id \
- -group_name $group_name]
-
- # Create segment of registered users
- set segment_name "$truncated_subsite_name Members"
- set segment_id [rel_segments_new $subsite_group_id membership_rel $segment_name]
-
- # Create constraint that says "to be a member of this
- # subsite, you have to be a member of the parent subsite"
-
- set supersite_group_id ""
-
- db_0or1row parent_subsite_query {
- select m.group_id as supersite_group_id,
- p.instance_name as supersite_name
- from application_group_element_map m,
- apm_packages p
- where p.package_id = m.package_id
- and container_id = group_id
- and element_id = :subsite_group_id
- and rel_type = 'composition_rel'
- }
-
- # First get parent application group's id and instance name
- if { ![empty_string_p $supersite_group_id] } {
-
- set constraint_name "Members of [string range $subsite_name 0 30] must be members of [string range $supersite_name 0 30]"
-
- if {[ad_conn isconnected]} {
- set user_id [ad_conn user_id]
- set creation_ip [ad_conn peeraddr]
- } else {
- set user_id ""
- set creation_ip ""
- }
-
- set constraint_id [db_exec_plsql add_constraint {
- BEGIN
- :1 := rel_constraint.new(
- constraint_name => :constraint_name,
- rel_segment => :segment_id,
- rel_side => 'two',
- required_rel_segment => rel_segment.get(:supersite_group_id, 'membership_rel'),
- creation_user => :user_id,
- creation_ip => :creation_ip
- );
- END;
- }]
- }
- }
-
}