Index: openacs-4/packages/acs-tcl/acs-tcl.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/acs-tcl.info,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-tcl/acs-tcl.info 12 Apr 2002 18:06:24 -0000 1.17 +++ openacs-4/packages/acs-tcl/acs-tcl.info 15 May 2002 18:47:31 -0000 1.18 @@ -71,6 +71,8 @@ + + @@ -87,6 +89,9 @@ + + + Index: openacs-4/packages/acs-tcl/tcl/acs-permissions-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/acs-permissions-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-tcl/tcl/acs-permissions-procs.tcl 18 Mar 2002 21:59:14 -0000 1.5 +++ openacs-4/packages/acs-tcl/tcl/acs-permissions-procs.tcl 15 May 2002 18:47:31 -0000 1.6 @@ -6,7 +6,7 @@ @cvs-id $Id$ } -ad_proc -public ad_permission_grant { +ad_proc -deprecated ad_permission_grant { user_id object_id privilege @@ -18,7 +18,7 @@ permission::grant -party_id $user_id -object_id $object_id -privilege $privilege } -ad_proc -public ad_permission_revoke { +ad_proc -deprecated ad_permission_revoke { user_id object_id privilege @@ -30,15 +30,15 @@ permission::revoke -party_id $user_id -object_id $object_id -privilege $privilege } -ad_proc -public ad_permission_p { +ad_proc -deprecated ad_permission_p { {-user_id ""} object_id privilege } { return [permission::permission_p -party_id $user_id -object_id $object_id -privilege $privilege] } -ad_proc -public ad_require_permission { +ad_proc -deprecated ad_require_permission { object_id privilege } { Index: openacs-4/packages/acs-tcl/tcl/admin-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/admin-init.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-tcl/tcl/admin-init.tcl 13 Mar 2001 22:59:26 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/admin-init.tcl 15 May 2002 18:47:31 -0000 1.2 @@ -23,4 +23,4 @@ } db_release_unused_handles -} \ No newline at end of file +} Index: openacs-4/packages/acs-tcl/tcl/defs-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/defs-procs-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/acs-tcl/tcl/defs-procs-oracle.xql 24 Apr 2001 06:02:27 -0000 1.1 +++ openacs-4/packages/acs-tcl/tcl/defs-procs-oracle.xql 15 May 2002 18:47:31 -0000 1.2 @@ -1,32 +1,16 @@ - oracle8.1.6 + oracle8.1.6 - - - - insert into query_strings - (query_date, query_string, subsection, n_results, user_id) values - (sysdate, :query_string, :subsection, :n_results, :user_id) - - - + + + insert + into query_strings + (query_date, query_string, subsection, n_results, user_id) + values + (sysdate, :query_string, :subsection, :n_results, :user_id) + + - - - - - begin - apm.set_value( - package_id => :package_id, - parameter_name => :name, - attr_value => :set - ); - end; - - - - - Index: openacs-4/packages/acs-tcl/tcl/defs-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/defs-procs-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-tcl/tcl/defs-procs-postgresql.xql 24 Apr 2001 06:02:27 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/defs-procs-postgresql.xql 15 May 2002 18:47:31 -0000 1.4 @@ -1,30 +1,16 @@ - postgresql7.1 + postgresql7.1 - - + + + insert + into query_strings + (query_date, query_string, subsection, n_results, user_id) + values + (now(), :query_string, :subsection, :n_results, :user_id) + + - insert into query_strings - (query_date, query_string, subsection, n_results, user_id) values - (now(), :query_string, :subsection, :n_results, :user_id) - - - - - - - - - select apm__set_value( - :package_id, - :name, - :set - ); - - - - - Index: openacs-4/packages/acs-tcl/tcl/defs-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/defs-procs.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/acs-tcl/tcl/defs-procs.tcl 27 Apr 2002 18:29:18 -0000 1.10 +++ openacs-4/packages/acs-tcl/tcl/defs-procs.tcl 15 May 2002 18:47:31 -0000 1.11 @@ -459,7 +459,7 @@ return $package_id } -ad_proc -public ad_parameter { +ad_proc -deprecated ad_parameter { -set {-package_id ""} name @@ -478,48 +478,27 @@ you want. Note: The parameters/ad.ini file is deprecated. + + @see parameter::set_value + @see parameter::get + @param -set Use this if you want to indicate a value to set the parameter to. @param -package_id Specify this if you want to manually specify what object id to use the new parameter. @return The parameter of the object or if it doesn't exist, the default. } { - if {[empty_string_p $package_id]} { - set package_id [ad_requested_object_id] } { - } - - if { [info exists set] } { - if { ![empty_string_p $package_id] } { - # Write to the database. - db_exec_plsql ad_parameter_set { - begin - apm.set_value( - package_id => :package_id, - parameter_name => :name, - attr_value => :set - ); - end; - } - ad_parameter_cache -set $set $package_id $name - } - return $set + if {[info exists set]} { + set ns_param [parameter::set_value -package_id $package_id -parameter $name -value $set] } else { - if { [empty_string_p $package_key] } { - set ns_param [ns_config "ns/server/[ns_info server]/acs" $name] - } else { - set ns_param [ns_config "ns/server/[ns_info server]/acs/$package_key" $name] + set ns_param [ad_parameter_from_file $name $package_key] + if {[empty_string_p $ns_param]} { + set ns_param [parameter::get -package_id $package_id -parameter $name -default $default] } - if { [empty_string_p $ns_param] } { - # Just retrieve the parameter from the cache if it exists. - set ns_param [ad_parameter_cache $package_id $name] - } } - if { ![empty_string_p $ns_param] } { - return $ns_param - } else { - return $default - } + + return $ns_param } -ad_proc -public ad_parameter_from_file { +ad_proc -deprecated ad_parameter_from_file { name {package_key ""} } { @@ -543,6 +522,7 @@ } else { set ns_param [ns_config "ns/server/[ns_info server]/acs/$package_key" $name] } + return $ns_param } Index: openacs-4/packages/acs-tcl/tcl/parameter-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/parameter-procs-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/parameter-procs-oracle.xql 15 May 2002 18:47:31 -0000 1.1 @@ -0,0 +1,18 @@ + + + + oracle8.1.6 + + + + begin + apm.set_value( + package_id => :package_id, + parameter_name => :parameter, + attr_value => :value + ); + end; + + + + Index: openacs-4/packages/acs-tcl/tcl/parameter-procs-postrgesql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/Attic/parameter-procs-postrgesql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/parameter-procs-postrgesql.xql 15 May 2002 18:47:31 -0000 1.1 @@ -0,0 +1,16 @@ + + + + postgresql7.1 + + + + select apm__set_value( + :package_id, + :parameter, + :value + ); + + + + Index: openacs-4/packages/acs-tcl/tcl/parameter-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/parameter-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/acs-tcl/tcl/parameter-procs.tcl 15 May 2002 18:47:31 -0000 1.1 @@ -0,0 +1,85 @@ +ad_library { + + parameter procs + + @author yon (yon@openforce.net) + @creation-date May 12, 2002 + @version $Id: parameter-procs.tcl,v 1.1 2002/05/15 18:47:31 yon Exp $ + +} + +namespace eval parameter { + + ad_proc -public set_value { + {-package_id ""} + {-parameter:required} + {-value:required} + } { + set a parameter + + @param package_id what package to set the parameter in. defaults to + [ad_conn package_id] + @param parameter which parameter's value to set + @param value what value to set said parameter to + } { + if {[empty_string_p $package_id]} { + ::set package_id [ad_requested_object_id] + } + + db_exec_plsql set_parameter_value {} + return [ad_parameter_cache -set $value $package_id $parameter] + } + + ad_proc -public get { + {-package_id ""} + {-parameter:required} + {-default ""} + } { + get a parameter + + @param package_id what package to get the parameter from. defaults to + [ad_conn package_id] + @param parameter which parameter's value to get + @param default what to return if we don't find a value + } { + if {[empty_string_p $package_id]} { + ::set package_id [ad_requested_object_id] + } + + ::set value [ad_parameter_cache $package_id $parameter] + + if {[empty_string_p $value]} { + ::set value $default + } + + return $value + } + + ad_proc -public get_from_package_key { + {-package_key:required} + {-parameter:required} + {-default ""} + } { + get a parameter + + @param package_key what package to get the parameter from. we will try + to get the package_id from the package_key. this + may cause an error if there are more than one + instance of this package + @param parameter which parameter's value to get + @param default what to return if we don't find a value + } { + with_catch errmsg { + ::set value [get \ + -package_id [apm_package_id_from_key $package_key] \ + -parameter $parameter \ + -default $default + ] + } { + ::set value $default + } + + return $value + } + +}