Index: openacs-4/packages/logger/lib/entries.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/lib/entries.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/logger/lib/entries.tcl 5 Jan 2004 20:54:25 -0000 1.2 +++ openacs-4/packages/logger/lib/entries.tcl 5 Jan 2004 21:05:27 -0000 1.3 @@ -37,7 +37,8 @@ } } -ds_comment $projection_values +# Projects +set project_values [db_list_of_lists select_projects {}] # Define the list @@ -111,11 +112,12 @@ } -filters { project_id { label "Projects" - values {[db_list_of_lists select_projects {}]} + values $project_values where_clause { le.project_id = :project_id } add_url_eval {[export_vars -base "log" { { project_id $__filter_value } variable_id }]} + has_default_p {[ad_decode [llength $project_values] 1 1 0]} } variable_id { label "Variables" @@ -130,6 +132,7 @@ label "Projections" type multivar values $projection_values + has_default_p 1 } user_id { label "Users" Index: openacs-4/packages/logger/tcl/project-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/project-procs-oracle.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/logger/tcl/project-procs-oracle.xql 11 Dec 2003 21:40:07 -0000 1.3 +++ openacs-4/packages/logger/tcl/project-procs-oracle.xql 5 Jan 2004 21:05:27 -0000 1.4 @@ -37,4 +37,14 @@ + + + select min(p.projection_id) + from logger_projections p + where p.project_id = :project_id + and p.variable_id = :variable_id + and sysdate between p.start_time and p.end_time + + + Index: openacs-4/packages/logger/tcl/project-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/project-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/logger/tcl/project-procs-postgresql.xql 11 Dec 2003 21:40:07 -0000 1.4 +++ openacs-4/packages/logger/tcl/project-procs-postgresql.xql 5 Jan 2004 21:05:27 -0000 1.5 @@ -33,4 +33,14 @@ + + + select min(p.projection_id) + from logger_projections p + where p.project_id = :project_id + and p.variable_id = :variable_id + and current_timestamp between p.start_time and p.end_time + + + Index: openacs-4/packages/logger/tcl/project-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/project-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/logger/tcl/project-procs.tcl 28 Aug 2003 09:45:30 -0000 1.7 +++ openacs-4/packages/logger/tcl/project-procs.tcl 5 Jan 2004 21:05:27 -0000 1.8 @@ -289,3 +289,12 @@ return $users_list } + +ad_proc -public logger::project::get_current_projection { + -project_id:required + -variable_id:required +} { + Gets the active projection for the given project and variable, if any. Returns empty string if none. +} { + return [db_string select_current_projection {} -default {}] +} Index: openacs-4/packages/logger/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.tcl,v diff -u -r1.19 -r1.20 --- openacs-4/packages/logger/www/index.tcl 5 Jan 2004 20:54:25 -0000 1.19 +++ openacs-4/packages/logger/www/index.tcl 5 Jan 2004 21:05:27 -0000 1.20 @@ -41,9 +41,17 @@ set instance_name [ad_conn instance_name] + if { ![exists_and_not_null project_id] } { set package_projects [logger::package::all_projects_in_package -package_id [ad_conn package_id]] if { [llength $package_projects] == 1 } { set project_id $package_projects } } + +# Default to the current projection +if { [exists_and_not_null project_id] && [exists_and_not_null variable_id] && ![exists_and_not_null projection_id] } { + set projection_id [logger::project::get_current_projection \ + -project_id $project_id \ + -variable_id $variable_id] +}