rss_gen_200 (public)

 rss_gen_200 [ -channel_title channel_title ] \
    [ -channel_link channel_link ] \
    [ -channel_description channel_description ] [ -image image ] \
    [ -items items ] [ -channel_language channel_language ] \
    [ -channel_copyright channel_copyright ] \
    [ -channel_managingEditor channel_managingEditor ] \
    [ -channel_webMaster channel_webMaster ] \
    [ -channel_rating channel_rating ] \
    [ -channel_pubDate channel_pubDate ] \
    [ -channel_lastBuildDate channel_lastBuildDate ] \
    [ -channel_skipDays channel_skipDays ] \
    [ -channel_skipHours channel_skipHours ]

Defined in packages/rss-support/tcl/rss-generation-procs.tcl

generate an rss 2.0 xml feed

Switches:
-channel_title
(optional)
-channel_link
(optional)
-channel_description
(optional)
-image
(optional)
-items
(optional)
-channel_language
(defaults to "en-us") (optional)
-channel_copyright
(optional)
-channel_managingEditor
(optional)
-channel_webMaster
(optional)
-channel_rating
(optional)
-channel_pubDate
(optional)
-channel_lastBuildDate
(optional)
-channel_skipDays
(optional)
-channel_skipHours
(optional)

Partial Call Graph (max 5 caller/called nodes):
%3 rss_gen rss_gen (public) rss_gen_200 rss_gen_200 rss_gen->rss_gen_200 acs_root_dir acs_root_dir (public) rss_gen_200->acs_root_dir ad_url ad_url (public) rss_gen_200->ad_url lang::system::timezone lang::system::timezone (public) rss_gen_200->lang::system::timezone lc_time_tz_convert lc_time_tz_convert (public) rss_gen_200->lc_time_tz_convert rss_package_url rss_package_url (public) rss_gen_200->rss_package_url

Testcases:
No testcase defined.
Source code:

    set rss ""

    if {$channel_title eq ""} {
        error "argument channel_title not provided"
    }
    if {$channel_link eq ""} {
        error "argument channel_link not provided"
    }
    if {$channel_description eq ""} {
        error "argument channel_description not provided"
    }

    if { $channel_lastBuildDate eq "" } {
        set now_ansi [clock format [clock seconds] -format "%Y-%m-%d %H:%M:%S"]
        set now_ansi [lc_time_tz_convert -from [lang::system::timezone] -to "Etc/GMT" -time_value $now_ansi]
        set channel_lastBuildDate "[clock format [clock scan $now_ansi] -format "%a, %d %b %Y %H:%M:%S"] GMT"
    }

    append rss {<rss version="2.0">} \n
    append rss {<channel>} \n

    append rss "<title>[ns_quotehtml $channel_title]</title>" \n
    append rss "<link>$channel_link</link>" \n
    append rss "<description>[ns_quotehtml $channel_description]</description>" \n

    append rss {<generator>OpenACS 5.0</generator>} \n
    append rss "<lastBuildDate>[ns_quotehtml $channel_lastBuildDate]</lastBuildDate>" \n
    if { $channel_pubDate ne "" } {
    append rss "<pubDate>[ns_quotehtml $channel_pubDate]</pubDate>" \n
    }

    if {$image eq ""} {
    set base     images/openacs_logo_rss.gif
        set url      [ad_url][rss_package_url]$base
        set title    $channel_title
        set link     $channel_link
        set size     [ns_gifsize [acs_root_dir]/packages/rss-support/www/$base]

        set image [list                                           url $url                                          title $title                                      link $link                                        width [lindex $size 0]                            height [lindex $size 1]]
    }

    # image handling
    append rss "<image>\n"
    array set iarray $image

    append rss "<title>[ns_quotehtml $iarray(title)]</title>\n"
    append rss "<url>$iarray(url)</url>\n"
    append rss "<link>[ns_quotehtml $iarray(link)]</link>\n"
    if {[info exists iarray(width)]} {
        set element [ns_quotehtml $iarray(width)]
        append rss "<width>$element</width>\n"
    }
    if {[info exists iarray(height)]} {
        set element [ns_quotehtml $iarray(height)]
        append rss "<height>$element</height>\n"
    }
    if {[info exists iarray(description)]} {
        set element [ns_quotehtml $iarray(description)]
        append rss "<description>$element</description>\n"
    }

    append rss "</image>\n"

    # now top level items
    foreach item $items {
        array unset iarray
        array set iarray $item
        append rss {<item>} \n

        append rss "<title>[ns_quotehtml $iarray(title)]</title>" \n

        append rss "<link>[ns_quotehtml $iarray(link)]</link>" \n
        append rss {<guid isPermaLink="true">} [ns_quotehtml $iarray(link)] {</guid>} \n

        if { [info exists iarray(description)] && $iarray(description) ne ""} {
            append rss "<description>[ns_quotehtml $iarray(description)]</description>" \n
        }

        if { [info exists iarray(timestamp)] && $iarray(timestamp) ne "" } {
            append rss "<pubDate>[ns_quotehtml $iarray(timestamp)]</pubDate>" \n
        }

        if { [info exists iarray(category)] && $iarray(category) ne "" } {
            append rss "<category>[ns_quotehtml $iarray(category)]</category>" \n
        }

        if { [info exists iarray(enclosure_url)] && $iarray(enclosure_url) ne ""
             && [info exists iarray(enclosure_length)] && $iarray(enclosure_length) ne ""
             && [info exists iarray(enclosure_type)] && $iarray(enclosure_type) ne ""
         } {
        append rss "<enclosure url=\"[ns_quotehtml $iarray(enclosure_url)]\" length=\"$iarray(enclosure_length)\" type=\"$iarray(enclosure_type)\"/>"
    }
        append rss {</item>} \n
    }

    append rss {</channel>} \n
    append rss {</rss>} \n

   return $rss
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: