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.96 -r1.97 --- openacs-4/packages/dotlrn/tcl/community-procs.tcl 3 Apr 2002 00:33:12 -0000 1.96 +++ openacs-4/packages/dotlrn/tcl/community-procs.tcl 4 Apr 2002 05:55:45 -0000 1.97 @@ -885,11 +885,20 @@ ad_proc -public has_subcommunity_p { {-community_id:required} } { + Returns 1 if the community has a subcommunity, memoized for 1 min + } { + return [util_memoize "dotlrn_community::has_subcommunity_p_memoized -community_id $community_id" 60] + } + + ad_proc -public has_subcommunity_p_memoized { + {-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} } { @@ -914,8 +923,10 @@ member of all the supergroups to the leaf subgroup. Not even admins see the whole tree. - FIXME: totally unoptimized!! + FIXME: still rather slow + things to get: has_subcom, member_p, url, name, admin_p, not_closed_p, member_pending, needs_approval + things to send: user_id, sc_id, } { set chunk "" @@ -987,6 +998,117 @@ return $chunk } + + ad_proc -public get_subcomm_chunk_new { + {-user_id ""} + {-community_id:required} + {-pretext "
debug: $has_subcomm_p / $m_s = $member_p / $a_s = $admin_p " + + if {$admin_p} { + append chunk \ + "\[admin\]" + } + + append chunk \ + "
debug: $has_subcomm_p / $m_s = $member_p / $a_s = $admin_p " + + if {!$member_p && [not_closed_p -community_id $sc_id]} { + + append chunk \ + "\[" + + if {[member_pending_p -community_id $sc_id -user_id $user_id]} { + append chunk \ + "waiting for approval" + } elseif {[needs_approval_p -community_id $sc_id]} { + append chunk \ + "request membership" + } else { + append chunk \ + "join" + } + + append chunk "\]\n" + } + + if {$admin_p} { + append chunk \ + " \[admin\]\n" + } + } + } + + return $chunk + } + ad_proc -public get_community_type_url { community_type } { @@ -1041,6 +1163,14 @@ } { get the name for a community } { + return [util_memoize "dotlrn_community::get_community_name_memoized $community_id"] + } + + ad_proc -public get_community_name_memoized { + community_id + } { + memo helper + } { return [db_string select_community_name {} -default ""] }