Index: openacs-4/packages/logger/sql/oracle/logger-tables-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/sql/oracle/logger-tables-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/logger/sql/oracle/logger-tables-create.sql 25 Apr 2003 09:45:15 -0000 1.5 +++ openacs-4/packages/logger/sql/oracle/logger-tables-create.sql 1 May 2003 21:17:39 -0000 1.6 @@ -152,6 +152,8 @@ projection_id integer constraint logger_projections_pk primary key, + name varchar(1000), + description varchar(4000), project_id integer constraint logger_projections_pid_nn not null Index: openacs-4/packages/logger/tcl/projection-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/projection-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/logger/tcl/projection-procs.tcl 5 Apr 2003 13:10:42 -0000 1.1 +++ openacs-4/packages/logger/tcl/projection-procs.tcl 1 May 2003 21:17:54 -0000 1.2 @@ -16,16 +16,18 @@ {-start_time:required} {-end_time:required} {-value:required} + {-name:required} + {-description:required} } { Create a new projection for a certain variable and project. @param projection_id An optional pre-generated id for the projection. @param project_id The id of the project the projection is for @param variable_id The id of the variable the projection is for @param start_time Marks the start of the time range the projection is for. - Must be on ANSI format. + Must be on ANSI day format "YYYY-MM-DD". @param end_time Marks the end of the time range the projection is for. - Must be on ANSI format. + Must be on ANSI day format "YYYY-MM-DD". @param value The anticipated or targeted value (a sum for additive variables, an average for non-additive variables). @@ -45,6 +47,25 @@ return $projection_id } +ad_proc -public logger::projection::edit { + {-projection_id ""} + {-variable_id:required} + {-start_time:required} + {-end_time:required} + {-value:required} + {-name:required} + {-description:required} +} { + Edit a projection. The parameters are explained in the + logger::projection::new proc. + + @return The return value of db_dml + + @author Peter Marklund +} { + db_dml update_projection {} +} + ad_proc -public logger::projection::delete { {-projection_id:required} } { Index: openacs-4/packages/logger/tcl/projection-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/projection-procs.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/logger/tcl/projection-procs.xql 5 Apr 2003 13:10:42 -0000 1.1 +++ openacs-4/packages/logger/tcl/projection-procs.xql 1 May 2003 21:17:55 -0000 1.2 @@ -4,11 +4,38 @@ - insert into logger_projections (projection_id, project_id, variable_id, start_time, end_time, value) - values (:projection_id, :project_id, :variable_id, :start_time, :end_time, :value) + insert into logger_projections (projection_id, + project_id, + variable_id, + start_time, + end_time, + value, + name, + description) + values (:projection_id, + :project_id, + :variable_id, + to_date(:start_time, 'YYYY-MM-DD'), + to_date(:end_time, 'YYYY-MM-DD'), + :value, + :name, + :description) + + + update logger_projections + set variable_id = :variable_id, + start_time = to_date(:start_time, 'YYYY-MM-DD'), + end_time = to_date(:end_time, 'YYYY-MM-DD'), + value = :value, + name = :name, + description = :description + where projection_id = :projection_id + + + delete from logger_projections Index: openacs-4/packages/logger/tcl/ui-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/tcl/ui-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/logger/tcl/ui-procs.tcl 1 May 2003 14:14:33 -0000 1.3 +++ openacs-4/packages/logger/tcl/ui-procs.tcl 1 May 2003 21:17:55 -0000 1.4 @@ -70,3 +70,39 @@ return $selected_p } + +ad_proc -public logger::ui::variable_options { + {-project_id:required} +} { + Return a list suitable to be passed to the form builder + for the select box of the variables that are mapped to + a project. + + @param project_id The id of the project to return variable options for + + @return A list with variable options on the format + [list [list variable_label1 variable_id1] [list variable_label2 variable_value2] ...] + Returns the empty string if project_id is an empty string. + + @author Peter Marklund +} { + if { [empty_string_p $project_id] } { + return "" + } + + set variable_options [list] + db_foreach variable_options { + select lv.variable_id, + lv.name + from logger_variables lv + where exists (select 1 + from logger_project_var_map lpvm + where lpvm.project_id = :project_id + and lpvm.variable_id = lv.variable_id + ) + } { + lappend variable_options [list $name $variable_id] + } + + return $variable_options +} Index: openacs-4/packages/logger/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/logger/www/admin/index.adp 1 May 2003 14:16:18 -0000 1.3 +++ openacs-4/packages/logger/www/admin/index.adp 1 May 2003 21:18:08 -0000 1.4 @@ -20,9 +20,10 @@ - [ delete | - permissions ] + [ new projection | + permissions | + delete ] @projects.name@ @@ -59,9 +60,9 @@ - [ delete | - permissions ] + [ permissions | + delete ] @variables.name@ @@ -81,6 +82,41 @@ Add new variable

+

Projections

+ + + + + + + + + + + + + + + + + + + + + + + +
 ProjectVariableValueNameDescription
+ [ delete ] + + @projections.project_name@@projections.variable_name@@projections.value@@projections.name@@projections.description@
+
+ + + There are no projections + +

Package

Set permissions of this package Index: openacs-4/packages/logger/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/index.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/logger/www/admin/index.tcl 1 May 2003 14:16:18 -0000 1.3 +++ openacs-4/packages/logger/www/admin/index.tcl 1 May 2003 21:18:08 -0000 1.4 @@ -15,11 +15,23 @@ set application_url [ad_conn url] set permissions_uri "/permissions/one" +########### +# +# Projects +# +########### + db_multirow -extend { permissions_url } projects select_projects {} { set description [string_truncate -len 50 $description] set permissions_url "${permissions_uri}?[export_vars {{object_id $project_id} application_url}]" } +########### +# +# Variables +# +########### + db_multirow -extend { permissions_url } variables select_variables { select lv.variable_id, lv.name, @@ -40,6 +52,32 @@ set permissions_url "${permissions_uri}?[export_vars {{object_id $variable_id} application_url}]" } +########### +# +# Projections +# +########### + +db_multirow projections select_variables { + select lpe.projection_id, + lpe.name, + lpe.description, + lpe.value, + lpo.name as project_name, + lv.name as variable_name, + acs_permission.permission_p(lpo.project_id, :user_id, 'admin') as admin_p + from logger_projections lpe, + logger_projects lpo, + logger_variables lv + where exists (select 1 + from logger_project_pkg_map lppm + where lppm.package_id = :package_id + and lppm.project_id = lpe.project_id + ) + and lpe.project_id = lpo.project_id + and lpe.variable_id = lv.variable_id +} + set package_permissions_url "${permissions_uri}?[export_vars {{object_id $package_id} application_url}]" ad_return_template Index: openacs-4/packages/logger/www/admin/project.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/logger/www/admin/project.tcl 1 May 2003 14:16:18 -0000 1.4 +++ openacs-4/packages/logger/www/admin/project.tcl 1 May 2003 21:18:08 -0000 1.5 @@ -114,9 +114,7 @@ } } -} else { - # We are in add mode -} +} # Finalize the form with the execution blocks ad_form -extend -name project_form -select_query { Index: openacs-4/packages/logger/www/admin/variable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/variable.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/logger/www/admin/variable.tcl 1 May 2003 14:16:18 -0000 1.3 +++ openacs-4/packages/logger/www/admin/variable.tcl 1 May 2003 21:18:08 -0000 1.4 @@ -1,5 +1,5 @@ ad_page_contract { - Add/edit/display a variable for this Logger application instance. + Add/edit/display a variable. @author Peter marklund (peter@collaboraid.biz) @creation-date 2003-04-15