Index: openacs-4/packages/notifications/tcl/notification-display-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-display-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/notifications/tcl/notification-display-procs.tcl 29 May 2002 05:12:01 -0000 1.1 +++ openacs-4/packages/notifications/tcl/notification-display-procs.tcl 30 May 2002 06:26:09 -0000 1.2 @@ -26,17 +26,38 @@ # Check if subscribed set request_id [notification::request::get_request_id -type_id $type_id -object_id $object_id -user_id $user_id] - set root_path [apm_package_url_from_key [notification::package_key]] - set encoded_stuff "pretty_name=[ns_urlencode $pretty_name]&return_url=[ns_urlencode $url]" - if {![empty_string_p $request_id]} { - set sub_url "${root_path}request-delete?request_id=$request_id&$encoded_stuff" + set sub_url [unsubscribe_url -request_id $request_id -url $url] set sub_chunk "You have requested notification for $pretty_name. You may unsubscribe." } else { - set sub_url "${root_path}request-new?type_id=$type_id&user_id=$user_id&object_id=$object_id&$encoded_stuff" + set sub_url [subscribe_url -type $type -object_id $object_id -url $url -user_id $user_id] set sub_chunk "You may request notification for $pretty_name." } return "\[ $sub_chunk \]" } + + ad_proc -public subscribe_url { + {-type:required} + {-object_id:required} + {-url:required} + {-user_id:required} + } { + set type_id [notification::type::get_type_id -short_name $type] + + set root_path [apm_package_url_from_key [notification::package_key]] + set subscribe_url "${root_path}request-new?type_id=$type_id&user_id=$user_id&object_id=$object_id&return_url=[ns_urlencode $url]" + + return $subscribe_url + } + + ad_proc -public unsubscribe_url { + {-request_id:required} + {-url:required} + } { + set root_path [apm_package_url_from_key [notification::package_key]] + set unsubscribe_url "${root_path}request-delete?request_id=$request_id&return_url=[ns_urlencode $url]" + + return $unsubscribe_url + } } 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 -N -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-procs.tcl 29 May 2002 05:12:01 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-procs.tcl 30 May 2002 06:26:09 -0000 1.3 @@ -14,6 +14,18 @@ return "notifications" } + ad_proc -public get_interval_id { + {-name:required} + } { + return [db_string select_interval_id {} -default ""] + } + + ad_proc -public get_delivery_method_id { + {-name:required} + } { + return [db_string select_delivery_method_id {} -default ""] + } + ad_proc -public get_all_intervals {} { return [db_list_of_lists select_all_intervals {}] } Index: openacs-4/packages/notifications/tcl/notification-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/tcl/notification-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/notifications/tcl/notification-procs.xql 29 May 2002 05:12:01 -0000 1.2 +++ openacs-4/packages/notifications/tcl/notification-procs.xql 30 May 2002 06:26:09 -0000 1.3 @@ -1,6 +1,18 @@ + + +select interval_id from notification_intervals where name= :name + + + + + +select delivery_method_id from notification_delivery_methods where short_name= :name + + + select name, interval_id from 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 -N -r1.1 -r1.2 --- openacs-4/packages/notifications/tcl/sweep-procs.tcl 29 May 2002 05:12:01 -0000 1.1 +++ openacs-4/packages/notifications/tcl/sweep-procs.tcl 30 May 2002 06:26:09 -0000 1.2 @@ -63,7 +63,7 @@ db_transaction { # Send it send_one -user_id [ns_set get $notif user_id] \ - -subject "[Notification]: [ns_set get $notif notif_subject]" \ + -subject "\[Notification\]: [ns_set get $notif notif_subject]" \ -content [ns_set get $notif notif_text] \ -response_id [ns_set get $notif response_id] \ -delivery_method_id [ns_set get $notif delivery_method_id]