static_add_curriculum_bar_if_necessary pre_bodyWhat it does:
Returns the page, up to the close body tag, with a curriculum bar added if necessaryDefined in: /web/philip/tcl/ad-html.tcl
Source code:
if { ![ad_parameter EnabledP curriculum 0] || ![ad_parameter StickInStaticPagesP curriculum 0] } {
return $pre_body
}
set curriculum_bar [curriculum_bar]
if [empty_string_p $curriculum_bar] {
# we are using the curriculum system but this user doesn't need a bar
return $pre_body
}
# let's look for a good place to stuff the bar
# rely on maximal matching in REGEXP
if { [regexp -nocase {(.*)<hr>(.*)} $pre_body match up_to_last_hr after_last_hr] } {
# we found at least one HR, let's make sure that it is indeed
# at the bottom of the page
if { [string length $up_to_last_hr] > [string length $after_last_hr] } {
# this is indeed probably the last
append pre_body_with_curriculum_bar $up_to_last_hr "\n<center>[curriculum_bar]</center>\n" "<HR>" $after_last_hr
} else {
# found an HR but probably it isn't the last one
append pre_body_with_curriculum_bar $pre_body "\n<center>[curriculum_bar]</center>\n"
}
} else {
append pre_body_with_curriculum_bar $pre_body "\n<center>[curriculum_bar]</center>\n"
}
return $pre_body_with_curriculum_bar