Tags:
create new tag
view all tags

Question

I'm trying to write a script/plugin combination that will create a static page in each web that includes a list of all topics in the web, along with the authors who revised each topic (see HowToGenerateListOfUserEdits for more on why). The script calls a function in the plugin, the plugin gets a list of all topics in a given web, and then calls the ContributorsPlugin to get author information.

I've got most of the script working, but am running into a problem; the Func::getRevisionInfo function doesn't return the proper revision information. ContributorsPlugin relies heavily on this function, and even after adding the function directly to my plugin function it still fails. For each topic it returns a user of "Guest", and lists all topics as having a max revision of 1. However, if I call Func::readTopicText I can get the full text of each topic, including meta data at the top.

Clearly the getRevisionInfo function would be much cleaner to use (and more future-proof) than trying to pull revision data out of the meta data. Any ideas why getRevisionInfo is not returning the correct values? Am I doing something that simply cannot (or should not) be done, or is there a way to get around this?

Here's a trimmed version of the code showing the direct call to the getRevisionInfo function (I apologize for novice mistakes in advance):

Script file:

I used the statistics script as a base, adding in:

use TWiki::Plugins::TestContributorsPage;
TWiki::Plugins::TestContributorsPage::writecontributorpage( $query, $pathInfo, $remoteUser, $topic );

Plugin file:

package TWiki::Plugins::TestContributorsPage;

use TWiki::Plugins::ContributorsPlugin; 
use TWiki::Store::RcsWrap # necessary to prevent errors

[default plugin information left untouched]

 sub writecontributorpage {
   my ( $query, $thePathInfo, $theRemoteUser, $topic )  = @_;
   TWiki::basicInitialize(); 
   my @weblist = TWiki::Func::getPublicWebList; 
   my $webtodonow = "Sandbox"; # Just testing on Sandbox for now; later will add loop to do all
   my @topiclist = TWiki::Func::getTopicList( $webtodonow ); 
   my $countTopic = 0;
   while ($countTopic <= $#topiclist) {
      my $topicText = &TWiki::Func::readTopicText( $webtodonow, $topiclist[$countTopic]);
      # $topicText does contain the full text of the topic, including META data
      my ($revDate, $revUser, $maxRevision, $Comment) = &TWiki::Func::getRevisionInfo( $webtodonow, $topiclist[$countTopic], "");
      # $maxRevision = 1 for all topics
      # $revUser = guest for all topics
      .....

Environment

TWiki version: TWikiRelease02Sep2004
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, ContributorsPlugin
Server OS: Debian Linux
Web server:  
Perl version:  
Client OS:  
Web Browser:  
Categories: Plugins

-- MarcPerkins - 21 Apr 2005

Answer

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2005-06-06 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.