Index: openacs-4/packages/logger/tcl/variable-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/variable-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/logger/tcl/variable-procs.tcl 22 Apr 2003 09:25:40 -0000 1.3 +++ openacs-4/packages/logger/tcl/variable-procs.tcl 25 Apr 2003 09:47:11 -0000 1.4 @@ -14,8 +14,9 @@ {-name:required} {-unit:required} {-type "additive"} + {-pre_installed_p 0} } { - Create a new variable to use for logger measurements. The + Create a new variable to use for logger entries. The variable can be tied to logger projects through the logger::project::add_variable proc. @@ -24,22 +25,25 @@ @param unit The unit of the variable, for example hours, minutes, or a currency code such as USD or EUR. @param type Must be either additive (default) or non-additive. + @param pre_installed_p Indicates whether this is a variable that is comes pre-installed + with the logger application (1) or not (0). Default is 0. @return The id of the created variable. @author Peter Marklund } { ad_assert_arg_value_in_list type {additive non-additive} - # Default variable_id to next id in a sequence - if { [empty_string_p $variable_id] } { - set variable_id [db_nextval logger_variables_seq] + # Use ad_conn to initialize variables + logger::util::set_vars_from_ad_conn {package_id creation_user creation_ip} + + if { $pre_installed_p } { + # Pre-installed vars are not associated with any particular package + set package_id [db_null] } - set package_id [ad_conn package_id] + db_exec_plsql insert_variable {} - db_dml insert_variable {} - return $variable_id } @@ -78,7 +82,7 @@ @author Peter Marklund } { - db_dml delete_variable {} + db_exec_plsql delete_variable {} } ad_proc -public logger::variable::get {