ad_page_contract { @author Matthew Geddert (geddert@yahoo.com) @creation-date 2004-06-07 @cvs-id $Id: index.vuh,v 1.1.2.3 2004/08/19 01:23:15 matthewg Exp $ } { } permission::require_permission -object_id [ad_conn package_id] -privilege "read" set path [split [ad_conn path_info] "-"] set party_id [lindex $path 0] set view_id [lindex $path 1] set error_p 0 if { ![exists_and_not_null party_id] } { set error_p 1 } else { if { ![string is integer $party_id] } { set error_p 1 } else { if { ![contact::exists_p $party_id] } { set error_p 1 } } } if { ![exists_and_not_null view_id] } { if { [string is false $error_p] } { # there is no view_id but the party_id was valid, so we get the default view_id set object_type [contact::get::object_type $party_id] db_0or1row select_first_view_id { select view_id from contact_views where contact_object_type = :object_type order by sort_order limit 1 } if { ![exists_and_not_null view_id] } { # there are no pages available for this contact object type set error_p 1 } } } else { if { [string is integer $view_id] && [string is false $error_p] } { if { ![contacts::view::exists_p -object_type [contact::get::object_type $party_id] $view_id] } { set error_p 1 } } else { # the view_id specified was invalid set error_p 1 } } if { [string is true $error_p] } { ad_returnredirect -message "The URL you specified was invalid" [apm_package_url_from_id [ad_conn package_id]] } else { rp_form_put party_id $party_id rp_form_put view_id $view_id rp_internal_redirect "/packages/contacts/www/view/view" }