set special_index_page [ad_parameter SpecialIndexPage content]
if ![empty_string_p $special_index_page] {
set full_filename "[ns_info pageroot]$special_index_page"
if [file exists $full_filename] {
ns_returnfile 200 [ns_guesstype $full_filename] $full_filename
return
}
}
# publisher didn't have any special directive for the top-level
# page, so let's generate something
set old_login_process [ad_parameter "SeparateEmailPasswordPagesP" "" "0"]
ReturnHeaders
ns_write "[ad_header [ad_system_name]]
[ad_system_name]
Login
"
set user_id [ad_get_user_id]
set db [ns_db gethandle]
if { $user_id != 0 } {
# they've got a cookie
if ![catch { set user_name [database_to_tcl_string $db "select first_names || ' ' || last_name as name from users where user_id = $user_id and user_state <> 'deleted'"] } errmsg] {
# no errors
ns_write "If you like, you can go directly to $user_name's [ad_pvt_home_name] in [ad_system_name]."
}
set requires_registration_p_clause ""
} else {
# not logged in
set requires_registration_p_clause "\nand requires_registration_p <> 't'"
}
ns_write ""
set selection [ns_db select $db "
select section_url_stub, section_pretty_name
from content_sections
where scope='public' and enabled_p = 't' $requires_registration_p_clause
order by sort_key, upper(section_pretty_name)"]
while { [ns_db getrow $db $selection] } {
set_variables_after_query
ns_write "- $section_pretty_name\n"
}
ns_write "
[ad_footer]
"