Index: openacs-4/packages/notifications/notifications.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v diff -u -N -r1.37 -r1.38 --- openacs-4/packages/notifications/notifications.info 26 May 2007 10:51:20 -0000 1.37 +++ openacs-4/packages/notifications/notifications.info 27 Jun 2007 18:54:47 -0000 1.38 @@ -8,15 +8,15 @@ t notifications - + OpenACS Email notifications management 2006-02-12 OpenACS Provides an API for packages to provide subscription based email notifications and handle replies. Used by forums, bug-tracker, etc. The currently prefered package for email notifications. 0 - + Index: openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql,v diff -u -N -r1.14 -r1.15 --- openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 8 Aug 2006 21:27:06 -0000 1.14 +++ openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 27 Jun 2007 18:54:47 -0000 1.15 @@ -176,7 +176,8 @@ references users(user_id), notif_subject varchar(1000), notif_text text, - notif_html text + notif_html text, + file_ids text ); -- RI indexes Index: openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql 29 Jun 2004 10:18:41 -0000 1.13 +++ openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql 27 Jun 2007 18:54:47 -0000 1.14 @@ -255,9 +255,10 @@ end; ' language 'plpgsql'; -select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_user,notif_subject,notif_text,notif_html,creation_date,creation_user,creation_ip,context_id'); -create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,text,text,timestamptz,integer,varchar,integer) +select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_user,notif_subject,notif_text,notif_html,file_ids,creation_date,creation_user,creation_ip,context_id'); + +create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,text,text,text,timestamptz,integer,varchar,integer) returns integer as ' declare p_notification_id alias for $1; @@ -269,10 +270,11 @@ p_notif_subject alias for $7; p_notif_text alias for $8; p_notif_html alias for $9; - p_creation_date alias for $10; - p_creation_user alias for $11; - p_creation_ip alias for $12; - p_context_id alias for $13; + p_file_ids alias for $10; + p_creation_date alias for $11; + p_creation_user alias for $12; + p_creation_ip alias for $13; + p_context_id alias for $14; v_notification_id integer; v_notif_date notifications.notif_date%TYPE; begin @@ -293,9 +295,9 @@ insert into notifications - (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html) + (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html, file_ids) values - (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_user, p_notif_subject, p_notif_text, p_notif_html); + (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_user, p_notif_subject, p_notif_text, p_notif_html, p_file_ids); return v_notification_id; end; Index: openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-5.4.0d2-5.4.0d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-5.4.0d2-5.4.0d3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-5.4.0d2-5.4.0d3.sql 27 Jun 2007 18:54:48 -0000 1.1 @@ -0,0 +1,49 @@ +-- Adding support for file attachments in notifications +alter table notifications add column file_ids text; + +select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_user,notif_subject,notif_text,notif_html,file_ids,creation_date,creation_user,creation_ip,context_id'); + +create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,text,text,text,timestamptz,integer,varchar,integer) +returns integer as ' +declare + p_notification_id alias for $1; + p_type_id alias for $2; + p_object_id alias for $3; + p_notif_date alias for $4; + p_response_id alias for $5; + p_notif_user alias for $6; + p_notif_subject alias for $7; + p_notif_text alias for $8; + p_notif_html alias for $9; + p_file_ids alias for $10; + p_creation_date alias for $11; + p_creation_user alias for $12; + p_creation_ip alias for $13; + p_context_id alias for $14; + v_notification_id integer; + v_notif_date notifications.notif_date%TYPE; +begin + v_notification_id := acs_object__new( + p_notification_id, + ''notification'', + p_creation_date, + p_creation_user, + p_creation_ip, + p_context_id + ); + + if p_notif_date is null then + v_notif_date := now(); + else + v_notif_date := p_notif_date; + end if; + + insert + into notifications + (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html, file_ids) + values + (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, p_notif_user, p_notif_subject, p_notif_text, p_notif_html, p_file_ids); + + return v_notification_id; +end; +' language 'plpgsql'; Index: openacs-4/packages/notifications/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/apm-callback-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 29 Jun 2004 10:18:41 -0000 1.3 +++ openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 27 Jun 2007 18:54:48 -0000 1.4 @@ -76,6 +76,30 @@ } } + 5.4.0d2 5.4.0d3 { + db_transaction { + + # Delete and recreate contract + delete_delivery_method_contract + create_delivery_method_contract + + # The old implementation is still there, but now it's unbound + + # Now change the name of the old implementation + db_dml update { update acs_sc_impls set impl_name = 'notification_email_old' where impl_name = 'notification_email' } + db_dml update { update acs_sc_impl_aliases set impl_name = 'notification_email_old' where impl_name = 'notification_email' } + + # Create the new implementation + set impl_id [create_email_delivery_method_impl] + + # Register the new impl ID with notification_delivery_methods + update_email_delivery_method_impl -impl_id $impl_id + + # Delete the old implementation + delete_email_delivery_method_impl -impl_name "notification_email_old" + + } + } } } @@ -95,7 +119,8 @@ notification_type_id:integer subject:string content_text:string - content_html:string + content_html:string + file_ids:string } } ScanReplies { Index: openacs-4/packages/notifications/tcl/delivery-method-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/delivery-method-procs.tcl,v diff -u -N -r1.11 -r1.12 --- openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 29 Jun 2004 10:18:42 -0000 1.11 +++ openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 27 Jun 2007 18:54:48 -0000 1.12 @@ -34,6 +34,7 @@ {-subject:required} {-content_text:required} {-content_html:required} + {-file_ids ""} } { do the delivery of certain content to a particular user using a particular delivery method. This is just a wrapper proc that sets up the call to the service contract implementation for @@ -49,7 +50,7 @@ set impl_key [get_impl_key -delivery_method_id $delivery_method_id] # Prepare the arguments - set args [list $from_user_id $to_user_id $reply_object_id $notification_type_id $subject $content_text $content_html] + set args [list $from_user_id $to_user_id $reply_object_id $notification_type_id $subject $content_text $content_html $file_ids] # Make the generic call return [acs_sc_call NotificationDeliveryMethod Send $args $impl_key] Index: openacs-4/packages/notifications/tcl/notification-email-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-email-procs.tcl,v diff -u -N -r1.27 -r1.28 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 26 Dec 2006 22:48:43 -0000 1.27 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 27 Jun 2007 18:54:48 -0000 1.28 @@ -96,6 +96,7 @@ subject content_text content_html + file_ids } { Send the actual email. @@ -152,6 +153,7 @@ -mime_type $mime_type \ -subject $subject \ -body $content \ + -file_ids $file_ids \ -use_sender \ -extraheaders $eh_list_of_lists } Index: openacs-4/packages/notifications/tcl/notification-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-procs.tcl,v diff -u -N -r1.13 -r1.14 --- openacs-4/packages/notifications/tcl/notification-procs.tcl 6 Sep 2006 18:11:55 -0000 1.13 +++ openacs-4/packages/notifications/tcl/notification-procs.tcl 27 Jun 2007 18:54:48 -0000 1.14 @@ -85,6 +85,7 @@ {-return_notified:boolean} {-notif_user {}} {-notif_date {}} + {-file_ids {}} } { Create a new notification if any notification requests exist for the object and type. @@ -304,7 +305,7 @@ set extra_vars [ns_set create] oacs_util::vars_to_ns_set \ -ns_set $extra_vars \ - -var_list {notification_id type_id object_id response_id notif_subject notif_text notif_html notif_user notif_date} + -var_list {notification_id type_id object_id response_id notif_subject notif_text notif_html notif_user notif_date file_ids} # Create the notification package_instantiate_object -extra_vars $extra_vars notification Index: openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/Attic/sweep-procs-oracle.xql,v diff -u -N -r1.15 -r1.16 --- openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 6 Sep 2006 18:11:56 -0000 1.15 +++ openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 27 Jun 2007 18:54:48 -0000 1.16 @@ -30,6 +30,7 @@ notifications.notif_subject, notifications.notif_text, notifications.notif_html, + notifications.file_ids, notification_requests.user_id, notification_requests.type_id, notification_requests.delivery_method_id, Index: openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/Attic/sweep-procs-postgresql.xql,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql 6 Sep 2006 18:11:56 -0000 1.8 +++ openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql 27 Jun 2007 18:54:48 -0000 1.9 @@ -22,6 +22,7 @@ notif_subject, notif_text, notif_html, + file_ids, user_id, type_id, delivery_method_id, Index: openacs-4/packages/notifications/tcl/sweep-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/sweep-procs.tcl,v diff -u -N -r1.21 -r1.22 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 26 Feb 2005 17:52:22 -0000 1.21 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 27 Jun 2007 18:54:48 -0000 1.22 @@ -46,6 +46,7 @@ set list_of_notification_ids [list] set batched_content_text "" set batched_content_html "" + set batched_file_ids [list] set summary_text "[_ notifications.Contents]/n" set summary_html "

