Index: openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl 26 Oct 2001 16:54:30 -0000 1.2 +++ openacs-4/packages/calendar-portlet/tcl/calendar-portlet-procs.tcl 26 Oct 2001 17:21:05 -0000 1.3 @@ -58,75 +58,131 @@ @creation-date Sept 2001 } { + # carries "calendar_id" array set config $cf + set calendar_id $config(calendar_id) - # things we need in the config - # community_id and folder_id - - # get user_id from the conn at this point - set user_id [ad_conn user_id] - - set date [dt_sysdate] set current_date $date set date_format "YYYY-MM-DD HH24:MI" + set num_hour_rows 24 + set i 0 + set bgcolor_html "border=1 color=blue" + set view day - # a big-time query from file-storage - set query " - select to_char(start_date, 'HH24') as start_hour, - to_char(start_date, 'HH24:MI') as pretty_start_date, - to_char(end_date, 'HH24:MI') as pretty_end_date, - nvl(e.name, a.name) as name, - e.event_id as item_id -from acs_activities a, - acs_events e, - timespans s, - time_intervals t -where e.timespan_id = s.timespan_id -and s.interval_id = t.interval_id -and e.activity_id = a.activity_id -and start_date between - to_date(:current_date,:date_format) and - to_date(:current_date,:date_format) + (24 - 1/3600)/24 -and e.event_id -in ( - select cal_item_id - from cal_items - where on_which_calendar = $config(community_calendar_id) - ) -" + + # AKS: code from calendar/www/cal-dayview.tcl + # --- + + set mlist "" + set set_id [ns_set new day_items] + + # otherwise, get the calendar_name for the give_id + set calendar_name [calendar_get_name $calendar_id] - set data "" - set rowcount 0 + # big non-ported query, i'm bad + db_foreach get_day_items " + select to_char(start_date, 'HH24') as start_hour, + to_char(start_date, 'HH24:MI') as pretty_start_date, + to_char(end_date, 'HH24:MI') as pretty_end_date, + nvl(e.name, a.name) as name, + e.event_id as item_id + from acs_activities a, + acs_events e, + timespans s, + time_intervals t + where e.timespan_id = s.timespan_id + and s.interval_id = t.interval_id + and e.activity_id = a.activity_id + and start_date between + to_date(:current_date,:date_format) and + to_date(:current_date,:date_format) + (24 - 1/3600)/24 + and e.event_id + in ( + select cal_item_id + from cal_items + where on_which_calendar = :calendar_id + )" { + ns_set put $set_id $start_hour \ + " + $pretty_start_date - $pretty_end_date $name ($calendar_name) +
" + } - db_foreach select_files_and_folders $query { - append data "$name$path$content_size$type$last_modified" - incr rowcount + + set row_html " + + " + + while {$i < $num_hour_rows} { + set filled_cell_count 0 + + # making hours before 10 looks prettier + if {$i < 10} { set cal_hour "0$i" } else { set cal_hour "$i" } + + # am or pm determination logic + if {$i < 12} { + if {$i == 0} { + set time "12:00 am" + } else { + set time "$cal_hour:00 am" + } + } else { + if {$i == 12} { + set time "12:00 pm" + } else { + set fm_hour [expr $i - 12] + if {$fm_hour < 10} { + set fm_hour "0$fm_hour" + } + set time "$fm_hour:00 pm" + } + } + + set cal_item_index [ns_set find $set_id $cal_hour] + + append row_html " + + + + " + + incr i } + + append row_html "
TimeTitle
+ $time + " + + if {$cal_item_index == -1} { + append row_html " " + } + + while {$cal_item_index > -1} { + append row_html "[ns_set value $set_id $cal_item_index]" + ns_set delete $set_id $cal_item_index + set cal_item_index [ns_set find $set_id $cal_hour] + } + + append row_html "
" + + # --- + # AKS: end lots of code from calendar/www/cal-dayview.tcl + set template " - - - - - - - - $data + $row_html
NameActionSize (bytes)TypeModified
" - - if {!$rowcount} { - set template "No items in this folder

more..." - } - + + set code [template::adp_compile -string $template] - + set output [template::adp_eval code] return $output - + } - + ad_proc -public remove_self_from_page { portal_id community_id