Index: openacs-4/packages/notifications/notifications.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v
diff -u -r1.11.2.10 -r1.11.2.11
--- openacs-4/packages/notifications/notifications.info	5 May 2003 09:34:10 -0000	1.11.2.10
+++ openacs-4/packages/notifications/notifications.info	12 Jun 2003 13:34:51 -0000	1.11.2.11
@@ -8,7 +8,7 @@
     <singleton-p>t</singleton-p>
     <auto-mount>notifications</auto-mount>
 
-    <version name="4.6.2" url="http://openacs.org/repository/download/apm/notifications-4.6.2.apm">
+    <version name="4.6.4" url="http://openacs.org/repository/download/apm/notifications-4.6.4.apm">
     <database-support>
         <database>oracle</database>
         <database>postgresql</database>
@@ -17,10 +17,13 @@
         <summary>Notification Management</summary>
         <release-date>2003-02-17</release-date>
 
-        <provides url="notifications" version="4.6.2"/>
+        <provides url="notifications" version="4.6.4"/>
         <requires url="acs-mail-lite" version="0.1d"/>
 
         <callbacks>
+            <callback type="after-install" proc="notification::apm::after_install"/>
+            <callback type="before-uninstall" proc="notification::apm::before_uninstall"/>
+            <callback type="after-upgrade" proc="notification::apm::after_upgrade"/>
         </callbacks>
         <parameters>
             <parameter datatype="string"  min_n_values="1"  max_n_values="1"  name="EmailDomain"  description="The domain for the notification email address" section_name="email"/>
Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/oracle/delivery-method-sc-create.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/oracle/email-sc-impl-create.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/oracle/notification-type-sc-create.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
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.8.2.3 -r1.8.2.4
--- openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql	5 Mar 2003 15:02:57 -0000	1.8.2.3
+++ openacs-4/packages/notifications/sql/oracle/notifications-core-create.sql	12 Jun 2003 13:34:51 -0000	1.8.2.4
@@ -1,5 +1,5 @@
 --
--- The Notifications Package
+-- The Notifications
 --
 -- @author Ben Adida (ben@openforce.net)
 -- @version $Id$
@@ -155,6 +155,9 @@
     -- this is to allow responses to notifications
     response_id                     constraint notif_reponse_id_fk
                                     references acs_objects (object_id),
+    notif_user                      integer
+                                    constraint notif_user_id_fk
+                                    references users(user_id),
     notif_subject                   varchar(1000),
     notif_text                      clob,
     notif_html                      clob
Index: openacs-4/packages/notifications/sql/oracle/notifications-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-create.sql,v
diff -u -r1.7 -r1.7.2.1
--- openacs-4/packages/notifications/sql/oracle/notifications-create.sql	9 Aug 2002 20:51:49 -0000	1.7
+++ openacs-4/packages/notifications/sql/oracle/notifications-create.sql	12 Jun 2003 13:34:51 -0000	1.7.2.1
@@ -16,11 +16,7 @@
 @ notifications-replies-create.sql
 @ notifications-replies-package-create.sql
 
--- the service contracts will eventually be created
--- @ notifications-interval-sc-create.sql
--- @ notifications-delivery-sc-create.sql
-
 @ notification-type-sc-create.sql
-@ delivery-method-sc-create.sql
+
 @ notifications-init.sql
-@ email-sc-impl-create.sql
+
Index: openacs-4/packages/notifications/sql/oracle/notifications-init.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-init.sql,v
diff -u -r1.4 -r1.4.2.1
--- openacs-4/packages/notifications/sql/oracle/notifications-init.sql	9 Aug 2002 20:51:49 -0000	1.4
+++ openacs-4/packages/notifications/sql/oracle/notifications-init.sql	12 Jun 2003 13:34:51 -0000	1.4.2.1
@@ -35,15 +35,6 @@
         creation_ip => null
     );
            
--- This now done by email-sc-impl-create.sql
--- 
---     v_foo:= notification_delivery_method.new(
---         short_name => 'email',
---         pretty_name => 'Email',
---         creation_user => null,
---         creation_ip => null
---     );
-
 end;
 /
 show errors
