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.4 -r1.5 --- openacs-4/packages/logger/www/admin/index.adp 1 May 2003 21:18:08 -0000 1.4 +++ openacs-4/packages/logger/www/admin/index.adp 1 May 2003 21:50:38 -0000 1.5 @@ -20,8 +20,7 @@ - [ new projection | - permissions | + [ permissions | delete ] @@ -82,41 +81,6 @@ 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.4 -r1.5 --- openacs-4/packages/logger/www/admin/index.tcl 1 May 2003 21:18:08 -0000 1.4 +++ openacs-4/packages/logger/www/admin/index.tcl 1 May 2003 21:50:38 -0000 1.5 @@ -52,32 +52,6 @@ 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.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/admin/project.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/logger/www/admin/project.adp 30 Apr 2003 12:21:16 -0000 1.2 +++ openacs-4/packages/logger/www/admin/project.adp 1 May 2003 21:50:38 -0000 1.3 @@ -5,3 +5,80 @@

+ + +

Variables

+ + + + + +

+ no variables +

+
+ + +

+ [ add variable ] +

+
+ +
+ +

Projections

+ + + + + + + + + + + + + + + + + + + + + + + + + +
 NameStart dayEnd dayVariableValueDescription
+ [ delete ] + + @projections.name@@projections.start_day@@projections.end_day@@projections.variable_name@@projections.value@@projections.description@
+
+ + + There are no projections + + +

+ [ add projection ] +

\ No newline at end of file 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.5 -r1.6 --- openacs-4/packages/logger/www/admin/project.tcl 1 May 2003 21:18:08 -0000 1.5 +++ openacs-4/packages/logger/www/admin/project.tcl 1 May 2003 21:50:38 -0000 1.6 @@ -51,37 +51,59 @@ {description:text(textarea),optional {html {cols 60 rows 13}} } +} -select_query { + select name, + description + from logger_projects + where project_id = :project_id +} -validate { + { + name + { ![empty_string_p [string trim $name]] } + { A name with only spaces is not allowed } + } + +} -new_data { + + logger::project::new -project_id $project_id \ + -name $name \ + -description $description \ +} -edit_data { + + # The edit proc requires all attributes to be provided + # so use the old values for project_lead and active_p + logger::project::get -project_id $project_id -array old_project + logger::project::edit -project_id $project_id \ + -name $name \ + -description $description \ + -project_lead $old_project(project_lead) \ + -active_p $old_project(active_p) +} -after_submit { + + ad_returnredirect "[ad_conn url]?project_id=$project_id" + + ad_script_abort } if { $project_exists_p } { # We are in edit or display mode - # Display the variables linked to this project - set variables_list [list] - set variables_text "" - db_foreach variables_in_project { + + ########### + # + # Variables + # + ########### + + db_multirow variables variables_in_project { select lv.variable_id, lv.name, lpvm.primary_p from logger_project_var_map lpvm, logger_variables lv where lpvm.variable_id = lv.variable_id and lpvm.project_id = :project_id - } { - set variable_link "$name" - if { [string equal $primary_p "f"] } { - append variable_link "   \[ unmap | make primary \]" - } else { - append variable_link " (primary)" - } - - lappend variables_list $variable_link } - if { [llength $variables_list] != 0 } { - set variables_text "" - } else { - set variables_text "no variables" - } set n_can_be_mapped [db_string n_can_be_mapped { select count(*) from logger_variables lv @@ -102,51 +124,28 @@ and acs_permission.permission_p(lv.variable_id, :user_id, 'read') = 't' }] - if { $n_can_be_mapped > 0 } { - append variables_text "

\[add variable\]

" - } + ########### + # + # Projections + # + ########### + db_multirow projections select_projections { + select lpe.projection_id, + lpe.name, + lpe.description, + lpe.value, + lpo.name as project_name, + lv.name as variable_name, + to_char(lpe.start_time, 'YYYY-MM-DD') start_day, + to_char(lpe.end_time, 'YYYY-MM-DD') end_day, + acs_permission.permission_p(lpo.project_id, :user_id, 'admin') as admin_p + from logger_projections lpe, + logger_projects lpo, + logger_variables lv + where lpe.project_id = :project_id + and lpe.project_id = lpo.project_id + and lpe.variable_id = lv.variable_id + } - ad_form -extend -name project_form -form { - {variables:text(inform) - {label Variables} - {value $variables_text} - } - } - } - -# Finalize the form with the execution blocks -ad_form -extend -name project_form -select_query { - select name, - description - from logger_projects - where project_id = :project_id -} -validate { - { - name - { ![empty_string_p [string trim $name]] } - { A name with only spaces is not allowed } - } - -} -new_data { - - logger::project::new -project_id $project_id \ - -name $name \ - -description $description \ -} -edit_data { - - # The edit proc requires all attributes to be provided - # so use the old values for project_lead and active_p - logger::project::get -project_id $project_id -array old_project - logger::project::edit -project_id $project_id \ - -name $name \ - -description $description \ - -project_lead $old_project(project_lead) \ - -active_p $old_project(active_p) -} -after_submit { - - ad_returnredirect "[ad_conn url]?project_id=$project_id" - - ad_script_abort -}