Index: openacs-4/packages/dotlrn/dotlrn.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/dotlrn.info,v diff -u -r1.91 -r1.92 --- openacs-4/packages/dotlrn/dotlrn.info 30 May 2002 22:26:27 -0000 1.91 +++ openacs-4/packages/dotlrn/dotlrn.info 31 May 2002 06:23:49 -0000 1.92 @@ -46,14 +46,14 @@ - + Index: openacs-4/packages/dotlrn/sql/oracle/communities-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/communities-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn/sql/oracle/communities-create.sql 30 May 2002 22:04:58 -0000 1.5 +++ openacs-4/packages/dotlrn/sql/oracle/communities-create.sql 31 May 2002 06:23:49 -0000 1.6 @@ -157,3 +157,5 @@ constraint dotlrn_community_applets_pk primary key (community_id, applet_id) ); + +@@ communities-tree-create.sql Index: openacs-4/packages/dotlrn/sql/oracle/communities-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/communities-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/communities-drop.sql 30 May 2002 22:04:58 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/communities-drop.sql 31 May 2002 06:23:49 -0000 1.2 @@ -24,6 +24,8 @@ -- @version $Id$ -- +@@ communities-tree-drop.sql; + drop table dotlrn_community_applets; drop table dotlrn_applets; drop view dotlrn_active_comms_not_closed; Index: openacs-4/packages/dotlrn/sql/oracle/communities-tree-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/communities-tree-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn/sql/oracle/communities-tree-create.sql 30 May 2002 22:04:58 -0000 1.1 +++ openacs-4/packages/dotlrn/sql/oracle/communities-tree-create.sql 31 May 2002 06:23:49 -0000 1.2 @@ -14,353 +14,80 @@ -- details. -- -create or replace package dotlrn_community_type -is - function new ( - community_type in dotlrn_community_types.community_type%TYPE, - parent_type in dotlrn_community_types.supertype%TYPE default 'dotlrn_community', - pretty_name in dotlrn_community_types.pretty_name%TYPE, - pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, - description in dotlrn_community_types.description%TYPE, - package_id in dotlrn_community_types.package_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_community_types.community_type%TYPE; +create or replace trigger dotlrn_community_types_in_tr +before insert on dotlrn_community_types +for each row +declare + v_parent_sortkey dotlrn_community_types.tree_sortkey%TYPE; + v_max_child_sortkey dotlrn_community_types.max_child_sortkey%TYPE; +begin - procedure delete ( - community_type in dotlrn_community_types.community_type%TYPE - ); - - function name ( - community_type in dotlrn_community_types.community_type%TYPE - ) return varchar; -end; -/ -show errors - -create or replace package body dotlrn_community_type -is - function new ( - community_type in dotlrn_community_types.community_type%TYPE, - parent_type in dotlrn_community_types.supertype%TYPE default 'dotlrn_community', - pretty_name in dotlrn_community_types.pretty_name%TYPE, - pretty_plural in dotlrn_community_types.pretty_name%TYPE default null, - description in dotlrn_community_types.description%TYPE, - package_id in dotlrn_community_types.package_id%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_community_types.community_type%TYPE - is - v_parent_object_type acs_object_types.object_type%TYPE; - v_unique_name acs_objects.object_id%TYPE; - begin - if parent_type is null then - v_parent_object_type:= 'group'; - else - v_parent_object_type:= parent_type; - end if; - - select acs_object_id_seq.nextval - into v_unique_name - from dual; - - acs_object_type.create_type ( - supertype => v_parent_object_type, - object_type => dotlrn_community_type.new.community_type, - pretty_name => dotlrn_community_type.new.community_type, - pretty_plural => dotlrn_community_type.new.community_type, - table_name => v_unique_name, - id_column => v_unique_name, - package_name => v_unique_name, - name_method => 'acs_group.name' - ); - - insert - into group_types - (group_type, default_join_policy) - values - (dotlrn_community_type.new.community_type, 'closed'); - - insert - into dotlrn_community_types - (community_type, - pretty_name, - description, - package_id, - supertype) - values - (dotlrn_community_type.new.community_type, - dotlrn_community_type.new.pretty_name, - dotlrn_community_type.new.description, - dotlrn_community_type.new.package_id, - dotlrn_community_type.new.parent_type); - - return community_type; - end; - - procedure delete ( - community_type in dotlrn_community_types.community_type%TYPE - ) - is - begin - delete + if :new.supertype is null then + -- if this is the root community_type we leave it's sortkey as null + return; + else + -- else get the max_child_sortkey of the parent community_type + select tree_sortkey, max_child_sortkey + into v_parent_sortkey, v_max_child_sortkey from dotlrn_community_types - where community_type = dotlrn_community_type.delete.community_type; + where community_type = :new.supertype + for update of max_child_sortkey; + end if; - acs_object_type.drop_type(dotlrn_community_type.delete.community_type); - end; + -- increment the sort_key + v_max_child_sortkey := lpad(tree.increment_key(v_max_child_sortkey), 6, '0'); - function name ( - community_type in dotlrn_community_types.community_type%TYPE - ) return varchar - is - v_name dotlrn_community_types.pretty_name%TYPE; - begin - select dotlrn_community_types.pretty_name - into v_name - from dotlrn_community_types - where dotlrn_community_types.community_type = dotlrn_community_type.name.community_type; + update dotlrn_community_types + set max_child_sortkey = v_max_child_sortkey + where community_type = :new.supertype; - return v_name; - end; -end; -/ -show errors + -- generate the sortkey for the current row + :new.tree_sortkey := v_parent_sortkey || v_max_child_sortkey; -create or replace package dotlrn_community -is - - function new ( - community_id in dotlrn_communities_all.community_id%TYPE default null, - parent_community_id in dotlrn_communities_all.parent_community_id%TYPE default null, - community_type in dotlrn_communities_all.community_type%TYPE, - community_key in dotlrn_communities_all.community_key%TYPE, - pretty_name in dotlrn_communities_all.pretty_name%TYPE, - description in dotlrn_communities_all.description%TYPE, - archived_p in dotlrn_communities_all.archived_p%TYPE default 'f', - portal_id in dotlrn_communities_all.portal_id%TYPE default null, - non_member_portal_id in dotlrn_communities_all.non_member_portal_id%TYPE default null, - package_id in dotlrn_communities_all.package_id%TYPE default null, - join_policy in groups.join_policy%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_communities_all.community_id%TYPE; - - procedure set_active_dates ( - community_id in dotlrn_communities_all.community_id%TYPE, - start_date in dotlrn_communities_all.active_start_date%TYPE, - end_date in dotlrn_communities_all.active_end_date%TYPE - ); - - procedure delete ( - community_id in dotlrn_communities_all.community_id%TYPE - ); - - function name ( - community_id in dotlrn_communities_all.community_id%TYPE - ) return varchar; - - function member_p ( - community_id in dotlrn_communities_all.community_id%TYPE, - party_id in parties.party_id%TYPE - ) return char; - - function admin_p ( - community_id in dotlrn_communities_all.community_id%TYPE, - party_id in parties.party_id%TYPE - ) return char; - - function url ( - community_id in dotlrn_communities_all.community_id%TYPE - ) return varchar2; - - function has_subcomm_p ( - community_id in dotlrn_communities_all.community_id%TYPE - ) return char; - -end dotlrn_community; +end dotlrn_community_types_in_tr; / -show errors -create or replace package body dotlrn_community -as +create or replace trigger dotlrn_communities_in_tr +before insert on dotlrn_communities_all +for each row +declare + v_parent_sortkey dotlrn_communities_all.tree_sortkey%TYPE; + v_max_child_sortkey dotlrn_communities_all.max_child_sortkey%TYPE; +begin - function new ( - community_id in dotlrn_communities_all.community_id%TYPE default null, - parent_community_id in dotlrn_communities_all.parent_community_id%TYPE default null, - community_type in dotlrn_communities_all.community_type%TYPE, - community_key in dotlrn_communities_all.community_key%TYPE, - pretty_name in dotlrn_communities_all.pretty_name%TYPE, - description in dotlrn_communities_all.description%TYPE, - archived_p in dotlrn_communities_all.archived_p%TYPE default 'f', - portal_id in dotlrn_communities_all.portal_id%TYPE default null, - non_member_portal_id in dotlrn_communities_all.non_member_portal_id%TYPE default null, - package_id in dotlrn_communities_all.package_id%TYPE default null, - join_policy in groups.join_policy%TYPE default null, - creation_date in acs_objects.creation_date%TYPE default sysdate, - creation_user in acs_objects.creation_user%TYPE default null, - creation_ip in acs_objects.creation_ip%TYPE default null, - context_id in acs_objects.context_id%TYPE default null - ) return dotlrn_communities_all.community_id%TYPE - is - c_id integer; - begin - c_id := acs_group.new ( - context_id => dotlrn_community.new.context_id, - group_id => dotlrn_community.new.community_id, - object_type => dotlrn_community.new.community_type, - creation_date => dotlrn_community.new.creation_date, - creation_user => dotlrn_community.new.creation_user, - creation_ip => dotlrn_community.new.creation_ip, - group_name => dotlrn_community.new.community_key, - join_policy => dotlrn_community.new.join_policy - ); + 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 + into v_parent_sortkey, v_max_child_sortkey + from dotlrn_community_types + where community_type = :new.community_type + for update of max_child_sortkey; + else + -- else get the max_child_sortkey of the parent community_type + select 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 of max_child_sortkey; + end if; - insert into dotlrn_communities_all - (community_id, - parent_community_id, - community_type, - community_key, - pretty_name, - description, - package_id, - archived_p, - portal_id, - non_member_portal_id) - values - (c_id, - dotlrn_community.new.parent_community_id, - dotlrn_community.new.community_type, - dotlrn_community.new.community_key, - dotlrn_community.new.pretty_name, - dotlrn_community.new.description, - dotlrn_community.new.package_id, - dotlrn_community.new.archived_p, - dotlrn_community.new.portal_id, - dotlrn_community.new.non_member_portal_id); + -- increment the sort_key + v_max_child_sortkey := lpad(tree.increment_key(v_max_child_sortkey), 6, '0'); - return c_id; - end; - - procedure set_active_dates ( - community_id in dotlrn_communities_all.community_id%TYPE, - start_date in dotlrn_communities_all.active_start_date%TYPE, - end_date in dotlrn_communities_all.active_end_date%TYPE - ) - is - begin + 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 active_start_date = dotlrn_community.set_active_dates.start_date, - active_end_date = dotlrn_community.set_active_dates.end_date - where dotlrn_communities_all.community_id = dotlrn_community.set_active_dates.community_id; - end; + set max_child_sortkey = v_max_child_sortkey + where community_id = :new.parent_community_id; + end if; - procedure delete ( - community_id in dotlrn_communities_all.community_id%TYPE - ) - is - begin - delete - from dotlrn_communities_all - where dotlrn_communities_all.community_id = dotlrn_community.delete.community_id; + -- generate the sortkey for the current row + :new.tree_sortkey := v_parent_sortkey || v_max_child_sortkey; - acs_group.delete(dotlrn_community.delete.community_id); - end; - - function name ( - community_id in dotlrn_communities_all.community_id%TYPE - ) return varchar - is - begin - return acs_group.name(dotlrn_community.name.community_id); - end; - - function member_p ( - community_id in dotlrn_communities_all.community_id%TYPE, - party_id in parties.party_id%TYPE - ) return char - is - v_member_p char(1); - begin - select decode(count(*), 0, 'f', 't') - into v_member_p - from dual - where exists (select 1 - from dotlrn_member_rels_approved - where dotlrn_member_rels_approved.user_id = dotlrn_community.member_p.party_id - and dotlrn_member_rels_approved.community_id = dotlrn_community.member_p.community_id); - - return v_member_p; - end; - - function admin_p ( - community_id in dotlrn_communities_all.community_id%TYPE, - party_id in parties.party_id%TYPE - ) return char - is - v_rv char(1); - begin - select decode( - acs_permission.permission_p(dotlrn_community.admin_p.community_id, dotlrn_community.admin_p.party_id, 'dotlrn_admin_community'), - 'f', - acs_permission.permission_p(dotlrn_community.admin_p.community_id, dotlrn_community.admin_p.party_id, 'admin'), - 't' - ) into v_rv - from dual; - - return v_rv; - end; - - function url ( - community_id in dotlrn_communities_all.community_id%TYPE - ) return varchar2 - is - v_node_id site_nodes.node_id%TYPE; - begin - select site_nodes.node_id into v_node_id - from dotlrn_communities_all, - site_nodes - where dotlrn_communities_all.community_id = dotlrn_community.url.community_id - and site_nodes.object_id = dotlrn_communities_all.package_id; - - return site_node.url(v_node_id); - - exception - when no_data_found then - return ''; - end; - - function has_subcomm_p ( - community_id in dotlrn_communities_all.community_id%TYPE - ) return char - is - v_rv char(1); - begin - select decode(count(*), 0, 'f', 't') - into v_rv - from dual - where exists (select 1 - from dotlrn_communities_all - where dotlrn_communities_all.parent_community_id = dotlrn_community.has_subcomm_p.community_id); - return v_rv; - end; - -end; +end dotlrn_communities_in_tr; / show errors - -create or replace view dotlrn_communities_full -as - select dotlrn_communities.*, - dotlrn_community.url(dotlrn_communities.community_id) as url, - groups.group_name, - groups.join_policy - from dotlrn_communities, - groups - where dotlrn_communities.community_id = groups.group_id; Index: openacs-4/packages/dotlrn/sql/oracle/communities-tree-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/sql/oracle/communities-tree-drop.sql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/dotlrn/sql/oracle/communities-tree-drop.sql 31 May 2002 06:23:49 -0000 1.1 @@ -0,0 +1,18 @@ +-- +-- Copyright (C) 2001, 2002 OpenForce, Inc. +-- +-- This file is part of dotLRN. +-- +-- dotLRN is free software; you can redistribute it and/or modify it under the +-- terms of the GNU General Public License as published by the Free Software +-- Foundation; either version 2 of the License, or (at your option) any later +-- version. +-- +-- dotLRN is distributed in the hope that it will be useful, but WITHOUT ANY +-- WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +-- FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +-- details. +-- + +drop trigger dotlrn_communities_in_tr; +drop trigger dotlrn_community_types_in_tr; Index: openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql,v diff -u -r1.17 -r1.18 --- openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 1 May 2002 01:19:47 -0000 1.17 +++ openacs-4/packages/dotlrn/tcl/community-procs-oracle.xql 31 May 2002 06:23:49 -0000 1.18 @@ -91,26 +91,21 @@ - select object_type - from acs_object_types - where supertype = 'dotlrn_community' - start with object_type = (select community_type - from dotlrn_communities - where parent_community_id is null - and community_type != 'dotlrn_community' - start with community_id = :community_id - connect by community_id = prior parent_community_id) - connect by object_type = prior supertype + 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 object_type - from acs_object_types - where supertype = 'dotlrn_community' - start with object_type = :community_type - connect by object_type = prior supertype + 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/www/communities-chunk-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql,v diff -u -r1.10 -r1.11 --- openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql 1 May 2002 01:19:47 -0000 1.10 +++ openacs-4/packages/dotlrn/www/communities-chunk-oracle.xql 31 May 2002 06:23:49 -0000 1.11 @@ -19,12 +19,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 1 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_active_communities dotlrn_communities, dotlrn_member_rels_approved where dotlrn_member_rels_approved.user_id = :user_id @@ -44,12 +42,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 1 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_communities dotlrn_communities, dotlrn_member_rels_approved where dotlrn_member_rels_approved.user_id = :user_id @@ -69,12 +65,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 0 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_active_comms_not_closed dotlrn_communities where not exists (select 1 from dotlrn_member_rels_full @@ -95,12 +89,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 0 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_communities_not_closed dotlrn_communities where not exists (select 1 from dotlrn_member_rels_full @@ -130,12 +122,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 1 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_active_communities dotlrn_communities, dotlrn_member_rels_approved where dotlrn_member_rels_approved.user_id = :user_id @@ -156,12 +146,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 1 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_communities dotlrn_communities, dotlrn_member_rels_approved where dotlrn_member_rels_approved.user_id = :user_id @@ -182,12 +170,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 0 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_active_comms_not_closed dotlrn_communities where not exists (select 1 from dotlrn_member_rels_full @@ -209,12 +195,10 @@ dotlrn_communities.package_id, dotlrn_community.url(dotlrn_communities.community_id) as url, 0 as member_p, - decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'),'f',0,1) as admin_p, - (select community_type + decode(acs_permission.permission_p(:user_id, dotlrn_communities.community_id, 'admin'), 'f', 0, 1) as admin_p, + (select dotlrn_community_types.community_type from dotlrn_community_types - where supertype = 'dotlrn_community' - start with community_type = dotlrn_communities.community_type - connect by community_type = prior supertype) as root_community_type + where dotlrn_community_types.tree_sortkey = tree.ancestor_key(dotlrn_communities.tree_sortkey, 1)) as root_community_type from dotlrn_communities_not_closed dotlrn_communities where not exists (select 1 from dotlrn_member_rels_full Index: openacs-4/packages/dotlrn/www/dotlrn-main-portlet-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/dotlrn-main-portlet-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn/www/dotlrn-main-portlet-oracle.xql 7 Apr 2002 06:42:38 -0000 1.3 +++ openacs-4/packages/dotlrn/www/dotlrn-main-portlet-oracle.xql 31 May 2002 06:23:49 -0000 1.4 @@ -5,27 +5,19 @@ - select dc.*, - dotlrn_community.url(dc.community_id) as url, - acs_permission.permission_p(dc.community_id, :user_id, 'admin') as admin_p, - decode(dc.community_type, 'dotlrn_community', 'dotlrn_community', - 'dotlrn_club', 'dotlrn_club', - 'dotlrn_class_instance') as simple_community_type - from (select level, - rownum as my_rownum, - dotlrn_communities.community_id, - dotlrn_communities.parent_community_id, - dotlrn_communities.community_type, - dotlrn_communities.pretty_name - from dotlrn_communities - connect by prior dotlrn_communities.community_id = dotlrn_communities.parent_community_id - start with dotlrn_communities.parent_community_id is null - order by decode(dotlrn_communities.community_type, 'dotlrn_community', 2, 'dotlrn_club', 1, 0), - dotlrn_communities.pretty_name) dc, + select dotlrn_communities.*, + dotlrn_community.url(dotlrn_communities.community_id) as url, + decode(dotlrn_communities.community_type, 'dotlrn_community', 'dotlrn_community', + 'dotlrn_club', 'dotlrn_club', + 'dotlrn_class_instance') as simple_community_type, + tree.tree_level(dotlrn_communities.tree_sortkey) as tree_level, + acs_permission.permission_p(dotlrn_communities.community_id, :user_id, 'admin') as admin_p + from dotlrn_communities, dotlrn_member_rels_approved - where dc.community_id = dotlrn_member_rels_approved.community_id + where dotlrn_communities.community_id = dotlrn_member_rels_approved.community_id and dotlrn_member_rels_approved.user_id = :user_id - order by dc.my_rownum + order by decode(dotlrn_communities.community_type, 'dotlrn_community', 2, 'dotlrn_club', 1, 0), + tree_level Index: openacs-4/packages/dotlrn/www/dotlrn-main-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/dotlrn-main-portlet.adp,v diff -u -r1.27 -r1.28 --- openacs-4/packages/dotlrn/www/dotlrn-main-portlet.adp 29 May 2002 04:45:23 -0000 1.27 +++ openacs-4/packages/dotlrn/www/dotlrn-main-portlet.adp 31 May 2002 06:23:49 -0000 1.28 @@ -36,13 +36,20 @@ <% - if {![string equal $communities(simple_community_type) "dotlrn_community"] == 1} { + if {![string equal $communities(simple_community_type) dotlrn_community]} { set new_simple_community_type $communities(simple_community_type) } - set new_level $communities(level) + +# if {[string equal $communities(simple_community_type) dotlrn_club]} { +# set new_level [expr $communities(tree_level) - 1] +# } elseif {[string equal $communities(simple_community_type) dotlrn_class_instance]} { +# set new_level [expr $communities(tree_level) - 3] +# } + + set new_level $communities(tree_level) %> - + @@ -65,12 +72,14 @@
  • - @communities.pretty_name@ - - [ - Administer - ] - + + @communities.pretty_name@ + + [ + Administer + ] + +
  • <%