################## KLUDGE BY STAS ###############
# Try and look up the item in the content repository
#################################################
ad_page_contract {
   
    @author Unknown
    @creation-date Unknown
    @cvs-id $Id: index.vuh,v 1.8 2003/07/07 12:25:53 olah Exp $
} {    
    { revision_id "" }
}

# Get the paths
set the_root [ns_info pageroot]
set the_url [ad_conn path_info]
set content_type ""


# Get the IDs
set content_root [db_string content_root ""]
set template_root [db_string template_root ""]

# Serve the page

# DRB: Note that content::init modifies the local variable the_root, which is treated
# as though it's been passed by reference.   This requires that the redirect treat the
# path as an absolute path within the filesystem.

if { [content::init the_url the_root $content_root $template_root public $revision_id $content_type] } {
  set file "$the_root/$the_url"
  rp_internal_redirect -absolute_path $file
} else {
  # 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 200 text/html $page
}

