Index: openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql 9 Aug 2002 20:51:49 -0000 1.7 +++ openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql 20 Sep 2002 21:18:58 -0000 1.8 @@ -144,7 +144,7 @@ -- this is to allow responses to notifications response_id constraint notif_reponse_id_fk references acs_objects (object_id), - notif_subject varchar(100), + notif_subject varchar(1000), notif_text clob, notif_html clob ); 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 -r1.6 -r1.7 --- openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 9 Aug 2002 20:51:50 -0000 1.6 +++ openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 20 Sep 2002 21:18:59 -0000 1.7 @@ -164,7 +164,7 @@ response_id integer constraint notif_reponse_id_fk references acs_objects (object_id), - notif_subject varchar(100), + notif_subject varchar(1000), notif_text text, notif_html text ); 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.4 -r1.5 --- openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 9 Jul 2002 16:29:39 -0000 1.4 +++ openacs-4/packages/notifications/tcl/delivery-method-procs.tcl 20 Sep 2002 21:19:00 -0000 1.5 @@ -26,6 +26,12 @@ } { do the delivery of certain content to a particular user } { + #need to check if its ok to notify this user in this way. For now just checks if they are an approved user. + if { ![notification::security::can_notify_user -user_id $to_user_id -delivery_method_id $delivery_method_id] } { + ns_log notice "Blocked notification to $to_user_id subject:$subject" + return "Blocked" + } + # Get the implementation key set impl_key [get_impl_key -delivery_method_id $delivery_method_id] 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.7 -r1.8 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 10 Sep 2002 22:23:11 -0000 1.7 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 20 Sep 2002 21:19:00 -0000 1.8 @@ -25,6 +25,10 @@ return [get_parameter -name "EmailDomain"] } + ad_proc -public manage_notifications_url {} { + return "[ad_url]/[apm_package_url_from_key [notification::package_key]]manage" + } + ad_proc -public reply_address_prefix {} { return [get_parameter -name "EmailReplyAddressPrefix"] } @@ -48,7 +52,7 @@ if {[empty_string_p $object_id] || [empty_string_p $type_id]} { return [reply_address_prefix] } else { - return "[reply_address_prefix]-$object_id-$type_id@[address_domain]" + return "[address_domain] mailer <[reply_address_prefix]-$object_id-$type_id@[address_domain]>" } } @@ -80,6 +84,8 @@ # Get email set email [cc_email_from_party $to_user_id] + append content "\nGetting too much email? Manage your notifications at: [manage_notifications_url]" + acs_mail_lite::send \ -to_addr $email \ -from_addr [reply_address -object_id $reply_object_id -type_id $notification_type_id] \ 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.3 -r1.4 --- openacs-4/packages/notifications/tcl/notification-procs-oracle.xql 1 Aug 2002 12:56:16 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-procs-oracle.xql 20 Sep 2002 21:19:00 -0000 1.4 @@ -16,8 +16,9 @@ insert into notification_user_map (notification_id, user_id, sent_date) - values - (:notification_id, :user_id, sysdate) + select :notification_id, :user_id, sysdate + from dual where exists (select 1 from notifications + where notification_id = :notification_id) 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.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-procs-postgresql.xql 1 Aug 2002 12:56:16 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-procs-postgresql.xql 20 Sep 2002 21:19:00 -0000 1.3 @@ -14,8 +14,9 @@ insert into notification_user_map (notification_id, user_id, sent_date) - values - (:notification_id, :user_id, now()) + select :notification_id, :user_id, now() + from dual where exists (select 1 from notifications + where notification_id = :notification_id) Index: openacs-4/packages/notifications/tcl/notifications-security-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notifications-security-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/notifications/tcl/notifications-security-procs.tcl 29 May 2002 05:12:01 -0000 1.1 +++ openacs-4/packages/notifications/tcl/notifications-security-procs.tcl 20 Sep 2002 21:19:00 -0000 1.2 @@ -10,11 +10,23 @@ namespace eval notification::security { + ad_proc -public can_notify_user { + {-user_id:required} + {-delivery_method_id ""} + } { + This proc can be expanded to deal with cases when we don't want to + send a notification. For instance we could check email_bouncing_p + or if a user is on vacation. Right now it just makes sure its an + approved user. + } { + return [db_string user_approved_p {}] + } + ad_proc -public can_notify_object_p { {-user_id ""} {-object_id:required} - } { - # HACK + } { + # hack return 1 } Index: openacs-4/packages/notifications/tcl/notifications-security-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/Attic/notifications-security-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/notifications-security-procs.xql 20 Sep 2002 21:19:00 -0000 1.1 @@ -0,0 +1,14 @@ + + + + + + + select case when member_state = 'approved' then 1 else 0 end as send_p + from cc_users + where user_id = :user_id + + + + + \ No newline at end of file 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 -r1.8 -r1.9 --- openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 1 Jul 2002 19:35:30 -0000 1.8 +++ openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 20 Sep 2002 21:19:00 -0000 1.9 @@ -7,7 +7,8 @@ select notification_id from notifications - where not exists (select notifications.notification_id + where sysdate - notif_date > 2 + and not exists (select notifications.notification_id from notifications, notification_requests, notification_user_map @@ -27,8 +28,7 @@ notification_requests.user_id, notification_requests.type_id, notification_requests.delivery_method_id, - notifications.response_id, - acs_object.name(notifications.object_id) as object_name + notifications.response_id from notifications, notification_requests, notification_user_map 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 -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql 1 Aug 2002 12:55:25 -0000 1.2 +++ openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql 20 Sep 2002 21:19:00 -0000 1.3 @@ -7,7 +7,8 @@ select notification_id from notifications - where not exists (select notifications.notification_id + where now() - notif_date > 2 + and not exists (select notifications.notification_id from notifications inner join notification_requests on ( @@ -29,8 +30,7 @@ notification_requests.user_id, notification_requests.type_id, notification_requests.delivery_method_id, - notifications.response_id, - acs_object__name(notifications.object_id) as object_name + notifications.response_id from notifications inner join notification_requests on ( 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.8 -r1.9 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 11 Jul 2002 04:53:02 -0000 1.8 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 20 Sep 2002 21:19:00 -0000 1.9 @@ -104,7 +104,7 @@ # append content to built-up content ns_log Notice "NOTIF-BATCHED: appending one notif!" - append batched_content "SUBJECT: [ns_set get $notif object_name] - [ns_set get $notif notif_subject]\n[ns_set get $notif notif_text]\n=====================\n" + append batched_content "SUBJECT: [ns_set get $notif notif_subject]\n[ns_set get $notif notif_text]\n=====================\n" lappend list_of_notification_ids [ns_set get $notif notification_id] # Set the vars @@ -120,7 +120,7 @@ # Send it notification::delivery::send -to_user_id [ns_set get $notif user_id] \ -notification_type_id [ns_set get $notif type_id] \ - -subject "\[[ns_set get $notif object_name]\] [ns_set get $notif notif_subject]" \ + -subject [ns_set get $notif notif_subject] \ -content [ns_set get $notif notif_text] \ -reply_object_id [ns_set get $notif response_id] \ -delivery_method_id [ns_set get $notif delivery_method_id] Index: openacs-4/packages/notifications/www/manage-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/Attic/manage-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/manage-oracle.xql 20 Sep 2002 21:19:01 -0000 1.1 @@ -0,0 +1,39 @@ + + + + oracle8.1.6 + + + + select request_id, + (select pretty_name + from notification_types + where notification_types.type_id = + notification_requests.type_id) as type, + decode ((select short_name + from notification_types + where notification_types.type_id = + notification_requests.type_id), + 'forums_forum_notif', + (select name + from forums_forums + where forum_id = + notification_requests.object_id), + 'forums_message_notif', + (select subject + from forums_messages + where message_id = + notification_requests.object_id), + '') as object_name, + (select name + from notification_intervals + where notification_intervals.interval_id = + notification_requests.interval_id) as interval, + object_id + from notification_requests + where user_id = :user_id + + + + + Index: openacs-4/packages/notifications/www/manage-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/Attic/manage-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/manage-postgresql.xql 20 Sep 2002 21:19:01 -0000 1.1 @@ -0,0 +1,44 @@ + + + + postgresql7.1 + + + + select request_id, + (select pretty_name + from notification_types + where notification_types.type_id = + notification_requests.type_id) as type, + case when (select short_name + from notification_types + where notification_types.type_id = + notification_requests.type_id) = 'forums_forum_notif' + then + (select name + from forums_forums + where forum_id = + notification_requests.object_id) + when (select short_name + from notification_types + where notification_types.type_id = + notification_requests.type_id) = 'forums_message_notif' + then + (select subject + from forums_messages + where message_id = + notification_requests.object_id) + else + acs_object__name(notification_requests.object_id) + end as object_name, + (select name + from notification_intervals + where notification_intervals.interval_id = + notification_requests.interval_id) as interval, + object_id + from notification_requests + where user_id = :user_id + + + + Index: openacs-4/packages/notifications/www/manage.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/manage.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/manage.adp 20 Sep 2002 21:19:01 -0000 1.1 @@ -0,0 +1,33 @@ + +Manage Notifications +"manage notifications" + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Notification typeItemFrequencyAction
@notifications.type@@notifications.object_name@@notifications.interval@Unsubscribe
You have no notifications.
+ Index: openacs-4/packages/notifications/www/manage.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/manage.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/manage.tcl 20 Sep 2002 21:19:01 -0000 1.1 @@ -0,0 +1,15 @@ +ad_page_contract { + + Manage notifications for one user + + @author Tracy Adams (teadams@alum.mit.edu) + @creation-date 2002-07-22 + @cvs-id $Id: manage.tcl,v 1.1 2002/09/20 21:19:01 jeffd Exp $ +} {} + +set user_id [ad_conn user_id] +set return_url [ad_conn url] + +db_multirow notifications select_notifications {} + +ad_return_template \ No newline at end of file Index: openacs-4/packages/notifications/www/object-goto.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/object-goto.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/object-goto.tcl 20 Sep 2002 21:19:01 -0000 1.1 @@ -0,0 +1,23 @@ +ad_page_contract { + go to an object + + @author Tracy Adams (teadams@alum.mit.edu) + @creation-date 22 July 2002 + @cvs-id $Id: object-goto.tcl,v 1.1 2002/09/20 21:19:01 jeffd Exp $ +} { + object_id:notnull +} + + +# At the time of writing, the only supported +# notification types were on the object types +# forum_forums and forum_messages. get_url +# will handle both these types. If there are +# more type of notifications added, this file +# has to be changed to handle them. Perhaps +# it could be handles in a generic way, using +# meta-data about the object_type to auto-generate +# the url. + +ad_returnredirect [forum::notification::get_url $object_id] +