Index: openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql,v
diff -u -r1.6.2.2 -r1.6.2.3
--- openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql	5 Mar 2003 15:02:57 -0000	1.6.2.2
+++ openacs-4/packages/notifications/sql/oracle/notifications-package-create.sql	12 Jun 2003 13:34:51 -0000	1.6.2.3
@@ -330,6 +330,7 @@
       object_id                         in notifications.object_id%TYPE,
       notif_date                        in notifications.notif_date%TYPE default sysdate,
       response_id                       in notifications.response_id%TYPE default null,
+      notif_user                        in notifications.notif_user%TYPE default null,
       notif_subject                     in notifications.notif_subject%TYPE default null,
       notif_text                        in varchar default null,
       notif_html                        in varchar default null,
@@ -358,6 +359,7 @@
       object_id                         in notifications.object_id%TYPE,
       notif_date                        in notifications.notif_date%TYPE default sysdate,
       response_id                       in notifications.response_id%TYPE default null,
+      notif_user                        in notifications.notif_user%TYPE default null,
       notif_subject                     in notifications.notif_subject%TYPE default null,
       notif_text                        in varchar default null,
       notif_html                        in varchar default null,
@@ -379,9 +381,9 @@
                            );
 
       insert into notifications
-      (notification_id, type_id, object_id, notif_date, response_id, notif_subject, notif_text, notif_html)
+      (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html)
       values
-      (v_notification_id, type_id, object_id, notif_date, response_id, notif_subject, notif_text, notif_html);
+      (v_notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html);
 
       return v_notification_id;
    end new;
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/oracle/upgrade/upgrade-4.6.2-4.6.4.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.3.2.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/postgresql/delivery-method-sc-create.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/postgresql/email-sc-impl-create.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.2.2.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/postgresql/notification-type-sc-create.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
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.7.2.4 -r1.7.2.5
--- openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql	5 Mar 2003 15:03:35 -0000	1.7.2.4
+++ openacs-4/packages/notifications/sql/postgresql/notifications-core-create.sql	12 Jun 2003 13:34:51 -0000	1.7.2.5
@@ -167,6 +167,10 @@
     response_id                     integer
                                     constraint notif_reponse_id_fk
                                     references acs_objects (object_id),
+    -- this is the user that caused the notification to go out
+    notif_user                      integer
+                                    constraint notif_user_id_fk
+                                    references users(user_id),
     notif_subject                   varchar(1000),
     notif_text                      text,
     notif_html                      text
@@ -199,78 +203,68 @@
 --
 -- Object Types
 --
-create function inline_0 ()
-returns integer as '
-begin
+select acs_object_type__create_type(
+    'notification_interval',
+    'Notification Interval',
+    'Notification Intervals',
+    'acs_object',
+    'notification_intervals',
+    'interval_id',
+    'notification_interval',
+    'f',
+    null,
+    null
+);
 
-    perform acs_object_type__create_type(
-        ''notification_interval'',
-        ''Notification Interval'',
-        ''Notification Intervals'',
-        ''acs_object'',
-        ''notification_intervals'',
-        ''interval_id'',
-        ''notification_interval'',
-        ''f'',
-        null,
-        null
-    );
+select acs_object_type__create_type(
+    'notification_delivery_method',
+    'Notification Delivery Method',
+    'Notification Delivery Methods',
+    'acs_object',
+    'notification_delivery_methods',
+    'delivery_method_id',
+    'notification_delivery_method',
+    'f',
+    null,
+    null
+);
 
-    perform acs_object_type__create_type(
-        ''notification_delivery_method'',
-        ''Notification Delivery Method'',
-        ''Notification Delivery Methods'',
-        ''acs_object'',
-        ''notification_delivery_methods'',
-        ''delivery_method_id'',
-        ''notification_delivery_method'',
-        ''f'',
-        null,
-        null
-    );
+select acs_object_type__create_type(
+    'notification_type',
+    'Notification Type',
+    'Notification Types',
+    'acs_object',
+    'notification_types',
+    'type_id',
+    'notification_type',
+    'f',
+    null,
+    null
+);
 
