%3 ::xowiki::RSS ::xowiki::RSS css_link extra_where_clause head item limit render tail ::xowiki::XMLSyndication ::xowiki::XMLSyndication init tag ::xowiki::RSS->::xowiki::XMLSyndication ::xowiki::Timeline ::xowiki::Timeline render ::xowiki::Timeline->::xowiki::XMLSyndication ::xotcl::Object ::xotcl::Object ::xowiki::XMLSyndication->::xotcl::Object ::xowiki::Podcast ::xowiki::Podcast head item render ::xowiki::Podcast->::xowiki::RSS

Class ::xowiki::RSS

::xowiki::RSS[i] create ... \
           [ -css (default "") ] \
           [ -days:integer,0..1 (default "") ] \
           [ -description (default "") ] \
           [ -entries_of (default "") ] \
           [ -language (default "en-us") ] \
           [ -maxentries:integer,0..1 maxentries:integer,0..1 ] \
           [ -name_filter (default "") ] \
           [ -parent_ids:integer,0..n (default "") ] \
           [ -siteurl (default "[ad_url]") ] \
           [ -title (default "") ]

Report content of xowiki folder in RSS 2.0 format. The reporting order is descending by date. The title of the feed is taken from the title, the description is taken from the description field of the folder object.
Documented Parameters:
maxentries
maximum number of entries retrieved
days
report entries changed in specified last days
name_filter
include only pages matching the provided regular expression (postgres)
Defined in packages/xowiki/tcl/syndicate-procs.tcl

Class Relations

  • class: ::xotcl::Class[i]
  • superclass: ::xowiki::XMLSyndication[i]
  • subclass: ::xowiki::Podcast[i]
::xotcl::Class create ::xowiki::RSS \
     -superclass ::xowiki::XMLSyndication

Methods (to be applied on instances)

  • css (setter)

  • css_link (scripted)

    if {${:css} ne ""} {
      #
      # Firefox 2.0 appears to overwrite the style info, so one has to use such ugly tricks:
      #    http://www.blingblog.info/2006/10/30/firefox-big-browser/
      # when we want to use custom style sheets
      #
      set user_agent [string tolower [ns_set iget [ns_conn headers] User-Agent]]
      set filler [expr {[string first firefox $user_agent] >- 1 ?
                        "<!-- [string repeat deadbef 100] -->" : ""
                      }]
      set css_link [expr {[string match "/*" ${:css}] ? ${:css} : "/resources/xowiki/${:css}"}]
      return "\n<?xml-stylesheet type='text/css' href='[ns_quotehtml $css_link]' ?>\n$filler"
    }
    return ""
  • days (setter)

  • description (setter)

  • entries_of (setter)

  • extra_where_clause (scripted)

    set extra_where_clause ""
    if {${:name_filter} ne ""} {
      append extra_where_clause " and ci.name ~ E'${:name_filter}' "
    }
    if {${:days} ne ""} {
      append extra_where_clause "and "  [::xo::dc since_interval_condition p.publish_date "${:days} days"]
    }
    if {${:entries_of} ne ""} {
      if {[regexp {^[0-9 ]+$} ${:entries_of}]} {
        # form item_ids were provided as a filter
        set form_items ${:entries_of}
      } else {
        set form_items [::${:package_id} instantiate_forms -forms ${:entries_of}]
      }
    
      if {[llength $form_items] == 0} {
        # In case, we have no form_items to select on, let the query fail
        # without causing a SQL error.
        set form_items [list -1]
      }
      append extra_where_clause [subst {
        and p.page_template in ([ns_dbquotelist $form_items]) and p.page_instance_id = p.revision_id
      }] " "
    
      set :base_table xowiki_form_pagex
    }
    return $extra_where_clause
  • head (scripted)

    return "<?xml version='1.0' encoding='utf-8'?>[:css_link]
    <rss version='2.0'
      xmlns:ent='http://www.purl.org/NET/ENT/1.0/'
      xmlns:content='http://purl.org/rss/1.0/modules/content/'
      xmlns:dc='http://purl.org/dc/elements/1.1/'>
    <channel>
      [:tag title ${:title}]
      [:tag link ${:link}]
      [:tag description ${:description}]
      [:tag language ${:language}]
      [:tag generator xowiki]"
  • item (scripted)

    append result <item> \n [:tag dc:creator $creator ] \n [:tag title $title ] \n [:tag link $link ] \n [:tag -atts {isPermaLink false} guid $guid] \n [:tag description $description ] \n [:tag pubDate $pubdate ] \n </item> \n
  • language (setter)

  • limit (scripted)

    if {[info exists :maxentries] && ${:maxentries} ne ""} {
      return ${:maxentries}
    }
    return ""
  • maxentries (setter)

  • name_filter (setter)

  • parent_ids (setter)

  • render (scripted)

    
    if {[:parent_ids] ne ""} {
      set folder_ids [:parent_ids]
    } else {
      set folder_ids [::${:package_id} folder_id]
    }
    
    set :link ${:siteurl}[lindex [site_node::get_url_from_object_id -object_id ${:package_id}] 0]
    
    set :base_table xowiki_pagex
    set extra_where_clause [:extra_where_clause]
    
    if {${:base_table} ne "xowiki_pagex"} {
      # we assume, we retrieve the entries for a form
      set extra_from ""
    } else {
      # return always instance_attributes
      set extra_from "left join  xowiki_page_instance on (p.revision_id = page_instance_id)"
    }
    
    if {[llength $folder_ids] > 1} {
      set folder_select "ci.parent_id in ([ns_dbquotelist $folder_ids])"
    } else {
      set folder_select "ci.parent_id = :folder_ids"
    }
    
    set sql [::xo::dc select  -vars "s.body, s.rss_xml_frag, p.name, p.creator, p.title, p.page_id, instance_attributes,  p.object_type as content_type, p.publish_date, p.description"  -from "syndication s, cr_items ci, ${:base_table} p $extra_from"  -where "$folder_select and ci.live_revision = s.object_id  and ci.publish_status <> 'production'  and s.object_id = p.page_id  $extra_where_clause" -orderby "p.publish_date desc"  -limit [:limit]]
    
    set content [:head]
    ::xo::dc foreach get_pages $sql {
      if {[string match "::*" $name]} continue
      if {$content_type eq "::xowiki::PageTemplate" || $content_type eq "::xowiki::Form"} continue
      append content $rss_xml_frag
      set :title $title
      set :description ${:description}
    }
    append content [:tail]
    return $content
  • siteurl (setter)

  • tail (scripted)

    return  "\n</channel>\n</rss>\n"
  • title (setter)

Variables

::xowiki::RSS set __default_metaclass ::xotcl::Class
::xowiki::RSS set __default_superclass ::xotcl::Object