Index: openacs-4/packages/dotlrn/tcl/community-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.tcl,v diff -u -r1.65 -r1.66 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 6 Mar 2002 20:32:22 -0000 1.65 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 7 Mar 2002 06:48:53 -0000 1.66 @@ -686,6 +686,14 @@ } } + ad_proc -public has_subcommunity_p { + {-community_id:required} + } { + Returns 1 if the community has a subcommunity + } { + return [db_0or1row select_subcomm_check {}] + } + ad_proc -public get_subcomm_list { {-community_id:required} } { @@ -703,18 +711,28 @@ ad_proc -public get_subcomm_chunk { {-community_id:required} + {-pretext "<li>"} } { - Returns a html fragment of the subcommunities of this community or - if none, the empty list + Returns a html fragment of the subcommunity hierarchy of this + community or if none, the empty list } { - set subcomm_chunk "<ul>" - + set subcomm_chunk "" foreach subcomm_id [get_subcomm_list -community_id $community_id] { - append subcomm_chunk "<li><a href=[get_community_url $subcomm_id]>[get_community_name $subcomm_id]</a></li>" + if {[has_subcommunity_p -community_id $subcomm_id]} { + append subcomm_chunk \ + "$pretext <a href=[get_community_url $subcomm_id]>" \ + "[get_community_name $subcomm_id]</a>\n" \ + "<ul>\n" \ + [get_subcomm_chunk -community_id $subcomm_id] \ + "</ul>\n" + } else { + append subcomm_chunk \ + "$pretext <a href=[get_community_url $subcomm_id]>" \ + "[get_community_name $subcomm_id]</a>\n" + } } - - return [append subcomm_chunk "</ul>"] + return $subcomm_chunk } ad_proc -public get_community_type_url { Index: openacs-4/packages/dotlrn/tcl/community-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/community-procs.xql,v diff -u -r1.31 -r1.32 --- openacs-4/packages/dotlrn/tcl/community-procs.xql 5 Mar 2002 22:37:34 -0000 1.31 +++ openacs-4/packages/dotlrn/tcl/community-procs.xql 7 Mar 2002 06:48:53 -0000 1.32 @@ -186,6 +186,12 @@ </querytext> </fullquery> +<fullquery name="dotlrn_community::has_subcommunity_p.select_subcomm_check"> +<querytext> +select count(*) from dual where exists (select 1 from dotlrn_communities where parent_community_id = :community_id) +</querytext> +</fullquery> + <fullquery name="dotlrn_community::get_subcomm_list.select_subcomms"> <querytext> select community_id as subcomm_id from dotlrn_communities where parent_community_id = :community_id 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.9 -r1.10 --- openacs-4/packages/dotlrn/www/dotlrn-main-portlet.adp 4 Mar 2002 23:54:00 -0000 1.9 +++ openacs-4/packages/dotlrn/www/dotlrn-main-portlet.adp 7 Mar 2002 06:48:54 -0000 1.10 @@ -1,31 +1,40 @@ -[ -<font size="-1"> - <a href="/dotlrn/all-communities">Join/Drop a Class or Community Group</a> -</font> -] - -<p></p> - <if @classes:rowcount@ gt 0> - <%= [ad_parameter classes_pretty_plural] %> + <div class=larger><%= [ad_parameter classes_pretty_plural] %></div> <ul> <multiple name="classes"> - <li><a href="@classes.url@">@classes.pretty_name@</a></li> - <%= [dotlrn_community::get_subcomm_chunk -community_id $classes(community_id)] %> - + <li> + <a href="@classes.url@">@classes.pretty_name@</a> + <if @classes.admin_p@ eq t> + - <a class=note href="@classes.url@one-community-admin">[admin]</a> + </if> + </li> + <ul> + <%= [dotlrn_community::get_subcomm_chunk -community_id $classes(community_id)] %> + </ul> </multiple> </ul> </if> <if @clubs:rowcount@ gt 0> - <%= [ad_parameter clubs_pretty_plural] %> + <div class=larger><%= [ad_parameter clubs_pretty_plural] %></div> <ul> <multiple name="clubs"> <li> <a href="@clubs.url@">@clubs.pretty_name@</a> - <if @clubs.admin_p@ eq t> - <a href="@clubs.url@one-community-admin">admin</a></if> + <if @clubs.admin_p@ eq t> + - <a class=note href="@clubs.url@one-community-admin">[admin]</a> + </if> </li> - <%= [dotlrn_community::get_subcomm_chunk -community_id $clubs(community_id)] %> + <ul> + <%= [dotlrn_community::get_subcomm_chunk -community_id $clubs(community_id)] %> + </ul> </multiple> </ul> </if> + +<div class="note"> +[ + <a href="/dotlrn/all-communities">Join/Drop a Class or Community Group</a> +] +</div> + Index: openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-portlet-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-portlet-procs.tcl 6 Mar 2002 23:21:16 -0000 1.1 +++ openacs-4/packages/dotlrn-portlet/tcl/dotlrn-members-portlet-procs.tcl 7 Mar 2002 06:49:10 -0000 1.2 @@ -25,7 +25,7 @@ ad_proc -public get_pretty_name { } { - return "Members" + return "Community Members" } ad_proc -public link { Index: openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl,v diff -u -r1.22 -r1.23 --- openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 6 Mar 2002 23:21:16 -0000 1.22 +++ openacs-4/packages/dotlrn-portlet/tcl/dotlrn-portlet-procs.tcl 7 Mar 2002 06:49:10 -0000 1.23 @@ -27,10 +27,9 @@ ad_proc -public get_pretty_name { } { - return "FIXME name Information" + return "Subgroups Plus" } - ad_proc -public link { } { return "" Index: openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.adp 6 Mar 2002 23:21:16 -0000 1.3 +++ openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.adp 7 Mar 2002 06:49:10 -0000 1.4 @@ -2,10 +2,18 @@ @pretty_name@ - <i>@description@</i> - <P> + <if @has_subcomm_p@ eq 1> - @subcomm_data@ + <P> + Subcommunities: <P> + + <ul> + + @subcomm_data@ + + </ul> + </if> </if> <else> <br> Index: openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.tcl 6 Mar 2002 23:21:16 -0000 1.2 +++ openacs-4/packages/dotlrn-portlet/www/dotlrn-portlet.tcl 7 Mar 2002 06:49:10 -0000 1.3 @@ -13,29 +13,10 @@ set pretty_name [dotlrn_community::get_community_name $community_id] set description [dotlrn_community::get_community_description $community_id] +set has_subcomm_p \ + [dotlrn_community::has_subcommunity_p -community_id $community_id] -# aks move to "members" portlets -#if {[dotlrn::user_can_read_private_data_p]} { -# set member_link "<p><a href=\"members\">List of Members</a>" -#} else { -# set member_link "" -#} +set subcomm_data \ + [dotlrn_community::get_subcomm_chunk -community_id $community_id] -set subcomm_list [dotlrn_community::get_subcomm_list -community_id $community_id] -if {[llength $subcomm_list] > 0} { - - set subcomm_data "Subcommunities: <P><ul>" - - foreach subcomm_id $subcomm_list { - append subcomm_data \ - "<li><a href=[dotlrn_community::get_community_url $subcomm_id]>[dotlrn_community::get_community_name $subcomm_id]</li>" - } - - append subcomm_data "</ul>" - -} else { - - set subcomm_data "" -} -