-    perform acs_object_type__create_type(
-        ''notification_type'',
-        ''Notification Type'',
-        ''Notification Types'',
-        ''acs_object'',
-        ''notification_types'',
-        ''type_id'',
-        ''notification_type'',
-        ''f'',
-        null,
-        null
-    );
+select acs_object_type__create_type(
+    'notification_request',
+    'Notification Request',
+    'Notification Requests',
+    'acs_object',
+    'notification_requests',
+    'request_id',
+    'notification_request',
+    'f',
+    null,
+    null
+);
 
-    perform acs_object_type__create_type(
-        ''notification_request'',
-        ''Notification Request'',
-        ''Notification Requests'',
-        ''acs_object'',
-        ''notification_requests'',
-        ''request_id'',
-        ''notification_request'',
-        ''f'',
-        null,
-        null
-    );
+select acs_object_type__create_type(
+    'notification',
+    'Notification',
+    'Notifications',
+    'acs_object',
+    'notifications',
+    'notification_id',
+    'notification',
+    'f',
+    null,
+    null
+);
 
-    perform acs_object_type__create_type(
-        ''notification'',
-        ''Notification'',
-        ''Notifications'',
-        ''acs_object'',
-        ''notifications'',
-        ''notification_id'',
-        ''notification'',
-        ''f'',
-        null,
-        null
-    );
-
-    return null;
-
-end;' language 'plpgsql';
-
-select inline_0();
-drop function inline_0();
Index: openacs-4/packages/notifications/sql/postgresql/notifications-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-create.sql,v
diff -u -r1.5 -r1.5.2.1
--- openacs-4/packages/notifications/sql/postgresql/notifications-create.sql	9 Aug 2002 20:51:50 -0000	1.5
+++ openacs-4/packages/notifications/sql/postgresql/notifications-create.sql	12 Jun 2003 13:34:52 -0000	1.5.2.1
@@ -14,12 +14,6 @@
 \i notifications-replies-create.sql
 \i notifications-replies-package-create.sql
 
--- the service contracts will eventually be created
--- @ notifications-interval-sc-create.sql
--- @ notifications-delivery-sc-create.sql
-
 \i notification-type-sc-create.sql
 
-\i delivery-method-sc-create.sql
 \i notifications-init.sql
-\i email-sc-impl-create.sql
Index: openacs-4/packages/notifications/sql/postgresql/notifications-init.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/sql/postgresql/notifications-init.sql,v
diff -u -r1.4 -r1.4.2.1
--- openacs-4/packages/notifications/sql/postgresql/notifications-init.sql	9 Aug 2002 20:51:50 -0000	1.4
+++ openacs-4/packages/notifications/sql/postgresql/notifications-init.sql	12 Jun 2003 13:34:52 -0000	1.4.2.1
@@ -8,56 +8,32 @@
 -- GNU GPL v2
 --
 
--- initialize some stuff
-create function inline_0 ()
-returns integer as '
-begin
+select notification_interval__new (
+    null,
+    'daily',
+    3600 * 24,
+    now(),
+    null,
+    null,
+    null
+);
 
-    perform notification_interval__new (
-        null,
-        ''daily'',
-        3600 * 24,
-        now(),
-        null,
-        null,
-        null
-    );
+select notification_interval__new (
+    null,
+    'hourly',
+    3600,
+    now(),
+    null,
+    null,
+    null
+);
 
-    perform notification_interval__new (
-        null,
-        ''hourly'',
-        3600,
-        now(),
-        null,
-        null,
-        null
-    );
-
-    perform notification_interval__new (
-        null,
-        ''instant'',
-        0,
-        now(),
-        null,
-        null,
-        null
-    );
-           
--- This is now done by email-sc-impl-create.sql
---
---     perform notification_delivery_method__new (
---         null,
---         ''email'',
---         ''Email'',
---         now(),
---         null,
---         null,
---         null
---     );
-
-    return null;
-
-end;' language 'plpgsql';
-
-select inline_0();
-drop function inline_0 ();
+select notification_interval__new (
+    null,
+    'instant',
+    0,
+    now(),
+    null,
+    null,
+    null
+);
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 -r1.8.2.4 -r1.8.2.5
--- openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql	5 Mar 2003 15:03:35 -0000	1.8.2.4
+++ openacs-4/packages/notifications/sql/postgresql/notifications-package-create.sql	12 Jun 2003 13:34:52 -0000	1.8.2.5
@@ -236,23 +236,24 @@
 end;
 ' language 'plpgsql';
 
