news_do_notification (public)

 news_do_notification news_package_id news_id

Defined in packages/news/tcl/news-procs.tcl

Sends notifications for specified news item.

Parameters:
news_package_id (required)
news_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 packages/news/www/item-create-3.tcl packages/news/ www/item-create-3.tcl news_do_notification news_do_notification packages/news/www/item-create-3.tcl->news_do_notification ad_conn ad_conn (public) news_do_notification->ad_conn ad_html_text_convert ad_html_text_convert (public) news_do_notification->ad_html_text_convert apm_package_url_from_id apm_package_url_from_id (public) news_do_notification->apm_package_url_from_id application_group::closest_ancestor_element application_group::closest_ancestor_element (public) news_do_notification->application_group::closest_ancestor_element db_0or1row db_0or1row (public) news_do_notification->db_0or1row

Testcases:
No testcase defined.
Source code:
    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"]

    # 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
    }] } {
        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${item_url} \n\n"
        append html_content "<br><br><hr>" [ad_html_text_convert "\n ${item_url}""<br><br>"
    }

    # 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
Generic XQL file:
packages/news/tcl/news-procs.xql

PostgreSQL XQL file:
packages/news/tcl/news-procs-postgresql.xql

Oracle XQL file:
packages/news/tcl/news-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: