Index: openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 10 Mar 2003 19:19:14 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/tcl-documentation-procs.tcl 2 Aug 2003 00:40:01 -0000 1.8 @@ -344,6 +344,10 @@ signature for the whole list. For :array it also expects one signature only, taken on the [array get] form of the array. +
cached +
This syntax will check to see if a value is being passed in for this variable. If it is not, it will then look in + cache for this variable in the package that this page is located, and get this value if it exists. +
date
Pluggable filter, installed by default, that makes sure the array validates as a date. Use this filter with :array to do automatic date filtering. To use it, set up in your HTML form @@ -956,6 +960,28 @@ foreach formal_name $apc_formals { upvar 1 $formal_name var + + if { [info exists apc_internal_filter($formal_name:cached)] } { + if { ![ad_page_contract_get_validation_passed_p $formal_name] && ![info exists apc_internal_filter($formal_name:notnull)] && (![info exists apc_default_value($formal_name)] || [empty_string_p $apc_default_value($formal_name)]) } { + if { [info exists apc_internal_filter($formal_name:array)] } { + # This is an array variable, so we need to loop through each name.* variable for this package we have ... + set array_list "" + foreach arrayvar [ns_cache names util_memoize] { + if [regexp [list [ad_conn session_id] [ad_conn package_id] "$formal_name."] $arrayvar] { + set arrayvar [lindex $arrayvar [expr [llength $arrayvar] - 1]] + if { ![empty_string_p $array_list] } { + append array_list " " + } + set arrayvar_formal [string range $arrayvar [expr [string first "." $arrayvar] + 1] [string length $arrayvar]] + append array_list "{$arrayvar_formal} {[ad_get_client_property [ad_conn package_id] $arrayvar]}" + } + } + set apc_default_value($formal_name) $array_list + } else { + set apc_default_value($formal_name) [ad_get_client_property [ad_conn package_id] $formal_name] + } + } + } if { [ad_page_contract_get_validation_passed_p $formal_name] } { @@ -1124,6 +1150,7 @@ trim {internal} notnull {internal} verify {internal} + cached {internal} } nsv_array set ad_page_contract_filter_rules [list] Index: openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 17 May 2003 10:04:18 -0000 1.32 +++ openacs-4/packages/acs-tcl/tcl/utilities-procs.tcl 2 Aug 2003 00:40:01 -0000 1.33 @@ -2417,6 +2417,67 @@ " } +# Brad Duell (bduell@ncacasi.org) 07/10/2003 +# User session variables, then redirect +ad_proc -public ad_cache_returnredirect { url { persistent "f" } { excluded_vars "" } } { + An addition to ad_returnredirect. It caches all variables in the redirect except those in excluded_vars + and then calls ad_returnredirect with the resultant string. + + @author Brad Duell (bduell@ncacasi.org) + +} { + util_memoize_flush_regexp [list [ad_conn session_id] [ad_conn package_id]] + + set url_list [split $url "?"] + set url [lindex $url_list 0] + set vars [lindex $url_list 1] + + set excluded_vars_list "" + set excluded_vars_url "" + for { set i 0 } { $i < [llength $excluded_vars] } { incr i } { + set item [lindex [lindex $excluded_vars $i] 0] + set value [lindex [lindex $excluded_vars $i] 1] + if { [empty_string_p $value] } { + # Obtain value from adp level + upvar #[template::adp_level] __item item_reference + set item_reference $item + upvar #[template::adp_level] __value value_reference + uplevel #[template::adp_level] {set __value [expr $$__item]} + set value $value_reference + } + lappend excluded_vars_list $item + if { ![empty_string_p $value] } { + # Value provided + if { ![empty_string_p $excluded_vars_url] } { + append excluded_vars_url "&" + } + append excluded_vars_url [export_vars -url [list [list "$item" "$value"]]] + } + } + + set saved_list "" + if { ![empty_string_p $vars] } { + foreach item_value [split $vars "&"] { + set item_value_pair [split $item_value "="] + set item [lindex $item_value_pair 0] + set value [ns_urldecode [lindex $item_value_pair 1]] + if { [lsearch -exact $excluded_vars_list $item] == -1 } { + # No need to save the value if it's being passed ... + if { [lsearch -exact $saved_list $item] != -1 } { + # Allows for multiple values ... + append value " [ad_get_client_property [ad_conn package_id] $item]" + } else { + # We'll keep track of who we've saved for this package ... + lappend saved_list $item + } + ad_set_client_property -persistent $persistent [ad_conn package_id] $item $value + } + } + } + + ad_returnredirect "$url?$excluded_vars_url" +} + # branimir 2000/04/25 ad_returnredirect and helper procs : # util_complete_url_p util_absolute_path_p util_current_location # util_current_directory