-select define_function_args ('notification__new','notification_id,type_id,object_id,notif_date,response_id,notif_subject,notif_text,notif_html,creation_date,creation_user,creation_ip,context_id');
+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 function notification__new(integer,integer,integer,timestamptz,integer,varchar,text,text,timestamptz,integer,varchar,integer)
+create or replace function notification__new(integer,integer,integer,timestamptz,integer,integer,varchar,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_subject                 alias for $6;
-    p_notif_text                    alias for $7;
-    p_notif_html                    alias for $8;
-    p_creation_date                 alias for $9;
-    p_creation_user                 alias for $10;
-    p_creation_ip                   alias for $11;
-    p_context_id                    alias for $12;
+    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_creation_date                 alias for $10;
+    p_creation_user                 alias for $11;
+    p_creation_ip                   alias for $12;
+    p_context_id                    alias for $13;
     v_notification_id               integer;
     v_notif_date                    notifications.notif_date%TYPE;
 begin
@@ -273,9 +274,9 @@
 
     insert
     into notifications
-    (notification_id, type_id, object_id, notif_date, response_id, notif_subject, notif_text, notif_html)
+    (notification_id, type_id, object_id, notif_date, response_id, notif_user, notif_subject, notif_text, notif_html)
     values
-    (v_notification_id, p_type_id, p_object_id, v_notif_date, p_response_id, 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);
 
     return v_notification_id;
 end;
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/sql/postgresql/upgrade/upgrade-4.6.2-4.6.4.sql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/tcl/apm-callback-procs.tcl'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/tcl/delivery-method-procs-oracle.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/tcl/delivery-method-procs-postgresql.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
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.5.2.1 -r1.5.2.2
--- openacs-4/packages/notifications/tcl/delivery-method-procs.tcl	30 Oct 2002 21:12:05 -0000	1.5.2.1
+++ openacs-4/packages/notifications/tcl/delivery-method-procs.tcl	12 Jun 2003 13:34:52 -0000	1.5.2.2
@@ -14,63 +14,108 @@
 
 }
 
