Index: openacs-4/packages/logger/lib/entries-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/lib/entries-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/lib/entries-oracle.xql 4 Jan 2004 21:27:48 -0000 1.1 @@ -0,0 +1,32 @@ + + + + oracle8.1.6 + + + + select le.entry_id, + acs_permission.permission_p(le.entry_id, :current_user_id, 'delete') as delete_p, + acs_permission.permission_p(le.entry_id, :current_user_id, 'write') as edit_p, + le.time_stamp, + to_char(le.time_stamp, 'fmDyfm fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + to_char(le.time_stamp, 'IW-YYYY') as time_stamp_week, + le.value, + le.description, + lp.project_id, + lp.name as project_name, + submitter.user_id, + submitter.first_names || ' ' || submitter.last_name as user_name + from logger_entries le, + logger_projects lp, + acs_objects ao, + cc_users submitter + where le.project_id = lp.project_id + and ao.object_id = le.entry_id + and ao.creation_user = submitter.user_id + [list::filter_where_clauses -and -name "entries"] + [list::orderby_clause -orderby -name "entries"] + + + + Index: openacs-4/packages/logger/lib/entries-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/lib/entries-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/lib/entries-postgresql.xql 4 Jan 2004 21:27:48 -0000 1.1 @@ -0,0 +1,32 @@ + + + + postgresql7.2 + + + + select le.entry_id, + acs_permission__permission_p(le.entry_id, :current_user_id, 'delete') as delete_p, + acs_permission__permission_p(le.entry_id, :current_user_id, 'write') as edit_p, + le.time_stamp, + to_char(le.time_stamp, 'fmDyfm fmMMfm-fmDDfm-YYYY') as time_stamp_pretty, + to_char(le.time_stamp, 'IW-YYYY') as time_stamp_week, + le.value, + le.description, + lp.project_id, + lp.name as project_name, + submitter.user_id, + submitter.first_names || ' ' || submitter.last_name as user_name + from logger_entries le, + logger_projects lp, + acs_objects ao, + cc_users submitter + where le.project_id = lp.project_id + and ao.object_id = le.entry_id + and ao.creation_user = submitter.user_id + [list::filter_where_clauses -and -name "entries"] + [list::orderby_clause -orderby -name "entries"] + + + + Index: openacs-4/packages/logger/lib/entries.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/lib/entries.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/lib/entries.adp 4 Jan 2004 21:27:48 -0000 1.1 @@ -0,0 +1,14 @@ + + + + + + +
+ + + + + +
+
Index: openacs-4/packages/logger/lib/entries.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/lib/entries.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/lib/entries.tcl 4 Jan 2004 21:27:48 -0000 1.1 @@ -0,0 +1,311 @@ +# Expected variables: +# +# filters_p, default true, show filters +# + +if { ![exists_and_not_null filters_p] } { + set filters_p 1 +} + +if { ![exists_and_not_null format] } { + set format "normal" +} + +set package_id [ad_conn package_id] +set current_user_id [ad_conn user_id] +set admin_p [permission::permission_p -object_id $package_id -privilege admin] + +if { [empty_string_p $variable_id] } { + ad_return_template "no-projects" + return +} + +# Get variable info +logger::variable::get -variable_id $variable_id -array variable + +# These are used to construct the values for the date filter +set weekdayno [clock format [clock seconds] -format %w] +set monthdayno [string trimleft [clock format [clock seconds] -format %d] 0] + +# Define the list + +list::create \ + -name entries \ + -multirow entries \ + -key entry_id \ + -row_pretty_plural "entries" \ + -checkbox_name checkbox \ + -selected_format $format \ + -class "list" \ + -main_class "list" \ + -sub_class "narrow" \ + -pass_properties { + variable + } -actions { + "Add Entry" "project-select" "Add new log entry" + } -bulk_actions { + "Delete" "log-delete" "Delete checked entries" + } -elements { + edit { + label {} + display_template { + + Edit + + } + } + project_id { + display_col project_name + label "Project" + hide_p {[ad_decode [exists_and_not_null project_id] 1 1 0]} + } + user_id { + label "User" + display_col user_name + link_url_eval {[acs_community_member_url -user_id $user_id]} + csv_col user_name + hide_p {[ad_decode [exists_and_not_null user_id] 1 1 0]} + } + time_stamp { + label "Date" + display_col time_stamp_pretty + aggregate_label {[ad_decode $variable(type) "additive" "Total" "Average"]} + aggregate_group_label {[ad_decode $variable(type) "additive" "Group total" "Group Average"]} + } + value { + label $variable(name) + link_url_eval {log?[export_vars { entry_id }]} + link_html { title "View this entry" } + aggregate {[ad_decode $variable(type) "additive" sum average]} + html { align right } + display_eval {[lc_numeric $value]} + } + description { + label "Description" + display_eval {[string_truncate -len 50 -- $description]} + link_url_eval {log?[export_vars { entry_id }]} + link_html { title "View this entry" } + } + description_long { + label "Description" + display_eval {[string_truncate -len 400 -- $description]} + hide_p 1 + link_url_eval {log?[export_vars { entry_id }]} + link_html { title "View this entry" } + } + } -filters { + project_id { + label "Projects" + values {[db_list_of_lists select_projects {}]} + where_clause { + le.project_id = :project_id + } + add_url_eval {[export_vars -base "log" { { project_id $__filter_value } variable_id }]} + } + variable_id { + label "Variables" + values {[db_list_of_lists select_variables {}]} + where_clause { + le.variable_id = :variable_id + } + add_url_eval {[ad_decode [exists_and_not_null project_id] 1 [export_vars -base "log" { project_id { variable_id $__filter_value } }] ""]} + has_default_p t + } + user_id { + label "Users" + values {[db_list_of_lists select_users {}]} + where_clause { + submitter.user_id = :user_id + } + } + time_stamp { + label "Date" + where_clause { + le.time_stamp >= to_date(:start_date,'YYYY-MM-DD') and le.time_stamp <= to_date(:end_date,'YYYY-MM-DD') + } + other_label "Custom" + type multival + has_default_p 1 + values { + { + "Today" { + [clock format [clock seconds] -format "%Y-%m-%d"] + [clock format [clock seconds] -format "%Y-%m-%d"] + } + } + { + "Yesterday" { + [clock format [clock scan "-1 days"] -format "%Y-%m-%d"] + [clock format [clock scan "-1 days"] -format "%Y-%m-%d"] + } + } + { + "This week" { + [clock format [clock scan "-$weekdayno days"] -format "%Y-%m-%d"] + [clock format [clock scan "[expr 6-$weekdayno] days"] -format "%Y-%m-%d"] + } + } + { + "Last week" { + [clock format [clock scan "[expr -7-$weekdayno] days"] -format "%Y-%m-%d"] + [clock format [clock scan "[expr -1-$weekdayno] days"] -format "%Y-%m-%d"] + } + } + { + "Past 7 days" { + [clock format [clock scan "-1 week 1 day"] -format "%Y-%m-%d"] + [clock format [clock seconds] -format "%Y-%m-%d"] + } + } + { + "This month" { + [clock format [clock scan "[expr 1-$monthdayno] days"] -format "%Y-%m-%d"] + [clock format [clock scan "1 month -1 day" -base [clock scan "[expr 1-$monthdayno] days"]] -format "%Y-%m-%d"] + } + } + { + "Last month" { + [clock format [clock scan "-1 month [expr 1-$monthdayno] days"] -format "%Y-%m-%d"] + [clock format [clock scan "1 month -1 day" -base [clock scan "-1 month [expr 1-$monthdayno] days"]] -format "%Y-%m-%d"] + } + } + { + "Past 30 days" { + [clock format [clock scan "-1 month 1 day"] -format "%Y-%m-%d"] + [clock format [clock seconds] -format "%Y-%m-%d"] + } + } + { + "Always" { + [clock format 0 -format "%Y-%m-%d"] + [clock format [clock scan "+10 year"] -format "%Y-%m-%d"] + } + } + } + } + } -groupby { + label "Group by" + type multivar + values { + { "Day" { { groupby time_stamp } { orderby time_stamp,desc } } } + { "Week" { { groupby time_stamp_week } { orderby time_stamp,desc } } } + { "Project" { { groupby project_name } { orderby project_id,asc } } } + { "User" { { groupby user_id } { orderby user_id,asc } } } + } + } -orderby { + default_value time_stamp,desc + time_stamp { + label "Date" + orderby_desc "le.time_stamp desc, ao.creation_date desc" + orderby_asc "le.time_stamp asc, ao.creation_date asc" + default_direction desc + } + project_id { + label "Project" + orderby_asc "project_name asc, le.time_stamp desc, ao.creation_date desc" + orderby_desc "project_name desc, le.time_stamp desc, ao.creation_date desc" + } + user_id { + label "User" + orderby_asc "user_name asc, le.time_stamp desc, ao.creation_date desc" + orderby_desc "user_name desc, le.time_stamp desc, ao.creation_date desc" + } + value { + label $variable(name) + orderby_asc "value asc, le.time_stamp desc, ao.creation_date desc" + orderby_desc "value desc, le.time_stamp desc, ao.creation_date desc" + } + description { + label "Description" + orderby_asc "description asc, le.time_stamp desc, ao.creation_date desc" + orderby_desc "description desc, le.time_stamp desc, ao.creation_date desc" + } + } -formats { + normal { + label "Table" + layout table + row { + checkbox {} + edit {} + project_id {} + user_id {} + time_stamp {} + value {} + description {} + } + } + detailed { + label "Detailed table" + layout table + row { + checkbox { + html { rowspan 2 } + } + edit {} + project_id {} + user_id {} + time_stamp {} + value {} + } + row { + description_long { + html { colspan 5 } + hide_p 0 + } + } + } + list { + label "List" + layout list + template { + + + + + +
+ + + @variable.name@: + + @variable.unit@
+ +
+ + Project:
+ + By + on +
+ } + } + csv { + label "CSV" + output csv + page_size 0 + } + } + + + +# This query will override the ad_page_contract value entry_id + +db_multirow -extend { edit_url delete_url delete_onclick } -unclobber entries select_entries " +" { + set selected_p [string equal [ns_queryget entry_id] $entry_id] + set edit_url "log?[export_vars { entry_id { edit t } }]" + set edit_p [ad_decode [expr [ad_decode $edit_p "t" 1 0] || ($user_id == [ad_conn user_id])] 1 "t" "f"] + if { $delete_p } { + 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 }]" + } else { + set delete_url "" + } +} + + + +# This spits out the CSV if we happen to be in CSV layout +list::write_output -name entries Index: openacs-4/packages/logger/lib/entries.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/lib/entries.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/logger/lib/entries.xql 4 Jan 2004 21:27:48 -0000 1.1 @@ -0,0 +1,81 @@ + + + + + + + select variable_id + from logger_entries le, + acs_objects ao + where ao.creation_date = (select max(ao.creation_date) + from logger_entries le, + acs_objects ao + where ao.object_id = le.entry_id + [ad_decode $project_clause "" "" "and $project_clause"] + ) + and ao.object_id = le.entry_id + [ad_decode $project_clause "" "" "and $project_clause"] + + + + + + select lp.name as label, + lp.project_id as project_id, + (select count(*) from logger_entries e where e.project_id = lp.project_id and variable_id = :variable_id) as count + from logger_projects lp, + logger_project_pkg_map lppm + where lp.project_id = lppm.project_id + and lppm.package_id = :package_id + order by lp.name + + + + + + select lv.name || ' (' || lv.unit || ')' as name, + lv.variable_id as unique_id + from logger_variables lv, + logger_projects lp, + logger_project_var_map lpvm + where lp.project_id = lpvm.project_id + and lv.variable_id = lpvm.variable_id + and exists (select 1 + from logger_project_pkg_map + where project_id = lp.project_id + and package_id = :package_id + ) + group by lv.variable_id, lv.name, lv.unit + + + + + + select submitter.first_names || ' ' || submitter.last_name as label, + submitter.user_id as user_id + from cc_users submitter, + logger_entries le, + acs_objects ao + where ao.object_id = le.entry_id + and submitter.user_id = ao.creation_user + and exists (select 1 + from logger_project_pkg_map + where project_id = le.project_id + and package_id = :package_id) + group by submitter.user_id, submitter.first_names, submitter.last_name + + + + + + select lpe.projection_id as unique_id, + lpe.name, + to_char(lpe.start_time, 'YYYY-MM-DD') as start_date, + to_char(lpe.end_time, 'YYYY-MM-DD') as end_date + from logger_projections lpe + where lpe.project_id = :selected_project_id + and lpe.variable_id = :selected_variable_id + + + + Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/index-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/index-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/logger/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.adp,v diff -u -r1.12 -r1.13 --- openacs-4/packages/logger/www/index.adp 25 Sep 2003 14:10:18 -0000 1.12 +++ openacs-4/packages/logger/www/index.adp 4 Jan 2004 21:27:48 -0000 1.13 @@ -1,23 +1,16 @@ @instance_name@ - - - - - - - - - - -
- - - - - - - -
- + Index: openacs-4/packages/logger/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/index.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/logger/www/index.tcl 30 Dec 2003 23:10:28 -0000 1.17 +++ openacs-4/packages/logger/www/index.tcl 4 Jan 2004 21:27:48 -0000 1.18 @@ -38,299 +38,4 @@ } } -set package_id [ad_conn package_id] -set current_user_id [ad_conn user_id] set instance_name [ad_conn instance_name] -set admin_p [permission::permission_p -object_id $package_id -privilege admin] - -if { [empty_string_p $variable_id] } { - ad_return_template "no-projects" - return -} - -# Get variable info -logger::variable::get -variable_id $variable_id -array variable - -# These are used to construct the values for the date filter -set weekdayno [clock format [clock seconds] -format %w] -set monthdayno [string trimleft [clock format [clock seconds] -format %d] 0] - -# Define the list -list::create \ - -name entries \ - -multirow entries \ - -key entry_id \ - -row_pretty_plural "entries" \ - -checkbox_name checkbox \ - -html { width 100% } \ - -selected_format $format \ - -class "list" \ - -main_class "list" \ - -sub_class "narrow" \ - -pass_properties { - variable - } -actions { - "Add Entry" "project-select" "Add new log entry" - } -bulk_actions { - "Delete" "log-delete" "Delete checked entries" - } -elements { - edit { - label {} - display_template { - - Edit - - } - } - project_id { - display_col project_name - label "Project" - } - user_id { - label "User" - display_col user_name - link_url_eval {[acs_community_member_url -user_id $user_id]} - csv_col user_name - } - time_stamp { - label "Date" - display_col time_stamp_pretty - aggregate_label {[ad_decode $variable(type) "additive" "Total" "Average"]} - aggregate_group_label {[ad_decode $variable(type) "additive" "Group total" "Group Average"]} - } - value { - label $variable(name) - link_url_eval {log?[export_vars { entry_id }]} - link_html { title "View this entry" } - aggregate {[ad_decode $variable(type) "additive" sum average]} - html { align right } - } - description { - label "Description" - display_eval {[string_truncate -len 50 -- $description]} - link_url_eval {log?[export_vars { entry_id }]} - link_html { title "View this entry" } - } - description_long { - label "Description" - display_eval {[string_truncate -len 400 -- $description]} - hide_p 1 - link_url_eval {log?[export_vars { entry_id }]} - link_html { title "View this entry" } - } - } -filters { - project_id { - label "Projects" - values {[db_list_of_lists select_projects {}]} - where_clause { - le.project_id = :project_id - } - add_url_eval {[export_vars -base "log" { { project_id $__filter_value } variable_id }]} - } - variable_id { - label "Variables" - values {[db_list_of_lists select_variables {}]} - where_clause { - le.variable_id = :variable_id - } - add_url_eval {[ad_decode [exists_and_not_null project_id] 1 [export_vars -base "log" { project_id { variable_id $__filter_value } }] ""]} - has_default_p t - } - user_id { - label "Users" - values {[db_list_of_lists select_users {}]} - where_clause { - submitter.user_id = :user_id - } - } - time_stamp { - label "Date" - where_clause { - le.time_stamp >= to_date(:start_date,'YYYY-MM-DD') and le.time_stamp <= to_date(:end_date,'YYYY-MM-DD') - } - other_label "Custom" - type multival - has_default_p 1 - values { - { - "Today" { - [clock format [clock seconds] -format "%Y-%m-%d"] - [clock format [clock seconds] -format "%Y-%m-%d"] - } - } - { - "Yesterday" { - [clock format [clock scan "-1 days"] -format "%Y-%m-%d"] - [clock format [clock scan "-1 days"] -format "%Y-%m-%d"] - } - } - { - "This week" { - [clock format [clock scan "-$weekdayno days"] -format "%Y-%m-%d"] - [clock format [clock scan "[expr 6-$weekdayno] days"] -format "%Y-%m-%d"] - } - } - { - "Last week" { - [clock format [clock scan "[expr -7-$weekdayno] days"] -format "%Y-%m-%d"] - [clock format [clock scan "[expr -1-$weekdayno] days"] -format "%Y-%m-%d"] - } - } - { - "Past 7 days" { - [clock format [clock scan "-1 week 1 day"] -format "%Y-%m-%d"] - [clock format [clock seconds] -format "%Y-%m-%d"] - } - } - { - "This month" { - [clock format [clock scan "[expr 1-$monthdayno] days"] -format "%Y-%m-%d"] - [clock format [clock scan "1 month -1 day" -base [clock scan "[expr 1-$monthdayno] days"]] -format "%Y-%m-%d"] - } - } - { - "Last month" { - [clock format [clock scan "-1 month [expr 1-$monthdayno] days"] -format "%Y-%m-%d"] - [clock format [clock scan "1 month -1 day" -base [clock scan "-1 month [expr 1-$monthdayno] days"]] -format "%Y-%m-%d"] - } - } - { - "Past 30 days" { - [clock format [clock scan "-1 month 1 day"] -format "%Y-%m-%d"] - [clock format [clock seconds] -format "%Y-%m-%d"] - } - } - { - "Always" { - [clock format 0 -format "%Y-%m-%d"] - [clock format [clock scan "+10 year"] -format "%Y-%m-%d"] - } - } - } - } - } -groupby { - label "Group by" - type multivar - values { - { "Day" { { groupby time_stamp } { orderby time_stamp,desc } } } - { "Week" { { groupby time_stamp_week } { orderby time_stamp,desc } } } - { "Project" { { groupby project_name } { orderby project_id,asc } } } - { "User" { { groupby user_id } { orderby user_id,asc } } } - } - } -orderby { - default_value time_stamp,desc - time_stamp { - label "Date" - orderby_desc "le.time_stamp desc, ao.creation_date desc" - orderby_asc "le.time_stamp asc, ao.creation_date asc" - default_direction desc - } - project_id { - label "Project" - orderby_asc "project_name asc, le.time_stamp desc, ao.creation_date desc" - orderby_desc "project_name desc, le.time_stamp desc, ao.creation_date desc" - } - user_id { - label "User" - orderby_asc "user_name asc, le.time_stamp desc, ao.creation_date desc" - orderby_desc "user_name desc, le.time_stamp desc, ao.creation_date desc" - } - value { - label $variable(name) - orderby_asc "value asc, le.time_stamp desc, ao.creation_date desc" - orderby_desc "value desc, le.time_stamp desc, ao.creation_date desc" - } - description { - label "Description" - orderby_asc "description asc, le.time_stamp desc, ao.creation_date desc" - orderby_desc "description desc, le.time_stamp desc, ao.creation_date desc" - } - } -formats { - normal { - label "Table" - layout table - row { - checkbox {} - edit {} - project_id {} - user_id {} - time_stamp {} - value {} - description {} - } - } - detailed { - label "Detailed table" - layout table - row { - checkbox { - html { rowspan 2 } - } - edit {} - project_id {} - user_id {} - time_stamp {} - value {} - } - row { - description_long { - html { colspan 5 } - hide_p 0 - } - } - } - list { - label "List" - layout list - template { - - - - - -
- - - @variable.name@: - - @variable.unit@
- -
- - Project:
- - By - on -
- } - } - csv { - label "CSV" - output csv - page_size 0 - } - } - - - -# This query will override the ad_page_contract value entry_id - -db_multirow -extend { edit_url delete_url delete_onclick } -unclobber entries select_entries " -" { - set selected_p [string equal [ns_queryget entry_id] $entry_id] - set edit_url "log?[export_vars { entry_id { edit t } }]" - set edit_p [ad_decode [expr [ad_decode $edit_p "t" 1 0] || ($user_id == [ad_conn user_id])] 1 "t" "f"] - if { $delete_p } { - 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 }]" - } else { - set delete_url "" - } -} - - - -# This spits out the CSV if we happen to be in CSV layout -list::write_output -name entries Fisheye: Tag 1.3 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/index.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/logger/www/log.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/logger/www/log.adp 28 Aug 2003 09:45:30 -0000 1.9 +++ openacs-4/packages/logger/www/log.adp 4 Jan 2004 21:27:48 -0000 1.10 @@ -45,27 +45,16 @@ - -

- » - Add new log entry -

-
+ +

Recent Entries

- -

Log history (@start_date_ansi@ to @end_date_ansi@)

- -

- The log history is - shown @log_history_n_days@ days back from your last logged entry, or @log_history_n_days@ days back from - today if you have no previously logged entries. -

- - +
Index: openacs-4/packages/logger/www/log.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/logger/www/log.tcl 9 Nov 2003 22:57:22 -0000 1.12 +++ openacs-4/packages/logger/www/log.tcl 4 Jan 2004 21:27:48 -0000 1.13 @@ -20,6 +20,8 @@ } } +# TODO: Make the recent entries list start on the date of the last entry + set package_id [ad_conn package_id] set current_user_id [ad_maybe_redirect_for_registration] @@ -126,37 +128,30 @@ {label Project} {value $project_array(name)} } - {project_id:integer(hidden) {value $project_id} } - {variable_id:integer(hidden) {value $variable_id} } - {return_url:text(hidden) {value $return_url}} } # Add form elements common to all modes # The form builder date datatype doesn't take ANSI format date strings # but wants dates in list format -set default_date [clock format [clock seconds] -format "%Y %m %d"] ad_form -extend -name log_entry_form -form { {value:float {label $variable_array(name)} {after_html $variable_array(unit)} {html {size 9 maxlength 9}} } - {description:text,optional {label Description} {html {size 50}} } - - {time_stamp:date + {time_stamp:date(date),to_sql(ansi),from_sql(ansi) {label Date} - {value $default_date} } } @@ -171,51 +166,50 @@ { [regexp {^([0-9]{1,6}|[0-9]{0,6}\.[0-9]{0,2})$} $value] } {The value may not contain more than two decimals and must be between 0 and 999999.99} } - +} -new_request { + # Get the date of the last entry + set time_stamp [ad_get_client_property logger time_stamp] + if { [empty_string_p $time_stamp] } { + set time_stamp [clock format [clock seconds] -format "%Y-%m-%d"] + } + set time_stamp [template::util::date::acquire ansi $time_stamp] } -new_data { - set time_stamp_ansi "[lindex $time_stamp 0]-[lindex $time_stamp 1]-[lindex $time_stamp 2]" - + # jarkko: check to see if user has already added this entry and has come # back with her back button. If the entry exists, we give the user a complaint - # and a link to edit this particular entry. + # LARS: took out the edit link, because the new templated ad_return_complaint quotes + if { [string match [db_string check_if_exists " select 1 from logger_entries where entry_id = :entry_id " -default "0"] "0"]} { - logger::entry::new -entry_id $entry_id \ - -project_id $project_id \ - -variable_id $variable_id \ - -value $value \ - -time_stamp $time_stamp_ansi \ - -description $description + logger::entry::new \ + -entry_id $entry_id \ + -project_id $project_id \ + -variable_id $variable_id \ + -value $value \ + -time_stamp $time_stamp \ + -description $description } else { - - doc_return 200 text/html "[ad_header_with_extra_stuff "Problem with Your Input" "" ""] -

