--
MichaelSparks - 10 Jul 2003
Thanks for creating this
MichaelSparks!
It's easy to inadvertantly get stuck repeatedly following the same train of related topics and this should be a useful tool for periodically inserting new ideas.
--
MattWilkie - 29 Jul 2003
Anyone interested in maintaining this Plugin here on TWiki.org?
--
PeterThoeny - 09 Dec 2003
Anyone intersted in rewriting this Plugin? This Plugin sits idle for a long time, and the "new" Plugin home on owiki is dead. If there is no new maintainer I will mark this Plugin as an
ObsoletePluginPackage.
--
PeterThoeny - 01 Nov 2004
no need to rewrite this plugin; it continues to work with
CairoRelease.
--
WillNorris - 01 Nov 2004
While I agree with Matt, I fail to see wht this needs a plugin. Surely it can be done with a
%SEARCH and a couple of the functions from
SpreadSheetPlugin --
$RAND,
$LISTITEM. That way you can use
%SEARCH's excludetopic mechanism to make sure you don't get the
WEB* and the
*EditTemplate topics.
--
AntonAylward - 13 Nov 2004
Good point Anton. This can be packaged as a
RandomPackageOddOn, that has just one topic that does the magic between STARTINCLUDE and STOPINCLUDE.
--
PeterThoeny - 13 Nov 2004
I needed it, so I saved it. The
%SEARCH approach is way too ugly.
--
CrawfordCurrie - 15 Nov 2004
Crawford, while you are at it, could you also measure and document the
PluginBenchmarks?
--
PeterThoeny - 16 Nov 2004
checked in to
CVS
--
WillNorris - 14 Feb 2005
I've created a
DashBoard topic in the TWiki web that will be included in all other webs (allowing for a single point of maintenance). This works in much the same way that the
WebChanges topic for each web is simply an
%INCLUDE{"%TWIKIWEB%.WebChanges"}%
I'd like to place the list of random topics in the
DashBoard, but at the moment the
RandomTopicPlugin is missing a
$web parameter. Could this be added, to allow the following:
%RANDOMTOPIC{topics="5" format="| $web.$topic |$n"}% ?
--
KeithHelfrich - 17 Dec 2006
You can do that without this plugin: Feed the comma-space separated topic list into the
SpreadSheetPlugin's
$LISTITEM(), with index as a
$RAND() on
$LISTSIZE(). Special care needs to be taken on index start 0 vs 1. Untested example:
$SET(list, %TOPICLIST{ separator=", " }%)$LISTITEM($INT(1 + $RAND($INT($LISTSIZE($GET(list)) - 1))), $GET(list))
Hmm, a new
$LISTRAND() function would be handly. That way one could simply write:
$LISTRAND(%TOPICLIST{ separator=", " }%)
--
PeterThoeny - 17 Dec 2006
The latest
SpreadSheetPlugin has now a
$LISTRAND() function that returns a random list element, a
$LISTSHUFFLE() function that shuffles a list in rundom order, and a
$LISTTRUNCATE() function that truncates a list to a specific size. You can write
$LISTTRUNCATE(4, $LISTSHUFFLE(%TOPICLIST{ separator=", " }%)) get a list of 4 random topics in a web.
--
PeterThoeny - 19 Dec 2006
Whiz bang !
You'll likely have a more elegant way of accomplishing this. But using these new functions, my replacement for the
RandomTopicPlugin is as follows :
RandomTopicPlugin Command:
%RANDOMTOPIC{topics="5" format="| $topic |$n"}%
SpreadSheetPlugin Command:
| %CALC{"$LISTTRUNCATE(1, $LISTSHUFFLE(%TOPICLIST{ web="%INCLUDINGWEB%" separator=", " }%))"}% |
| %CALC{"$LISTTRUNCATE(1, $LISTSHUFFLE(%TOPICLIST{ web="%INCLUDINGWEB%" separator=", " }%))"}% |
| %CALC{"$LISTTRUNCATE(1, $LISTSHUFFLE(%TOPICLIST{ web="%INCLUDINGWEB%" separator=", " }%))"}% |
| %CALC{"$LISTTRUNCATE(1, $LISTSHUFFLE(%TOPICLIST{ web="%INCLUDINGWEB%" separator=", " }%))"}% |
| %CALC{"$LISTTRUNCATE(1, $LISTSHUFFLE(%TOPICLIST{ web="%INCLUDINGWEB%" separator=", " }%))"}% |
How would one boil those five lines down into a single command that includes the table delimiting pipes ?
Also, something funky is happening with my use of
%INCLUDINGWEB% from inside of
%TOPICLIST% because for some reason it expanses out to the
INCLUDED web instead of the
INCLUDING web. So we're not quite there yet in terms of being able to include the single dashboard located in the TWiki web from all other webs (as is done with
WebChanges).
--
KeithHelfrich - 20 Dec 2006
Write this:
%CALC{$LISTJOIN($n, $LISTMAP(| [[$item]] |, $LISTTRUNCATE(5, $LISTSHUFFLE(%TOPICLIST{ separator=", " }%))))}%
You probably need to use
%BASEWEB% (if there are multiple nested INCLUDEs.)
--
PeterThoeny - 20 Dec 2006
Thanks Peter, your SpreadSheetPlugin post from 20 Dec, 2006 has deprecated the RandomTopicPlugin
I'm still battling with the include problem. It seems to be a bug in the behaviour of
%TOPICLIST% which does not respect either
%INCLUDINGWEB% or
%BASEWEB% At least one, but probably both of these items below should link to a list of random topics from this, the Plugins web. Do you agree ? Instead of linking to the web you're in, they prompt you to create a topic in the web where the call is included from (sandbox).
--
KeithHelfrich - 20 Dec 2006
I fixed it by replacing square brackets links with html links. No time to investigate, possibly a bug in fixing cross-web links.
--
PeterThoeny - 21 Dec 2006
Well done! I'm glad that you had an intuition about where and how to work around the bug. Since this topic is now likely to remain quiet for a while, summary of all conversation since 17 Dec, 2006 is that the
RandomTopicPlugin is no longer necessary. This is because the same result can be achieved by clever use of the most recent
SpreadSheetPlugin.
The code below is a nice replacement for the
RandomTopicPlugin because it functions even when "included" from across different webs.
* Set RANDOMTOPIC = %CALC{$LISTJOIN($n, $LISTMAP(| <a href='%SCRIPTURL{view}%/%BASEWEB%/$item'>$item</a> |, $LISTTRUNCATE(5, $LISTSHUFFLE(%TOPICLIST{ "<nop>$name" web="%BASEWEB%" separator=", " }%))))}%
which results in:
A word of caution: none of this works
CairoRelease
--
KeithHelfrich - 21 Dec 2006
Hmm, this should work in Sep-2004 release if you install the latest
SpreadSheetPlugin.
--
PeterThoeny - 21 Dec 2006
Unfortunately no. Taking the
Set out of the equation, what comes as a result of just the calc statement is the following :
$LISTJOIN($n, $LISTMAP(| [[%SCRIPTURL%/view/Plugins/%SCRIPTURL{view/Plugins/$item][$item]] |, $LISTTRUNCATE(5, $LISTSHUFFLE(topicListHere, commaSeparated, topicList))))}%
note the funny destination of the
$item link (which was manipulated here in Dakar to represent what I see in Cairo)
--
KeithHelfrich - 22 Dec 2006
Even still, with the new
SpreadSheetPlugin I
can effectively disable the
RandomTopicPlugin by using double-brackets around
$item as you pointed out on 20 Dec 2006. The only limitation on Cairo is that it's not possible to
%INCLUDE% this randomess from one web to the next, a little problemito that
Encourages Upgrading.
--
KeithHelfrich - 22 Dec 2006
Ah, Ciaro does not understand
%SCRIPTURL{view}%. Replace that with
%SCRIPTURL%view%SCRIPTSUFFIX%.
--
PeterThoeny - 23 Dec 2006
And there we have it !! The latest
SpreadSheetPlugin can replace the
RandomTopicPlugin as follows (also works correctly when "included" across different webs) :
On Cairo
* Set RANDOMTOPICS = %CALC{$LISTJOIN($n, $LISTMAP(| <a href='%SCRIPTURL%/view%SCRIPTSUFFIX%/%BASEWEB%/$item'>$item</a> |, $LISTTRUNCATE(5, $LISTSHUFFLE(%TOPICLIST{ "<nop>$name" web="%BASEWEB%" separator=", " }%))))}%
On Dakar
* Set RANDOMTOPICS = %CALC{$LISTJOIN($n, $LISTMAP(| <a href='%SCRIPTURL{view}%/%BASEWEB%/$item'>$item</a> |, $LISTTRUNCATE(5, $LISTSHUFFLE(%TOPICLIST{ "<nop>$name" web="%BASEWEB%" separator=", " }%))))}%
I'm not really convinced that such complex and lengthy code is a "convenient" replacement for a short plugin...
--
Vicki Brown - 2013-05-23
How exactly would I use the exclude="" feature to exclude multiple topics?
I have placed exclude="^Web" on the page I am using this. And it cuts out the topics that start with Web. However, I'd also like to cut out those that begin with TWiki, and those that end in Template. As far as I can tell, I need to use ^TWiki and Template$ for it. But not how the entire RE would look.
--
Matt Smith - 2013-11-13
Matt, I have not used this plugin and I would use the CALC Vicki recommended. You should be able to use a regex like this, but not sure if the plugin supports this:
(^Web|^TWiki|Template$)
--
Peter Thoeny - 2013-11-14