This question about Using an extension: Answered

Search/Query to iteratively return previous topic revisions (for RSS)

Hi all,

Is it possible to interatively run a query or search to return all versions of a topic in a list? I'm trying to make an RSS feed for 'changes to this topic'. I'll need a "format" argument to put the RSS statements in amongst the results.

-- HughBlair - 29 Aug 2011

I've been informed in IRC land that HistoryPlugin might be the answer to all my woes. In any case I'll try it out and post my results here.

-- HughBlair - 29 Aug 2011

OK, so it's working ok now. The only thing I'm have trouble with is returning the time results in the local time zone (i.e. passing the date format for the HistoryPlugin using LocalTimePlugin). The two plugins appear share variable namespaces so I'm not sure how to make that fly. One way around this is to use an RSS reader that knows the local time and can convert from UTC. In general this is the best approach since websites aren't expected to magically know what timezone you're accessing from. Internet Explorer 8 RSS reader can convert from UTC to local time and I've had mixed results from other RSS clients.

I copied the stuff from RssBase and replace the SEARCH call with a HISTORY call. The topic being checked is from the URL parameters (the parameter name is trackedpage) so you can put it in a skin template and subsitute the current topicname. Then you can have a link which says "subscribe to updates to this topic".

It's a bit rough and ready, but it seems to work so far.

Here is the fragment for the TopicRss topic. I have munted the Set statements below so they don't apply to this current topic. You can replace the two BLAHs below with a * in your own site.
<channel rdf:about="%SCRIPTURL{"view"}%/%WEB%">
<title> %NOP%%URLPARAM{"trackedpage"}% Updates </title>
<link>%SCRIPTURL{"view"}%/%WEB%</link> 
<description> 
   <literal>%MAKETEXT{"The [_1] web of [_2]." args="%WEB%,%WIKITOOLNAME%"}% %WEBSUMMARY% </literal> 
</description>
%INCLUDE{"TopicRssBase"}%
<!--   
   BLAH Set SKIN = rss   
   BLAH Set COVER = rss
-->

Here is the fragment for the TopicRssBase topic

%STARTINCLUDE%
<image rdf:resource="%WIKILOGOIMG%" />
<dc:language>en-us</dc:language>
<dc:rights>%WEBRSSCOPYRIGHT%</dc:rights>
<dc:publisher>%WIKIWEBMASTERNAME% [%WIKIWEBMASTER%]</dc:publisher>
<dc:creator>The contributing authors of %WIKITOOLNAME%</dc:creator>
<dc:source>%WIKITOOLNAME%</dc:source>
<items>
  <rdf:Seq>

%~~    HISTORY{
~~~       topic="%MAINWEB%.%URLPARAM{"trackedpage"}%" 
~~~       reverse="on" 
~~~       nrev="5"
~~~       format=" <rdf:li rdf:resource=\"%SCRIPTURL{"view"}%/$web/$topic\" /> "
~~~    }%

</rdf:Seq>
  </items>
</channel>
<image rdf:about="%WIKILOGOIMG%">
  <title>%WIKILOGOALT%.%BASEWEB%</title>
  <link>%SCRIPTURL{"view"}%/%BASEWEB%</link>
  <url>%WIKILOGOIMG%</url>
</image>

%~~    HISTORY{
~~~       topic="%MAINWEB%.%URLPARAM{"trackedpage"}%" 
~~~       reverse="on" 
~~~       nrev="5"
~~~       format=" 
~~~       <item rdf:about=\"$topic\">
~~~         <title>$topic version $rev</title>$n
~~~         <link>$topic</link>$n
~~~         <description> current revision is $rev (last changed by $wikiusername) </description>$n
~~~         <dc:date> $date $time $tz </dc:date> $n
~~~         <dc:contributor>$n
~~~           <rdf:Description link=\"$topic\">$n
~~~             <rdf:value>$wikiusername</rdf:value>$n
~~~           </rdf:Description>$n
~~~         </dc:contributor>
~~~         </item>"
~~~       "
~~~    }%
%STOPINCLUDE%

-- HughBlair - 29 Aug 2011

Hello Hugh, it's really cool to see you sharing your solution!

I've added some syntax highlighting to the code, but please note, GluePlugin ~~~ syntax is not necessary for the TML you've written here.

-- PaulHarvey - 04 Sep 2011

See MichaelDaum's comment regarding GluePlugin at Tasks.Item11103

-- PaulHarvey - 05 Sep 2011

QuestionForm edit

Subject Using an extension
Extension
Version Foswiki 1.1.3
Status Answered
Related Topics
Topic revision: r5 - 05 Sep 2011, PaulHarvey
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy