Index: openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml,v diff -u -r1.16 -r1.17 --- openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml 11 Dec 2003 21:39:58 -0000 1.16 +++ openacs-4/packages/calendar/catalog/calendar.en_US.ISO-8859-1.xml 10 Jan 2004 18:59:50 -0000 1.17 @@ -129,4 +129,7 @@ Yes yes, delete it Yes, I am sure! + Item is recurring. + + 0 } { - set result [db_string get_calendar_info_calendar_id_list {} -default 0] - } else { - set result [db_string get_calendar_info {} -default 0] - } - - if { ![string equal $result "0"] } { - - if { [string equal $return_id "1"] } { - return $result - } else { - return 1 - } - - } else { - - return 0 - } -} - - #------------------------------------------------ # Should be moved into the calendar:: namespace. Will do after .LRN 2.0 release # (Dirk 9-Jan-2003) @@ -209,6 +173,39 @@ } +ad_proc -public calendar::have_private_p { + {-return_id 0} + {-calendar_id_list {}} + party_id +} { + check to see if ther user have a private calendar + if -return_id is 1, then proc will return the calendar_id + + @param calendar_id_list If you supply the calendar_id_list, then we'll only search + for a personal calendar among the calendars supplied here. +} { + + if { [llength $calendar_id_list] > 0 } { + set result [db_string get_calendar_info_calendar_id_list {} -default 0] + } else { + set result [db_string get_calendar_info {} -default 0] + } + + if { ![string equal $result "0"] } { + + if { [string equal $return_id "1"] } { + return $result + } else { + return 1 + } + + } else { + + return 0 + } +} + + ad_proc -public calendar::name { calendar_id } { Return a calendar's name } { @@ -486,3 +483,56 @@ return 0 } +ad_proc -public calendar::do_notifications { + {-mode:required} + {-cal_item_id:required} +} { + # Select all the important information + calendar::item::get -cal_item_id $cal_item_id -array cal_item + + set cal_item_id $cal_item(cal_item_id) + set n_attachments $cal_item(n_attachments) + set ansi_start_date $cal_item(start_date_ansi) + set ansi_end_date $cal_item(end_date_ansi) + set start_time $cal_item(start_time) + set end_time $cal_item(end_time) + set title $cal_item(name) + set description $cal_item(description) + set repeat_p $cal_item(recurrence_id) + set item_type $cal_item(item_type) + set item_type_id $cal_item(item_type_id) + set calendar_id $cal_item(calendar_id) + set time_p $cal_item(time_p) + + set url "[ad_url][ad_conn package_url]" + + set new_content "" + append new_content "[_ calendar.Calendar]: [ad_conn instance_name]
\n" + append new_content "[_ calendar.Calendar_Item]: $cal_item(name)
\n" + append new_content "[_ calendar.Start_Time]: $cal_item(start_date_ansi) $cal_item(start_time)
\n" + append new_content "[_ calendar.to]: $cal_item(end_date_ansi) $cal_item(end_time)
\n" + + if {![empty_string_p $repeat_p] && $repeat_p} { + append new_content "[_ calendar.is_recurring]" + } + + append new_content "\n
\n" + append new_content $cal_item(description) + + acs_user::get -user_id $cal_item(creation_user) -array user_info + append new_content "Author: $user_info(first_names) $user_info(last_name)
\n" + + # send text for now. + set new_content [ad_html_to_text -- $new_content] + + # Do the notification for the forum + notification::new \ + -type_id [notification::type::get_type_id \ + -short_name calendar_notif] \ + -object_id [ad_conn package_id] \ + -response_id $cal_item(cal_item_id) \ + -notif_subject "$mode [_ calendar.Calendar_Item]: $cal_item(name)" \ + -notif_text $new_content + +} + Index: openacs-4/packages/calendar/tcl/calendar-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/tcl/calendar-procs.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/calendar/tcl/calendar-procs.xql 9 Jan 2004 21:54:24 -0000 1.5 +++ openacs-4/packages/calendar/tcl/calendar-procs.xql 10 Jan 2004 18:59:50 -0000 1.6 @@ -10,24 +10,16 @@ - + - select calendar_id, - from calendars - where owner_id = :party_id - - - - - select calendar_id from calendars where owner_id = :party_id and private_p = 't' - + select calendar_id from calendars 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.21 -r1.22 --- openacs-4/packages/calendar/www/cal-item-new.tcl 11 Dec 2003 21:39:59 -0000 1.21 +++ openacs-4/packages/calendar/www/cal-item-new.tcl 10 Jan 2004 18:59:50 -0000 1.22 @@ -153,7 +153,7 @@ } } -new_request { # Seamlessly create a private calendar if the user doesn't have one - if { ![calendar_have_private_p $user_id] } { + if { ![calendar::have_private_p $user_id] } { calendar::new -owner_id $user_id -private_p "t" -calendar_name "Personal" -package_id $package_id } Index: openacs-4/packages/calendar/www/cal-options-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-options-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/calendar/www/cal-options-oracle.xql 24 Aug 2001 01:47:36 -0000 1.1 +++ openacs-4/packages/calendar/www/cal-options-oracle.xql 10 Jan 2004 18:59:50 -0000 1.2 @@ -7,7 +7,7 @@ - select unique(calendar_id) as calendar_id, + select calendar_id, calendar_name, ' ' as checked_p from calendars @@ -17,12 +17,14 @@ union - select unique(on_which_calendar) as calendar_id, - calendar.name(on_which_calendar) as calendar_name, + select calendar_id, + calendar_name, ' ' as checked_p - from cal_items + from cal_items, calendars where acs_permission.permission_p(cal_item_id, :user_id, 'cal_item_read') = 't' and calendar.private_p(on_which_calendar) = 'f' + and calendars.private_p = 'f' + and cal_items.on_which_calendar = calendars.calendar_id Index: openacs-4/packages/calendar/www/cal-options-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/Attic/cal-options-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/calendar/www/cal-options-postgresql.xql 6 Sep 2001 06:30:43 -0000 1.3 +++ openacs-4/packages/calendar/www/cal-options-postgresql.xql 10 Jan 2004 18:59:50 -0000 1.4 @@ -17,12 +17,13 @@ union - select distinct(on_which_calendar) as calendar_id, - calendar__name(on_which_calendar) as calendar_name, + select on_which_calendar as calendar_id, + calendar_name, ' '::varchar as checked_p - from cal_items + from cal_items, calendars where acs_permission__permission_p(cal_item_id, :user_id, 'cal_item_read') = 't' - and calendar__private_p(on_which_calendar) = 'f' + and calendars.private_p = 'f' + and cal_items.on_which_calendar = calendars.calendar_id Index: openacs-4/packages/calendar/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/index.tcl,v diff -u -r1.14 -r1.15 --- openacs-4/packages/calendar/www/index.tcl 11 Dec 2003 21:39:59 -0000 1.14 +++ openacs-4/packages/calendar/www/index.tcl 10 Jan 2004 18:59:50 -0000 1.15 @@ -12,7 +12,7 @@ set package_id [ad_conn package_id] set user_id [auth::require_login] -if { ![calendar_have_private_p $user_id] } { +if { ![calendar::have_private_p $user_id] } { calendar::new -owner_id $user_id -private_p "t" -calendar_name "Personal" -package_id $package_id } Index: openacs-4/packages/calendar/www/view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.adp,v diff -u -r1.22 -r1.23 --- openacs-4/packages/calendar/www/view.adp 11 Dec 2003 21:39:59 -0000 1.22 +++ openacs-4/packages/calendar/www/view.adp 10 Jan 2004 18:59:50 -0000 1.23 @@ -11,8 +11,15 @@

- #calendar.Add_Item##calendar.Add_Item# + + #calendar.Add_Item##calendar.Add_Item# +

+@notification_chunk;noquote@ + +

#calendar.lt_Calendar_Administrati# Index: openacs-4/packages/calendar/www/view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/calendar/www/view.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/calendar/www/view.tcl 11 Dec 2003 21:39:59 -0000 1.17 +++ openacs-4/packages/calendar/www/view.tcl 10 Jan 2004 18:59:50 -0000 1.18 @@ -42,4 +42,12 @@ set end_date [dt_julian_to_ansi [expr [dt_ansi_to_julian $ansi_year $ansi_month $ansi_day ] + $period_days]] } +set notification_chunk [notification::display::request_widget \ + -type calendar_notif \ + -object_id $package_id \ + -pretty_name [ad_conn instance_name] \ + -url [ad_conn url] \ + ] + + ad_return_template