Index: openacs-4/packages/acs-subsite/www/o.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/o.vuh,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-subsite/www/o.vuh 14 Jun 2004 12:27:12 -0000 1.1 @@ -0,0 +1,62 @@ +ad_page_contract { + This page accepts an object_id and uses the FtsContentProvider url + method for the content type of that item to redirect to the page + to display the object. + + @author Jeff Davis davis@xarg.net + @creation-date 2003-12-29 + @cvs-id $Id: o.vuh,v 1.1 2004/06/14 12:27:12 jeffd Exp $ +} {} + +if {![regexp {^/([0-9]+)(-(.+))?$} [ad_conn path_info] match object_id dummy anchor]} { + ad_return_warning "Invalid object_id" [subst { + We could not find this object. This probably means that + the link you have clicked is broken. + We are sorry for this inconvenience. [ad_conn path_info] + }] + return +} + +if {![empty_string_p $anchor]} { + set anchor "#$anchor" +} + +db_0or1row object_data { + select o.object_type, o.title, o.package_id + from acs_objects o + where o.object_id = :object_id +} + +# Users are handled as a special case since we want to preserve the subsite +# we are loading from... +if {[string eq $object_type user]} { + ad_returnredirect [acs_community_member_url -user_id $object_id] + ad_script_abort +} + + +if {[string eq $object_type content_item]} { + db_0or1row object_data { + select o.object_type, o.object_id, o.package_id + from acs_objects o, cr_items i + where i.item_id = :object_id + and o.object_id = coalesce(i.live_revision, i.latest_revision, i.item_id) + } + if {[string eq $object_type content_item]} { + # punt, assume file storage extlink for now + # JCDXXX TODO: figure out what to do... + ad_returnredirect [apm_package_url_from_id $package_id]simple?object_id=$object_id&todo=fixthis + } + +} + +if {![info exists object_type]} { + ad_return_warning "Invalid object ID" [subst { + The object ID $object_id doesn't exist. +

We are sorry for this inconvenience. + }] + return +} + +set page_url [acs_sc::invoke -error -contract FtsContentProvider -operation url -impl $object_type -call_args [list $object_id]] +ad_returnredirect $page_url$anchor