Index: openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql,v diff -u -r1.3 -r1.3.12.1 --- openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql 11 Dec 2003 21:40:08 -0000 1.3 +++ openacs-4/packages/notifications/sql/oracle/notifications-replies-extra-create.sql 24 Jan 2008 17:39:25 -0000 1.3.12.1 @@ -1,7 +1,7 @@ create table notification_email_hold ( reply_id integer constraint notification_email_hold_pk primary key - constraint notif_email_hold_reply_id_ref + constraint notif_email_hold_reply_id_fk references notification_replies(reply_id), to_addr clob, headers 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.15 -r1.15.2.1 --- openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 27 Jun 2007 18:54:47 -0000 1.15 +++ openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql 24 Jan 2008 17:39:26 -0000 1.15.2.1 @@ -13,127 +13,127 @@ -- taken into account. For now we're going to make them just intervals create table notification_intervals ( interval_id integer - constraint notif_interv_id_fk + constraint notification_intervals_interval_id_fk references acs_objects (object_id) - constraint notif_interv_id_pk + constraint notification_intervals_interval_id_pk primary key, name varchar(200) - constraint notif_interv_name_nn + constraint notification_intervals_name_nn not null - constraint notif_interv_name_un + constraint notification_intervals_name_un unique, -- how to schedule this n_seconds integer - constraint notif_interv_n_seconds_nn + constraint notification_intervals_n_seconds_nn not null ); -- delivery methods should be service contracts, too. create table notification_delivery_methods ( delivery_method_id integer - constraint notif_deliv_meth_fk + constraint notification_delivery_methods_fk references acs_objects (object_id) - constraint notif_deliv_meth_pk + constraint notification_delivery_methods_pk primary key, sc_impl_id integer not null - constraint notif_deliv_meth_impl_id_fk + constraint notification_delivery_methods_impl_id_fk references acs_sc_impls(impl_id), short_name varchar(100) - constraint notif_deliv_short_name_nn + constraint notification_delivery_methods_short_name_nn not null - constraint notif_deliv_short_name_un + constraint notifications_delivery_methods_short_name_un unique, pretty_name varchar(200) not null ); create table notification_types ( type_id integer - constraint notif_type_type_id_fk + constraint notification_types_type_id_fk references acs_objects (object_id) - constraint notif_type_type_id_pk + constraint notification_types_type_id_pk primary key, sc_impl_id integer not null - constraint notif_deliv_meth_impl_id_fk + constraint notification_delivery_method_impl_id_fk references acs_sc_impls(impl_id), short_name varchar(100) - constraint notif_type_short_name_nn + constraint notification_type_short_name_nn not null - constraint notif_type_short_name_un + constraint notification_type_short_name_un unique, pretty_name varchar(200) - constraint notif_type_pretty_name_nn + constraint notification_type_pretty_name_nn not null, description varchar(2000) ); -- what's allowed for a given notification type? create table notification_types_intervals ( type_id integer - constraint notif_type_int_type_id_fk + constraint notifications_type_int_type_id_fk references notification_types (type_id) on delete cascade, interval_id integer - constraint notif_type_int_int_id_fk + constraint notifications_type_int_int_id_fk references notification_intervals (interval_id) on delete cascade, - constraint notif_type_int_pk + constraint notifications_type_int_pk primary key (type_id, interval_id) ); -- allowed delivery methods create table notification_types_del_methods ( type_id integer - constraint notif_type_del_type_id_fk + constraint notifications_type_del_type_id_fk references notification_types (type_id) on delete cascade, delivery_method_id integer - constraint notif_type_del_meth_id_fk + constraint notifications_type_del_meth_id_fk references notification_delivery_methods (delivery_method_id) on delete cascade, - constraint notif_type_deliv_pk + constraint notifications_type_deliv_pk primary key (type_id, delivery_method_id) ); -- Requests for Notifications create table notification_requests ( request_id integer - constraint notif_request_id_fk + constraint notification_requests_id_fk references acs_objects (object_id) on delete cascade - constraint notif_request_id_pk + constraint notifications_request_id_pk primary key, type_id integer - constraint notif_request_type_id_fk + constraint notifications_request_type_id_fk references notification_types (type_id) on delete cascade, user_id integer - constraint notif_request_user_id_fk + constraint notifications_request_user_id_fk references users (user_id) on delete cascade, -- The object this request pertains to object_id integer - constraint notif_request_object_id_fk + constraint notifications_request_object_id_fk references acs_objects (object_id) on delete cascade, -- the interval must be allowed for this type interval_id integer - constraint notif_request_interv_id_nn + constraint notifications_request_interv_id_nn not null, - constraint notif_request_interv_fk + constraint notifications_request_interv_fk foreign key (type_id, interval_id) references notification_types_intervals (type_id, interval_id), -- the delivery method must be allowed for this type delivery_method_id integer - constraint notif_request_delivery_meth_nn + constraint notifications_request_delivery_meth_nn not null, - constraint notif_request_deliv_fk + constraint notifications_request_deliv_fk foreign key (type_id, delivery_method_id) references notification_types_del_methods (type_id, delivery_method_id), -- the format of the notification should be... format varchar(100) default 'text' - constraint notif_request_format_ch + constraint notifications_request_format_ck check (format in ('text', 'html')), dynamic_p bool default 'f' ); @@ -149,30 +149,30 @@ -- the actual stuff that has to go out create table notifications ( notification_id integer - constraint notif_notif_id_fk + constraint notifications_notification_id_fk references acs_objects (object_id) on delete cascade - constraint notif_notif_id_pk + constraint notifications_notification_id_pk primary key, type_id integer - constraint notif_type_id_fk + constraint notifications_type_id_fk references notification_types(type_id), -- the object this notification pertains to object_id integer - constraint notif_object_id_fk + constraint notifications_object_id_fk references acs_objects(object_id) on delete cascade, notif_date timestamptz - constraint notif_notif_date_nn + constraint notifications_notif_date_nn not null, -- this is to allow responses to notifications response_id integer - constraint notif_reponse_id_fk + constraint notifications_response_id_fk references acs_objects (object_id) on delete cascade, -- this is the user that caused the notification to go out notif_user integer - constraint notif_user_id_fk + constraint notifications_notif_user_fk references users(user_id), notif_subject varchar(1000), notif_text text, Index: openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql,v diff -u -r1.3 -r1.3.12.1 --- openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql 11 Dec 2003 21:40:09 -0000 1.3 +++ openacs-4/packages/notifications/sql/postgresql/notifications-replies-extra-create.sql 24 Jan 2008 17:39:26 -0000 1.3.12.1 @@ -1,7 +1,7 @@ create table notification_email_hold ( reply_id integer constraint notification_email_hold_pk primary key - constraint notif_email_hold_reply_id_ref + constraint notif_email_hold_reply_id_fk references notification_replies(reply_id), to_addr text, headers text, 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.4 -r1.4.2.1 --- openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 27 Jun 2007 18:54:48 -0000 1.4 +++ openacs-4/packages/notifications/tcl/apm-callback-procs.tcl 24 Jan 2008 17:39:26 -0000 1.4.2.1 @@ -10,6 +10,8 @@ namespace eval notification::apm {} ad_proc -public notification::apm::after_install {} { + After install callback. Create service contracts. +} { db_transaction { # Create the delivery method service contract @@ -27,6 +29,8 @@ } ad_proc -public notification::apm::before_uninstall {} { + Before uninstall callback. Get rid of service contracts. +} { db_transaction { # Delete the notification type service contract @@ -48,6 +52,8 @@ {-from_version_name:required} {-to_version_name:required} } { + After upgrade callback. +} { apm_upgrade_logic \ -from_version_name $from_version_name \ -to_version_name $to_version_name \ @@ -105,6 +111,8 @@ ad_proc -public notification::apm::create_delivery_method_contract {} { + Create the delivery method service contract. +} { acs_sc::contract::new_from_spec \ -spec { name "NotificationDeliveryMethod" @@ -131,6 +139,8 @@ } ad_proc -public notification::apm::delete_delivery_method_contract {} { + Delete the delivery method contract. +} { acs_sc::contract::delete -name "NotificationDeliveryMethod" } @@ -197,6 +207,9 @@ } ad_proc -public notification::apm::create_notification_type_contract {} { + Create the notification type service contract, used by client packages to define notification + types specific to the client's object types. +} { acs_sc::contract::new_from_spec \ -spec { name "NotificationType" @@ -226,5 +239,7 @@ } ad_proc -public notification::apm::delete_notification_type_contract {} { + Delete the notification type service contract. +} { acs_sc::contract::delete -name "NotificationType" } Index: openacs-4/packages/notifications/tcl/notification-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-callback-procs.tcl,v diff -u -r1.3 -r1.3.2.1 --- openacs-4/packages/notifications/tcl/notification-callback-procs.tcl 16 Dec 2006 19:32:46 -0000 1.3 +++ openacs-4/packages/notifications/tcl/notification-callback-procs.tcl 24 Jan 2008 17:39:26 -0000 1.3.2.1 @@ -134,4 +134,4 @@ ad_proc -public -callback notifications::incoming_email { -array:required } { -} +}- 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.31 -r1.31.2.1 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 12 Jan 2008 17:14:30 -0000 1.31 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 24 Jan 2008 17:39:26 -0000 1.31.2.1 @@ -11,17 +11,25 @@ namespace eval notification::email { ad_proc -public get_package_id {} { + Get the package id for notifications (depends on this being a singular + package) + } { return [apm_package_id_from_key notifications] } ad_proc -public get_parameter { {-name:required} {-default ""} } { + Shorthand proc to return a given notifications package parameter. + } { return [parameter::get -package_id [get_package_id] -parameter $name -default $default] } ad_proc -public address_domain {} { + Get the domain name to use for e-mail. The package parameter "EmailDomain" is + preferred, but if it doesn't exist, we build one using the system URL. + } { set domain [get_parameter -name "EmailDomain"] if { [empty_string_p $domain] } { # No domain set up, let's use the default from the system info @@ -36,18 +44,26 @@ } ad_proc -public manage_notifications_url {} { + Build a url to the "manage notifications" script. + } { return "[ad_url][apm_package_url_from_key [notification::package_key]]manage" } ad_proc -public reply_address_prefix {} { + Shorthand proc to return the email reply address prefix parameter value. + } { return [get_parameter -name "EmailReplyAddressPrefix"] } ad_proc -private qmail_mail_queue_dir {} { + Shorthand proc to return the email qmail-style mail queue (i.e. a Maildir directory) + } { return [get_parameter -name "EmailQmailQueue"] } ad_proc -private parse_email_address {email} { + Strip out the user's name (in angle brackets) from an e-mail address if it exists. + } { if {![regexp {<([^>]*)>} $email all clean_email]} { return $email } else { @@ -59,6 +75,8 @@ {-object_id:required} {-type_id:required} } { + Build an object/type-specific e-mail address that the user can reply to. + } { if {[empty_string_p $object_id] || [empty_string_p $type_id]} { return "\"[address_domain] mailer\" <[reply_address_prefix]@[address_domain]>" } else {