Index: openacs-4/packages/acs-templating/tcl/filter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-templating/tcl/filter-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-templating/tcl/filter-procs.tcl 29 Dec 2003 20:08:52 -0000 1.13 +++ openacs-4/packages/acs-templating/tcl/filter-procs.tcl 27 Feb 2005 22:45:40 -0000 1.14 @@ -19,24 +19,23 @@ @see ad_cache_returnredirect } { - # DRB: The code that was here before didn't preserve the protocol, always - # using HTTP even if HTTPS was used to establish the connection. Besides - # which ad_returnredirect has funky checks for even funkier browsers, and - # is therefore not only the standard way to redirect in OpenACS 4 but - # more robust as well. + # DRB: The code that was here before didn't preserve the protocol, always + # using HTTP even if HTTPS was used to establish the connection. Besides + # which ad_returnredirect has funky checks for even funkier browsers, and + # is therefore not only the standard way to redirect in OpenACS 4 but + # more robust as well. - set cache_p [lindex $args 0] + set cache_p [lindex $args 0] - if { [string equal $cache_p "t"] } { - set persistent_p [lindex $args 1] + if { [string equal $cache_p "t"] } { + set persistent_p [lindex $args 1] set excluded_vars [lindex $args 2] - ad_cache_returnredirect $url $persistent_p $excluded_vars - } else { + ad_cache_returnredirect $url $persistent_p $excluded_vars + } else { ad_returnredirect $url - } - - ad_script_abort + } + ad_script_abort } ad_proc -public template::filter { command args } { @@ -45,22 +44,22 @@ a reference (not the value) to a variable containing the URL of the template to parse. The filter procedure may modify this. } { - variable filter_list + variable filter_list - set arg1 [lindex $args 0] - set arg2 [lindex $args 1] + set arg1 [lindex $args 0] + set arg2 [lindex $args 1] - switch -exact $command { + switch -exact $command { - add { lappend filter_list $arg1 } + add { lappend filter_list $arg1 } - exec { - upvar $arg1 url $arg2 root_path - foreach proc_name $filter_list { $proc_name url root_path } - } + exec { + upvar $arg1 url $arg2 root_path + foreach proc_name $filter_list { $proc_name url root_path } + } - default { error "Invalid filter command: must be add or exec" } - } + default { error "Invalid filter command: must be add or exec" } + } } # DRB: The following debugging filters weren't integrated with OpenACS. @@ -73,56 +72,55 @@ ad_proc -public cmp_page_filter { why } { Show the compiled template (for debugging) } { - if { [catch { - set url [ns_conn url] - regsub {.cmp} $url {} url_stub - regexp {^/([^/]*)(.*)} $url_stub all package_key rest - set file_stub "[acs_root_dir]/packages/$package_key/www$rest" + if { [catch { + set url [ns_conn url] + regsub {.cmp} $url {} url_stub + regexp {^/([^/]*)(.*)} $url_stub all package_key rest + set file_stub "[acs_root_dir]/packages/$package_key/www$rest" - set beginTime [clock clicks -milliseconds] + set beginTime [clock clicks -milliseconds] - set output "
[ns_quotehtml \
-      [template::adp_compile -file $file_stub.adp]]
" + set output "
[ns_quotehtml [template::adp_compile -file $file_stub.adp]]
" - set timeElapsed [expr ([clock clicks -milliseconds] - $beginTime)] - ns_log debug "cmp_page_filter: Time elapsed: $timeElapsed" + set timeElapsed [expr ([clock clicks -milliseconds] - $beginTime)] + ns_log debug "cmp_page_filter: Time elapsed: $timeElapsed" - } errMsg] } { - global errorInfo - set output
$errorInfo
- } + } errMsg] } { + global errorInfo + set output
[ad_quotehtml $errorInfo]
+ } - ns_return 200 text/html $output + ns_return 200 text/html $output - return filter_return + return filter_return } ad_proc -public dat_page_filter { why } { Show the comments for the template (for designer) } { - if { [catch { - set url [ns_conn url] - regsub {.dat} $url {} url_stub - regexp {^/([^/]*)(.*)} $url_stub all package_key rest - set code_stub "[acs_root_dir]/packages/$package_key/www$rest" + if { [catch { + set url [ns_conn url] + regsub {.dat} $url {} url_stub + regexp {^/([^/]*)(.*)} $url_stub all package_key rest + set code_stub "[acs_root_dir]/packages/$package_key/www$rest" - set beginTime [clock clicks -milliseconds] + set beginTime [clock clicks -milliseconds] - set file_stub [template::get_resource_path]/messages/datasources + set file_stub [template::get_resource_path]/messages/datasources - set output [template::adp_parse $file_stub [list code_stub $code_stub]] + set output [template::adp_parse $file_stub [list code_stub $code_stub]] - set timeElapsed [expr ([clock clicks -milliseconds] - $beginTime)] - ns_log debug " dat_page_filter: Time elapsed: $timeElapsed" + set timeElapsed [expr ([clock clicks -milliseconds] - $beginTime)] + ns_log debug " dat_page_filter: Time elapsed: $timeElapsed" - } errMsg] } { - global errorInfo - set output
$errorInfo
- } + } errMsg] } { + global errorInfo + set output
$errorInfo
+ } - ns_return 200 text/html $output + ns_return 200 text/html $output - return filter_return + return filter_return } # Return the auto-generated template for a form @@ -135,42 +133,41 @@ originally handled inline but doing so screwed up the query processor. } { - set url [ns_conn url] - regsub {.frm} $url {} url_stub - regexp {^/([^/]*)(.*)} $url_stub all package_key rest - set __adp_stub "[acs_root_dir]/packages/$package_key/www$rest" + set url [ns_conn url] + regsub {.frm} $url {} url_stub + regexp {^/([^/]*)(.*)} $url_stub all package_key rest + set __adp_stub "[acs_root_dir]/packages/$package_key/www$rest" - # Set the parse level - variable parse_level - lappend parse_level [info level] + # Set the parse level + variable parse_level + lappend parse_level [info level] - # execute the code to prepare the form(s) for a template - adp_prepare + # execute the code to prepare the form(s) for a template + adp_prepare - # get the form template - return [form::template [ns_queryget form_id] [ns_queryget form_style]] + # get the form template + return [form::template [ns_queryget form_id] [ns_queryget form_style]] } } -ad_proc -public frm_page_filter { why } { +ad_proc -private frm_page_filter { why } { + Return the form data for a request for .frm +} { if { [catch { - set beginTime [clock clicks -milliseconds] + set beginTime [clock clicks -milliseconds] - set output [template::frm_page_handler] + set output [template::frm_page_handler] - set timeElapsed [expr ([clock clicks -milliseconds] - $beginTime)] - ns_log debug "frm_page_filter: Time elapsed: $timeElapsed" + set timeElapsed [expr ([clock clicks -milliseconds] - $beginTime)] + ns_log debug "frm_page_filter: Time elapsed: $timeElapsed" } errMsg] } { - global errorInfo - set output $errorInfo + global errorInfo + set output $errorInfo } - ns_return 200 text/html " - -
[ns_quotehtml $output]
- " + ns_return 200 text/html "
[ns_quotehtml $output]
" - return filter_return + return filter_return }