Index: openacs-4/packages/news/tcl/news-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs-oracle.xql,v diff -u -r1.7 -r1.8 --- openacs-4/packages/news/tcl/news-procs-oracle.xql 30 Dec 2009 23:13:36 -0000 1.7 +++ openacs-4/packages/news/tcl/news-procs-oracle.xql 10 Jul 2018 13:48:19 -0000 1.8 @@ -38,18 +38,6 @@ - - - - select site_node.url(node_id) as url_stub - from site_nodes - where object_id=:package_id - and rownum = 1 - - - - - select * from ( Index: openacs-4/packages/news/tcl/news-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs-postgresql.xql,v diff -u -r1.6 -r1.7 --- openacs-4/packages/news/tcl/news-procs-postgresql.xql 30 Dec 2009 23:13:36 -0000 1.6 +++ openacs-4/packages/news/tcl/news-procs-postgresql.xql 10 Jul 2018 13:48:19 -0000 1.7 @@ -33,17 +33,6 @@ - - - - select site_node__url(node_id) as url_stub - from site_nodes - where object_id=:package_id - limit 1 - - - - select cn.*, Index: openacs-4/packages/news/tcl/news-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs.tcl,v diff -u -r1.39 -r1.40 --- openacs-4/packages/news/tcl/news-procs.tcl 9 May 2018 15:33:32 -0000 1.39 +++ openacs-4/packages/news/tcl/news-procs.tcl 10 Jul 2018 13:48:19 -0000 1.40 @@ -11,62 +11,57 @@ ad_proc news_items_archive { id_list when } { - immediately gives all news items in list id_list - a status of archived as of ANSI date in when, i.e. when must be like 2000-10-11. + Immediately gives all news items in list id_list a status of + archived as of ANSI date in when, i.e. when must be like + 2000-10-11. } { - foreach id $id_list { db_exec_plsql news_item_archive {} } - } - ad_proc news_items_make_permanent { id_list } { - immediately gives all news items in list id_list - a status of permanently published + Immediately gives all news items in list id_list a status of + permanently published. } { - foreach id $id_list { db_exec_plsql news_item_make_permanent {} } - } - ad_proc news_items_delete { id_list } { - deletes all news items with news_id in id_list + Deletes all news items with news_id in id_list. } { - foreach id $id_list { db_exec_plsql news_item_delete {} } - } - ad_proc news_util_get_url { package_id -} { +} { + Get package URL from package_id. If this was mounted multiple + times, only the first occurrence will be returned. + + This proc could be deprecated in the future. + + @see apm_package_url_from_id + @author Robert Locke } { - - set url_stub "" - - db_0or1row get_url_stub {} - return $url_stub - + return [apm_package_url_from_id $package_id] } ad_proc news__datasource { object_id -} { - +} { + Implementation for the FtsContentProvider.datasource Service + Contract. @author Jeff Davis (davis@xarg.net) } { @@ -124,13 +119,15 @@ ad_proc news__url { object_id } { + Returns the URL for specified news object. @author Robert Locke } { db_1row get {} - return "[ad_url][news_util_get_url $package_id]item/$item_id" + set package_url [apm_package_url_from_id $package_id] + return "[ad_url]${package_url}item/$item_id" } -ad_proc news_pretty_status { +ad_proc news_pretty_status { {-publish_date:required} {-archive_date:required} {-status:required} @@ -208,7 +205,7 @@ package_id } { - Return the timestamp of the most recent item in this news instance + Return the timestamp of the most recent item in this news instance. @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2005-01-22 @@ -302,44 +299,60 @@ # add news notification ad_proc -public news_notification_get_url { - news_package_id + news_package_id } { - returns a full url to the news item. -} { - return "[news_util_get_url $news_package_id]" + Get package URL from package_id. If this was mounted multiple + times, only the first occurrence will be returned. + + This proc could be deprecated in the future. + + @see apm_package_url_from_id +} { + return [apm_package_url_from_id $package_id] } ad_proc -public news_do_notification { news_package_id news_id -} { - - set package_id [ad_conn package_id] +} { + Sends notifications for specified news item. +} { + set system_url [parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL] + set package_url [apm_package_url_from_id $news_package_id] + set node_id [ad_conn node_id] - set instance_name [application_group::closest_ancestor_element -include_self -node_id $node_id -element "instance_name"] - + set instance_name [application_group::closest_ancestor_element \ + -include_self \ + -node_id $node_id \ + -element "instance_name"] + # get the title and teaser for latest news item for the given package id if { [db_0or1row get_news { - select item_id, publish_date, publish_title as title, publish_lead as lead, publish_body, publish_format - from news_items_live_or_submitted where news_id = :news_id + select item_id, + publish_date, + publish_title as title, + publish_lead as lead, + publish_body, + publish_format + from news_items_live_or_submitted + where news_id = :news_id }] } { + set item_url ${system_url}${package_url}item?item_id=$item_id set new_content "$title\n\n$lead\n\n[ad_html_text_convert -from $publish_format -to text/plain -- $publish_body]" set html_content [ad_html_text_convert -from $publish_format -to text/html -- $publish_body] append new_content "\n\n[string repeat - 70]" - append new_content "\n\n[parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][news_util_get_url $news_package_id]]item?item_id=$item_id \n\n" - append html_content "


[ad_html_text_convert "\n [parameter::get_from_package_key -package_key acs-kernel -parameter SystemURL][news_util_get_url $news_package_id]item?item_id=$item_id"]

" + append new_content "\n\n${item_url} \n\n" + append html_content "


" [ad_html_text_convert "\n ${item_url}"] "

" } # Notifies the users that requested notification for the specific news item - notification::new \ -type_id [notification::type::get_type_id -short_name one_news_item_notif] \ -object_id $news_package_id \ -notif_subject "\[$instance_name\] #news.Latest_News#" \ -notif_text $new_content \ -notif_html $html_content \ -notif_date $publish_date - } # Local variables: