Index: openacs-4/packages/acs-subsite/acs-subsite.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/acs-subsite.info,v
diff -u -r1.35.2.5 -r1.35.2.6
--- openacs-4/packages/acs-subsite/acs-subsite.info 9 Dec 2002 14:10:36 -0000 1.35.2.5
+++ openacs-4/packages/acs-subsite/acs-subsite.info 9 Mar 2003 22:56:07 -0000 1.35.2.6
@@ -6,11 +6,9 @@
ACS Subsite Services
t
f
-
+
- oracle
- postgresql
Michael Bryzek
Oumi Mehrotra
@@ -27,619 +25,38 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql 12 May 2002 20:57:02 -0000 1.2
+++ openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql 9 Mar 2003 22:56:23 -0000 1.2.2.1
@@ -114,7 +114,7 @@
object_type => :group_type,
group_name => :group_name,
package_id => :package_id,
- context_id => :context_id,
+ context_id => :parent_group_id,
creation_user => :creation_user,
creation_ip => :creation_ip,
email => :email,
@@ -125,22 +125,4 @@
-
-
-
-
- begin
- :1 := composition_rel.new (
- rel_type => 'composition_rel',
- object_id_one => :parent_group_id,
- object_id_two => :group_id,
- creation_user => :creation_user,
- creation_ip => :creation_ip
- );
- end;
-
-
-
-
-
Index: openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql,v
diff -u -r1.4 -r1.4.2.1
--- openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql 12 May 2002 20:57:02 -0000 1.4
+++ openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql 9 Mar 2003 22:56:23 -0000 1.4.2.1
@@ -114,27 +114,10 @@
:url,
:group_name,
:package_id,
- :context_id
+ :parent_group_id
)
-
-
-
-
- select composition_rel__new (
- null,
- 'composition_rel',
- :parent_group_id,
- :group_id,
- :creation_user,
- :creation_ip
- )
-
-
-
-
-
Index: openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl 12 May 2002 20:57:02 -0000 1.2
+++ openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl 9 Mar 2003 22:56:23 -0000 1.2.2.1
@@ -183,7 +183,6 @@
{ -parent_group_id "" }
{ -package_id "" }
{ -group_name "" }
- { -context_id "" }
{ -creation_user "" }
{ -creation_ip "" }
{ -email "" }
@@ -192,12 +191,10 @@
Creates an application group
(i.e., group of "users/parties of this application")
- NOTE: Doesn't deal with specializing membership and composition yet.
- TO DO: Fix this.
-
Returns the group_id of the new application group.
} {
+ns_log Notice "Huh? starting"
if { [ad_conn isconnected] } {
# Since we have a connection, default user_id / peeraddr
# if they're not specified
@@ -215,12 +212,17 @@
# by default, this application group will be a subgroup
# of the first parent application group based on the site map.
+ns_log Notice "Huh? before db_string ..."
set parent_node_id [db_string parent_node_id ""]
+ns_log Notice "Huh? before db_0or1row ..."
db_0or1row parent_group_id_query ""
+ns_log Notice "Huh? after db_0or1row ..."
}
}
+ns_log Notice "Huh? got here"
+
if {[empty_string_p $package_id]} {
error "application_group::new - package_id not specified"
}
@@ -233,11 +235,8 @@
}]
append group_name " Parties"
}
+ns_log Notice "Huh? group_name: $group_name"
- if {[empty_string_p $context_id]} {
- set context_id $parent_group_id
- }
-
db_transaction {
# creating the new group
@@ -256,22 +255,6 @@
);
end;
}]
-
- if {![empty_string_p $parent_group_id]} {
-
- set rel_id [db_exec_plsql add_composition_rel {
- begin
- :1 := composition_rel.new (
- rel_type => 'composition_rel',
- object_id_one => :parent_group_id,
- object_id_two => :group_id,
- creation_user => :creation_user,
- creation_ip => :creation_ip
- );
- end;
- }]
-
- }
}
return $group_id
Index: openacs-4/packages/acs-subsite/tcl/relation-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/relation-procs.tcl,v
diff -u -r1.5 -r1.5.2.1
--- openacs-4/packages/acs-subsite/tcl/relation-procs.tcl 10 Sep 2002 22:22:11 -0000 1.5
+++ openacs-4/packages/acs-subsite/tcl/relation-procs.tcl 9 Mar 2003 22:56:23 -0000 1.5.2.1
@@ -79,8 +79,6 @@
db_transaction {
- ns_log Notice "DOTLRN: relation_add: var_list is $var_list"
-
set rel_id [package_instantiate_object \
-creation_user $creation_user \
-creation_ip $creation_ip \
Index: openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql,v
diff -u -r1.3 -r1.3.4.1
--- openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql 10 Oct 2001 06:56:44 -0000 1.3
+++ openacs-4/packages/acs-subsite/tcl/subsite-procs-oracle.xql 9 Mar 2003 22:56:23 -0000 1.3.4.1
@@ -3,7 +3,7 @@
oracle8.1.6
-
+
BEGIN
Index: openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql,v
diff -u -r1.5 -r1.5.4.1
--- openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql 4 Dec 2001 00:20:47 -0000 1.5
+++ openacs-4/packages/acs-subsite/tcl/subsite-procs-postgresql.xql 9 Mar 2003 22:56:23 -0000 1.5.4.1
@@ -3,7 +3,7 @@
postgresql7.1
-
+
select rel_constraint__new(
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
+
+ - Create application group
+
- Create segment "Subsite Users"
+
- Create relational constraint to make subsite registration
+ require supersite registration.
+
+ @author Don Baccus (dhogaza@pacifier.com)
+ @creation-date 2003-03-05
+
} {
- subsite::configure_if_necessary -package_id $package_id
-}
+ set subsite_name [db_string subsite_name_query {}]
+ 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 {}
+
+ # 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]"
+
+ set user_id [ad_conn user_id]
+ set creation_ip [ad_conn peeraddr]
+
+ db_exec_plsql add_constraint {}
+ }
+# }
+}
+
ad_proc subsite::configure_if_necessary {
{-package_id ""}
} {
@@ -93,98 +132,7 @@
ad_proc subsite::configure {
{-package_id ""}
} {
- Configures a subsite. This involves 3 steps:
-
- - Create application group
-
- Create segment "Subsite Users"
-
- Create relational constraint to make subsite registration
- require supersite registration.
-
-
- @author Oumi Mehrotra (oumi@arsdigita.com)
- @creation-date 2000-02-05
-
- @param package_id The package_id of the subsite application instance
- to configure. If package_id is not specified, then
- [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;
- }]
- }
- }
-
}
Index: openacs-4/packages/acs-subsite/tcl/subsite-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/subsite-procs.xql,v
diff -u -r1.3 -r1.3.4.1
--- openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 10 Oct 2001 06:56:44 -0000 1.3
+++ openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 9 Mar 2003 22:56:23 -0000 1.3.4.1
@@ -1,7 +1,7 @@
-
+
select instance_name
@@ -12,18 +12,16 @@
-
+
- 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'
-
+ select m.group_id as supersite_group_id, p.instance_name as supersite_name
+ from application_groups m, apm_packages p, site_nodes s1, site_nodes s2
+ where s1.node_id = :node_id
+ and s2.node_id = s1.parent_id
+ and p.package_id = s2.object_id
+ and m.package_id = s2.object_id
+
Index: openacs-4/packages/acs-subsite/www/admin/users/new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/users/new.tcl,v
diff -u -r1.4.2.1 -r1.4.2.2
--- openacs-4/packages/acs-subsite/www/admin/users/new.tcl 20 Jan 2003 13:48:05 -0000 1.4.2.1
+++ openacs-4/packages/acs-subsite/www/admin/users/new.tcl 9 Mar 2003 22:56:36 -0000 1.4.2.2
@@ -182,7 +182,13 @@
$member_state \
$user_id]
- relation_add -form_id add_user -variable_prefix rel -member_state $rel_member_state $add_with_rel_type $add_to_group_id $user_id
+ # Hack for adding users to the main subsite, whose application group is the registered users group.
+
+ if { $add_to_group_id != [acs_lookup_magic_object "registered_users"] ||
+ ![string equal $add_with_rel_type "membership_rel"] } {
+ relation_add -form_id add_user -variable_prefix rel -member_state $rel_member_state $add_with_rel_type $add_to_group_id $user_id
+ }
+
} on_error {
ad_return_error "User Creation Failed" "We were unable to create the user record in the database."
}