Index: openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql 8 Jul 2002 21:04:16 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/postgresql/classes-create.sql 11 Jul 2002 15:54:13 -0000 1.2 @@ -300,13 +300,15 @@ BEGIN v_class_instance_id := dotlrn_community__new ( p_class_instance_id, + null, p_class_key, p_community_key, p_pretty_name, p_description, - p_package_id, + ''f'', p_portal_id, p_non_member_portal_id, + p_package_id, p_join_policy, p_creation_date, p_creation_user, Index: openacs-4/packages/dotlrn/sql/postgresql/clubs-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/clubs-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/postgresql/clubs-create.sql 8 Jul 2002 21:04:16 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/postgresql/clubs-create.sql 11 Jul 2002 15:54:13 -0000 1.2 @@ -74,13 +74,15 @@ BEGIN v_club_id := dotlrn_community__new( p_club_id, + null, ''dotlrn_club'', p_community_key, p_pretty_name, p_description, - p_package_id, + ''f'', p_portal_id, p_non_member_portal_id, + p_package_id, p_join_policy, p_creation_date, p_creation_user, Index: openacs-4/packages/dotlrn/sql/postgresql/communities-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-package-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/postgresql/communities-package-create.sql 8 Jul 2002 21:04:16 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-package-create.sql 11 Jul 2002 15:54:13 -0000 1.2 @@ -160,7 +160,7 @@ -- dotlrn_community -select define_function_args('dotlrn_community__new','community_id,parent_community_id,community_type,community_key,pretty_name,description,portal_id,non_member_portal_id,package_id,join_policy,creation_date,creation_user,creation_ip,context_id'); +select define_function_args('dotlrn_community__new','community_id,parent_community_id,community_type,community_key,pretty_name,description,portal_id,non_member_portal_id,archived_p,package_id,join_policy,creation_date,creation_user,creation_ip,context_id'); select define_function_args('dotlrn_community__set_active_dates','community_id,start_date,end_date'); @@ -184,7 +184,7 @@ p_community_key alias for $4; p_pretty_name alias for $5; p_description alias for $6; - archived_p alias for $7 + p_archived_p alias for $7; p_portal_id alias for $8; p_non_member_portal_id alias for $9; p_package_id alias for $10; @@ -196,26 +196,29 @@ c_id integer; BEGIN c_id := acs_group__new ( - p_context_id, p_community_id, p_community_type, p_creation_date, p_creation_user, p_creation_ip, + null, + null, p_community_key, - p_join_policy + p_join_policy, + p_context_id ); - insert into dotlrn_communities + insert into dotlrn_communities_all (community_id, parent_community_id, community_type, community_key, pretty_name, description, package_id, - portal_id, - portal_template_id) + portal_id, + archived_p, + non_member_portal_id) values (c_id, p_parent_community_id, @@ -226,7 +229,6 @@ p_package_id, p_portal_id, p_archived_p, - p_portal_id, p_non_member_portal_id); return c_id; Index: openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql 8 Jul 2002 21:04:16 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/postgresql/communities-tree-create.sql 11 Jul 2002 15:54:13 -0000 1.2 @@ -17,24 +17,24 @@ create function dotlrn_community_types_in_tr() returns opaque as ' declare - v_parent_sortkey dotlrn_community_types.tree_sortkey%TYPE; - v_max_child_sortkey dotlrn_community_types.max_child_sortkey%TYPE; + v_parent_sortkey dotlrn_community_types.tree_sortkey%TYPE; + v_max_child_sortkey dotlrn_community_types.max_child_sortkey%TYPE; begin if new.supertype is null then -- if this is the root community_type we leave it''s sortkey as null return new; else -- else get the max_child_sortkey of the parent community_type - select tree_sortkey, max_child_sortkey + select coalesce(tree_sortkey, ''''), max_child_sortkey into v_parent_sortkey, v_max_child_sortkey from dotlrn_community_types where community_type = new.supertype for update; end if; -- increment the sort_key - v_max_child_sortkey := tree_increment_key(v_max_child_sortkey); + v_max_child_sortkey := tree__increment_key(v_max_child_sortkey); update dotlrn_community_types set max_child_sortkey = v_max_child_sortkey @@ -55,47 +55,47 @@ create function dotlrn_communities_in_tr() returns opaque as ' declare - v_parent_sortkey dotlrn_communities_all.tree_sortkey%TYPE; - v_max_child_sortkey dotlrn_communities_all.max_child_sortkey%TYPE; + v_parent_sortkey dotlrn_communities_all.tree_sortkey%TYPE; + v_max_child_sortkey dotlrn_communities_all.max_child_sortkey%TYPE; begin if new.parent_community_id is null then - -- if this is the root community we get the sortkey from it''s parent - -- community_type - select tree_sortkey, max_child_sortkey + + select coalesce(tree_sortkey, ''''), max_child_sortkey into v_parent_sortkey, v_max_child_sortkey from dotlrn_community_types where community_type = new.community_type for update; + + v_max_child_sortkey := tree_increment_key(v_max_child_sortkey); + + update dotlrn_community_types + set max_child_sortkey = v_max_child_sortkey + where community_type = new.community_type; + else - -- else get the max_child_sortkey of the parent community_type - select tree_sortkey, max_child_sortkey + + select coalesce(tree_sortkey, ''''), max_child_sortkey into v_parent_sortkey, v_max_child_sortkey from dotlrn_communities_all where community_id = new.parent_community_id for update; - end if; - -- increment the sort_key - v_max_child_sortkey := tree_increment_key(v_max_child_sortkey); + v_max_child_sortkey := tree_increment_key(v_max_child_sortkey); - if new.parent_community_id is null then - update dotlrn_community_types - set max_child_sortkey = v_max_child_sortkey - where community_type = new.community_type; - else update dotlrn_communities_all set max_child_sortkey = v_max_child_sortkey where community_id = new.parent_community_id; + end if; - -- generate the sortkey for the current row new.tree_sortkey := v_parent_sortkey || v_max_child_sortkey; return new; + end;' language 'plpgsql'; create trigger dotlrn_communities_in_tr before insert on dotlrn_communities_all for each row -execute procedure dotlrn_community_types_in_tr(); +execute procedure dotlrn_communities_in_tr(); Index: openacs-4/packages/dotlrn/tcl/community-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/community-procs-postgresql.xql 11 Jul 2002 15:54:13 -0000 1.1 @@ -0,0 +1,85 @@ + + + + postgresql7.1 + + + + select community_id + from dotlrn_communities + where package_id = :package_id + + + + + + :1 := dotlrn_community_type__new( + :community_type_key, + :parent_type, + :pretty_name, + :pretty_name, + :description + ); + + + + + + :1 := dotlrn_community__new( + :community_type, + :name + :pretty_name, + :pretty_name, + :description + ); + + + + + + dotlrn_community__set_active_dates( + :community_id, + to_date(:start_date, :date_format), + to_date(:end_date, :date_format) + ); + + + + + + select site_node__url(node_id) + from site_nodes + where parent_id = :current_node_id + and object_id = :package_id + + + + + + select community_type + from dotlrn_communities + where community_id = :community_id + + + + + + select dotlrn_community_types.community_type + from dotlrn_community_types + where dotlrn_community_types.tree_sortkey = (select tree__ancestor_key(dotlrn_communities.tree_sortkey, 1) + from dotlrn_communities + where dotlrn_communities.community_id = :community_id) + + + + + + select dotlrn_community_types.community_type + from dotlrn_community_types + where dotlrn_community_types.tree_sortkey = (select tree__ancestor_key(dct.tree_sortkey, 1) + from dotlrn_community_types dct + where dct.community_type = :community_type) + + + + Index: openacs-4/packages/dotlrn/tcl/term-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/Attic/term-procs-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/tcl/term-procs-postgresql.xql 11 Jul 2002 15:54:13 -0000 1.1 @@ -0,0 +1,49 @@ + + + + postgresql7.1 + + + + insert + into dotlrn_terms + (term_id, term_name, term_year, start_date, end_date) + values + (acs_object_id_seq.nextval, :term_name, :term_year, to_date(:start_date, :date_format), to_date(:end_date, :date_format)) + + + + + + update dotlrn_terms + set term_name = :term_name, + term_year = :term_year, + start_date = to_date(:start_date, :date_format), + end_date = to_date(:end_date, :date_format) + where term_id = :term_id + + + + + + select to_char(dotlrn_terms.start_date, :date_format) as start_date, + to_char(dotlrn_terms.start_date, 'YYYY') as year, + to_char(dotlrn_terms.start_date, 'MM') as month, + to_char(dotlrn_terms.start_date, 'DD') as day + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + + + + select to_char(dotlrn_terms.end_date, :date_format) as end_date, + to_char(dotlrn_terms.end_date, 'YYYY') as year, + to_char(dotlrn_terms.end_date, 'MM') as month, + to_char(dotlrn_terms.end_date, 'DD') as day + from dotlrn_terms + where dotlrn_terms.term_id = :term_id + + + + Index: openacs-4/packages/dotlrn/www/admin/users-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/admin/Attic/users-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/dotlrn/www/admin/users-postgresql.xql 9 Jul 2002 12:39:33 -0000 1.1 +++ openacs-4/packages/dotlrn/www/admin/users-postgresql.xql 11 Jul 2002 15:54:13 -0000 1.2 @@ -1,19 +1,19 @@ - postgres7.1 + postgresql7.1 select count(*) from (select acs_rels.object_id_two from acs_rels where acs_rels.object_id_one = (select acs__magic_object_id('registered_users') from dual) - minus - select acs_rels.object_id_two - from acs_rels, - dotlrn_user_types - where acs_rels.object_id_one = dotlrn_user_types.group_id) + and acs_rels.object_id_two not in ( + select acs_rels.object_id_two + from acs_rels, + dotlrn_user_types + where acs_rels.object_id_one = dotlrn_user_types.group_id)) as foo