warning This is an experimental version of FortunePlugin.

support How to configure your Foswiki to install from this repository

In lib/LocalSite.cfg, add this web's URL to {ExtensionsRepositories}:
Foswiki.org=(http://foswiki.org/Extensions/,http://foswiki.org/pub/Extensions/);Local=(http://www.foswiki.org/Extensions/Testing/,http://www.foswiki.org/pub/Extensions/Testing/)

Read more about configuring Extension repositories

Documentation

Fortune Plugin

This plugin uses the Unix/Linux fortune command to insert a random fortune into a topic. On windows environments, or if fortune is not installed, it uses the CPAN Fortune implementation.

Usage

The following macros are implemented:
  • %FORTUNE{"database" LENGTH="S"}% Insert a random fortune into the topic from the named "database".
    • LENGTH parameter (optional) can be set to S or SHORT to select short fortunes, and L or LONG for long fortunes. This option only works if the unix fortune-mod program is used.
  • %FORTUNE_LIST{"database"}% List the contents of the named database
  • %FORTUNE_DB_LIST{}% List the available database files in the fortune directory.
  • Set TINYMCEPLUGIN_DISABLE = 1

Examples

Example: %FORTUNE{"foswiki" LENGTH="S"}%

If installed, a random fortune from the foswiki database will appear here:
%FORTUNE{"foswiki" LENGTH="S"}%

Example: %FORTUNE_LIST{"foswiki"}%

If installed, the list of fortunes in the foswiki database

%FORTUNE_LIST{"foswiki"}%

Example: %FORTUNE_DB_LIST{}%

If installed, the list of fortune databases is shown. Note that two different format results are possible. The Unix fortune-mod program reports the percentage of fortunes supplied by each file. The Perl Fortune module shows a simple fortune count.

%FORTUNE_DB_LIST{}%

Plugin Preferences

There are no perferences that can be set for this plugin. All configuration parameters are set in LocalSite.cfg using the bin/configure interface.

Installation

  • Install FortunePlugin using the bin/configure interface
  • If fortune_mod is installed on a *nix system
    • Set the {Plugins}{FortunePlugin}{FortuneDBPath} to point to the directory containing the fortune files. Typically this is in /usr/share/fortune/. Trailing slash must be included.
    • Set the {Plugins}{FortunePlugin}{FortuneProgram} to point to the fortune program. Typically /usr/bin/fortune.
  • On a windows system, or if fortune is not installed:
    • Install the Fortune module using CPAN
    • leave {Plugins}{FortunePlugin}{FortuneProgram} unset.
    • leave {Plugins}{FortunePlugin}{FortuneDBPath} unset. The plugin will use fortune files attached to this topic. Or if other fortune files are available, point to the directory containing the fortune files. Typically this is in /usr/share/fortune/. Trailing slash must be included.

Creating new fortune files

Fortune files must be created by using the strfile command that is installed on Linux with the fortune-mod package. On Windows environments this can be installed using cygwin. This is beyond the scope of this document.

Create the fortune text file

Using your favorite editor, build a simple text file consisting of each quote, followed by a single line containing a percent-sign ( % ) For example, file foswiki contains:

Today there are a variety of wikis, one of them being the wiki you are presently looking at. 
%
Foswiki can be extended with hundreds of plugins 
% 

Build the fortune database

"Compile" the file into a .dat file using strfile

> ~ $ strfile foswiki 
"foswiki.dat" created 
There were 2 strings 
Longest string: 93 bytes 
Shortest string: 49 bytes 

The original foswiki file and the related foswiki.dat file can be placed in the fortune database directory. Or attach it to this topic or to another topic identified in the Foswiki configuration.

For easiest system maintenance and upgrades, it is not recommended to modify or attach files to this topic!

Plugin Info

Author: Foswiki:Main.GeorgeClark
Copyright: © 2008, Foswiki Contributors
License: GPL (GNU General Public License)
Version: 10414 (2010-12-27)
Home: http://foswiki.org/Extensions/FortunePluginDev
Feedback: http://foswiki.org/Extensions/FortunePluginDev

Support

Ask a new question

Can't find your problem here, or would you like to post a request? Ask a question on FortunePlugin.

Bug Tracker

Active Items

Id Summary Priority Current State Creation Date Last Edit
Item706 New FortunePlugin to run Linux fortune-mod Normal Being Worked On 09 Jan 2009 - 03:59 19 Mar 2010 - 01:26

Discussion

FortunePlugin Development

This is the topic to discuss development of download FortunePlugin?

help If you need support, go to Support.FortunePlugin where you can ask questions and find answers to previously asked questions. warning If you want to report a bug, or a feature request, go to Tasks.FortunePlugin where you can see already submitted issues and where you can submit a new bug report or feature request.

Active Items

Id Summary Priority Current State Creation Date Last Edit
Item706 New FortunePlugin to run Linux fortune-mod Normal Being Worked On 09 Jan 2009 - 03:59 19 Mar 2010 - 01:26

Discussion

To discuss development of this extensions please go to Development.FortunePlugin.

Download

Topic attachments
I Attachment Action Size Date Who Comment
FortunePlugin.md5md5 FortunePlugin.md5 manage 0.2 K 27 Oct 2011 - 22:40 GeorgeClark  
FortunePlugin.sha1sha1 FortunePlugin.sha1 manage 0.2 K 27 Oct 2011 - 22:40 GeorgeClark  
FortunePlugin.tgztgz FortunePlugin.tgz manage 7.9 K 27 Oct 2011 - 22:39 GeorgeClark  
FortunePlugin.zipzip FortunePlugin.zip manage 11.1 K 27 Oct 2011 - 22:39 GeorgeClark  
FortunePlugin_installerEXT FortunePlugin_installer manage 4.2 K 27 Oct 2011 - 22:40 GeorgeClark  
foswikiEXT foswiki manage 1.9 K 27 Oct 2011 - 22:39 GeorgeClark  
foswiki.datdat foswiki.dat manage 0.1 K 27 Oct 2011 - 22:39 GeorgeClark  

Topic revision: 27 Oct 2011, GeorgeClark
 
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. see CopyrightStatement. Creative Commons LicenseGet Foswiki at sourceforge.net. Fast, secure and Free Open Source software downloads