-namespace eval notification::delivery {
+namespace eval notification::delivery {}
 
-    ad_proc -private get_impl_key {
-        {-delivery_method_id:required}
-    } {
-	Return the service contract implementation key for notification delivery methods
-    } {
-        return [db_string select_impl_key {}]
+
+ad_proc -private notification::delivery::get_impl_key {
+    {-delivery_method_id:required}
+} {
+    Return the service contract implementation key for notification delivery methods
+} {
+    return [db_string select_impl_key {}]
+}
+
+ad_proc -public notification::delivery::send {
+    {-delivery_method_id:required}
+    {-reply_object_id ""}
+    {-notification_type_id:required}
+    {-from_user_id ""}
+    {-to_user_id:required}
+    {-subject:required}
+    {-content: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
+    a given delivery method.
+} {
+    #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"
     }
 
-    ad_proc -public send {
-        {-delivery_method_id:required}
-        {-reply_object_id ""}
-        {-notification_type_id:required}
-        {-to_user_id:required}
-        {-subject:required}
-        {-content: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
-	a given delivery method.
-    } {
-        #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]
 
-        # Get the implementation key
-        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]
 
-        # Prepare the arguments
-        set args [list $to_user_id $reply_object_id $notification_type_id $subject $content]
+    # Make the generic call
+    return [acs_sc_call NotificationDeliveryMethod Send $args $impl_key]
+}
 
-        # Make the generic call
-        return [acs_sc_call NotificationDeliveryMethod Send $args $impl_key]
-    }
+ad_proc -public notification::delivery::scan_replies {
+    {-delivery_method_id:required}
+} {
+    scan for replies.
+    
+    Every delivery method allows for replies. This is the wrapper proc that
+    indicates to the delivery method service contract implementation that it's time to
+    scan for replies.
+} {
+    # Get the implementation key
+    set impl_key [get_impl_key -delivery_method_id $delivery_method_id]
 
-    ad_proc -public scan_replies {
-        {-delivery_method_id:required}
-    } {
-        scan for replies.
-	
-	Every delivery method allows for replies. This is the wrapper proc that
-	indicates to the delivery method service contract implementation that it's time to
-	scan for replies.
-    } {
-        # Get the implementation key
-        set impl_key [get_impl_key -delivery_method_id $delivery_method_id]
+    # Prepare the arguments
+    set args [list]
 
-        # Prepare the arguments
-        set args [list]
+    # ns_log Notice "NOTIF-DELIV-METHOD: about to call acs_sc on $impl_key"
 
-        # ns_log Notice "NOTIF-DELIV-METHOD: about to call acs_sc on $impl_key"
+    # Make the generic call
+    return [acs_sc_call NotificationDeliveryMethod ScanReplies $args $impl_key]
+}
 
-        # Make the generic call
-        return [acs_sc_call NotificationDeliveryMethod ScanReplies $args $impl_key]
-    }
+ad_proc -public notification::delivery::new {
+    {-delivery_method_id ""}
+    {-sc_impl_id:required}
+    {-short_name:required}
+    {-pretty_name:required}
+} {
+    Register a new delivery method with the notification service.
+} {
+    set extra_vars [ns_set create]
 
+    oacs_util::vars_to_ns_set \
+        -ns_set $extra_vars \
+        -var_list {delivery_method_id sc_impl_id short_name pretty_name}
+    
+    return [package_instantiate_object \
+                -extra_vars $extra_vars \
+                "notification_delivery_method"]
 }
+
+ad_proc -public notification::delivery::delete {
+    {-delivery_method_id:required}
+} {
+    Unregister a delivery method with the notification service.
+} {
+    db_exec_plsql delete {}
+}
+
+ad_proc -public notification::delivery::update_sc_impl_id {
+    {-delivery_method_id ""}
+    {-sc_impl_id:required}
+} {
+    Register a new service contract implementation with an existing delivery method.
+} {
+    db_dml update {}
+}
+
+ad_proc -public notification::delivery::get_id {
+    {-short_name:required}
+} {
+    Return the delivery_method_id from the short_name.
+} {
+    return [db_string select_delivery_method_id {}]
+}
+
Index: openacs-4/packages/notifications/tcl/delivery-method-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/delivery-method-procs.xql,v
diff -u -r1.2 -r1.2.2.1
--- openacs-4/packages/notifications/tcl/delivery-method-procs.xql	28 Jun 2002 20:21:50 -0000	1.2
+++ openacs-4/packages/notifications/tcl/delivery-method-procs.xql	12 Jun 2003 13:34:52 -0000	1.2.2.1
@@ -2,12 +2,28 @@
 
 <queryset>
 
-<fullquery name="notification::delivery::get_impl_key.select_impl_key">
-<querytext>
-select impl_name from acs_sc_impls, notification_delivery_methods
-where acs_sc_impls.impl_id = notification_delivery_methods.sc_impl_id
-and delivery_method_id= :delivery_method_id
-</querytext>
-</fullquery>
+  <fullquery name="notification::delivery::get_impl_key.select_impl_key">
+    <querytext>
+      select impl_name from acs_sc_impls, notification_delivery_methods
+      where acs_sc_impls.impl_id = notification_delivery_methods.sc_impl_id
+      and delivery_method_id= :delivery_method_id
+    </querytext>
+  </fullquery>
 
+  <fullquery name="notification::delivery::get_id.select_delivery_method_id">
+    <querytext>
+      select delivery_method_id
+      from   notification_delivery_methods
+      where  short_name = :short_name
+    </querytext>
+  </fullquery>
+
+  <fullquery name="notification::delivery::update_sc_impl_id.update">
+    <querytext>
+      update notification_delivery_methods
+      set    sc_impl_id = :sc_impl_id
+      where  delivery_method_id = :delivery_method_id
+    </querytext>
+  </fullquery>
+
 </queryset>
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.9.2.4 -r1.9.2.5
--- openacs-4/packages/notifications/tcl/notification-email-procs.tcl	1 Nov 2002 18:48:25 -0000	1.9.2.4
+++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl	12 Jun 2003 13:34:52 -0000	1.9.2.5
@@ -81,24 +81,44 @@
     }
 
     ad_proc -public send {
+        from_user_id
         to_user_id
         reply_object_id
         notification_type_id
         subject
         content
     } {
-        Send the actual email
+        Send the actual email.
+
+        @param from_user_id The user_id of the user that the email should be sent as. Leave empty for the standard mailer from address.
     } {
         # Get email
         set email [cc_email_from_party $to_user_id]
 
-       append content "\nGetting too much email? Manage your notifications at: [manage_notifications_url]"
+        append content "\nGetting too much email? Manage your notifications at: [manage_notifications_url]"
 
+        set extra_headers [ns_set new]
+        
+        if { ![empty_string_p $from_user_id] && [db_0or1row get_person {}]} {
+            set from_email "\"$first_names $last_name\" <[cc_email_from_party $from_user_id]>"
+
+            # Set the Reply-To and Mail-Followup-To addresses to the
+            # address of the notifications handler.
+            set reply_to [reply_address -object_id $reply_object_id -type_id $notification_type_id]
+            ns_set put $extra_headers Reply-To $reply_to
+            ns_set put $extra_headers Mail-Followup-To $reply_to
+        } else {
+            set from_email [reply_address -object_id $reply_object_id -type_id $notification_type_id]
+        }
+
+        ns_set put $extra_headers Precedence list
+
         acs_mail_lite::send \
             -to_addr $email \
-            -from_addr [reply_address -object_id $reply_object_id -type_id $notification_type_id] \
+            -from_addr $from_email \
             -subject $subject \
-            -body $content
+            -body $content \
+            -extraheaders $extra_headers
     }
 
     ad_proc -private load_qmail_mail_queue {
Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/notifications/tcl/notification-email-procs.xql'.
Fisheye: No comparison available.  Pass `N' to diff?
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.3.2.5 -r1.3.2.6
--- openacs-4/packages/notifications/tcl/notification-procs.tcl	15 May 2003 07:54:42 -0000	1.3.2.5
+++ openacs-4/packages/notifications/tcl/notification-procs.tcl	12 Jun 2003 13:34:52 -0000	1.3.2.6
@@ -83,6 +83,7 @@
         {-force:boolean}
         {-default_request_data {}}
         {-return_notified:boolean}
+        {-notif_user {}}
     } {
         Create a new notification if any notification requests exist for the object and type.
         
@@ -264,6 +265,10 @@
                 }
             }
             
+            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 } {
@@ -295,7 +300,9 @@
 
                 # Set up the vars
                 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}
+                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}
                 
                 # 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 -r1.9.2.5 -r1.9.2.6
--- openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql	4 Jun 2003 20:41:03 -0000	1.9.2.5
+++ openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql	12 Jun 2003 13:34:52 -0000	1.9.2.6
@@ -32,7 +32,8 @@
                     notification_requests.delivery_method_id,
                     notification_requests.request_id,
                     notifications.response_id,
-                    notifications.notif_date
+                    notifications.notif_date,
+                    notifications.notif_user
                   from notifications, notification_requests
                   where notifications.type_id = notification_requests.type_id
                     and notifications.object_id = notification_requests.object_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 -r1.3.2.5 -r1.3.2.6
--- openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql	4 Jun 2003 20:43:17 -0000	1.3.2.5
+++ openacs-4/packages/notifications/tcl/sweep-procs-postgresql.xql	12 Jun 2003 13:34:52 -0000	1.3.2.6
@@ -25,7 +25,8 @@
                    type_id,
                    delivery_method_id,
 		   response_id,
-		   notif_date
+		   notif_date,
+                   notif_user
             from notifications inner join notification_requests using (type_id, object_id)
               inner join acs_objects on (notification_requests.request_id = acs_objects.object_id)
               left outer join notification_user_map using (notification_id, user_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 -r1.9.2.3 -r1.9.2.4
--- openacs-4/packages/notifications/tcl/sweep-procs.tcl	5 Mar 2003 15:04:04 -0000	1.9.2.3
+++ openacs-4/packages/notifications/tcl/sweep-procs.tcl	12 Jun 2003 13:34:52 -0000	1.9.2.4
@@ -128,12 +128,13 @@
                 db_transaction {
                     # 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 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]
+                        -from_user_id [ns_set get $notif notif_user] \
+                        -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] \
+                        -reply_object_id [ns_set get $notif response_id] \
+                        -delivery_method_id [ns_set get $notif delivery_method_id]
                     
                     # Markt it as sent
                     notification::mark_sent \