Index: openacs-4/packages/forums/sql/oracle/forums-notifications-init.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/sql/oracle/Attic/forums-notifications-init.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/forums/sql/oracle/forums-notifications-init.sql 29 May 2002 21:40:10 -0000 1.1 +++ openacs-4/packages/forums/sql/oracle/forums-notifications-init.sql 29 Jun 2002 00:21:11 -0000 1.2 @@ -12,10 +12,40 @@ -- the integration with Notifications declare + impl_id integer; v_foo integer; begin + -- the notification type impl + impl_id := acs_sc_impl.new ( + 'NotificationType', + 'forums_forum_notif_type', + 'forums' + ); + + v_foo := acs_sc_impl.new_alias ( + 'NotificationType', + 'forums_forum_notif_type', + 'GetURL', + 'forum::notification::get_url', + 'TCL' + ); + + v_foo := acs_sc_impl.new_alias ( + 'NotificationType', + 'forums_forum_notif_type', + 'ProcessReply', + 'forum::notification::process_reply', + 'TCL' + ); + + acs_sc_binding.new ( + contract_name => 'NotificationType', + impl_name => 'forums_forum_notif_type' + ); + v_foo:= notification_type.new ( short_name => 'forums_forum_notif', + sc_impl_id => impl_id, pretty_name => 'Forum Notification', description => 'Notifications for Entire Forums', creation_user => NULL, @@ -33,8 +63,37 @@ select v_foo, delivery_method_id from notification_delivery_methods where short_name in ('email'); + -- the notification type impl + impl_id := acs_sc_impl.new ( + 'NotificationType', + 'forums_message_notif_type', + 'forums' + ); + + v_foo := acs_sc_impl.new_alias ( + 'NotificationType', + 'forums_message_notif_type', + 'GetURL', + 'forum::notification::get_url', + 'TCL' + ); + + v_foo := acs_sc_impl.new_alias ( + 'NotificationType', + 'forums_message_notif_type', + 'ProcessReply', + 'forum::notification::process_reply', + 'TCL' + ); + + acs_sc_binding.new ( + contract_name => 'NotificationType', + impl_name => 'forums_message_notif_type' + ); + v_foo:= notification_type.new ( short_name => 'forums_message_notif', + sc_impl_id => impl_id, pretty_name => 'Message Notification', description => 'Notifications for Message Thread', creation_user => NULL, Index: openacs-4/packages/forums/tcl/forum-message-reply-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forum-message-reply-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/tcl/forum-message-reply-procs.tcl 29 Jun 2002 00:21:46 -0000 1.1 @@ -0,0 +1,26 @@ +ad_library { + + Forums Library - Reply Handling + + @creation-date 2002-05-17 + @author Ben Adida + @cvs-id $Id: forum-message-reply-procs.tcl,v 1.1 2002/06/29 00:21:46 ben Exp $ + +} + +namespace eval forum::message::notification { + + ad_proc -public get_url { + object_id + } { + + } + + ad_proc -public process_reply { + reply_id + } { + + } + + +} Index: openacs-4/packages/forums/tcl/forum-reply-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forum-reply-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/forums/tcl/forum-reply-procs.tcl 29 Jun 2002 00:21:46 -0000 1.1 @@ -0,0 +1,39 @@ +ad_library { + + Forums Library - Reply Handling + + @creation-date 2002-05-17 + @author Ben Adida + @cvs-id $Id: forum-reply-procs.tcl,v 1.1 2002/06/29 00:21:46 ben Exp $ + +} + +namespace eval forum::notification { + + ad_proc -public get_url { + object_id + } { + + } + + ad_proc -public process_reply { + reply_id + } { + ns_log Notice "FORUM-NOTIF: processing reply $reply_id" + + # Get the data + notification::reply::get -reply_id $reply_id -array reply + + # Get the message information + forum::message::get -message_id $reply(object_id) -array message + + # Insert the message + forum::message::new -forum_id $message(forum_id) \ + -parent_id $message(message_id) \ + -subject $reply(subject) \ + -content $reply(content) \ + -user_id $reply(from_user) + } + + +} Index: openacs-4/packages/notifications/notifications.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/notifications.info,v diff -u -r1.7 -r1.8 --- openacs-4/packages/notifications/notifications.info 28 Jun 2002 20:21:50 -0000 1.7 +++ openacs-4/packages/notifications/notifications.info 29 Jun 2002 00:21:11 -0000 1.8 @@ -50,6 +50,7 @@ + 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.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-email-procs.tcl 28 Jun 2002 20:21:50 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-email-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 @@ -78,8 +78,10 @@ @param queue_dir The location of the qmail mail queue in the file-system. } { - if [catch {set messages [glob "$queue_dir/new/*"]} ] { - ns_log Notice "queue dir = [glob $queue_dir/new/*]" + if {[catch { + set messages [glob "$queue_dir/new/*"] + } errmsg]} { + ns_log Notice "queue dir = $queue_dir/new/*, no messages" return [list] } @@ -143,7 +145,8 @@ } set from [parse_email_address $from] - + set to [parse_email_address $to] + # Find the from user set from_user [cc_lookup_email_user $from] Index: openacs-4/packages/notifications/tcl/notification-reply-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-reply-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-reply-procs.tcl 25 Jun 2002 18:58:06 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-reply-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 @@ -29,6 +29,17 @@ return $reply_id } + ad_proc -public get { + {-reply_id:required} + {-array:required} + } { + Get the information for the reply + } { + # Select the info into the upvar'ed Tcl Array + upvar $array row + db_1row select_reply {} -column_array row + } + ad_proc -public delete { {-reply_id:required} } { Index: openacs-4/packages/notifications/tcl/notification-reply-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-reply-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/notification-reply-procs.xql 29 Jun 2002 00:21:46 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + +select reply_id, object_id, type_id, from_user, subject, content, reply_date +from notification_replies +where reply_id= :reply_id + + + + Index: openacs-4/packages/notifications/tcl/notification-type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-type-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-type-procs.tcl 25 Jun 2002 18:58:06 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-type-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 @@ -10,6 +10,12 @@ namespace eval notification::type { + ad_proc -public get_impl_key { + {-type_id:required} + } { + return [db_string select_impl_key {}] + } + ad_proc -public new { {-type_id ""} {-sc_impl_id:required} Index: openacs-4/packages/notifications/tcl/notification-type-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-type-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-type-procs.xql 3 Jun 2002 22:27:00 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-type-procs.xql 29 Jun 2002 00:21:11 -0000 1.3 @@ -2,6 +2,14 @@ + + +select impl_name from acs_sc_impls, notification_types +where acs_sc_impls.impl_id = notification_types.sc_impl_id +and type_id= :type_id + + + select type_id Index: openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl 25 Jun 2002 18:58:06 -0000 1.2 +++ openacs-4/packages/notifications/tcl/reply-sweep-procs.tcl 29 Jun 2002 00:21:11 -0000 1.3 @@ -35,12 +35,14 @@ # Loop through and transactionally process each one foreach reply $replies { - ns_log Notice "NOTIF- one reply $reply_id of type $type_id" - set reply_id [lindex $reply 0] set type_id [lindex $reply 1] + ns_log Notice "NOTIF- one reply $reply_id of type $type_id" + notification::type::process_reply -type_id $type_id -reply_id $reply_id + + notification::reply::delete -reply_id $reply_id } } Index: openacs-4/packages/notifications/tcl/reply-sweep-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/reply-sweep-procs.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/tcl/reply-sweep-procs.xql 29 Jun 2002 00:21:46 -0000 1.1 @@ -0,0 +1,17 @@ + + + + + + +select delivery_method_id from notification_delivery_methods + + + + + +select reply_id, type_id from notification_replies order by reply_date + + + + 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.6 -r1.7 --- openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 28 Jun 2002 20:21:50 -0000 1.6 +++ openacs-4/packages/notifications/tcl/sweep-procs-oracle.xql 29 Jun 2002 00:21:11 -0000 1.7 @@ -26,6 +26,8 @@ notif_html, 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 from notifications, notification_requests,