events_range_bar start_id display_size reg_range sql db url { url_vars " " }What it does:
returns a bar for selecting a block of reg_id's display_size large. start_id indicates the start of the current reg_id at which you're looking. reg_range is the largest reg_id at which you're interested in viewing. url is the url of the page calling this procedure. url_vars are any variables passed into url.Defined in: /web/philip/tcl/events-defs.tcl
Source code:
set original_start_id $start_id set return_str "" set found_current_range 0 set i 0 set url_html "?" if {[exists_and_not_null url_vars]} { append url_html $url_vars "&" #append url_html "&" } set selection [ns_db select $db $sql] set i 1 set next_reg_id 0 set found_current_range 0 set first_case 1 while {[ns_db getrow $db $selection]} { set_variables_after_query if {$i == $display_size} { #we've counted reg_id's to write out if {$original_start_id >= 0 && $original_start_id <= $reg_id && !$found_current_range} { #we're displaying this range, so no links if {$first_case} { append return_str "0 to $reg_id | " } else { append return_str "$next_reg_id to $reg_id | " } set found_current_range 1 #pass this end index uplevel uplevel "set end_index \"$reg_id\"" } else { #show a link for this section if {$first_case} { set start_id 0 set tmp_url_html $url_html append tmp_url_html "start_id=$next_reg_id" append return_str " <a href=\"$url$tmp_url_html\"> $next_reg_id to $reg_id</a> | " } else { set start_id $i set tmp_url_html $url_html append tmp_url_html "start_id=$next_reg_id" append return_str " <a href=\"$url$tmp_url_html\"> $next_reg_id to $reg_id</a> | " } } #the first case is special if {$first_case} { set first_case 0 } set next_reg_id [expr $reg_id + 1] set i 1 } else { incr i } } #append the last range if there's any left if {$next_reg_id <= [expr $reg_id]} { if {$found_current_range || $original_start_id < 0} { #show a link for this section set start_id $next_reg_id set tmp_url_html $url_html append tmp_url_html "start_id=$start_id" append return_str " <a href=\"$url$tmp_url_html\"> $next_reg_id to $reg_id</a> | " } else { #we're displaying this range, so no links append return_str "$next_reg_id to $reg_id | " set found_current_range 1 #pass this end index uplevel uplevel "set end_index \"$reg_id\"" } } #show the all registrations link if start_id >=0 if {$original_start_id >= 0 } { set start_id -1 set tmp_url_html $url_html append tmp_url_html "start_id=$start_id" append return_str "<a href=\"$url$tmp_url_html\">all registrations</a>" } else { append return_str "all registrations" } return $return_str