Index: openacs-4/packages/logger/www/lib/entries-table.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/lib/Attic/entries-table.tcl,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/logger/www/lib/entries-table.tcl 6 May 2003 17:37:28 -0000 1.2
+++ openacs-4/packages/logger/www/lib/entries-table.tcl 7 May 2003 16:43:44 -0000 1.3
@@ -1,3 +1,14 @@
+# Displays list of log entries
+#
+# Expects:
+# selected_project_id
+# selected_variable_id
+# selected_user_id
+# selected_entry_id
+# start_date_ansi
+# end_date_ansi
+# projection_value
+
set user_id [ad_conn user_id]
set package_id [ad_conn package_id]
@@ -15,9 +26,12 @@
)"
}
-if { ![info exists selected_variable_unit] } {
- set selected_variable_unit ""
-}
+db_1row select_variable_info {
+ select name,
+ unit
+ from logger_variables
+ where variable_id = :selected_variable_id
+} -column_array variable
if { [exists_and_not_null selected_variable_id] } {
lappend where_clauses "le.variable_id = :selected_variable_id"
@@ -35,25 +49,27 @@
lappend where_clauses "le.time_stamp <= to_date(:end_date_ansi,'YYYY-MM-DD')"
}
+if { ![exists_and_not_null selected_entry_id] } {
+ set selected_entry_id {}
+}
+
set value_total "0"
-db_multirow -extend action_links entries select_entries "
+db_multirow -extend { edit_url delete_url delete_onclick user_chunk selected_p } entries select_entries "
select le.entry_id as id,
acs_permission.permission_p(le.entry_id, :user_id, 'delete') as delete_p,
le.time_stamp,
- lv.name as variable_name,
+ to_char(le.time_stamp, 'fmMMfm-fmDDfm-YYYY') as time_stamp_pretty,
le.value,
- lv.unit,
le.description,
lp.name as project_name,
+ submitter.user_id,
submitter.first_names || ' ' || submitter.last_name as user_name
from logger_entries le,
- logger_variables lv,
logger_projects lp,
acs_objects ao,
cc_users submitter
- where le.variable_id = lv.variable_id
- and le.project_id = lp.project_id
+ where le.project_id = lp.project_id
and ao.object_id = le.entry_id
and ao.creation_user = submitter.user_id
[ad_decode $where_clauses "" "" "and [join $where_clauses "\n and "]"]
@@ -64,17 +80,23 @@
set description "[string range $description 0 [expr $description_max_length - 4]]..."
}
+ set project_name_max_length 20
+ if { [string length $project_name] > $project_name_max_length } {
+ set project_name "[string range $project_name 0 [expr $project_name_max_length - 4]]..."
+ }
+
+ set selected_p [string equal $id $selected_entry_id]
+
set action_links_list [list]
- lappend action_links_list "display"
+ set edit_url "log?[export_vars { { entry_id $id } }]"
if { $delete_p } {
- set onclick_script "return confirm('Are you sure you want to delete log entry with $value $unit $variable_name on $time_stamp?');"
- lappend action_links_list "delete"
- }
- if { [llength $action_links_list] > 0 } {
- set action_links "\[ [join $action_links_list " | "] \]"
+ set delete_onclick "return confirm('Are you sure you want to delete log entry with $value $variable(unit) $variable(name) on $time_stamp?');"
+ set delete_url "log-delete?[export_vars { { entry_id $id } }]"
} else {
- set action_links ""
+ set delete_url ""
}
+
+ set user_chunk [ad_present_user $user_id $user_name]
set value_total [expr $value_total + $value]
}