Index: openacs-4/packages/acs-templating/www/doc/demo/compile.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/www/doc/demo/compile.tcl,v diff -u -r1.1.1.1.30.1 -r1.1.1.1.30.2 --- openacs-4/packages/acs-templating/www/doc/demo/compile.tcl 10 Sep 2015 08:22:09 -0000 1.1.1.1.30.1 +++ openacs-4/packages/acs-templating/www/doc/demo/compile.tcl 24 May 2016 09:11:28 -0000 1.1.1.1.30.2 @@ -1,18 +1,23 @@ -set file [ns_queryget file] +ad_page_contract { -if { [regexp {\.\.|^/} $file] } { + View compiled file + (Part of demo pages) - set compiled "Only files within this directory may be shown." - -} else { - - # [ns_url2file [ns_conn url]] fails under request processor ! - # the file for URL pkg/page may be in packages/pkg/www/page, not www/pkg/page - set dir [file dirname [ad_conn file]] - set compiled [ns_quotehtml [template::adp_compile -file $dir/$file]] +} { + file:trim,notnull +} -validate { + valid_file -requires file { + if { [regexp {\.\.|^/} $file] } { + ad_complain "Only files within this directory may be shown." + } + } } + +# [ns_url2file [ns_conn url]] fails under request processor ! +# the file for URL pkg/page may be in packages/pkg/www/page, not www/pkg/page -ns_return 200 text/html "
$compiled
" +set dir [file dirname [ad_conn file]] +set compiled [template::adp_compile -file $dir/$file] # Local variables: # mode: tcl