ad_page_contract { Gives the contact information for an employee or office. This works as-is with the ArsDigita Community System 3.x Intranet Module, but the queries can easily be changed to work with another system. You may use this software free under the GNU General Public License. @param user_or_office_id The user_id (default) or office_id (if it starts with the string office). @param passcode The 4-digit passcode, in case someone tries to access this page w/out going through passcode-check.tcl. @author Eve Andersson, eveander@eveander.com @creation-date February 24, 2001 } { user_or_office_id passcode:notnull,integer } if { [string compare $passcode [vxml_tellme_phone_dir_passcode]] != 0 } { ns_log Notice "/tellme/one.tcl exiting due to incorrect passcode" return } # by default the user_of_office_id is a user_id set lookup_party_type "user" # it is an office if it starts with the string office (then the office group_id appears after a space) if { [string match "office*" $user_or_office_id] } { # it's an office set lookup_party_type "office" # user_or_office_id is of the form "office office_id" set office_id [lindex $user_or_office_id 1] } set result_audio_list [list] if { $lookup_party_type == "user" } { # Get user's name and phone numbers. # It might also make sense to select priv_home_phone, etc., but I wouldn't know what to do with them # (they're integers, not booleans, and they're uncommented in community-core.sql). set user_id $user_or_office_id if { ![db_0or1row user_info "select u.first_names, u.last_name, c.home_phone, c.work_phone, c.cell_phone, c.pager, c.fax from users_contact c, users u where c.user_id = u.user_id and c.user_id = :user_id"] } { set party_name "Unknown user." lappend result_audio_list "" } else { set party_name "$first_names $last_name" set user_contact_fields [list [list work_phone "work phone"] [list cell_phone "cell phone"] [list home_phone "home phone"] [list pager pager] [list fax fax]] foreach user_contact_field $user_contact_fields { set user_contact_field_name [lindex $user_contact_field 1] set user_contact_field_value [set [lindex $user_contact_field 0]] if { ![empty_string_p $user_contact_field_value] } { lappend result_audio_list "" } } if { [llength $result_audio_list] == 0 } { lappend result_audio_list "" } else { if { [llength $result_audio_list] == 1 } { set again_message "Again, the number is" } else { set again_message "Again, the numbers are" } set result_audio_list [concat $result_audio_list [list "1500" ""] $result_audio_list] } } } elseif { $lookup_party_type == "office" } { if { ![db_0or1row user_info "select g.group_name, f.fax, f.phone, f.address_line1, f.address_line2, f.address_city from user_groups g, im_offices o, im_facilities f where g.group_id=:office_id and g.group_id = o.group_id and f.facility_id = o.facility_id"] } { set party_name "Unknown office." lappend result_audio_list "" } else { set party_name "the $group_name office" set office_contact_fields [list [list phone telephone] [list fax fax] [list address_line1 address] [list address_line2 ""] [list address_city ""]] foreach office_contact_field $office_contact_fields { set office_contact_field_name [lindex $office_contact_field 1] set office_contact_field_value [set [lindex $office_contact_field 0]] if { ![empty_string_p $office_contact_field_value] } { lappend result_audio_list "" } } if { [llength $result_audio_list] == 0 } { lappend result_audio_list "" } else { set result_audio_list [concat $result_audio_list [list "1500" ""] $result_audio_list] } } } db_release_unused_handles set results_audio [join $result_audio_list "\n"] set content "
$results_audio 500
" vxml_return_content $content