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 -N -r1.35.2.7 -r1.35.2.8 --- openacs-4/packages/acs-subsite/acs-subsite.info 14 Mar 2003 10:37:15 -0000 1.35.2.7 +++ openacs-4/packages/acs-subsite/acs-subsite.info 17 Mar 2003 02:26:05 -0000 1.35.2.8 @@ -7,7 +7,7 @@ t f - + Michael Bryzek @@ -19,7 +19,7 @@ OpenACS Aware of parties, groups, users, portraits, ... - + @@ -29,6 +29,7 @@ + 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 -N -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql 9 Mar 2003 22:56:23 -0000 1.2.2.1 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs-oracle.xql 17 Mar 2003 02:26:21 -0000 1.2.2.2 @@ -87,24 +87,6 @@ - - - - select ag.group_id as parent_group_id - from application_groups ag, - apm_packages, - (select object_id, rownum as tree_rownum - from site_nodes - start with node_id = :parent_node_id - connect by node_id = prior parent_id) nodes - where nodes.object_id = apm_packages.package_id - and apm_packages.package_id = ag.package_id - and tree_rownum=1 - - - - - @@ -114,7 +96,7 @@ object_type => :group_type, group_name => :group_name, package_id => :package_id, - context_id => :parent_group_id, + context_id => :package_id, creation_user => :creation_user, creation_ip => :creation_ip, email => :email, @@ -124,5 +106,17 @@ + + + + + begin + :1 := application_group.delete ( + group_id => :group_id, + ); + 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 -N -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql 9 Mar 2003 22:56:23 -0000 1.4.2.1 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs-postgresql.xql 17 Mar 2003 02:26:21 -0000 1.4.2.2 @@ -83,24 +83,7 @@ - - - - - select ag.group_id as parent_group_id - from (select tree_ancestor_keys(site_node_get_tree_sortkey(:parent_node_id)) as tree_sortkey) parents, - application_groups ag, site_nodes s, apm_packages a - where s.tree_sortkey = parents.tree_sortkey - and s.object_id = a.package_id - and a.package_id = ag.package_id - order by s.tree_sortkey desc - limit 1; - - - - - @@ -114,10 +97,20 @@ :url, :group_name, :package_id, - :parent_group_id + :package_id ) + + + + select application_group__delete ( + :group_id + ) + + + + 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 -N -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl 9 Mar 2003 22:56:23 -0000 1.2.2.1 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs.tcl 17 Mar 2003 02:26:21 -0000 1.2.2.2 @@ -180,7 +180,6 @@ ad_proc new { { -group_id "" } { -group_type "application_group"} - { -parent_group_id "" } { -package_id "" } { -group_name "" } { -creation_user "" } @@ -194,7 +193,6 @@ 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 @@ -207,22 +205,8 @@ if { [empty_string_p $package_id] } { set package_id [ad_conn package_id] } - - if {[empty_string_p $parent_group_id]} { - # 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" } @@ -235,30 +219,24 @@ }] append group_name " Parties" } -ns_log Notice "Huh? group_name: $group_name" db_transaction { - # creating the new group - set group_id [db_exec_plsql add_group { - begin - :1 := application_group.new ( - group_id => :group_id, - object_type => :group_type, - group_name => :group_name, - package_id => :package_id, - context_id => :context_id, - creation_user => :creation_user, - creation_ip => :creation_ip, - email => :email, - url => :url - ); - end; - }] + set group_id [db_exec_plsql add_group {}] } return $group_id } + + ad_proc delete { + -group_id:required + } { + Delete the given application group and all relational segments and constraints dependent + on it (handled by the PL/[pg]SQL API + } { + db_exec_plsql delete {} + } + } Index: openacs-4/packages/acs-subsite/tcl/application-group-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/Attic/application-group-procs.xql,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/acs-subsite/tcl/application-group-procs.xql 12 May 2002 20:57:02 -0000 1.3 +++ openacs-4/packages/acs-subsite/tcl/application-group-procs.xql 17 Mar 2003 02:26:21 -0000 1.3.2.1 @@ -10,17 +10,5 @@ - - - - - - select parent_id - from site_nodes - where object_id = :package_id - - - - Index: openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql,v diff -u -N -r1.1 -r1.1.4.1 --- openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql 6 May 2001 21:40:21 -0000 1.1 +++ openacs-4/packages/acs-subsite/tcl/rel-segments-procs-oracle.xql 17 Mar 2003 02:26:21 -0000 1.1.4.1 @@ -24,7 +24,7 @@ - begin rel_segment.delete(:constraint_id); end; + begin rel_constraint.delete(:constraint_id); end; Index: openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql,v diff -u -N -r1.2 -r1.2.4.1 --- openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql 15 May 2001 16:59:00 -0000 1.2 +++ openacs-4/packages/acs-subsite/tcl/rel-segments-procs-postgresql.xql 17 Mar 2003 02:26:21 -0000 1.2.4.1 @@ -27,7 +27,7 @@ - select rel_segment__delete(:constraint_id) + select rel_constraint__delete(:constraint_id) Index: openacs-4/packages/acs-subsite/tcl/rel-segments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/tcl/rel-segments-procs.tcl,v diff -u -N -r1.1.1.1 -r1.1.1.1.4.1 --- openacs-4/packages/acs-subsite/tcl/rel-segments-procs.tcl 13 Mar 2001 22:59:26 -0000 1.1.1.1 +++ openacs-4/packages/acs-subsite/tcl/rel-segments-procs.tcl 17 Mar 2003 02:26:21 -0000 1.1.1.1.4.1 @@ -66,7 +66,7 @@ where c.required_rel_segment = :segment_id } { db_exec_plsql constraint_delete { - begin rel_segment.delete(:constraint_id); end; + begin rel_constraint.delete(:constraint_id); end; } } 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 -N -r1.1.1.1.4.2 -r1.1.1.1.4.3 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 12 Mar 2003 09:13:10 -0000 1.1.1.1.4.2 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 17 Mar 2003 02:26:21 -0000 1.1.1.1.4.3 @@ -14,7 +14,6 @@ namespace eval util {} } - ad_proc -public subsite::after_mount { {-package_id:required} {-node_id:required} @@ -36,107 +35,47 @@ } { - set subsite_name [db_string subsite_name_query {}] + if { [empty_string_p [application_group::group_id_from_package_id -package_id $package_id]] } { - set truncated_subsite_name [string range $subsite_name 0 89] + set subsite_name [db_string subsite_name_query {}] -# db_transaction { + set truncated_subsite_name [string range $subsite_name 0 89] - # 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] + db_transaction { - # 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 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 constraint that says "to be a member of this - # subsite, you have to be a member of the parent subsite" + # 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] - set supersite_group_id "" + # Create a constraint that says "to be a member of this subsite you must be a member + # of the parent subsite. - db_0or1row parent_subsite_query {} + db_1row parent_subsite_query {} + 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 {} - # 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 ""} - } { - Performs post-install configuration if necessary. - See subsite::configured_p to learn how we determine if a subsite has - already been configured. See subsite::configure to learn what - is involved in configuring a subsite. +ad_proc -public subsite::before_uninstantiate { + {-package_id:required} +} { -

+ Delete the application group associated with this subsite. - NOTE: this proc might not work without a connection (i.e., - [ad_conn isconnected]==1). I haven't tested it without a connection, - but I think the code would work right now (assuming the caller passes - in a valid package_id). However, in the future, this proc may redirect - the administrator to a configuration "wizard" in case we need or want - some input from the admin to properly configure the subsite. +} { + application_group::delete -group_id [application_group::group_id_from_package_id -package_id $package_id] +} - @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 {![configured_p -package_id $package_id]} { - configure -package_id $package_id - } - - } - - - ad_proc subsite::configured_p { - {-package_id ""} - } { - Determines whether a subsite has been configured. Returns 1 if - configured, or 0 otherwise. Right now, a subsite is considered - to be configured if its application group exists. In the future, - we may store an explicit "configured_p" setting in the DB. - - @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 {[empty_string_p [application_group::group_id_from_package_id \ - -no_complain \ - -package_id $package_id]]} { - return 0 - } - return 1 - } - - - - ad_proc subsite::configure { - {-package_id ""} - } { - - } - - - ad_proc -private subsite::instance_name_exists_p { node_id instance_name @@ -156,7 +95,6 @@ }] } - ad_proc -public subsite::auto_mount_application { { -instance_name "" } { -pretty_name "" } @@ -165,14 +103,14 @@ } { Mounts a new instance of the application specified by package_key beneath node_id - + @author Michael Bryzek (mbryzek@arsdigita.com) @creation-date 2001-02-28 @param instance_name 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) - + @param pretty_name 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) @@ -282,7 +220,7 @@ @author Oumi Mehrotra (oumi@arsdigita.com) @creation-date 2000-02-07 - + @param object_type } { @@ -334,7 +272,7 @@ @author Oumi Mehrotra (oumi@arsdigita.com) @creation-date 2000-02-07 - + @param object_type } { return [db_string select_pretty_name { 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 -N -r1.3.4.1 -r1.3.4.2 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 9 Mar 2003 22:56:23 -0000 1.3.4.1 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 17 Mar 2003 02:26:21 -0000 1.3.4.2 @@ -1,6 +1,18 @@ + + + + select 1 + from dual + where exists (select 1 + from application_groups + where package_id = :package_id) + + + + Index: openacs-4/packages/acs-subsite/www/admin/group-types/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/index.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-subsite/www/admin/group-types/index.tcl 6 Sep 2002 21:49:58 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/group-types/index.tcl 17 Mar 2003 02:26:37 -0000 1.2.2.1 @@ -13,8 +13,6 @@ group_types:multirow } -subsite::configure_if_necessary - set context [list "Group types"] # we may want to move the inner count to get the number of groups of Index: openacs-4/packages/acs-subsite/www/admin/group-types/one.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/group-types/one.tcl,v diff -u -N -r1.3 -r1.3.2.1 --- openacs-4/packages/acs-subsite/www/admin/group-types/one.tcl 6 Sep 2002 21:49:58 -0000 1.3 +++ openacs-4/packages/acs-subsite/www/admin/group-types/one.tcl 17 Mar 2003 02:26:37 -0000 1.3.2.1 @@ -23,8 +23,6 @@ more_relation_types_p:onevalue } -subsite::configure_if_necessary - set user_id [ad_conn user_id] set return_url_enc [ad_urlencode [ad_conn url]?[ad_conn query]] set group_type_enc [ad_urlencode $group_type] Index: openacs-4/packages/acs-subsite/www/admin/groups/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/groups/index.tcl,v diff -u -N -r1.2 -r1.2.2.1 --- openacs-4/packages/acs-subsite/www/admin/groups/index.tcl 6 Sep 2002 21:49:59 -0000 1.2 +++ openacs-4/packages/acs-subsite/www/admin/groups/index.tcl 17 Mar 2003 02:27:04 -0000 1.2.2.1 @@ -24,8 +24,6 @@ view_by:onevalue } -subsite::configure_if_necessary - set context [list "Groups"] set this_url [ad_conn url]