Index: openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs-oracle.xql,v
diff -u -r1.9 -r1.9.2.1
--- openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql 11 Aug 2003 12:14:15 -0000 1.9
+++ openacs-4/packages/calendar/tcl/cal-item-2-procs-oracle.xql 24 Nov 2003 16:39:26 -0000 1.9.2.1
@@ -28,19 +28,22 @@
recurrence_id,
cal_items.item_type_id,
cal_item_types.type as item_type,
- on_which_calendar as calendar_id
+ on_which_calendar as calendar_id,
+ c.calendar_name
from acs_activities a,
acs_events e,
timespans s,
time_intervals t,
cal_items,
- cal_item_types
+ cal_item_types,
+ calendars c
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 = :cal_item_id
and cal_items.cal_item_id= :cal_item_id
and cal_item_types.item_type_id(+)= cal_items.item_type_id
+ and c.calendar_id = on_which_calendar
@@ -57,19 +60,22 @@
recurrence_id,
cal_items.item_type_id,
cal_item_types.type as item_type,
- on_which_calendar as calendar_id
+ on_which_calendar as calendar_id,
+ c.calendar_name
from acs_activities a,
acs_events e,
timespans s,
time_intervals t,
cal_items,
- cal_item_types
+ cal_item_types,
+ calendars c
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 = :cal_item_id
and cal_items.cal_item_id= :cal_item_id
and cal_item_types.item_type_id(+)= cal_items.item_type_id
+ and c.calendar_id = on_which_calendar
Index: openacs-4/packages/calendar/tcl/cal-item-2-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs-postgresql.xql,v
diff -u -r1.11 -r1.11.2.1
--- openacs-4/packages/calendar/tcl/cal-item-2-procs-postgresql.xql 13 Aug 2003 16:08:33 -0000 1.11
+++ openacs-4/packages/calendar/tcl/cal-item-2-procs-postgresql.xql 24 Nov 2003 16:39:26 -0000 1.11.2.1
@@ -19,12 +19,13 @@
0 as n_attachments,
to_char(start_date, 'YYYY-MM-DD HH24:MI:SS') as start_date_ansi,
to_char(end_date, 'YYYY-MM-DD HH24:MI:SS') as end_date_ansi,
- coalesce(a.name, e.name) as name,
+ coalesce(e.name, a.name) as name,
coalesce(e.description, a.description) as description,
recurrence_id,
i.item_type_id,
it.type as item_type,
- on_which_calendar as calendar_id
+ on_which_calendar as calendar_id,
+ c.calendar_name
from
acs_events e join timespans s
on (e.timespan_id = s.timespan_id)
@@ -36,6 +37,8 @@
on (e.event_id = i.cal_item_id)
left join cal_item_types it
on (it.item_type_id = i.item_type_id)
+ left join calendars c
+ on (c.calendar_id = i.on_which_calendar)
where
e.event_id = :cal_item_id
@@ -53,7 +56,8 @@
recurrence_id,
i.item_type_id,
it.type as item_type,
- on_which_calendar as calendar_id
+ on_which_calendar as calendar_id,
+ c.calendar_name
from
acs_events e join timespans s
on (e.timespan_id = s.timespan_id)
@@ -65,6 +69,8 @@
on (e.event_id = i.cal_item_id)
left join cal_item_types it
on (it.item_type_id = i.item_type_id)
+ left join calendars c
+ on (c.calendar_id = i.on_which_calendar)
where
e.event_id = :cal_item_id
Index: openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/cal-item-2-procs.tcl,v
diff -u -r1.13.2.1 -r1.13.2.2
--- openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl 23 Nov 2003 23:29:42 -0000 1.13.2.1
+++ openacs-4/packages/calendar/tcl/cal-item-2-procs.tcl 24 Nov 2003 16:39:26 -0000 1.13.2.2
@@ -123,13 +123,14 @@
{-description:required}
{-item_type_id ""}
{-edit_all_p 0}
+ {-calendar_id ""}
} {
Edit the item
} {
if {[dates_valid_p -start_date $start_date -end_date $end_date]} {
# For now we call the old nasty version
- return [cal_item_update $cal_item_id $start_date $end_date $name $description $item_type_id $edit_all_p]
+ return [cal_item_update $cal_item_id $start_date $end_date $name $description $item_type_id $edit_all_p $calendar_id]
} else {
# FIXME: do this better
ad_return_complaint 1 "Start Time must be before End Time"
Index: openacs-4/packages/calendar/tcl/cal-item-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.tcl,v
diff -u -r1.15 -r1.15.2.1
--- openacs-4/packages/calendar/tcl/cal-item-procs.tcl 25 Sep 2003 23:11:11 -0000 1.15
+++ openacs-4/packages/calendar/tcl/cal-item-procs.tcl 24 Nov 2003 16:39:26 -0000 1.15.2.1
@@ -134,31 +134,32 @@
#------------------------------------------------
# update an existing calendar item
-ad_proc cal_item_update { cal_item_id
- start_date
- end_date
- name
- description
-{item_type_id ""}
-{edit_all_p 0}
+ad_proc cal_item_update {
+ cal_item_id
+ start_date
+ end_date
+ name
+ description
+ {item_type_id ""}
+ {edit_all_p 0}
+ {calendar_id ""}
} {
-
- updating a new cal_item
- for this version, i am omitting recurrence
-
+ Updating a cal_item
} {
if {$edit_all_p} {
set recurrence_id [db_string select_recurrence_id {}]
# If the recurrence id is NULL, then we stop here and just do the normal update
if {![empty_string_p $recurrence_id]} {
- cal_item_edit_recurrence -event_id $cal_item_id \
- -start_date $start_date \
- -end_date $end_date \
- -name $name \
- -description $description \
- -item_type_id $item_type_id
+ cal_item_edit_recurrence \
+ -event_id $cal_item_id \
+ -start_date $start_date \
+ -end_date $end_date \
+ -name $name \
+ -description $description \
+ -item_type_id $item_type_id \
+ -calendar_id $calendar_id
return
}
@@ -190,11 +191,19 @@
end;
"
- # Update the item_type_id
- db_dml update_item_type_id "update cal_items
- set item_type_id= :item_type_id
- where cal_item_id= :cal_item_id"
- }
+ # Update the item_type_id and calendar_id
+ set colspecs [list]
+ lappend colspecs "item_type_id = :item_type_id"
+ if { ![empty_string_p $calendar_id] } {
+ lappend colspecs "on_which_calendar = :calendar_id"
+ }
+
+ db_dml update_item_type_id "
+ update cal_items
+ set [join $colspecs ", "]
+ where cal_item_id= :cal_item_id
+ "
+ }
}
@@ -240,6 +249,7 @@
{-name:required}
{-description:required}
{-item_type_id ""}
+ {-calendar_id ""}
} {
edit a recurrence
} {
@@ -256,7 +266,12 @@
# Update the events table
db_dml recurrence_events_update {}
- # Update the cal_items table
+ set colspecs [list]
+ lappend colspecs {item_type_id = :item_type_id}
+ if { ![empty_string_p $calendar_id] } {
+ lappend colspecs {on_which_calendar = :calendar_id}
+ }
+
db_dml recurrence_items_update {}
}
}
Index: openacs-4/packages/calendar/tcl/cal-item-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/cal-item-procs.xql,v
diff -u -r1.5 -r1.5.6.1
--- openacs-4/packages/calendar/tcl/cal-item-procs.xql 3 Jun 2002 04:08:17 -0000 1.5
+++ openacs-4/packages/calendar/tcl/cal-item-procs.xql 24 Nov 2003 16:39:26 -0000 1.5.6.1
@@ -85,9 +85,9 @@
- update cal_items set
- item_type_id= :item_type_id
- where cal_item_id in (select event_id from acs_events where recurrence_id= :recurrence_id)
+ update cal_items
+ set [join $colspecs ", "]
+ where cal_item_id in (select event_id from acs_events where recurrence_id = :recurrence_id)
Index: openacs-4/packages/calendar/tcl/calendar-2-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-2-procs-oracle.xql,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/calendar/tcl/calendar-2-procs-oracle.xql 27 Oct 2003 12:16:22 -0000 1.2
+++ openacs-4/packages/calendar/tcl/calendar-2-procs-oracle.xql 24 Nov 2003 16:39:26 -0000 1.2.2.1
@@ -9,8 +9,8 @@
calendar_id,
acs_permission.permission_p(calendar_id, :user_id, 'calendar_admin') as calendar_admin_p
from calendars
- where package_id= :package_id
- and (private_p='f' or (private_p='t' and owner_id= :user_id))
+ where (private_p = 'f' and package_id = :package_id) or (private_p = 't' and owner_id = :user_id)
+ order by private_p asc, upper(calendar_name)
Index: openacs-4/packages/calendar/tcl/calendar-2-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/Attic/calendar-2-procs-postgresql.xql,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/calendar/tcl/calendar-2-procs-postgresql.xql 27 Oct 2003 12:16:22 -0000 1.2
+++ openacs-4/packages/calendar/tcl/calendar-2-procs-postgresql.xql 24 Nov 2003 16:39:26 -0000 1.2.2.1
@@ -9,8 +9,8 @@
calendar_id,
acs_permission__permission_p(calendar_id, :user_id, 'calendar_admin') as calendar_admin_p
from calendars
- where package_id= :package_id
- and (private_p='f' or (private_p='t' and owner_id= :user_id))
+ where (private_p = 'f' and package_id = :package_id) or (private_p = 't' and owner_id = :user_id)
+ order by private_p asc, upper(calendar_name)
Index: openacs-4/packages/calendar/www/cal-item-new.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-new.tcl,v
diff -u -r1.20.2.1 -r1.20.2.2
--- openacs-4/packages/calendar/www/cal-item-new.tcl 18 Nov 2003 13:16:18 -0000 1.20.2.1
+++ openacs-4/packages/calendar/www/cal-item-new.tcl 24 Nov 2003 16:39:26 -0000 1.20.2.2
@@ -38,22 +38,17 @@
set ansi_date $date
set calendar_list [calendar::calendar_list]
-if { ![info exists cal_item_id] } {
- if { [llength $calendar_list] > 1 && [empty_string_p $calendar_id] } {
- set return_url [export_vars -base cal-item-new { date start_time end_time }]
- ad_returnredirect [export_vars -base calendar-choose { return_url }]
- ad_script_abort
- } elseif { [empty_string_p $calendar_id] } {
- set calendar_id [lindex [lindex $calendar_list 0] 1]
- }
-} else {
- set calendar_id [db_string get_calendar_id {select
- on_which_calendar as calendar_id
- from cal_items
- where cal_item_id = :cal_item_id} -default ""]
+# TODO: Move into ad_form
+if { ![ad_form_new_p -key cal_item_id] } {
+ set calendar_id [db_string get_calendar_id {
+ select on_which_calendar as calendar_id
+ from cal_items
+ where cal_item_id = :cal_item_id
+ } -default ""]
}
+# TODO: Move into ad_form
if { [exists_and_not_null cal_item_id] } {
set page_title "One calendar item"
set ad_form_mode display
@@ -63,7 +58,7 @@
}
ad_form -name cal_item -form {
- cal_item_id:key
+ {cal_item_id:key}
{title:text(text)
{label "[_ calendar.Title_1]"}
@@ -96,13 +91,28 @@
{html {cols 60 rows 3 wrap soft} maxlength 255}
}
- {repeat_p:text(radio)
- {label "[_ calendar.Repeat_1]"}
- {options {{"[_ calendar.Yes]" 1}
- {"[_ calendar.No]" 0} }}
+ {calendar_id:integer(radio)
+ {label "[_ calendar.Sharing]"}
+ {options $calendar_list}
}
+}
- {calendar_id:text(hidden) {value $calendar_id}}
+if { [ad_form_new_p -key cal_item_id] } {
+ ad_form -extend -name cal_item -form {
+ {repeat_p:text(radio)
+ {label "[_ calendar.Repeat_1]"}
+ {options {{"[_ calendar.Yes]" 1}
+ {"[_ calendar.No]" 0} }}
+ }
+ }
+} else {
+ ad_form -extend -name cal_item -form {
+ {edit_all_p:text(radio)
+ {label "[_ calendar.Apply_to_all]"}
+ {options {{"[_ calendar.Yes]" 1}
+ {"[_ calendar.No]" 0} }}
+ }
+ }
}
@@ -131,9 +141,10 @@
+#----------------------------------------------------------------------
+# Finishing definition of form
+#----------------------------------------------------------------------
-
-
set cal_item_types [calendar::get_item_types -calendar_id $calendar_id]
if {[llength $cal_item_types] > 1} {
@@ -148,7 +159,7 @@
ad_form -extend -name cal_item -validate {
{title {[string length $title] <= 4000}
- " TITLE MUST BE 4"
+ "Title is too long"
}
} -new_request {
set date [template::util::date::from_ansi $date]
@@ -165,6 +176,7 @@
set start_time "{} {} {} 0 0 {} {HH24:MI}"
set end_time "{} {} {} 0 0 {} {HH24:MI}"
}
+ set calendar_id [lindex [lindex $calendar_list 0] 1]
} -edit_request {
calendar::item::get -cal_item_id $cal_item_id -array cal_item
set cal_item_id $cal_item(cal_item_id)
@@ -181,11 +193,15 @@
set calendar_id $cal_item(calendar_id)
set time_p $cal_item(time_p)
- if {[empty_string_p $repeat_p]} {
+ if { [empty_string_p $repeat_p] } {
set repeat_p 0
} else {
set repeat_p 1
}
+ set edit_all_p $repeat_p
+ if { !$repeat_p } {
+ element set_property cal_item edit_all_p -widget hidden
+ }
set date [template::util::date::from_ansi $ansi_start_date]
set start_time [template::util::date::from_ansi $ansi_start_date [lc_get formbuilder_time_format]]
set end_time [template::util::date::from_ansi $ansi_end_date [lc_get formbuilder_time_format]]
@@ -199,27 +215,32 @@
-description $description \
-calendar_id $calendar_id \
-item_type_id $item_type_id]
+
+ if {$repeat_p} {
+ ad_returnredirect [export_vars -base cal-item-create-recurrence { cal_item_id }]
+ } else {
+ ad_returnredirect [export_vars -base cal-item-view { cal_item_id }]
+ }
+ ad_script_abort
+
} -edit_data {
# set up the datetimes
set start_date [calendar::to_sql_datetime -date $date -time $start_time -time_p $time_p]
set end_date [calendar::to_sql_datetime -date $date -time $end_time -time_p $time_p]
# Do the edit
- calendar::item::edit -cal_item_id $cal_item_id \
- -start_date $start_date \
- -end_date $end_date \
- -name $title \
- -description $description \
- -item_type_id $item_type_id \
- -edit_all_p $repeat_p
-} -after_submit {
- if {$repeat_p} {
- ad_returnredirect "cal-item-create-recurrence?cal_item_id=$cal_item_id"
- } else {
- ad_returnredirect "cal-item-view?cal_item_id=$cal_item_id"
- }
+ calendar::item::edit \
+ -cal_item_id $cal_item_id \
+ -start_date $start_date \
+ -end_date $end_date \
+ -name $title \
+ -description $description \
+ -item_type_id $item_type_id \
+ -edit_all_p $edit_all_p \
+ -calendar_id $calendar_id
+
+ ad_returnredirect [export_vars -base cal-item-view { cal_item_id }]
ad_script_abort
}
-ad_return_template
Index: openacs-4/packages/calendar/www/cal-item-view.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/cal-item-view.adp,v
diff -u -r1.22.2.1 -r1.22.2.2
--- openacs-4/packages/calendar/www/cal-item-view.adp 20 Nov 2003 05:28:43 -0000 1.22.2.1
+++ openacs-4/packages/calendar/www/cal-item-view.adp 24 Nov 2003 16:39:26 -0000 1.22.2.2
@@ -33,6 +33,12 @@
+ #calendar.Sharing#:
+ |
+ @cal_item.calendar_name@
+ |
+
+
#calendar.Date_1#
#calendar.and_Time#
@@ -91,8 +97,8 @@
-
- #calendar.all_events#
+ |
+ #calendar.all_events#
|
Sync all events with Outlook |
Index: openacs-4/packages/calendar/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/index.tcl,v
diff -u -r1.13.2.1 -r1.13.2.2
--- openacs-4/packages/calendar/www/index.tcl 18 Nov 2003 12:46:21 -0000 1.13.2.1
+++ openacs-4/packages/calendar/www/index.tcl 24 Nov 2003 16:39:26 -0000 1.13.2.2
@@ -13,7 +13,7 @@
set user_id [auth::require_login]
if { ![calendar_have_private_p $user_id] } {
- calendar::new -owner_id $user_id -private_p "t" -calendar_name "Personal" -package_id $package_id
+# calendar::new -owner_id $user_id -private_p "t" -calendar_name "Personal" -package_id $package_id
}
ad_returnredirect "view"
Index: openacs-4/packages/calendar/www/view-one-day-display.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view-one-day-display.tcl,v
diff -u -r1.22.2.1 -r1.22.2.2
--- openacs-4/packages/calendar/www/view-one-day-display.tcl 24 Nov 2003 00:23:02 -0000 1.22.2.1
+++ openacs-4/packages/calendar/www/view-one-day-display.tcl 24 Nov 2003 16:39:26 -0000 1.22.2.2
@@ -117,10 +117,23 @@
set start_time [lc_time_fmt $ansi_start_date "%X"]
set end_time [lc_time_fmt $ansi_end_date "%X"]
+ regexp {([1-9][0-9]*)} $start_hour match start_hour_no
+ regexp {([1-9][0-9]*)} $end_hour match end_hour_no
+
for { set item_current_hour $start_hour } { $item_current_hour < $end_hour } { incr item_current_hour } {
set item_current_hour [expr [string trimleft $item_current_hour 0]+0]
- if {$start_hour == $item_current_hour && $start_hour >= $start_display_hour && $end_hour <= $end_display_hour} {
- lappend day_items_per_hour [list $item_current_hour $name $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time]
+ ds_comment "start_hour_no = $start_hour_no, end_hour = $end_hour, item_current_hour = $item_current_hour, start_display_hour = $start_display_hour, end_display_hour = $end_display_hour, name=$name"
+
+ if { $start_hour_no == $item_current_hour && \
+ $start_hour_no >= $start_display_hour && $end_hour_no <= $end_display_hour } {
+
+ lappend day_items_per_hour \
+ [list $item_current_hour $name $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time]
+ ds_comment "Outputting $name at $start_hour ($item_current_hour)"
+ } else {
+ lappend day_items_per_hour \
+ [list $item_current_hour {} $item_id $calendar_name $status_summary $start_hour $end_hour $start_time $end_time]
+ ds_comment "Continuing $name at $start_hour ($item_current_hour)"
}
incr items_per_hour($item_current_hour)
}
@@ -141,14 +154,16 @@
set item_start_hour [expr [string trimleft [lindex $this_item 5] 0]+0]
set item_end_hour [expr [string trimleft [lindex $this_item 6] 0]+0]
set rowspan [expr $item_end_hour - $item_start_hour]
+
if {$item_start_hour > $day_current_hour} {
# need to add dummy entries to show all hours
for { } { $day_current_hour < $item_start_hour } { incr day_current_hour } {
set localized_day_current_hour [lc_time_fmt "$current_date $day_current_hour:00:00" "%X"]
- multirow append day_items_with_time "[subst $hour_template]" $day_current_hour $localized_day_current_hour "" "" "" "" "" "" "" "" 0 0 ""
+ multirow append day_items_with_time [subst $hour_template] $day_current_hour $localized_day_current_hour "" "" "" "" "" "" "" "" 0 0 ""
}
}
+ set day_current_hour [lindex $this_item 0]
set localized_day_current_hour [lc_time_fmt "$current_date $day_current_hour:00:00" "%X"]
# reset url stub
@@ -167,11 +182,19 @@
set end_time [lindex $this_item 8]
set item [lindex $this_item 1]
+ set item_id [lindex $this_item 2]
set full_item [subst $item_template]
- set current_hour_link "[subst $hour_template]"
+ set current_hour_link [subst $hour_template]
- multirow append day_items_with_time $current_hour_link $day_current_hour $localized_day_current_hour [lindex $this_item 1] [lindex $this_item 2] [lindex $this_item 3] [lindex $this_item 4] [lindex $this_item 5] [lindex $this_item 6] [lindex $this_item 7] [lindex $this_item 8] 0 $rowspan $full_item
+ ds_comment "Multirow: day_current_hour = $day_current_hour, name = [lindex $this_item 1]"
+
+ multirow append day_items_with_time \
+ $current_hour_link $day_current_hour $localized_day_current_hour \
+ [lindex $this_item 1] [lindex $this_item 2] [lindex $this_item 3] \
+ [lindex $this_item 4] [lindex $this_item 5] [lindex $this_item 6] \
+ [lindex $this_item 7] [lindex $this_item 8] 0 $rowspan $full_item
+
set day_current_hour [expr [lindex $this_item 0] +1 ]
}
|