# packages/file-storage/www/download/index.vuh ad_page_contract { Virtual URL handler for file downloads @author Kevin Scaldeferri (kevin@arsdigita.com) @author Don Baccus (simplified it by using cr utility) @creation-date 18 December 2000 @cvs-id $Id: index.vuh,v 1.11 2014/10/27 16:41:35 victorg Exp $ } { file_id:naturalnum,optional version_id:naturalnum,optional } -validate { either_one { if { ! [info exists file_id] && ! [info exists version_id] } { ad_complain "Either file_id or version_id must exist" } } } if {(![info exists version_id] || $version_id eq "") && [info exists file_id]} { set version_id [content::item::get_live_revision -item_id $file_id] } if { (![info exists file_id] || $file_id eq "") && [info exists version_id] } { set file_id [content::revision::item_id -revision_id $version_id] } set user_id [ad_conn user_id] permission::require_permission -party_id $user_id -object_id $version_id -privilege read if {[apm_package_installed_p views]} { views::record_view -object_id $file_id -viewer_id $user_id } cr_write_content -revision_id $version_id