Problem with Your Input

- -to [ad_system_name] - -
- -You have already added this entry once. If you want to edit this entry, click here. - -[ad_footer] -" + ad_return_complaint {} "You have already added this entry once." } + + # Remember this date, as the next entry is likely to be for the same date + ad_set_client_property logger time_stamp $time_stamp # Present the user with an add form again for quick logging - ad_returnredirect "[ad_conn url]?[export_vars {project_id variable_id}]" + ad_returnredirect [export_vars -base [ad_conn url] { project_id variable_id }] ad_script_abort } -edit_data { - set time_stamp_ansi "[lindex $time_stamp 0]-[lindex $time_stamp 1]-[lindex $time_stamp 2]" - logger::entry::edit -entry_id $entry_id \ - -value $value \ - -time_stamp $time_stamp_ansi \ - -description $description + logger::entry::edit \ + -entry_id $entry_id \ + -value $value \ + -time_stamp $time_stamp \ + -description $description } -after_submit { - ad_returnredirect "[ad_conn url]?[export_vars { project_id variable_id return_url }]" + ad_returnredirect "[ad_conn url]?[export_vars -base [ad_conn url] { project_id variable_id return_url }]" ad_script_abort } @@ -271,7 +265,7 @@ -format $ansi_format_string] } -set add_entry_url "log?[export_vars { project_id variable_id }]" +set add_entry_url [export_vars -base log { project_id variable_id }] if { [info exists entry_id] } { set entry_id_or_blank $entry_id Index: openacs-4/packages/logger/www/log.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/logger/www/log.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/logger/www/log.xql 8 May 2003 13:55:50 -0000 1.1 +++ openacs-4/packages/logger/www/log.xql 4 Jan 2004 21:27:48 -0000 1.2 @@ -15,7 +15,7 @@ select project_id, variable_id, value, - to_char(time_stamp, 'YYYY MM DD') as time_stamp, + to_char(time_stamp, 'YYYY-MM-DD') as time_stamp, description from logger_entries where entry_id = :entry_id Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/lib/entries-table-oracle.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.5 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/lib/entries-table-postgresql.xql'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.7 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/lib/entries-table.adp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/lib/entries-table.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/logger/www/lib/entries-table.xql'. Fisheye: No comparison available. Pass `N' to diff?