Index: openacs-4/packages/calendar-portlet/www/calendar-portlet-extra.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/Attic/calendar-portlet-extra.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/www/calendar-portlet-extra.tcl 17 Jan 2002 22:16:59 -0000 1.1
@@ -0,0 +1,371 @@
+
+## aks - fold this into sql/template?
+##
+## 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 "
+##
+##
+## $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 " |
+##
\n"
+##
+## incr i
+##}
+### end while
+##
+##append row_html ""
+##
+
+
+}
+
+# end view "day"
+
+###
+#######
+###
+#### set up the multirow datasource using the db_multirow proc and 1 id
+###set my_folder_id [lindex $list_of_folder_ids 0]
+###
+###db_multirow -local foo select_files_and_folders {} {
+###
+### # we can set array vars for this row
+### set foo(url) [dotlrn_community::get_url_from_package_id \
+### -package_id [db_string select_package_id {}]]
+###}
+###
+###foreach my_folder_id [lrange $list_of_folder_ids 1 end] {
+###
+### # use the append switch to add rows to the datasource
+### db_multirow -local -append foo select_files_and_folders {} {
+### set foo(url) [dotlrn_community::get_url_from_package_id \
+### -package_id [db_string select_package_id {}]]
+### }
+###}
+###
+###ad_return_template
+###
+###
+#######
+###
+###
+###if { $view == "day" } {
+###
+### foreach calendar_id $list_of_calendar_ids {
+###
+### set calendar_name ""
+### # [calendar_get_name $calendar_id]
+###
+### ns_log notice "aks11: the current calendar_id os $calendar_id, $calendar_name list is $list_of_calendar_ids, cf $cf"
+###
+### # 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)
+###
"
+### }
+###
+###}
+###
+#### shaded_p support version 1
+###
+### set row_html "
+###$calendar_name
+###
+###
+###
+###
+###Time | Title |
+###
\n"
+###
+### 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 "
+###
+###
+### $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 " |
+###
\n"
+###
+### incr i
+###}
+###
+###append row_html "
"
+###
+#### aks - week support
+###seif { $view == "week" } {
+###
+###db_1row get_weekday_info "
+###select to_char(to_date(:current_date, 'yyyy-mm-dd'), 'D')
+###as day_of_the_week,
+###to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7, 'SUNDAY'))
+###as sunday_of_the_week,
+###to_char(next_day(to_date(:current_date, 'yyyy-mm-dd'), 'Saturday'))
+###as saturday_of_the_week
+###from dual
+###"
+###
+###set mlist ""
+###set set_id [ns_set new week_items]
+###
+###db_foreach get_day_items {
+### select to_char(start_date, 'J') as start_date,
+### 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(:sunday_of_the_week,'YYYY-MM-DD') and
+### to_date(:saturday_of_the_week,'YYYY-MM-DD')
+### and e.event_id
+### in (
+### select cal_item_id
+### from cal_items
+### where on_which_calendar = :calendar_id
+### )
+###} {
+### ns_set put $set_id $start_date \
+### "
+### $pretty_start_date - $pretty_end_date $name ($calendar_name)
+### "
+### append items "
+### $pretty_start_date - $pretty_end_date $name ($calendar_name)
+###
"
+### }
+###
+### set num_hour_rows 7
+### set i 0
+###
+### set bgcolor_html "bgcolor=DCDCDC"
+###
+### set row_html "
+### "
+###
+### while {$i < $num_hour_rows} {
+###
+### set sql "
+### select
+### to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7,
+### 'SUNDAY')+$i, 'DAY')
+### as weekday,
+### to_char(next_day(to_date(:current_date,
+### 'yyyy-mm-dd')-7, 'SUNDAY')+$i, 'YYYY-MM-DD')
+### as pretty_date,
+### to_char(next_day(to_date(:current_date, 'yyyy-mm-dd')-7,
+### 'SUNDAY')+$i, 'J')
+### as start_date
+### from dual
+### "
+### db_1row week_data $sql
+### append row_html "
+###
+### $weekday
+### $pretty_date
+### |
+###
+###
+###
+### "
+###
+### set cal_item_index [ns_set find $set_id $start_date]
+###
+### 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 $start_date]
+### }
+###
+### append row_html "
+### |
+###
+### "
+###
+### incr i
+### }
+###
+### append row_html "
"
+###} elseif { $view == "month" } {
+###
+### set set_id [ns_set new month_items]
+###
+### db_foreach get_monthly_items "
+### select to_char(start_date, 'j') as start_date,
+### nvl(e.name, a.name) as name,
+### nvl(e.description, a.description) as description,
+### 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 e.event_id
+### in (
+### select cal_item_id
+### from cal_items
+### where on_which_calendar = :calendar_id
+### ) " {
+### ns_set put $set_id $start_date \
+### "
+### $name ($calendar_name)
+###
"
+### }
+###
+### set row_html \
+### [dt_widget_month -header_text_size "+0" \
+### -calendar_details $set_id -date $date]
+###
+###} elseif { $view == "list"} {
+###
+### set items ""
+###
+### db_foreach get_day_items "
+### select to_char(start_date, 'j') as start_date,
+### 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_date \
+### "
+### $pretty_start_date - $pretty_end_date $name ($calendar_name)
+###
"
+### append items "
+### $pretty_start_date - $pretty_end_date $name ($calendar_name)
+###
"
+### }
+###
+### set date [dt_systime]
+###
+### set row_html "For $date: $items"
+###}
+###
+###
+###set template "$row_html"
+###
Index: openacs-4/packages/calendar-portlet/www/calendar-portlet-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/Attic/calendar-portlet-oracle.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/www/calendar-portlet-oracle.xql 17 Jan 2002 22:16:59 -0000 1.1
@@ -0,0 +1,45 @@
+
+
+
+oracle8.1.6
+
+
+
+ select
+ 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,
+ c.calendar_name as calendar_name
+ from
+ acs_activities a,
+ acs_events e,
+ timespans s,
+ time_intervals t,
+ cal_items ci,
+ calendars c
+ 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 = ci.cal_item_id
+ and c.calendar_id = ci.on_which_calendar
+ and c.calendar_id in ($list_of_calendar_ids)
+ UNION
+ select
+ pretty_start_date,
+ pretty_end_date,
+ to_char(NULL) as name,
+ 0 as item_id,
+ to_char(NULL) as calendar_name
+ from hours_of_the_day
+ order by pretty_start_date
+
+
+
+
+
+
Index: openacs-4/packages/calendar-portlet/www/calendar-portlet.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-portlet.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/www/calendar-portlet.adp 17 Jan 2002 22:16:59 -0000 1.1
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+ There are some calendar items in this view - FIXME
+
+
+ No calendar items available
+
+
+
+
Index: openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/calendar-portlet/www/calendar-portlet.tcl 17 Jan 2002 22:16:59 -0000 1.1
@@ -0,0 +1,50 @@
+# www/calendar-portlet.tcl
+ad_page_contract {
+ The display logic for the calendar portlet
+
+ @author Arjun Sanyal (arjun@openforce.net)
+ @cvs_id $Id: calendar-portlet.tcl,v 1.1 2002/01/17 22:16:59 oracle Exp $
+} -properties {
+
+}
+
+# get stuff out of the config array
+array set config $cf
+set view $config(default_view)
+set list_of_calendar_ids $config(calendar_id)
+
+# ad_return_complaint 1 "$cf"
+
+# set up some vars
+set date [dt_sysdate]
+set current_date $date
+set date_format "YYYY-MM-DD HH24:MI"
+
+# big switch on the view var
+if { $view == "day" } {
+
+#
+#create table hours_of_the_day (
+#pretty_start_date char(5),
+#pretty_end_date char(5)
+#);
+#
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('00:00', '00:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('01:00', '01:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('02:00', '02:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('03:00', '03:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('04:00', '04:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('05:00', '05:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('06:00', '06:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('07:00', '07:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('08:00', '08:59');
+#insert into hours_of_the_day (pretty_start_date, pretty_end_date) values ('09:00', '09:59');
+#
+#
+ set list_of_calendar_ids [join $list_of_calendar_ids ", "]
+
+ db_multirow -local foo select_day_items "" {}
+}
+
+
+ad_return_template