Index: openacs-4/packages/file-storage/www/view/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/view/index.vuh,v diff -u -r1.6 -r1.7 --- openacs-4/packages/file-storage/www/view/index.vuh 12 Dec 2008 18:03:25 -0000 1.6 +++ openacs-4/packages/file-storage/www/view/index.vuh 27 May 2009 12:09:02 -0000 1.7 @@ -2,7 +2,7 @@ # Try and look up the item in the content repository ################################################# ad_page_contract { - + @author Unknown @creation-date Unknown @cvs-id $Id$ @@ -20,11 +20,11 @@ set content_root [fs::get_root_folder] set template_root [db_string template_root ""] set file_id [::content::item::get_id -item_path $the_url \ - -root_folder_id $content_root \ - -resolve_index "f"] + -root_folder_id $content_root \ + -resolve_index "f"] set user_id [ad_conn user_id] - + # Serve the page # DRB: Note that content::init modifies the local variable the_root, which is treated @@ -35,43 +35,44 @@ # Make sure we are not dealing with an upgraded file and there exists a file with the title if { [string equal "" $file_id] } { - set splitted_url [split $the_url "/"] - set item_url_title [lindex $splitted_url end] + set splitted_url [split $the_url "/"] + set item_url_title [lindex $splitted_url end] - # THIS CODE ONLY TAKES TWO FOLDERS INTO ACCOUNT. THIS NEEDS TO BE FIXED LATER - set item_url_folder [lindex $splitted_url end-1] - set item_url_parent_folder [lindex $splitted_url end-2] - set file_id [db_string upgraded_item_id {} -default 0] + # THIS CODE ONLY TAKES TWO FOLDERS INTO ACCOUNT. THIS NEEDS TO BE FIXED LATER + set item_url_folder [lindex $splitted_url end-1] + set item_url_parent_folder [lindex $splitted_url end-2] + set file_id [db_string upgraded_item_id {} -default 0] } if {$file_id == 0} { - # ns_returnnotfound - set page "[ad_header {Content Item Not Found}]" - append page "<h3>Content Item Not Found</h3>" - append page "The requested item is not available for viewing. " - append page "The item is either not available on this server or it is not in a publishable state " - append page "Unpublished items can be viewed via the CMS interface if the CMS package is installed.<br>" - append page "[ad_footer]" - doc_return 404 text/html $page + # ns_returnnotfound + set page "[ad_header {Content Item Not Found}]" + append page "<h3>Content Item Not Found</h3>" + append page "The requested item is not available for viewing. " + append page "The item is either not available on this server or it is not in a publishable state " + append page "Unpublished items can be viewed via the CMS interface if the CMS package is installed.<br>" + append page "[ad_footer]" + doc_return 404 text/html $page } else { - if {[content::symlink::is_symlink -item_id $file_id]} { - set file_id [content::symlink::resolve -item_id $file_id] - } + if {[content::symlink::is_symlink -item_id $file_id]} { + set file_id [content::symlink::resolve -item_id $file_id] + } - if {![exists_and_not_null version_id]} { - set version_id [item::get_live_revision $file_id] - } + if {![exists_and_not_null version_id]} { + set version_id [item::get_live_revision $file_id] + } - if {[apm_package_installed_p views]} { - views::record_view -object_id $file_id -viewer_id $user_id - } + if {[apm_package_installed_p views]} { + views::record_view -object_id $file_id -viewer_id $user_id + } - permission::require_permission \ - -party_id $user_id \ - -object_id $version_id \ - -privilege read - cr_write_content -revision_id $version_id + permission::require_permission \ + -party_id $user_id \ + -object_id $version_id \ + -privilege read + + cr_write_content -revision_id $version_id } } else {