rss_gen_100 (public)

 rss_gen_100 [ -channel_title channel_title ] \
    [ -channel_link channel_link ] \
    [ -channel_description channel_description ] [ -image image ] \
    [ -items items ] [ -channel_copyright channel_copyright ] \
    [ -channel_managingEditor channel_managingEditor ] \
    [ -channel_webMaster channel_webMaster ] \
    [ -channel_pubDate channel_pubDate ]

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

generate an rss 1.0 xml feed very basic rss 1.0, with no modules implemented....

Switches:
-channel_title (optional)
-channel_link (optional)
-channel_description (optional)
-image (optional)
-items (optional)
-channel_copyright (optional)
-channel_managingEditor (optional)
-channel_webMaster (optional)
-channel_pubDate (optional)

Partial Call Graph (max 5 caller/called nodes):
%3 rss_gen rss_gen (public) rss_gen_100 rss_gen_100 rss_gen->rss_gen_100 acs_root_dir acs_root_dir (public) rss_gen_100->acs_root_dir ad_url ad_url (public) rss_gen_100->ad_url rss_package_url rss_package_url (public) rss_gen_100->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"
    }

    set channel_date [clock format [clock seconds] -format "%Y-%m-%dT%H:%M"]

    append rss "<rdf:RDF "
    append rss "xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\""
    append rss " xmlns:dc=\"http://purl.org/dc/elements/1.1/\""
    append rss " xmlns=\"http://purl.org/rss/1.0/\""
    append rss ">"
    append rss "<channel rdf:about=\"$channel_link\">\n"

    append rss "<title>"
    append rss [ns_quotehtml $channel_title]
    append rss "</title>\n"

    append rss "<link>"
    append rss $channel_link
    append rss "</link>\n"

    append rss "<description>"
    append rss [ns_quotehtml $channel_description]
    append rss "</description>\n"

    if {$channel_pubDate eq ""} {
        append rss "<dc:date>$channel_date</dc:date>\n"
    } else {
        append rss "<dc:date>[ns_quotehtml $channel_pubDate]</dc:date>\n"
    }

    if {$channel_copyright ne ""} {
        append rss "<dc:rights>"
        append rss [ns_quotehtml $channel_copyright]
        append rss "</dc:rights>\n"
    }

    if {$channel_managingEditor ne ""} {
        append rss "<dc:creator>"
        append rss [ns_quotehtml $channel_managingEditor]
        append rss "</dc:creator>\n"
    }

    if {$channel_webMaster ne ""} {
        append rss "<dc:publisher>"
        append rss [ns_quotehtml $channel_webMaster]
        append rss "</dc:publisher>\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]]
    }

    array set imarray $image

    # channel image handling
    append rss "<image rdf:resource=\"[ns_quotehtml $imarray(url)]\" />\n"

    append rss "<items>\n"
    append rss "<rdf:Seq>\n"

    # channel item handling
    foreach item $items {
        array unset iarray
        array set iarray $item
        append rss "<rdf:li rdf:resource=\"[ns_quotehtml $iarray(link)]\" />\n"
    }

    append rss "</rdf:Seq>\n"
    append rss "</items>\n"
    append rss "</channel>\n"

    # now top level image
    append rss "<image rdf:about=\"$imarray(url)\">\n"
    append rss "<title>[ns_quotehtml $imarray(title)]</title>\n"
    append rss "<url>$imarray(url)</url>\n"
    append rss "<link>[ns_quotehtml $imarray(link)]</link>\n"
    if {[info exists iarray(width)]} {
        set element [ns_quotehtml $iarray(width)]
        append rss "<width>$element</width>\n"
    }
    append rss "</image>\n"

    # now top level items
    foreach item $items {
        array unset iarray
        array set iarray $item
        append rss "<item rdf:about=\"[ns_quotehtml $iarray(link)]\">\n"
        set element [ns_quotehtml $iarray(title)]
        append rss "<title>$element</title>\n"
        append rss "<link>[ns_quotehtml $iarray(link)]</link>\n"
        if {[info exists iarray(description)]} {
            set element [ns_quotehtml $iarray(description)]
            append rss "<description>$element</description>\n"
        }
        if {[info exists iarray(timestamp)]} {
            set element [ns_quotehtml $iarray(timestamp)]
            append rss "<dc:date>$element</dc:date>\n"
        }
        if {[info exists iarray(author)]} {
            set element [ns_quotehtml $iarray(author)]
            append rss "<dc:creator>$element</dc:creator>\n"
        }
        if {[info exists iarray(category)]} {
            set element [ns_quotehtml $iarray(category)]
            append rss "<dc:subject>$element</dc:subject>\n"
        }

        append rss "</item>\n"
    }

    append rss "</rdf:RDF>"
    return $rss
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: