im_alpha_nav_bar letter initial_list { vars_to_ignore " " }What it does:
Returns an A-Z bar with greyed out letters not in initial_list and bolds "letter". Note that this proc returns the empty string if there are fewer than NumberResultsPerPage records. inital_list is a list where the ith element is a letter and the i+1st letter is the number of times that letter appears.Defined in: /web/philip/tcl/intranet-defs.tcl
Source code:
set min_records [ad_parameter NumberResultsPerPage intranet 50]
# Let's run through and make sure we have enough records
set num_records 0
foreach { l count } $initial_list {
incr num_records $count
}
if { $num_records < $min_records } {
return ""
}
set url "[ns_conn url]?"
set vars_to_ignore_list [list "letter"]
foreach v $vars_to_ignore {
lappend vars_to_ignore_list $v
}
set query_args [export_ns_set_vars url $vars_to_ignore_list]
if { ![empty_string_p $query_args] } {
append url "$query_args&"
}
set html_list [list]
foreach l [im_all_letters] {
if { [lsearch -exact $initial_list $l] == -1 } {
# This means no user has this initial
lappend html_list "<font color=gray>$l</font>"
} elseif { [string compare $l $letter] == 0 } {
lappend html_list "<b>$l</b>"
} else {
lappend html_list "<a href=${url}letter=$l>$l</a>"
}
}
if { [empty_string_p $letter] || [string compare $letter "all"] == 0 } {
lappend html_list "<b>All</b>"
} else {
lappend html_list "<a href=${url}letter=all>All</a>"
}
if { [string compare $letter "scroll"] == 0 } {
lappend html_list "<b>Scroll</b>"
} else {
lappend html_list "<a href=${url}letter=scroll>Scroll</a>"
}
return [join $html_list " | "]