news__rss_datasource (private)

 news__rss_datasource summary_context_id

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

This procedure implements the 'datasource' operation of the 'RssGenerationSubscriber' Service Contract and should not be invoked directly.

Parameters:
summary_context_id (required)
Author:
Dave Bauer <dave@thedesignexperience.org>

Partial Call Graph (max 5 caller/called nodes):
%3 AcsSc.rssgenerationsubscriber.datasource.news AcsSc.rssgenerationsubscriber.datasource.news (private) news__rss_datasource news__rss_datasource AcsSc.rssgenerationsubscriber.datasource.news->news__rss_datasource _ _ (public) news__rss_datasource->_ ad_html_text_convert ad_html_text_convert (public) news__rss_datasource->ad_html_text_convert ad_system_name ad_system_name (public) news__rss_datasource->ad_system_name ad_url ad_url (public) news__rss_datasource->ad_url db_foreach db_foreach (public) news__rss_datasource->db_foreach

Testcases:
No testcase defined.
Source code:
    # TODO make limit a parameter
    set limit 15

    set items [list]
    set counter 0
    set package_url [news_util_get_url $summary_context_id]
    db_foreach get_news_items {
        select cn.*,
        ci.item_id,
        cr.content,
        cr.title,
        cr.mime_type,
        cr.description,
        to_char(o.last_modified, 'YYYY-MM-DD HH24:MI:SS') as last_modified
        from cr_news cn,
        cr_revisions cr,
        cr_items ci,
        acs_objects o
        where cn.package_id=:summary_context_id
        and cr.revision_id=cn.news_id
        and cn.news_id=o.object_id
        and cr.item_id=ci.item_id
        and cr.revision_id=ci.live_revision
        order by o.last_modified desc
        fetch first :limit rows only
    } {
        set entry_url [export_vars -base "[ad_url]${package_url}item" {item_id}]

        # content doesn't need to be convert to plain text. moreover it will look much
        # better in HTML
        set content_as_html [ad_html_text_convert -from $mime_type -to text/html -- $content]
        set description $content_as_html

        # Always convert timestamp to GMT
        set entry_date_ansi [lc_time_tz_convert -from [lang::system::timezone] -to "Etc/GMT" -time_value $last_modified]
        set entry_timestamp "[clock format [clock scan $entry_date_ansi] -format "%a, %d %b %Y %H:%M:%S"] GMT"

        lappend items [list  link $entry_url  title $title  description $description  value $content_as_html  timestamp $entry_timestamp]

        if { $counter == 0 } {
            set column_array(channel_lastBuildDate) $entry_timestamp
            incr counter
        }
    }

    set news_title [_ news.system_name_News [list system_name [ad_system_name]]]

    set column_array(channel_title) $news_title
    set column_array(channel_description) $news_title
    set column_array(items) $items
    set column_array(channel_language) ""
    set column_array(channel_copyright) ""
    set column_array(channel_managingEditor) ""
    set column_array(channel_webMaster) ""
    set column_array(channel_rating) ""
    set column_array(channel_skipDays) ""
    set column_array(channel_skipHours) ""
    set column_array(version) 2.0
    set column_array(image) ""
    set column_array(channel_link) "[ad_url]$package_url"
    return [array get column_array]
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: