ad_page_contract { @return a single view, if reference exists, otherwise a list. } { } # requires read_p set instance_id [ad_conn package_id] set user_id [ad_conn user_id] #set read_p [permission::permission_p -party_id $user_id -object_id $instance_id -privilege write] permission::require_permission -party_id $user_id -object_id $instance_id -privilege read # set is_url [ad_conn url] # set e_url [ad_conn extra_url] # set f [ad_conn file] set path_info [ad_conn path_info] set trash_folder_p 0 # path_info doesn not contain the stuff after a ? in a url, at least in some cases #ns_log Notice "path_info $path_info" # if path_info contains no /, lookup f(path_info) as ecds_product_id_site_url_map.site_url #if { [string match "*.html" $path_info] } { # set product_id [ecds_product_id_from_path $path_info] #} # get reference. If exists, pass parameter to a /packages/accounts-finance/www/pretti/view # where view.adp references a /lib/view-one and /lib/view-all which is also referenced in app.adp (now index.adp) for consistent view output set reserved_pages_list [list "index" "pretti/index"] set reserved_page_idx [lsearch -exact $reserved_pages_list $path_info] if { $reserved_page_idx > -1 } { set http_status "500" ns_log Warning "accounts-finance/www/index.vuh.32 should not identify an existing reserved page. reserved_page_idx $reserved_page_idx" ad_return_exception_page $http_status "Internal Error" "A page misconfiguration has created a system error. Please contact site administrators." ad_script_abort } set table_tid "" if { [qf_is_natural_number $path_info] } { set table_tid $path_info # is path_info a table_tid? set table_stats_list [qss_table_stats $table_tid] # name, title, comments, cell_count, row_count, template_id, flags, trashed, popularity, time last_modified, time created, user_id if { [llength $table_stats_list ] > 1 } { set http_status 200 set table_name [lindex $table_stats_list 0] # set table_title [lindex $table_stats_list 1] # set table_comments [lindex $table_stats_list 2] set table_flags [lindex $table_stats_list 6] set trash_folder_p [lindex $table_stats_list 7] set table_tid_from_name [qss_tid_from_name $table_name $instance_id $user_id] if { $table_tid_from_name eq $table_tid } { # table tid is the same as the table referenced by table name. redirect to keep 1 url per table: set http_status 307 # 307 moved temporarily ad_returnredirect $table_name ad_script_abort } rp_form_put mode v rp_form_put table_tid $table_tid rp_form_put trash_folder_p $trash_folder_p rp_internal_redirect /packages/accounts-finance/www/pretti/index ad_script_abort } else { # table_tid does not exist. provide a 404 error set http_status 404 } } # is path_info a table name? set table_tid [qss_tid_from_name $path_info $instance_id $user_id] ns_log Notice "accounts-finance/www/index.vuh.73 path_info '$path_info' table_tid '$table_tid'" if { $table_tid ne "" } { set http_status 200 set table_stats_list [qss_table_stats $table_tid] if { [llength $table_stats_list ] > 1 } { set table_name [lindex $table_stats_list 0] # set table_title [lindex $table_stats_list 1] # set table_comments [lindex $table_stats_list 2] set table_flags [lindex $table_stats_list 6] set trash_folder_p [lindex $table_stats_list 7] set table_tid_from_name [qss_tid_from_name $table_name $instance_id $user_id] rp_form_put mode v rp_form_put table_tid $table_tid rp_form_put trash_folder_p $trash_folder_p rp_internal_redirect /packages/accounts-finance/www/pretti/index ad_script_abort } else { set http_status 404 } } elseif { $path_info eq "trash" } { set trash_folder_p 1 rp_form_put trash_folder_p 1 rp_internal_redirect /packages/accounts-finance/www/pretti/index ad_script_abort } else { # table_tid does not exist. provide a 404 error set http_status 404 } if { $http_status eq "404" } { doc_return 404 text/html " [ad_header "Page Not Found"]
Please contact system administrator at [ad_system_owner] if you think this is a system error.
" ns_log Notice "accounts-finance/www/pretti/index.vuh.66: table_tid '$table_tid' not found for user_id $user_id instance_id $instance_id" ad_script_abort }