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.59 -r1.60 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 5 Aug 2018 21:09:49 -0000 1.59 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.tcl 28 Nov 2018 16:02:40 -0000 1.60 @@ -131,39 +131,42 @@ set node_id $node(node_id) if { $name eq "" } { - set subsite_name [db_string subsite_name_query {}] + set subsite_name $node(instance_name) } else { set subsite_name $name } + set subsite_name_30 [string range $subsite_name 0 30] + set subsite_name_89 [string range $subsite_name 0 89] - set truncated_subsite_name [string range $subsite_name 0 89] - db_transaction { # Create subsite application group - set group_name "$truncated_subsite_name" + set group_name "$subsite_name_89" 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_name "$subsite_name_89 Members" set segment_id [rel_segments_new $subsite_group_id membership_rel $segment_name] # Create a constraint that says "to be a member of this subsite you must be a member # of the parent subsite. set subsite_id [site_node::closest_ancestor_package \ -node_id $node_id \ -package_key [subsite::package_keys]] + set subsite [subsite::get -subsite_id $subsite_id] + set supersite_group_id [application_group::group_id_from_package_id \ + -package_id $subsite_id] + set supersite_name_30 [string range [dict get $subsite instance_name] 0 30] - 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 constraint_name "Members of $subsite_name_30 must be members of $supersite_name_30" set user_id [ad_conn user_id] set creation_ip [ad_conn peeraddr] db_exec_plsql add_constraint {} # Create segment of registered users for administrators - set segment_name "$truncated_subsite_name Administrators" + set segment_name "$subsite_name_89 Administrators" set admin_segment_id [rel_segments_new $subsite_group_id admin_rel $segment_name] # Grant admin privileges to the admin segment 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.14 -r1.15 --- openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 14 Jun 2018 12:56:48 -0000 1.14 +++ openacs-4/packages/acs-subsite/tcl/subsite-procs.xql 28 Nov 2018 16:02:40 -0000 1.15 @@ -1,31 +1,6 @@ - - - - select instance_name - from apm_packages - where package_id = :package_id - - - - - - - - - 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 = :subsite_id - - - - -