Index: openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl,v
diff -u -N -r1.21 -r1.22
--- openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 15 May 2002 20:32:11 -0000 1.21
+++ openacs-4/packages/acs-datetime/tcl/acs-calendar-2-procs.tcl 15 May 2002 22:34:52 -0000 1.22
@@ -382,14 +382,102 @@
{-url_template {?order_by=$order_by}}
} {
create a listing widget for lists
+
+ (ben) I would like to ask forgiveness from the coding gods for this proc.
+ Right now this is a big hack to make the schedule look a lot like the SloanSpace v1.0
+ display. Once we have thought this through a bit more, I will generalize this proc. I promise.
+ Please forgive me.
} {
- set return_html "
\n"
+ # Check for zero size
+ if {[ns_set size $calendar_details] == 0} {
+ return "No Items"
+ }
+
+ # The title
+ if {[empty_string_p $start_date] && [empty_string_p $end_date]} {
+ set title "All Items"
+ }
+
+ if {[empty_string_p $start_date] && ![empty_string_p $end_date]} {
+ set title "Items until [util_AnsiDatetoPrettyDate $end_date]"
+ }
+
+ if {![empty_string_p $start_date] && [empty_string_p $end_date]} {
+ set title "Items starting [util_AnsiDatetoPrettyDate $start_date]"
+ }
+
+ if {![empty_string_p $start_date] && ![empty_string_p $end_date]} {
+ set title "Items from [util_AnsiDatetoPrettyDate $start_date] to [util_AnsiDatetoPrettyDate $end_date]"
+ }
+
+ set return_html "$title"
+
+ # Prepare the templates
+ set real_order_by $order_by
+ set order_by "item_type"
+ set item_type_url [subst $url_template]
+ set order_by "start_date"
+ set start_date_url [subst $url_template]
+
+ # Create the header
+ append return_html "
+
+
+
+ Day of Week | Date | Start Time | End Time | "
+
+ if {$real_order_by != "item_type"} {
+ append return_html "Type | "
+ }
+
+
+ append return_html "Title | \n"
+
+ # initialize the item_type so we can do intermediate titles
+ set old_item_type ""
+
+ set flip 0
+
+ # Loop through the events, and add them
for {set i 0} {$i < [ns_set size $calendar_details]} {incr i} {
set item [ns_set value $calendar_details $i]
- append return_html "- $item\n"
+ set date [lindex $item 0]
+ set start_time [lindex $item 1]
+ set end_time [lindex $item 2]
+ set weekday [lindex $item 3]
+ set item_type [lindex $item 4]
+ set item_details [lindex $item 5]
+
+ # Do we need a title?
+ ns_log Notice "BMA-check : $real_order_by , $item_type, $old_item_type"
+ if {$real_order_by == "item_type" && $item_type != "$old_item_type"} {
+ if {[empty_string_p $item_type]} {
+ set item_type "(No Item Type)"
+ }
+ append return_html "
$item_type | \n"
+ set flip 0
+ }
+
+ set old_item_type $item_type
+
+ if {[expr $flip % 2] == 0} {
+ set bgcolor white
+ } else {
+ set bgcolor #dddddd
+ }
+
+ append return_html "
+ $weekday | $date | $start_time | $end_time | "
+
+ if {$real_order_by != "item_type"} {
+ append return_html "$item_type | "
+ }
+
+ append return_html "$item_details | \n"
+ incr flip
}
- append return_html ""
+ append return_html " |
\n"
return $return_html
}
Index: openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl,v
diff -u -N -r1.6 -r1.7
--- openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 15 May 2002 20:32:11 -0000 1.6
+++ openacs-4/packages/acs-datetime/tcl/acs-calendar-procs.tcl 15 May 2002 22:34:52 -0000 1.7
@@ -420,7 +420,8 @@
append result "
"
- foreach viewname {list day week month year} {
+ # ben: taking out year for now, since it doesn't work
+ foreach viewname {list day week month} {
set text [string toupper $viewname 0]
if { $viewname == $view } {
# current view
@@ -528,6 +529,7 @@
in that url's environment: the view and the date.
Valid views are list, day, week, month, and year.
+ (ben) for now I am disabling year, which doesn't work.
The date must be formatted YYYY-MM-DD.
} {
Index: openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs-oracle.xql,v
diff -u -N -r1.9 -r1.10
--- openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 15 May 2002 20:32:19 -0000 1.9
+++ openacs-4/packages/calendar/tcl/calendar-display-procs-oracle.xql 15 May 2002 22:34:57 -0000 1.10
@@ -114,6 +114,8 @@
select to_char(start_date, 'HH24') as start_hour,
+ to_char(start_date, 'MM/DD/YYYY') as pretty_date,
+ to_char(start_date, 'Day') as pretty_weekday,
to_char(start_date, 'HH:MIpm') as pretty_start_date,
to_char(end_date, 'HH:MIpm') as pretty_end_date,
nvl(e.name, a.name) as name,
@@ -125,12 +127,13 @@
acs_events e,
timespans s,
time_intervals t,
+ cal_items
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(:start_date,:date_format) and
- to_date(:end_date,:date_format)
+and cal_items.cal_item_id= e.event_id
+and (start_date > to_date(:start_date,:date_format) or :start_date is null) and
+ (start_date < to_date(:end_date,:date_format) or :end_date is null)
and e.event_id
in (
select cal_item_id
Index: openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs-postgresql.xql,v
diff -u -N -r1.3 -r1.4
--- openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql 15 May 2002 20:32:19 -0000 1.3
+++ openacs-4/packages/calendar/tcl/calendar-display-procs-postgresql.xql 15 May 2002 22:34:57 -0000 1.4
@@ -112,6 +112,8 @@
select to_char(start_date, 'HH24') as start_hour,
+ to_char(start_date, 'MM/DD/YYYY') as pretty_date,
+ to_char(start_date, 'Day') as pretty_weekday,
to_char(start_date, 'HH:MIpm') as pretty_start_date,
to_char(end_date, 'HH:MIpm') as pretty_end_date,
coalesce(e.name, a.name) as name,
@@ -122,13 +124,14 @@
from acs_activities a,
acs_events e,
timespans s,
- time_intervals t
+ time_intervals t,
+ cal_items
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(:start_date,:date_format) and
- to_date(:end_date,:date_format)
+and cal_items.cal_item_id= e.event_id
+and (start_date > to_date(:start_date,:date_format) or :start_date is null) and
+ (start_date < to_date(:end_date,:date_format) or :end_date is null)
and e.event_id
in (
select cal_item_id
Index: openacs-4/packages/calendar/tcl/calendar-display-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-display-procs.tcl,v
diff -u -N -r1.22 -r1.23
--- openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 15 May 2002 20:32:19 -0000 1.22
+++ openacs-4/packages/calendar/tcl/calendar-display-procs.tcl 15 May 2002 22:34:57 -0000 1.23
@@ -294,11 +294,12 @@
}
ad_proc -public list_display {
+ {-date ""}
{-start_date ""}
{-end_date ""}
{-calendar_id_list ""}
{-item_template {$item}}
- {-url_template {?sort_by=$sort_by}}
+ {-url_template {?sort_by=$order_by}}
{-url_stub_callback ""}
{-show_calendar_name_p 1}
{-sort_by "item_type"}
@@ -312,6 +313,8 @@
set calendar_id_list [list [calendar_have_private_p -return_id 1 [ad_get_user_id]]]
}
+ set date_format "YYYY-MM-DD HH24:MI"
+ set current_date $date
set items [ns_set create]
# Loop through the calendars
@@ -324,15 +327,15 @@
}
db_foreach select_list_items {} {
- set item "$pretty_start_date - $pretty_end_date: $name"
+ ns_log Notice "BMA-CHECK: test $name"
+ set item "$name"
+ set item [subst $item_template]
if {$show_calendar_name_p} {
append item " ($calendar_name)"
}
- set item [subst $item_template]
-
- ns_set put $items $start_hour [list $start_date $end_date $item_type $item]
+ ns_set put $items $start_hour [list $pretty_date $pretty_start_date $pretty_end_date $pretty_weekday $item_type $item]
}
}
@@ -348,82 +351,82 @@
}
- ad_proc -public list_display {
- {-date ""}
- {-calendar_id_list ""}
- {-item_template {$item}}
- {-url_stub_callback ""}
- {-show_calendar_name_p 1}
- } {
- Creates a list widget
- } {
- if {[empty_string_p $date]} {
- set date [dt_sysdate]
- }
+# ad_proc -public list_display {
+# {-date ""}
+# {-calendar_id_list ""}
+# {-item_template {$item}}
+# {-url_stub_callback ""}
+# {-show_calendar_name_p 1}
+# } {
+# Creates a list widget
+# } {
+# if {[empty_string_p $date]} {
+# set date [dt_sysdate]
+# }
- set date_format "YYYY-MM-DD HH24:MI"
- set current_date $date
+# set date_format "YYYY-MM-DD HH24:MI"
+# set current_date $date
- # If we were given no calendars, we assume we display the
- # private calendar. It makes no sense for this to be called with
- # no data whatsoever.
- if {[empty_string_p $calendar_id_list]} {
- set calendar_id_list [list [calendar_have_private_p -return_id 1 [ad_get_user_id]]]
- }
+# # If we were given no calendars, we assume we display the
+# # private calendar. It makes no sense for this to be called with
+# # no data whatsoever.
+# if {[empty_string_p $calendar_id_list]} {
+# set calendar_id_list [list [calendar_have_private_p -return_id 1 [ad_get_user_id]]]
+# }
- set items [ns_set create]
+# set items [ns_set create]
- # Loop through the calendars
- foreach calendar_id $calendar_id_list {
- set calendar_name [calendar_get_name $calendar_id]
+# # Loop through the calendars
+# foreach calendar_id $calendar_id_list {
+# set calendar_name [calendar_get_name $calendar_id]
- # In case we need to dispatch to a different URL (ben)
- if {![empty_string_p $url_stub_callback]} {
- set url_stub [$url_stub_callback $calendar_id]
- }
+# # In case we need to dispatch to a different URL (ben)
+# if {![empty_string_p $url_stub_callback]} {
+# set url_stub [$url_stub_callback $calendar_id]
+# }
- db_foreach select_day_items {} {
- # ns_log Notice "bma: one item"
- set item "$pretty_start_date - $pretty_end_date: $name"
+# db_foreach select_day_items {} {
+# # ns_log Notice "bma: one item"
+# set item "$pretty_start_date - $pretty_end_date: $name"
- if {$show_calendar_name_p} {
- append item " ($calendar_name)"
- }
+# if {$show_calendar_name_p} {
+# append item " ($calendar_name)"
+# }
- set item [subst $item_template]
+# set item [subst $item_template]
- ns_set put $items $start_hour $item
- }
+# ns_set put $items $start_hour $item
+# }
- }
+# }
- set return_html "Items for [util_AnsiDatetoPrettyDate $date]:\n"
+# set return_html "Items for [util_AnsiDatetoPrettyDate $date]:"
+# append return_html "
"
- return $return_html
- }
+# return $return_html
+# }
Index: openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl,v
diff -u -N -r1.17 -r1.18
--- openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 15 May 2002 20:32:01 -0000 1.17
+++ openacs-4/packages/calendar-portlet/www/calendar-full-portlet.tcl 15 May 2002 22:35:04 -0000 1.18
@@ -123,10 +123,18 @@
}
if {$view == "list"} {
+ set sort_by [ns_queryget sort_by]
+
+ if {[empty_string_p $sort_by]} {
+ set sort_by "item_type"
+ }
+
set cal_stuff [calendar::list_display \
-item_template $item_template \
-date $current_date \
-calendar_id_list $list_of_calendar_ids \
+ -sort_by $sort_by \
+ -url_template "?view=list&sort_by=\$order_by&page_num=$page_num" \
-url_stub_callback "calendar_portlet_display::get_url_stub" \
-show_calendar_name_p $show_calendar_name_p]
}