[_ notifications.Contents]

    " @@ -85,6 +86,7 @@ -subject "[_ notifications.lt_system_name_-_Batched]" \ -content_text "$summary_text $batched_content_text" \ -content_html "$summary_html

$batched_content_html" \ + -file_ids $batched_file_ids \ -delivery_method_id $prev_deliv_method_id ns_log Debug "NOTIF-BATCHED: marking notifications" @@ -100,6 +102,7 @@ set list_of_notification_ids [list] set batched_content_text "" set batched_content_html "" + set batched_file_ids [list] set summary_text "[_ notifications.Contents]/n" set summary_html "

[_ notifications.Contents]

    " } else { @@ -134,6 +137,8 @@ append batched_content_text "[_ notifications.SUBJECT] [ns_set get $notif notif_subject]\n[ns_set get $notif notif_text]\n=====================\n" append batched_content_html "[_ notifications.SUBJECT] [ns_set get $notif notif_subject]\n $notif_html

    " + set batched_file_ids [concat [ns_set get $notif file_ids] $batched_file_ids] + lappend list_of_notification_ids [ns_set get $notif notification_id] # Set the vars @@ -154,6 +159,7 @@ -subject [ns_set get $notif notif_subject] \ -content_text [ns_set get $notif notif_text] \ -content_html [ns_set get $notif notif_html] \ + -file_ids [ns_set get $notif file_ids] \ -reply_object_id [ns_set get $notif response_id] \ -delivery_method_id [ns_set get $notif delivery_method_id]