Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-13006

Allow for filtering pages and Spaces out of Web RSS

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Unresolved
    • Major
    • None
    • 1.0 B4
    • Event Stream
    • None
    • patch
    • Unknown
    • Awaiting Contributor feedback

    Description

      Here's a full replacement for the XWiki.WebRssCode to allow for filtering out pages.
      Please keep the indentation as it's easier to read than the non-indented code that was there....

      It's probably be good to make $hiddenPages and $hiddenSpaces centralized so that other things like the navigation panel can all be changed from one place.

      XWiki.WebRssCode
      {pre}
      #set ($hiddenSpaces = ["XWiki", "Admin", "Panels"])
      #set ($hiddenPages = ["Main.WebRss", "Main.WebSearch", "Main.BlogRss","Main.Test", "Blog.Macros", "Main.TagsRss", "Main.WikiLaunch", "Main.RegisterNewUserAction", "Main.SpaceIndex", "Blog.Category", "Main.RecentMembers", "Main.Tags", "Main.Dashboard", "Main.PersonalRSS", "Blog.Categories"])
      $context.setCacheDuration(1800)
      <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://purl.org/rss/1.0/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wiki="http://purl.org/rss/1.0/modules/wiki/" xmlns:html="http://www.w3.org/1999/xhtml">
      <channel rdf:about="$baseurl">
      <title>
      #if($title)
        $title
      #else
        $request.serverName
      #end
      </title>
      <link>$baseurl</link>
      <description>
      #if($description)
        $description
      #else
        $request.serverName
      #end
      </description>
      #set($logourl = $xwiki.getSkinFile($xwiki.getSkinPreference('logo', 'logo.png')))
      #set($port = "")
      #if(($request.scheme == "http") && ($request.serverPort != 80))
        #set($port = ":${request.serverPort}")
      #elseif(($request.scheme == "https") && ($request.serverPort != 443))
        #set($port = ":${request.serverPort}")
      #end
      #set($logourl = "${request.scheme}://${request.serverName}${port}$logourl")
      <image rdf:resource="$logourl"/>
      <dc:language>$doc.defaultLanguage</dc:language>
      <dc:rights>$xwiki.getXMLEncoded($xwiki.webCopyright.replaceAll('<', '<html:').replaceAll('<html:/', '</html:'))</dc:rights>
      <dc:publisher>$xwiki.getUserName($doc.author, false)</dc:publisher>
      <dc:creator>$xwiki.getUserName($doc.author, false)</dc:creator>
      <items>
      <rdf:Seq>
      #if(!$list)
        #if(!$sql)
          #set($sql = "where 1=1 order by doc.date desc")
        #end
        #set($list = $xwiki.searchDocuments($sql, 50, 0))
      #end
      #set($list = $xwiki.wrapDocs($list))
      #foreach ($currentdoc in $list)
        #if(!$hiddenPages.contains($currentdoc.fullName) && !$hiddenSpaces.contains($currentdoc.space))
          #if($xwiki.hasAccessLevel("view", "${context.database}:${currentdoc.fullName}"))
            <rdf:li rdf:resource="$currentdoc.getExternalURL('view', "language=${currentdoc.realLanguage}")" />
          #end
        #end
      #end
      </rdf:Seq>
      </items>
      </channel>
      <image rdf:about="$logourl">
        <title>XWiki Logo</title>
        <link>${baseurl}</link>
        <url>$logourl</url>
      </image>
      #foreach ($currentdoc in $list)
        #if(!$hiddenPages.contains($currentdoc.fullName) && !$hiddenSpaces.contains($currentdoc.space))
          #if($xwiki.hasAccessLevel("view", "${context.database}:${currentdoc.fullName}"))
            #set ($url = $currentdoc.getExternalURL('view', "language=${currentdoc.realLanguage}"))
            #if ($currentdoc.content.length() < 255)
              #set ($length = $currentdoc.content.length())
            #else
              #set ($length = 255)
            #end
            <item rdf:about="$url">
              <title>$xwiki.getXMLEncoded(${currentdoc.displayTitle})</title>
              <link>$url</link>
              <description>Version $currentdoc.version edited by $xwiki.getXMLEncoded($xwiki.getUserName($currentdoc.author,     false)) on $currentdoc.date</description>
              #set($tz = $xwiki.formatDate($currentdoc.date, "Z"))
              #set($tz = "${tz.substring(0, 3)}:${tz.substring(3)}")
              <dc:date>$xwiki.formatDate($currentdoc.date, "yyyy-MM-dd")T$xwiki.formatDate($currentdoc.date, "hh:mm:ss")$tz</dc:date>
              <dc:creator>$xwiki.getXMLEncoded($xwiki.getUserName($currentdoc.creator, false))</dc:creator>
              <dc:contributor>
                <rdf:Description link="">
                  <rdf:value>$xwiki.getXMLEncoded($xwiki.getUserName($currentdoc.author, false))</rdf:value>
                </rdf:Description>
              </dc:contributor>
            </item>
          #end
        #end
      #end
      </rdf:RDF>
      {/pre}
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              psa Paul Armstrong
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: