Skip to content

Commit

Permalink
Item8786: port to foswiki
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.foswiki.org/trunk/RandomTopicPlugin@6961 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
WillNorris authored and WillNorris committed Mar 28, 2010
1 parent e13b3f1 commit 33bc1e0
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ __Note:__ You do not need to install anything on the browser to use this plugin.

---++ Plugin Info

| Plugin Author: | TWiki:Main/MichaelSparks |
| Plugin Author: | Foswiki:Main.MichaelSparks |
| Plugin Version: | %$VERSION% |
| Change History: <!-- Most recent first --> ||
| 28 Mar 2010 | 1.3.0 port to Foswiki -- Foswiki:Main.WillNorris |
| 27 Dec 2005 | 1.201 TWiki:Main.WillNorris - changed =INCLUDE= and =EXCLUDE= preferences (to =INCLUDETOPICS= and =EXCLUDETOPICS=) for Dakar compatability |
| 15 Nov 2004 | 1.200 Crawford Currie - removed non-functional persist option, added exclude and include parameters, ported to Cairo & BuildContrib build system, add to CVS. |
| 10 Jul 2003 | 1.010 Initial version |
| Dependencies: | %$DEPENDENCIES% |
| Perl Version: | 5.005 |
| Plugin Home: | http://foswiki.org/Extensions/%TOPIC% |
| Feedback: | http://foswiki.org/Extensions/%TOPIC%Dev |
| Support: | http://foswiki.org/Support/%TOPIC% |

__Related Topics:__ %SYSTEMWEB%.DefaultPreferences, %USERSWEB%.SitePreferences, [[%SYSTEMWEB%.Plugins][Plugins]]

-- TWiki:Main/MichaelSparks - 10 Jul 2003 <br />
-- TWiki:Main/CrawfordCurrie - 15 Nov 2004 <br />
-- TWiki:Main/WillNorris - 27 Dec 2005
-- TWiki:Main/WillNorris - 27 Dec 2005, 28 Mar 2010
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,32 @@
# GNU General Public License for more details, published at
# http://www.gnu.org/copyleft/gpl.html

package TWiki::Plugins::RandomTopicPlugin;
package Foswiki::Plugins::RandomTopicPlugin;

use strict;

use vars qw(
$VERSION $RELEASE @topicList $defaultIncludes $defaultExcludes
);

# This should always be $Rev$ so that TWiki can determine the checked-in
# This should always be $Rev$ so that Foswiki can determine the checked-in
# status of the plugin. It is used by the build automation tools, so
# you should leave it alone.
$VERSION = '$Rev$';

# This is a free-form string you can use to "name" your own plugin version.
# It is *not* used by the build automation tools, but is reported as part
# of the version number in PLUGINDESCRIPTIONS.
$RELEASE = 'Dakar';
$RELEASE = '20100328';


sub initPlugin {
my ( $topic, $web, $user, $installWeb ) = @_;

$defaultIncludes = TWiki::Func::getPreferencesValue( "RANDOMTOPICPLUGIN_INCLUDE" );
$defaultExcludes = TWiki::Func::getPreferencesValue( "RANDOMTOPICPLUGIN_EXCLUDE" );
$defaultIncludes = Foswiki::Func::getPreferencesValue( "RANDOMTOPICPLUGIN_INCLUDE" );
$defaultExcludes = Foswiki::Func::getPreferencesValue( "RANDOMTOPICPLUGIN_EXCLUDE" );

@topicList = TWiki::Func::getTopicList( $web );
@topicList = Foswiki::Func::getTopicList( $web );

return 1;
}
Expand All @@ -52,17 +52,17 @@ sub handleRandomPage {
my $excludes;

$format =
TWiki::Func::extractNameValuePair( $attr, "format" ) ||
Foswiki::Func::extractNameValuePair( $attr, "format" ) ||
"\$t* \$topic\$n";
$topics =
TWiki::Func::extractNameValuePair( $attr, "topics" ) || 1;
Foswiki::Func::extractNameValuePair( $attr, "topics" ) || 1;

$includes =
TWiki::Func::extractNameValuePair( $attr, "include" ) ||
Foswiki::Func::extractNameValuePair( $attr, "include" ) ||
$defaultIncludes || "^.+\$";

$excludes =
TWiki::Func::extractNameValuePair( $attr, "exclude" ) ||
Foswiki::Func::extractNameValuePair( $attr, "exclude" ) ||
$defaultExcludes || "^\$";

my @pickFrom = grep { /$includes/ && !/$excludes/ } @topicList;
Expand Down
2 changes: 2 additions & 0 deletions lib/Foswiki/Plugins/RandomTopicPlugin/MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
./lib/Foswiki/Plugins/RandomTopicPlugin.pm Plugin code
./data/Foswiki/RandomTopicPlugin.txt Plugin topic
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ BEGIN
}
}

use TWiki::Contrib::Build;
use Foswiki::Contrib::Build;

# Create the build object
$build = new TWiki::Contrib::Build( "RandomTopicPlugin" );
$build = new Foswiki::Contrib::Build( "RandomTopicPlugin" );

# Build the target on the command line, or the default target
$build->build($build->{target});
Expand Down
2 changes: 0 additions & 2 deletions lib/TWiki/Plugins/RandomTopicPlugin/MANIFEST

This file was deleted.

0 comments on commit 33bc1e0

Please sign in to comment.