Index: openacs-4/packages/dotlrn/tcl/navigation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/navigation-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/dotlrn/tcl/navigation-procs.tcl 11 Dec 2002 13:53:51 -0000 1.20 +++ openacs-4/packages/dotlrn/tcl/navigation-procs.tcl 29 May 2003 18:05:01 -0000 1.21 @@ -45,6 +45,76 @@ return [raw_navbar $args] } + ad_proc -public user_context_bar { + {-community_id:required} + } { +

+ Produce a helpful context bar for .LRN users. The context + bar is intended to aid navigation inside applications mounted + under dotlrn packages (classes, communities, and the .LRN home). + The proc will fetch the context var from the callers scope with upvar. +

+ +

+ Disclaimer: so far the proc has only been tested to work under + classes and communities. +

+ + @param community_id The id of the community/class we are at. + + @author Peter Marklund + } { + set community_context [dotlrn_community::navigation_context $community_id] + + upvar context context + + if { [exists_and_not_null context] } { + # The application context doesn't contain the application node itself so we need to prepend that + array set node_array [site_node::get -node_id [ad_conn node_id]] + set application_name $node_array(instance_name) + set application_url $node_array(url) + + if { [string match admin/* [ad_conn extra_url]] } { + set application_admin_context [list [list "${application_url}admin/" "Administration"]] + } else { + set application_admin_context [list] + } + + set application_context [list [list $application_url $application_name]] + + if { [llength $application_admin_context] > 0 } { + set application_context [concat $application_context $application_admin_context] + } + + if { ![empty_string_p $context] } { + set application_context [concat $application_context $context] + } else { + # Make last entry be just the label + set application_context [lreplace $application_context end end [lindex [lindex $application_context end] 1]] + } + } else { + set application_context [list] + } + + if { [llength $application_context] > 0 } { + set context_bar_context [concat $community_context $application_context] + } else { + # We need the last entry in the community context be just the label, so remove + # the URL + set community_context_last [lindex $community_context end] + set community_context_last_label [lindex $community_context_last 1] + + if { [llength $community_context] == 1} { + set context_bar_context [list $community_context_last_label] + } else { + set community_context_before_last [lrange $community_context 0 end-1] + set context_bar_context [concat $community_context_before_last [list $community_context_last_label]] + } + } + + return [dotlrn::raw_navbar $context_bar_context] + } + ad_proc -public navbar { { -community_id "" } { -community_type "" } @@ -100,7 +170,7 @@ } } - return "[join $list_of_links " > "]
" + return "[join $list_of_links " : "]
" } ad_proc -public portal_navbar { @@ -180,7 +250,8 @@ } # - # Common code for the the behavior of the control panel link + # Common code for the the behavior of the control panel link (class administration + # or my account) # set extra_td_selected_p 0 if {$show_control_panel} {