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.15 -r1.16 --- openacs-4/packages/notifications/tcl/notification-display-procs.tcl 15 May 2007 20:14:51 -0000 1.15 +++ openacs-4/packages/notifications/tcl/notification-display-procs.tcl 26 May 2007 10:43:27 -0000 1.16 @@ -53,6 +53,10 @@ set title [_ notifications.lt_Request_Notification_] set sub_chunk "[_ notifications.lt_You_may_a_hrefsub_url]" } + # if they are an admin give them to view all subscribers + if { [permission::permission_p -object_id $object_id -privilege admin] } { + append sub_chunk " \[[_ notifications.Subscribers]\]" + } if { [empty_string_p $sub_url] } { return "" Index: openacs-4/packages/notifications/www/manage-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/Attic/manage-postgresql.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/notifications/www/manage-postgresql.xql 17 May 2003 10:54:55 -0000 1.5 +++ openacs-4/packages/notifications/www/manage-postgresql.xql 26 May 2007 10:43:28 -0000 1.6 @@ -5,21 +5,22 @@ - select request_id, - type_id, - (select pretty_name - from notification_types - where notification_types.type_id = - notification_requests.type_id) as type, - acs_object__name(notification_requests.object_id) as object_name, - (select name - from notification_intervals - where notification_intervals.interval_id = - notification_requests.interval_id) as interval, - object_id - from notification_requests - where user_id = :user_id - and dynamic_p = 'f' + select nr.request_id, + nr.type_id, + nt.pretty_name as type, + acs_object__name(nr.object_id) as object_name, + ni.name as interval, + nr.object_id + from notification_requests nr, + notification_intervals ni, + notification_types nt, + persons p + where nr.user_id = :user_id + and nr.interval_id = ni.interval_id + and nr.type_id = nt.type_id + and nr.user_id = p.person_id + and nr.dynamic_p = 'f' + order by lower(nt.pretty_name), lower(acs_object__name(nr.object_id)) Index: openacs-4/packages/notifications/www/manage.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/manage.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/notifications/www/manage.adp 15 May 2007 20:14:51 -0000 1.9 +++ openacs-4/packages/notifications/www/manage.adp 26 May 2007 10:43:28 -0000 1.10 @@ -1,5 +1,10 @@ #notifications.Manage_Notifications# + +

@notice;noquote@

+
+ #notifications.Manage_Notifications_Help# + Index: openacs-4/packages/notifications/www/manage.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/manage.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/notifications/www/manage.tcl 15 Dec 2006 22:45:40 -0000 1.6 +++ openacs-4/packages/notifications/www/manage.tcl 26 May 2007 10:43:28 -0000 1.7 @@ -4,26 +4,35 @@ @author Tracy Adams (teadams@alum.mit.edu) @creation-date 2002-07-22 - @cvs-id $Id$ -} {} - -auth::require_login -set user_id [ad_conn user_id] -set return_url [ad_conn url] - -db_multirow -extend { interval_url } notifications select_notifications {} { - set interval_url [export_vars -base request-change-frequency { request_id {return_url [ad_return_url]} }] +} { + {user_id ""} } -template::list::create \ - -name notifications \ - -no_data [_ notifications.lt_You_have_no_notificat] \ - -elements { +auth::require_login +if { $user_id ne "" && $user_id ne [ad_conn user_id] } { + # we need to verify that they are an admin + permission::require_permission -object_id [ad_conn package_id] -privilege "admin" + set elements { type { label {[_ notifications.Notification_type]} } object_name { label {[_ notifications.Item]} + link_url_eval {[export_vars -base subscribers { object_id }]} + } + interval { + label {[_ notifications.Frequency]} + } + } + set notice "[acs_community_member_link -user_id $user_id -label [contact::name -party_id $user_id]] - [_ notifications.Notifications]" +} else { + set user_id [ad_conn user_id] + set elements { + type { + label {[_ notifications.Notification_type]} + } + object_name { + label {[_ notifications.Item]} link_url_eval {[export_vars -base object-goto { object_id type_id }]} link_html {title "\#notifications.goto_object_name\#"} } @@ -41,3 +50,18 @@ link_html {title "\#notifications.Unsubscribe_from_object_name\#"} } } +} + +set return_url [ad_conn url] + +db_multirow -extend { interval_url } notifications select_notifications {} { + set interval_url [export_vars -base request-change-frequency { request_id {return_url [ad_return_url]} }] +} + + + +template::list::create \ + -name notifications \ + -no_data [_ notifications.lt_You_have_no_notificat] \ + -elements $elements + Index: openacs-4/packages/notifications/www/subscribers.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/subscribers.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/subscribers.adp 26 May 2007 10:44:07 -0000 1.1 @@ -0,0 +1,8 @@ + +#notifications.Manage_Notifications# + + +

@notice;noquote@

+
+ + Index: openacs-4/packages/notifications/www/subscribers.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/notifications/www/subscribers.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/notifications/www/subscribers.tcl 26 May 2007 10:44:07 -0000 1.1 @@ -0,0 +1,71 @@ +ad_page_contract { + + Manage notifications for one user + + @author Tracy Adams (teadams@alum.mit.edu) + @creation-date 2002-07-22 + @cvs-id $Id: subscribers.tcl,v 1.1 2007/05/26 10:44:07 maltes Exp $ +} { + object_id:notnull +} + +permission::require_permission -object_id $object_id -privilege "admin" + +# first we verify that this object receives notifications +if { ![db_0or1row select_name { select acs_object__name(object_id) as name, type_id from notification_requests where dynamic_p = 'f' and object_id = :object_id order by type_id limit 1 }] } { + # there are no notifications for this object + ad_return_error "No Notifications" "This object does have anybody subscribed via notifications" +} + +# the link to the object picks up the first type_id it gets +# if objects have multiple types we may need to separate them +# with different links to their respective objects. + +set notice "$name - [_ notifications.Notifications]" + + + +set return_url [ad_conn url] +set package_admin_p [permission::permission_p -object_id [ad_conn package_id] -privilege "admin"] + +db_multirow -extend {subscriber_url subscriber_name } notifications select_notifications { + select nr.user_id, + ni.name as interval, + nt.pretty_name as type + from notification_requests nr, + notification_intervals ni, + notification_types nt, + persons p + where nr.object_id = :object_id + and nr.interval_id = ni.interval_id + and nr.type_id = nt.type_id + and nr.user_id = p.person_id + and nr.dynamic_p = 'f' + order by lower(p.last_name), lower(p.first_names) +} { + set subscriber_name [contact::name -party_id $user_id] + if { [string is true $package_admin_p] } { + set subscriber_url [export_vars -base "manage" -url {user_id}] + } else { + set subscriber_url [acs_community_member_url -user_id $user_id] + } +} + + + +template::list::create \ + -name notifications \ + -no_data [_ notifications.lt_You_have_no_notificat] \ + -elements { + subscriber_name { + label {[_ notifications.Subscriber] } + link_url_eval $subscriber_url + } + type { + label {[_ notifications.Notification_type]} + } + interval { + label {[_ notifications.Frequency]} + } + } +