# packages/attachments/www/download/index.vuh ad_page_contract { Virtual URL handler for file downloads @author Ben Adida @creation-date 2 July 2002 @cvs-id $Id: index.vuh,v 1.3.2.2 2019/07/11 16:38:53 hectorr Exp $ } { object_id:naturalnum,notnull attachment_id:naturalnum,notnull } # # Permission check # permission::require_permission -object_id $object_id -privilege read # # Double check if this is the right attachment, and get the live revision if the # object is a 'content_item' or subtype # set object_type [acs_object_type $attachment_id] if {$object_type eq ""} { # # No object type # set version_id "" } elseif {[content::item::is_subclass \ -object_type $object_type \ -supertype "content_item"]} { # # Content item, or subtype # set version_id [db_string select_version_id {} -default {}] } elseif {[content::item::is_subclass \ -object_type $object_type \ -supertype "content_revision"]} { # # Content revision, or subtype # set version_id [db_string select_version_id_revision {} -default {}] } # # Last check # if {$version_id eq ""} { ad_return_complaint 1 [_ attachments.lt_No_such_attachment_fo] ad_script_abort return } # # Good to go # cr_write_content -revision_id $version_id # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: