Index: openacs-4/packages/dotlrn/www/dotlrn-main-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/www/dotlrn-main-portlet.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/dotlrn/www/dotlrn-main-portlet.tcl 24 Jul 2004 08:34:10 -0000 1.13 +++ openacs-4/packages/dotlrn/www/dotlrn-main-portlet.tcl 8 Aug 2006 21:26:24 -0000 1.14 @@ -32,6 +32,18 @@ set show_archived_p 0 } +#DRB: This is a hack that depends on .LRN having clubs and classes. Done quickly for +#theme-selva for .LRN 2.2. + +set community_type_clause "" +if { [exists_and_not_null community_filter] } { + if { $community_filter eq "class_instances" } { + set community_type_clause "and dotlrn_communities_all.community_type not in ('dotlrn_community', 'dotlrn_club', 'dotlrn_pers_community')" + } elseif { $community_filter eq "communities" } { + set community_type_clause "and dotlrn_communities_all.community_type in ('dotlrn_club', 'dotlrn_pers_community')" + } +} + set user_id [ad_conn user_id] set user_can_browse_p [dotlrn::user_can_browse_p -user_id $user_id] @@ -46,15 +58,61 @@ } set comm_type "" -db_multirow communities select_communities {} { - set tree_level [expr $tree_level - $community_type_level] +set old_depth 0 +set depth 0 +db_multirow -extend {intra_type_ul_tags previous_type_ul_tags} communities select_communities {} { + set intra_type_ul_tags "" + set previous_type_ul_tags "" + set new_type_p 0 if {![string equal $simple_community_type dotlrn_community]} { set comm_type $simple_community_type } else { set simple_community_type $comm_type } + #Checking for existence of old_simple_community_type gives us an + #easy way to detect the first row. Don't pre-define it! + if { ![info exists old_simple_community_type] || + ![string equal $old_simple_community_type $simple_community_type] } { + set base_level $tree_level + set new_type_p 1 + } + if { [info exists old_simple_community_type] && + ![string equal $old_simple_community_type $simple_community_type] } { + append previous_type_ul_tags [string repeat "" $old_depth] + set old_depth 0 + } + + set depth [expr $tree_level - $base_level] + if { $depth > $old_depth } { + append intra_type_ul_tags [string repeat "" [expr $old_depth - $depth]] + append intra_type_ul_tags "
  • " + } + if { $depth == $old_depth && !$new_type_p } { + append intra_type_ul_tags "
  • " + } + + set old_depth $depth + set old_simple_community_type $simple_community_type } +if { $old_depth > 0 } { + set final_ul_tags [string repeat "
  • " $old_depth] +} else { + set final_ul_tags "" +} + set dotlrn_url [dotlrn::get_url] +# Add the dhtml tree javascript to the HEAD. +global dotlrn_master__header_stuff +append dotlrn_master__header_stuff { + + +} + +set self_registration_p [parameter::get -parameter SelfRegistrationP -package_id [dotlrn::get_package_id] -default 1] + ad_return_template