Index: openacs-4/packages/notifications/notifications.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v diff -u -r1.24.2.1 -r1.24.2.2 --- openacs-4/packages/notifications/notifications.info 24 Mar 2004 15:34:53 -0000 1.24.2.1 +++ openacs-4/packages/notifications/notifications.info 24 Jun 2004 19:27:50 -0000 1.24.2.2 @@ -8,14 +8,14 @@ t notifications - + OpenACS Email notifications management 2003-11-07 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. - + Index: openacs-4/packages/notifications/catalog/notifications.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/catalog/notifications.en_US.ISO-8859-1.xml,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/notifications/catalog/notifications.en_US.ISO-8859-1.xml 9 Mar 2004 18:02:48 -0000 1.11 +++ openacs-4/packages/notifications/catalog/notifications.en_US.ISO-8859-1.xml 24 Jun 2004 19:27:50 -0000 1.11.2.1 @@ -3,6 +3,7 @@ Action Change + Contents: Delivery Method Frequency Item 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 -r1.2 -r1.2.4.1 --- openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 28 Aug 2003 09:41:58 -0000 1.2 +++ openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 24 Jun 2004 19:27:50 -0000 1.2.4.1 @@ -52,7 +52,7 @@ -from_version_name $from_version_name \ -to_version_name $to_version_name \ -spec { - 4.6.2 4.6.4 { + 5.1.0d1 5.1.0d2 { db_transaction { # Delete and recreate contract @@ -94,7 +94,8 @@ reply_object_id:integer notification_type_id:integer subject:string - content:string + content_text:string + content_html: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 -r1.10 -r1.10.4.1 --- openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 1 Nov 2003 08:45:39 -0000 1.10 +++ openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 24 Jun 2004 19:27:50 -0000 1.10.4.1 @@ -32,7 +32,8 @@ {-from_user_id ""} {-to_user_id:required} {-subject:required} - {-content:required} + {-content_text:required} + {-content_html:required} } { 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 @@ -48,7 +49,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] + set args [list $from_user_id $to_user_id $reply_object_id $notification_type_id $subject $content_text $content_html] # 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 -r1.21 -r1.21.2.1 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 12 Feb 2004 18:32:32 -0000 1.21 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 24 Jun 2004 19:27:50 -0000 1.21.2.1 @@ -88,7 +88,8 @@ reply_object_id notification_type_id subject - content + content_text + content_html } { Send the actual email. @@ -99,7 +100,8 @@ # Variable used in the content set manage_notifications_url [manage_notifications_url] - append content "\n[_ notifications.lt_Getting_too_much_emai]" + append content_text "\n[_ notifications.lt_Getting_too_much_emai]" + append content_html "\n[_ notifications.lt_Getting_too_much_emai]" # Use this to build up extra mail headers set extra_headers [ns_set new] @@ -120,6 +122,12 @@ set from_email $reply_to } + set message_data [build_mime_message $content_text $content_html] + ns_set put $extra_headers MIME-Version [ns_set get $message_data MIME-Version] + ns_set put $extra_headers Content-ID [ns_set get $message_data Content-ID] + ns_set put $extra_headers Content-Type [ns_set get $message_data Content-Type] + set content [ns_set get $message_data body] + acs_mail_lite::send \ -to_addr $email \ -from_addr $from_email \ Index: openacs-4/packages/notifications/tcl/notification-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-procs-oracle.xql,v diff -u -r1.5 -r1.5.4.1 --- openacs-4/packages/notifications/tcl/notification-procs-oracle.xql 30 Sep 2003 12:10:08 -0000 1.5 +++ openacs-4/packages/notifications/tcl/notification-procs-oracle.xql 24 Jun 2004 19:27:50 -0000 1.5.4.1 @@ -22,5 +22,14 @@ + + + update notifications + set notif_html = empty_clob(), + notif_text = empty_clob() + where notification_id = :notification_id + returning notif_html, notif_text into :1, :2 + + Index: openacs-4/packages/notifications/tcl/notification-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-procs-postgresql.xql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/notifications/tcl/notification-procs-postgresql.xql 20 Sep 2002 21:19:00 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-procs-postgresql.xql 24 Jun 2004 19:27:50 -0000 1.3.8.1 @@ -20,4 +20,13 @@ + + + update notifications + set notif_html = :notif_html, + notif_text = :notif_text + where notification_id = :notification_id + + + 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 -r1.9 -r1.9.4.1 --- openacs-4/packages/notifications/tcl/notification-procs.tcl 7 Nov 2003 17:35:42 -0000 1.9 +++ openacs-4/packages/notifications/tcl/notification-procs.tcl 24 Jun 2004 19:27:50 -0000 1.9.4.1 @@ -159,6 +159,7 @@ @author Ben Adida @author Lars Pind } { + set requests_p [notification::request::request_exists -object_id $object_id -type_id $type_id] # We're only going to do anything if there are people who have requests, @@ -268,7 +269,7 @@ if { [empty_string_p $notif_user] && [ad_conn isconnected] } { set notif_user [ad_conn user_id] } - + # Actually carry out inserting the notification db_transaction { if { $subset_arg_p || $already_notified_arg_p } { @@ -306,6 +307,13 @@ # Create the notification package_instantiate_object -extra_vars $extra_vars notification + + # teadams@alum.mit.edu - pl/sql has a 32K limit for paramaters. + + # Updating the clob columns directly + # to avoid this limitation. + db_dml update_message {} -clobs [list $notif_html $notif_text] + } } 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 -r1.17 -r1.17.4.1 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 16 Oct 2003 14:06:46 -0000 1.17 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 24 Jun 2004 19:27:50 -0000 1.17.4.1 @@ -49,8 +49,11 @@ set prev_user_id 0 set prev_type_id 0 set prev_deliv_method_id "" - set batched_content "" set list_of_notification_ids [list] + set batched_content_text "" + set batched_content_html "" + set summary_text "[_ notifications.Contents]/n" + set summary_html "

[_ notifications.Contents]

    " # Add a stop codon lappend notifications STOP @@ -76,7 +79,7 @@ ns_log Debug "NOTIF-BATCHED: batching things up for $prev_user_id" # If no content, keep going - if {![empty_string_p $batched_content]} { + if {![empty_string_p $batched_content_text]} { ns_log Debug "NOTIF-BATCHED: content to send!" db_transaction { ns_log Debug "NOTIF-BATCHED: sending content" @@ -86,7 +89,8 @@ -to_user_id $prev_user_id \ -notification_type_id $prev_type_id \ -subject "[_ notifications.lt_system_name_-_Batched]" \ - -content $batched_content \ + -content_text "$summary_text $batched_content_text" \ + -content_html "$summary_html

$batched_content_html" \ -delivery_method_id $prev_deliv_method_id ns_log Debug "NOTIF-BATCHED: marking notifications" @@ -100,7 +104,10 @@ # Reset things set list_of_notification_ids [list] - set batched_content "" + set batched_content_text "" + set batched_content_html "" + set summary_text "[_ notifications.Contents]/n" + set summary_html "

[_ notifications.Contents]

    " } else { ns_log Debug "NOTIF-BATCHED: NO content to send!" } @@ -113,7 +120,33 @@ # append content to built-up content ns_log Debug "NOTIF-BATCHED: appending one notif!" - append batched_content "[_ notifications.SUBJECT] [ns_set get $notif notif_subject]\n[ns_set get $notif notif_text]\n\n\n=====================\n\n\n" + #Lets see what we have: + set notif_text [ns_set get $notif notif_text] + set notif_html [ns_set get $notif notif_html] + + if {[empty_string_p $notif_text]} { + set notif_text [ad_html_text_convert -from html -to text $no +tif_html] + } + + if {[empty_string_p $notif_html]} { + set notif_html [ad_html_text_convert -from text -to html $no +tif_text] + } else { + set html_content_p 1 + } + + append summary_text "[ns_set get $notif notif_subject]\n" + append summary_html "
  • [ns_set get $notif notif_subject]
  • " + + append batched_content_text "[_ notifications.SUBJECT] [ns_set get $notif notif_s +ubject]\n[ns_set get $notif notif_text]\n=====================\n" + append batched_content_html "[_ notifications.SUBJECT] [ns_set get $notif notif_subject]\n $notif_html

    " + lappend list_of_notification_ids [ns_set get $notif notification +_id] + lappend list_of_notification_ids [ns_set get $notif notification_id] # Set the vars @@ -132,7 +165,8 @@ -to_user_id [ns_set get $notif user_id] \ -notification_type_id [ns_set get $notif type_id] \ -subject [ns_set get $notif notif_subject] \ - -content [ns_set get $notif notif_text] \ + -content_text [ns_set get $notif notif_text] \ + -content_html [ns_set get $notif notif_html] \ -reply_object_id [ns_set get $notif response_id] \ -delivery_method_id [ns_set get $notif delivery_method_id]