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 -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 + } }