TWiki.TWikiPlugins (r1.1 vs. r1.27)
Diffs

 <<O>>  Difference Topic TWikiPlugins (r1.27 - 18 May 2004 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1071473016" format="1.0" version="1.26"
>
>
META TOPICINFO PeterThoeny date="1084862962" format="1.0" version="1.27"

TWiki Plugins

Line: 59 to 59

  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.
Added:
>
>

Checking that Plugins are Working on a Live Server

InstalledPlugins shows which Plugins are: 1) installed, 2) loading properly and 3) what TWiki:Codev.PluginHandlers they invoke. Any failures are shown in the Errors section.


A Note on Plugin Performance

The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://jcuckoo.sourceforge.net/cgi-bin/view/TWiki/AbcPlugin

Line: 301 to 305

}
Changed:
<
<
-- TWiki:Main/PeterThoeny - 11 Dec 2003
-- TWiki:Main/AndreaSterbini - 29 May 2001
>
>
-- TWiki:Main/PeterThoeny - 18 May 2004
-- TWiki:Main/AndreaSterbini - 29 May 2001

-- TWiki:Main/MikeMannix - 03 Dec 2001
Added:
>
>

 <<O>>  Difference Topic TWikiPlugins (r1.26 - 15 Dec 2003 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1071215820" format="1.0" version="1.25"
>
>
META TOPICINFO PeterThoeny date="1071473016" format="1.0" version="1.26"

TWiki Plugins

Line: 204 to 204

Example: <Include an example of the Plugin in action. Possibly include a static HTML version of the example to compare if the installation was a success!>"

Changed:
<
<
Plugin Global Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"
>
>
Plugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"

  • Plugins Preferences <If user settings are needed, explain... Entering values works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
    • Set <EXAMPLE = value added>
Line: 231 to 231

Publishing for Public Use

Changed:
<
<
You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web. All Plugins submitted to TWiki.org are available for download and further development in TWiki:Plugins. Publish your Plugin in three steps:
>
>
You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web. All Plugins submitted to TWiki.org are available for download and further development in TWiki:Plugins/PluginPackage. Publish your Plugin in these steps:

Changed:
<
<
  1. Post the Plugin documentation topic in the TWiki:Plugins web:
    • create a new topic using the Plugin name, ex: MyFirstPlugin.txt
>
>
  1. Post the Plugin documentation topic in the TWiki:Plugins/PluginPackage:
    • enter the Plugin name in the "How to Create a Plugin" section, for example MyFirstPlugin

  1. Attach the distribution zip file to the topic, ex: MyFirstPlugin.zip
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
Added:
>
>
  1. Put the Plugin into the CVS repository, see TWiki:Plugins/ReadmeFirst (optional)

Changed:
<
<
-- AndreaSterbini? - 29 May 2001
-- PeterThoeny - 11 Dec 2003
-- MikeMannix? - 03 Dec 2001
>
>
Thank you very much for sharing your Plugin with the TWiki community smile

Recommended Storage of Plugin Data

Plugins sometimes need to store data. This can be Plugin internal data like cache data, or generated data for the browser like images. The following is a recommendation where to store the data.

Where to store Plugin Internal Data

In case the Plugin generates data just for internal use, or data which is not specific to a topic, store it in the Plugin's attachment directory.

  • The Plugin's attachment directory is pubdir/Installweb/FooBarPlugin
    • Installweb refers to the name of the web where the Plugin is installed
  • The Plugin's attachment URL is %PUBURL%/Installweb/FooBarPlugin
  • The filename should start with an underscore, followed by an identifier, e.g. _any_name.ext
    • The leading underscore avoids a nameclash with files attached to the Plugin topic
    • Use only alphanumeric characters, underscores and periods to avoid platform dependency issues and URL issues
    • Do not use subdirectories (rename and delete would fail)
  • Use Plugin API functions documented in TWikiFuncModule to ensure portability:
    • Use getPubDir() to get the attachment root directory
    • Use getUrlHost() and getPubUrlPath() to build the URL in case you create content for the browser
    • Use $installWeb to get the name of the web where the Plugin is installed
    • Create the web directory and topic attachment directory if needed
  • Hint: Package the Plugin at least with one file attachment. This ensures that the attachment directory already exists

Where to Store Data for Topics using the Plugin

In case the Plugin generates data which is specific to a topic, store it in the topic's attachment directory.

  • The topic's attachment directory is pubdir/Webname/TopicName
  • The topic's attachment URL is %PUBURL%/Webname/TopicName
  • The filename should start with an underscore, followed by the Plugin name, an underscore and an identifier, e.g. _FooBarPlugin_any_name.ext
    • The leading underscore avoids a nameclash with files attached to the same topic
    • Use only alphanumeric characters, underscores and periods to avoid platform dependency issues and URL issues
    • Do not use subdirectories (rename and delete would fail)
  • Use Plugin API functions documented in TWikiFuncModule to ensure portability:
    • Use getPubDir() to get the attachment root directory
    • Use getUrlHost() and getPubUrlPath() to build the URL in case you create content for the browser

Example code to build the file name:

sub _make_filename
{
    my ( $web, $topic, $name ) = @_;

    # Create web directory "pub/$web" if needed
    my $dir = TWiki::Func::getPubDir() . "/$web";
    unless( -e "$dir" ) {
        umask( 002 );
        mkdir( $dir, 0775 );
    }
    # Create topic directory "pub/$web/$topic" if needed
    $dir .= "/$topic";
    unless( -e "$dir" ) {
        umask( 002 );
        mkdir( $dir, 0775 );
    }
    return "$dir/_FooBarPlugin_$name";
}

-- TWiki:Main/PeterThoeny - 11 Dec 2003
-- TWiki:Main/AndreaSterbini - 29 May 2001
-- TWiki:Main/MikeMannix - 03 Dec 2001


 <<O>>  Difference Topic TWikiPlugins (r1.25 - 12 Dec 2003 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1059724429" format="1.0" version="1.24"
>
>
META TOPICINFO PeterThoeny date="1071215820" format="1.0" version="1.25"

TWiki Plugins

Line: 17 to 17

Preinstalled Plugins

Changed:
<
<
TWiki comes with three Plugins as part of the standard installation.
>
>
TWiki comes with a set of Plugins as part of the standard installation.

Changed:
<
<
  • DefaultPlugin optionally handles some legacy variables from older versions of TWiki. You can control this option from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)

  • EmptyPlugin is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.

  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for shorthand linking to remote sites, ex: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can edit the predefined set of of Wiki-related sites, and add your own.
>
>
  • DefaultPlugin: Optionally handles some legacy variables from older versions of TWiki. You can control this option from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
  • EmptyPlugin: Is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.
  • InterwikiPlugin: Use it for shorthand linking to remote sites, ex: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can edit the predefined set of of Wiki-related sites, and add your own.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like  :-) for smile or  :cool: for cool!
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to tables located in TWiki topics.
  • TablePlugin: Control attributes of tables and sorting of table columns

Installing Plugins

Line: 55 to 59

  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.
Changed:
<
<

A Note on Performance

>
>

A Note on Plugin Performance


Changed:
<
<
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://jcuckoo.sourceforge.net/cgi-bin/view/TWiki/AbcPlugin
>
>
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that need to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://jcuckoo.sourceforge.net/cgi-bin/view/TWiki/AbcPlugin

In case you need to install an "expensive" Plugin and you need its functionality only in one web you can place the Plugin topic into that web. TWiki will initialize the Plugin only if the Plugin topic is found (which won't be the case for other webs.)

Line: 117 to 121

  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.
Added:
>
>
Most Plugins use either the commonTagsHandler or startRenderingHandler for rendering tasks:
  • commonTagsHandler: Use it to expand %XYZPLUGIN% and %XYZPLUGIN{...}% variables
  • startRenderingHandler: Use it for your own rendering rules or to overload TWiki's internal rendering like [[links]]

TWiki:Codev/StepByStepRenderingOrder helps you decide which rendering handler to use.

Hints on Writing Fast Plugins

  • Delay the Plugin initialization to the actual function which is handling the tag. This way all the expensive initialization is done only when needed.
  • For example, use an eval block like:
    eval { require IPC::Run }
    return "<font color=\"red\">SamplePlugin: Can't load required modules ($@)</font>" if $@;
  • You could return errors as strings to show what happened
  • You can use a flag to avoid running the initialization twice

Plugin Version Detection

To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking.

Line: 221 to 240

  1. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

-- AndreaSterbini? - 29 May 2001

Changed:
<
<
-- PeterThoeny - 29 Jan 2003
>
>
-- PeterThoeny - 11 Dec 2003

-- MikeMannix? - 03 Dec 2001

 <<O>>  Difference Topic TWikiPlugins (r1.24 - 01 Aug 2003 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1059716224" format="1.0" version="1.23"
>
>
META TOPICINFO PeterThoeny date="1059724429" format="1.0" version="1.24"

TWiki Plugins

Line: 57 to 57

A Note on Performance

Changed:
<
<
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin.
>
>
The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin. Example for Unix:
time wget -qO /dev/null http://jcuckoo.sourceforge.net/cgi-bin/view/TWiki/AbcPlugin

In case you need to install an "expensive" Plugin and you need its functionality only in one web you can place the Plugin topic into that web. TWiki will initialize the Plugin only if the Plugin topic is found (which won't be the case for other webs.)


 <<O>>  Difference Topic TWikiPlugins (r1.23 - 01 Aug 2003 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1046406720" format="1.0" version="1.22"
>
>
META TOPICINFO PeterThoeny date="1059716224" format="1.0" version="1.23"

TWiki Plugins

Line: 55 to 55

  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.
Added:
>
>

A Note on Performance

The performance of the system depends on the number of Plugins installed and on the Plugin implementation. Some Plugins impose no measurable performance decrease, some do. For example, outsidePREHandler is an expensive callback function, or a Plugin might use many Perl libraries that needs to be initialized with each page view (unless you run mod_perl). It is recommended to measure the performance with and without a new Plugin.

In case you need to install an "expensive" Plugin and you need its functionality only in one web you can place the Plugin topic into that web. TWiki will initialize the Plugin only if the Plugin topic is found (which won't be the case for other webs.)


Managing Plugins

When you finish installing a Plugin, you should be able to read the user instructions and go. In fact, some Plugins require additional settings or offer extra options that you have to select. Also, you may want to make a Plugin available only in certain webs, or temporarily disable it. And may want to list all available Plugins in certain topics. You can handle all of these management tasks with simple procedures.


 <<O>>  Difference Topic TWikiPlugins (r1.22 - 28 Feb 2003 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1043824860" format="1.0" version="1.21"
>
>
META TOPICINFO PeterThoeny date="1046406720" format="1.0" version="1.22"

TWiki Plugins

Line: 48 to 48

To test new Plugins on your installation before making them public, you may want to use one of these two approaches:

  • Method 1: Safely test on-the-fly by creating separate Production and Test branches in your live TWiki installation.
Changed:
<
<
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg, the twiki/data; the twiki/templates and twiki/pub directories are shared.
>
>
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, and adjust the paths in the new lib/TWiki.cfg. The following directories are shared: twiki/data, twiki/templates and twiki/pub.

    • Test Plugins and other new features in the Test installation until you're satisfied.
      • ALERT! If you modify topics using the new features, live users will likely see unfamiliar new META tags showing up on their pages - to avoid this, create and edit test-only topics to try out new features.
    • Copy the modified files to the Production installation. You can update a TWiki installation live and users won't even notice.

 <<O>>  Difference Topic TWikiPlugins (r1.21 - 29 Jan 2003 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1039329388" format="1.0" version="1.20"
>
>
META TOPICINFO PeterThoeny date="1043824860" format="1.0" version="1.21"

TWiki Plugins

Line: 108 to 108

In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

Deleted:
<
<
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.
Added:
>
>
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

Plugin Version Detection

Line: 146 to 146

Creating the Perl Module

Changed:
<
<
Copy file lib/TWiki/Plugins/EmptyPlugin.pm to <name>Plugin.pm. EmptyPlugin.pm contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.
>
>
Copy file lib/TWiki/Plugins/EmptyPlugin.pm to <name>Plugin.pm. The EmptyPlugin.pm module contains mostly empty functions, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

If your Plugin uses its own modules and objects, you must include the name of the Plugin in the package name. For example, write Package MyFirstPlugin::Attrs; instead of just Package Attrs;. Then call it using:

  use TWiki::Plugins::MyFirstPlugin::Attrs;
  $var = MyFirstPlugin::Attrs->new();

Writing the Documentation Topic

The Plugin documentation topic contains usage instructions and version details. It serves the Plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic:

Changed:
<
<
  1. Copy the Plugin topic template from EmptyPlugin. To copy the text, go to the page and:
    • click Edit
    • select all in the Edit box & copy
>
>
  1. Copy the Plugin topic template from TWiki.org. To copy the text, go to TWiki:Plugins/PluginPackage and:
    • enter the Plugin name in the "How to Create a Plugin" section
    • click Create
    • select all in the Edit box & copy

    • Cancel the edit
Changed:
<
<
    • paste & save as a text file or new topic on your site
  1. Customize the template for your Plugin; you'll probably want to post a working version on your local TWiki site.
  2. Save your topic as a text file, for use in packaging and publishing your Plugin.
>
>
    • go back to your site to the TWiki web
    • In the GoBox enter your Plugin name, for example MyFirstPlugin, press enter and create the new topic
    • paste & save new Plugin topic on your site
  1. Customize your Plugin topic.
    • In case you plan to publish your Plugin at TWiki.org, use Interwiki names for author names, like TWiki:Main/TWikiGuest.
  2. Save your topic, for use in packaging and publishing your Plugin.

OUTLINE: Doc Topic Contents
Changed:
<
<
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:
>
>
Check the Plugins web on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:

Syntax Rules: <Describe any special text formatting that will be rendered.>"

Changed:
<
<
MyFirstPlugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"
>
>
Example: <Include an example of the Plugin in action. Possibly include a static HTML version of the example to compare if the installation was a success!>"

Changed:
<
<
  • Plugins Preferences <If user settings are needed, explain... Entering valuse works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
    • Set <EXAMPLE = value added>
>
>
Plugin Global Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"

Changed:
<
<
How-to Instructions: <Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.>"
>
>
  • Plugins Preferences <If user settings are needed, explain... Entering values works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
    • Set <EXAMPLE = value added>

Changed:
<
<
Test Example: <Include an example of the Plugin in action: if it works, the installation was a success!>"
>
>
Plugin Installation Instructions: <Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.>"

Plugin Info: <Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.>"

Line: 205 to 215

  1. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

-- AndreaSterbini? - 29 May 2001

Changed:
<
<
-- PeterThoeny - 14 Sep 2001
>
>
-- PeterThoeny - 29 Jan 2003

-- MikeMannix? - 03 Dec 2001

 <<O>>  Difference Topic TWikiPlugins (r1.20 - 08 Dec 2002 - PeterThoeny)
Changed:
<
<
META TOPICINFO PeterThoeny date="1026976482" format="1.0" version="1.19"
>
>
META TOPICINFO PeterThoeny date="1039329388" format="1.0" version="1.20"

TWiki Plugins

Line: 100 to 100

Available Core Functions

Changed:
<
<
The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.
>
>
The TWikiFuncModule (lib/TWiki/Func.pm) implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.

ALERT! If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.

Deleted:
<
<
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

Predefined Hooks

In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

Added:
>
>
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.

Plugin Version Detection


 <<O>>  Difference Topic TWikiPlugins (r1.19 - 18 Jul 2002 - PeterThoeny)
Changed:
<
<
META TOPICINFO MikeMannix? date="1007374620" format="1.0" version="1.18"
>
>
META TOPICINFO PeterThoeny date="1026976482" format="1.0" version="1.19"

TWiki Plugins

Line: 53 to 53

      • ALERT! If you modify topics using the new features, live users will likely see unfamiliar new META tags showing up on their pages - to avoid this, create and edit test-only topics to try out new features.
    • Copy the modified files to the Production installation. You can update a TWiki installation live and users won't even notice.
Changed:
<
<
  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
>
>
  • Method 2: List the Plugin being tested in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Sandbox web and do the testing there.

Managing Plugins


 <<O>>  Difference Topic TWikiPlugins (r1.18 - 03 Dec 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="1001637305" format="1.0" version="1.17"
>
>
META TOPICINFO MikeMannix? date="1007374620" format="1.0" version="1.18"

TWiki Plugins

Line: 170 to 170

MyFirstPlugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"

Changed:
<
<
Plugins Preferences <If user settings are needed, explain... Entering valuse works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
>
>
  • Plugins Preferences <If user settings are needed, explain... Entering valuse works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"

    • Set <EXAMPLE = value added>

How-to Instructions: <Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.>"

Line: 206 to 206

  1. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

-- AndreaSterbini? - 29 May 2001

Deleted:
<
<
-- MikeMannix? - 01 Sep 2001

-- PeterThoeny - 14 Sep 2001
Added:
>
>
-- MikeMannix? - 03 Dec 2001

 <<O>>  Difference Topic TWikiPlugins (r1.17 - 28 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="1000787146" format="1.0" version="1.16"
>
>
META TOPICINFO MikeMannix? date="1001637305" format="1.0" version="1.17"

TWiki Plugins

Line: 42 to 42

  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (SomePluginDev).
  • User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.
Added:
>
>

On-Site Pretesting

To test new Plugins on your installation before making them public, you may want to use one of these two approaches:

Changed:
<
<
  • Method 1: Create Production and a Test installation of TWiki.
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg, the twiki/data; the twiki/templates and twiki/pub directories are shared.
    • Test Plugins and other new features in the Test installation until you're satisfied.
    • Copy the modified files to the Production installation. You can update a live TWiki installation and users won't even notice.
>
>
  • Method 1: Safely test on-the-fly by creating separate Production and Test branches in your live TWiki installation.
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg, the twiki/data; the twiki/templates and twiki/pub directories are shared.
    • Test Plugins and other new features in the Test installation until you're satisfied.
      • ALERT! If you modify topics using the new features, live users will likely see unfamiliar new META tags showing up on their pages - to avoid this, create and edit test-only topics to try out new features.
    • Copy the modified files to the Production installation. You can update a TWiki installation live and users won't even notice.

  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
Line: 100 to 102

The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.

Changed:
<
<
DevALERT: If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.
>
>
ALERT! If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.

  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

 <<O>>  Difference Topic TWikiPlugins (r1.16 - 18 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="1000620081" format="1.0" version="1.15"
>
>
META TOPICINFO MikeMannix? date="1000787146" format="1.0" version="1.16"

TWiki Plugins

Line: 7 to 7

Overview

Changed:
<
<
You can add Plugins to extend TWiki's functionality, without altering the core program code. With a plug-in approach, you can:
>
>
You can add Plugins to extend TWiki's functionality, without altering the core program code. A plug-in approach lets you:

  • add virtually unlimited features while keeping the main TWiki code compact and efficient;
  • heavily customize an installation and still do clean updates to new versions of TWiki;
  • rapidly develop new TWiki functions in Perl using the Plugin API.
Changed:
<
<
Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki:Plugins web.
>
>
Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki:Plugins web.

Preinstalled Plugins

TWiki comes with three Plugins as part of the standard installation.

Changed:
<
<
  • DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
>
>
  • DefaultPlugin optionally handles some legacy variables from older versions of TWiki. You can control this option from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)

Changed:
<
<
  • EmptyPlugin is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.
>
>
  • EmptyPlugin is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.

Changed:
<
<
  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.
>
>
  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for shorthand linking to remote sites, ex: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can edit the predefined set of of Wiki-related sites, and add your own.

Installing Plugins

Line: 51 to 51

    • Test Plugins and other new features in the Test installation until you're satisfied.
    • Copy the modified files to the Production installation. You can update a live TWiki installation and users won't even notice.
Changed:
<
<
  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
>
>
  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.

Managing Plugins

Changed:
<
<
Ideally, after you've installed a Plugin, just read the instructions and you're set. In fact, some Plugins require additional settings or offer extra options that you can modify on Preferences pages. You may want to make a Plugin available only in certain webs, or temporarily disable it. And having to list all available Plugins will probably come up. You can handle all of these with simple procedures.
>
>
When you finish installing a Plugin, you should be able to read the user instructions and go. In fact, some Plugins require additional settings or offer extra options that you have to select. Also, you may want to make a Plugin available only in certain webs, or temporarily disable it. And may want to list all available Plugins in certain topics. You can handle all of these management tasks with simple procedures.

Setting Preferences

Line: 81 to 81

  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.

Changed:
<
<
DEMO: Active Plugin Variables
>
>
DEMO: Automatically List Active Plugins Using Variables

Changed:
<
<
%ACTIVATEDPLUGINS%
>
>
Using %ACTIVATEDPLUGINS%:

On this TWiki site, the active Plugins are: DefaultPlugin, SpreadSheetPlugin, CommentPlugin, EditTablePlugin, InterwikiPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin.
Changed:
<
<
%PLUGINDESCRIPTIONS%
>
>
Using %PLUGINDESCRIPTIONS%:

You can use any of these active TWiki Plugins:
  • DefaultPlugin: This plugin can be used to specify some simple custom rendering rules. It also renders depreciated *_text_* as bold italic text.
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to tables located in JCuckoo topics.
  • CommentPlugin: Allows users to quickly post comments to a page without an edit/preview/save cycle.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • InterwikiPlugin: Link ExternalSite:Page text to external sites based on aliases defined in the InterWikis topic
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like  :-) for smile or  :cool: for cool!
  • TablePlugin: Control attributes of tables and sorting of table columns

Line: 126 to 126

With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki.

Added:
>
>

The DefaultPlugin Alternative

  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in DefaultPlugin topic. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.
Line: 163 to 164

OUTLINE: Doc Topic Contents
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:
Changed:
<
<
Syntax Rules: Describe any special text formatting that will be rendered.
>
>
Syntax Rules: <Describe any special text formatting that will be rendered.>"

Changed:
<
<
MyFirstPlugin Settings: Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.
>
>
MyFirstPlugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"

Changed:
<
<
Plugins Preferences work exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:
    • Set EXAMPLE = got it!
>
>
Plugins Preferences <If user settings are needed, explain... Entering valuse works exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:>"
    • Set <EXAMPLE = value added>

Changed:
<
<
How-to Instructions: Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.
>
>
How-to Instructions: <Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.>"

Changed:
<
<
Test Example: Include an example of the Plugin in action: if it works, the installation was a success!
>
>
Test Example: <Include an example of the Plugin in action: if it works, the installation was a success!>"

Changed:
<
<
Plugin Info: Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.
>
>
Plugin Info: <Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.>"


 <<O>>  Difference Topic TWikiPlugins (r1.15 - 16 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="1000548476" format="1.0" version="1.14"
>
>
META TOPICINFO MikeMannix? date="1000620081" format="1.0" version="1.15"

TWiki Plugins

Line: 80 to 80

  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.
Changed:
<
<
>
>

DEMO: Active Plugin Variables

%ACTIVATEDPLUGINS%

Line: 159 to 159

  1. Customize the template for your Plugin; you'll probably want to post a working version on your local TWiki site.
  2. Save your topic as a text file, for use in packaging and publishing your Plugin.
Changed:
<
<
OUTLINE: Doc Topic Contents
>
>
OUTLINE: Doc Topic Contents

Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:

Syntax Rules: Describe any special text formatting that will be rendered.

Line: 204 to 204

-- AndreaSterbini? - 29 May 2001
-- MikeMannix? - 01 Sep 2001

Changed:
<
<
-- PeterThoeny - 14 Sep 2001
>
>
-- PeterThoeny - 14 Sep 2001

 <<O>>  Difference Topic TWikiPlugins (r1.14 - 15 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO PeterThoeny date="1000461351" format="1.0" version="1.13"
>
>
META TOPICINFO MikeMannix? date="1000548476" format="1.0" version="1.14"

TWiki Plugins

Changed:
<
<
Plugin use and development; about the Plugin API.
>
>
Plug-in enhanced feature add-ons, with a Plugin API for developers

Overview

Changed:
<
<
You can add Plugins to greatly extend TWiki's functionality, without alering the program core. With a plug-in approach, you can:
>
>
You can add Plugins to extend TWiki's functionality, without altering the core program code. With a plug-in approach, you can:

  • add virtually unlimited features while keeping the main TWiki code compact and efficient;
  • heavily customize an installation and still do clean updates to new versions of TWiki;
Line: 23 to 23

  • EmptyPlugin is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.
Changed:
<
<
  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.
>
>
  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.

Installing Plugins

Line: 37 to 37

Special Requests: Some Plugins need certain Perl modules to be preinstalled on the host system. Plugins may also use other resources, like graphics, other modules, applications, templates. In these cases, detailed instructions are in the Plugin documentation.

Changed:
<
<
Each Plugin has a standard release page, located in the TWiki:Plugins web at TWiki.org. In addition to the documentation topic (SomePlugin), there's a separate development page.
>
>
Each Plugin has a standard release page, located in the TWiki:Plugins web at TWiki.org. In addition to the documentation topic (SomePlugin), there's a separate development page.

  • Doc page: Read all available info about the Plugin; download the attached distribution files.
Changed:
<
<
  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (SomePluginDev).
>
>
  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (SomePluginDev).

  • User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.

On-Site Pretesting

Line: 47 to 47

To test new Plugins on your installation before making them public, you may want to use one of these two approaches:

  • Method 1: Create Production and a Test installation of TWiki.
Changed:
<
<
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg, the twiki/data; the twiki/templates and twiki/pub directories are shared.
>
>
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg, the twiki/data; the twiki/templates and twiki/pub directories are shared.

    • Test Plugins and other new features in the Test installation until you're satisfied.
    • Copy the modified files to the Production installation. You can update a live TWiki installation and users won't even notice.
Changed:
<
<
  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
>
>
  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.

Managing Plugins

Line: 61 to 61

Installed Plugins can be toggled on or off, site-wide or by web, through TWikiPreferences and individual WebPreferences:

Changed:
<
<
  • All Plugin modules present in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS Preferences variable in TWikiPreferences. You can optionally list the installed Plugins in the INSTALLEDPLUGINS Preferences variable. This is useful to define the sequence of Plugin execution, or to specify other webs than the JCuckoo web for the Plugin topics. Settings in TWikiPreferences are:
    • Set INSTALLEDPLUGINS = DefaultPlugin, ...
    • Set DISABLEDPLUGINS = EmptyPlugin, ...
>
>
  • All Plugin modules present in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS Preferences variable in TWikiPreferences. You can optionally list the installed Plugins in the INSTALLEDPLUGINS Preferences variable. This is useful to define the sequence of Plugin execution, or to specify other webs than the JCuckoo web for the Plugin topics. Settings in TWikiPreferences are:
    • Set INSTALLEDPLUGINS = DefaultPlugin, ...
    • Set DISABLEDPLUGINS = EmptyPlugin, ...

Changed:
<
<
Plugin execution order in TWiki is determined by searching Plugin topics in a specific sequence: First, full web.topicname name, if specified in INSTALLEDPLUGINS; next, the TWiki web is searched; and finally, the current web.
>
>
Plugin execution order in TWiki is determined by searching Plugin topics in a specific sequence: First, full web.topicname name, if specified in INSTALLEDPLUGINS; next, the TWiki web is searched; and finally, the current web.

Plugin-specific settings are done in individual Plugin topics. Two settings are standard for each Plugin:

  1. One line description, used to form the bullets describing the Plugins in the TextFormattingRules topic:
Changed:
<
<
    • Set SHORTDESCRIPTION = Blah blah woof woof.
  1. Debug Plugin, output can be seen in data/debug.txt. Set to 0=off or 1=on:
    • Set DEBUG = 0
  • The settings can be retrieved as Preferences variables like %<pluginname>_<var>%, ex: %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.
>
>
    • Set SHORTDESCRIPTION = Blah blah woof woof.
  1. Debug Plugin, output can be seen in data/debug.txt. Set to 0=off or 1=on:
    • Set DEBUG = 0
  • The settings can be retrieved as Preferences variables like %<pluginname>_<var>%, ex: %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.

Listing Active Plugins

Plugin status variables let you list all active Plugins wherever needed. There are two list formats:

Changed:
<
<
  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.
>
>
  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.

DEMO: Active Plugin Variables
Changed:
<
<
%ACTIVATEDPLUGINS%
>
>
%ACTIVATEDPLUGINS%

On this TWiki site, the active Plugins are: DefaultPlugin, SpreadSheetPlugin, CommentPlugin, EditTablePlugin, InterwikiPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin.
Changed:
<
<
%PLUGINDESCRIPTIONS%
>
>
%PLUGINDESCRIPTIONS%

You can use any of these active TWiki Plugins:
  • DefaultPlugin: This plugin can be used to specify some simple custom rendering rules. It also renders depreciated *_text_* as bold italic text.
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to tables located in JCuckoo topics.
  • CommentPlugin: Allows users to quickly post comments to a page without an edit/preview/save cycle.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • InterwikiPlugin: Link ExternalSite:Page text to external sites based on aliases defined in the InterWikis topic
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like  :-) for smile or  :cool: for cool!
  • TablePlugin: Control attributes of tables and sorting of table columns

Line: 98 to 98

Available Core Functions

Changed:
<
<
The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.
>
>
The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.

Changed:
<
<
DevALERT: If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.
>
>
DevALERT: If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.

Changed:
<
<
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.
>
>
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

Predefined Hooks

Changed:
<
<
In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.
>
>
In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

Changed:
<
<
  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.
>
>
  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.

Plugin Version Detection

Changed:
<
<
To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking.
>
>
To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking.

Changed:
<
<
  • All modules require a $VERSION='0.000' variable, beginning at 1.000.
>
>
  • All modules require a $VERSION='0.000' variable, beginning at 1.000.

Changed:
<
<
  • The initPlugin handler should check all dependencies and return TRUE if the initialization is OK or FALSE if something went wrong.
    • The Plugin initialization code does not register a Plugin that returns FALSE (or that has no initPlugin handler).
>
>
  • The initPlugin handler should check all dependencies and return TRUE if the initialization is OK or FALSE if something went wrong.
    • The Plugin initialization code does not register a Plugin that returns FALSE (or that has no initPlugin handler).

Changed:
<
<
>
>

Creating Plugins

Line: 134 to 134

A basic TWiki Plugin consists of two elements:

Changed:
<
<
  • a Perl module, ex: MyFirstPlugin.pm
  • a documentation topic, ex: MyFirstPlugin.txt
>
>
  • a Perl module, ex: MyFirstPlugin.pm
  • a documentation topic, ex: MyFirstPlugin.txt

The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.

Changed:
<
<
In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the MyFirstPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/MyFirstPlugin/ directory.
>
>
In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the MyFirstPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/MyFirstPlugin/ directory.

The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.

Creating the Perl Module

Changed:
<
<
Copy file lib/TWiki/Plugins/EmptyPlugin.pm to <name>Plugin.pm. EmptyPlugin.pm contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.
>
>
Copy file lib/TWiki/Plugins/EmptyPlugin.pm to <name>Plugin.pm. EmptyPlugin.pm contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

Writing the Documentation Topic

Line: 180 to 180

Packaging for Distribution

Changed:
<
<
A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: MyFirstPlugin.pm, and a documentation page with the same name(MyFirstPlugin.txt).
>
>
A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: MyFirstPlugin.pm, and a documentation page with the same name(MyFirstPlugin.txt).

  1. Distribute the Plugin files in a directory structure that mirrors TWiki. If your Plugin uses additional files, include them ALL:
Changed:
<
<
    • lib/TWiki/Plugins/MyFirstPlugin.pm
    • data/TWiki/MyFirstPlugin.txt
    • pub/TWiki/MyFirstPlugin/uparrow.gif [a required graphic]
  1. Create a zip archive with the Plugin name (MyFirstPlugin.zip) and add the entire directory structure from Step 1. The archive should look like this:
    • lib/TWiki/Plugins/MyFirstPlugin.pm
    • data/TWiki/MyFirstPlugin.txt
    • pub/TWiki/MyFirstPlugin/uparrow.gif
>
>
    • lib/TWiki/Plugins/MyFirstPlugin.pm
    • data/TWiki/MyFirstPlugin.txt
    • pub/TWiki/MyFirstPlugin/uparrow.gif [a required graphic]
  1. Create a zip archive with the Plugin name (MyFirstPlugin.zip) and add the entire directory structure from Step 1. The archive should look like this:
    • lib/TWiki/Plugins/MyFirstPlugin.pm
    • data/TWiki/MyFirstPlugin.txt
    • pub/TWiki/MyFirstPlugin/uparrow.gif

Publishing for Public Use

Changed:
<
<
You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web, where all Plugins submitted to TWiki.org are available for download and further development discussion. Publish your Plugin in three steps:
>
>
You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web. All Plugins submitted to TWiki.org are available for download and further development in TWiki:Plugins. Publish your Plugin in three steps:

  1. Post the Plugin documentation topic in the TWiki:Plugins web:
Changed:
<
<
  1. Attach the distribution zip file to the topic, ex: MyFirstPlugin.zip.
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
>
>
  1. Attach the distribution zip file to the topic, ex: MyFirstPlugin.zip
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

-- AndreaSterbini? - 29 May 2001
-- MikeMannix? - 01 Sep 2001


 <<O>>  Difference Topic TWikiPlugins (r1.13 - 14 Sep 2001 - PeterThoeny)
Changed:
<
<
META TOPICINFO MikeMannix? date="999857462" format="1.0" version="1.12"
>
>
META TOPICINFO PeterThoeny date="1000461351" format="1.0" version="1.13"

TWiki Plugins

Line: 13 to 13

  • heavily customize an installation and still do clean updates to new versions of TWiki;
  • rapidly develop new TWiki functions in Perl using the Plugin API.
Changed:
<
<
Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki.org Plugins web.
>
>
Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki:Plugins web.

Preinstalled Plugins

Line: 21 to 21

  • DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
Changed:
<
<
  • EmptyPlug is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.
>
>
  • EmptyPlugin is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.

  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.
Line: 83 to 83

DEMO: Active Plugin Variables
Changed:
<
<
%ACTIVATEDPLUGINS%
>
>
%ACTIVATEDPLUGINS%

On this TWiki site, the active Plugins are: DefaultPlugin, SpreadSheetPlugin, CommentPlugin, EditTablePlugin, InterwikiPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin.
Changed:
<
<
%PLUGINDESCRIPTIONS%
>
>
%PLUGINDESCRIPTIONS%

You can use any of these active TWiki Plugins:
  • DefaultPlugin: This plugin can be used to specify some simple custom rendering rules. It also renders depreciated *_text_* as bold italic text.
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to tables located in JCuckoo topics.
  • CommentPlugin: Allows users to quickly post comments to a page without an edit/preview/save cycle.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • InterwikiPlugin: Link ExternalSite:Page text to external sites based on aliases defined in the InterWikis topic
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like  :-) for smile or  :cool: for cool!
  • TablePlugin: Control attributes of tables and sorting of table columns

Line: 94 to 94

The TWiki Plugin API

Changed:
<
<
The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001.
>
>
The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the 01-Sep-2001 release.

Available Core Functions

Line: 128 to 128

The DefaultPlugin Alternative

Changed:
<
<
  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in TWikiPreferences. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.
>
>
  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in DefaultPlugin topic. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.

Anatomy of a Plugin

A basic TWiki Plugin consists of two elements:

Changed:
<
<
  • a Perl module, ex: YourPlugin.pm
  • a documentation topic, ex: YourPlugin.txt
>
>
  • a Perl module, ex: MyFirstPlugin.pm
  • a documentation topic, ex: MyFirstPlugin.txt

The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.

Changed:
<
<
In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the YourPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/YourPlugin/ directory.
>
>
In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the MyFirstPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/MyFirstPlugin/ directory.

The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.

Creating the Perl Module

Changed:
<
<
Copy file (EmptyPlugin.pm to <name>Plugin.pm =EmptyPlugin.pm= contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.
>
>
Copy file lib/TWiki/Plugins/EmptyPlugin.pm to <name>Plugin.pm. EmptyPlugin.pm contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

Writing the Documentation Topic

The Plugin documentation topic contains usage instructions and version details. It serves the Plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic:

Changed:
<
<
  1. Copy the Plugin topic template from http://TWiki.org/cgi-bin/view/TWiki/EmptyPlugin. To copy the text, go to the page and:
>
>
  1. Copy the Plugin topic template from EmptyPlugin. To copy the text, go to the page and:

    • click Edit
    • select all in the Edit box & copy
    • Cancel the edit
Line: 161 to 161

OUTLINE: Doc Topic Contents
Changed:
<
<
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:
>
>
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:

Syntax Rules: Describe any special text formatting that will be rendered.

Changed:
<
<
YourPlugin Settings: Description and settings for your custom Plugin %VARIABLES%, and those required by TWiki.
>
>
MyFirstPlugin Settings: Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.

Plugins Preferences work exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:

    • Set EXAMPLE = got it!
Line: 180 to 180

Packaging for Distribution

Changed:
<
<
A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: YourPlugin.pm, and a documentation page with the same name(YourPlugin.txt).
>
>
A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: MyFirstPlugin.pm, and a documentation page with the same name(MyFirstPlugin.txt).

Changed:
<
<
  1. Distribute your Plugin files in a directory structure that mirrors TWiki. If your Plugin uses additional files, include them ALL:
    • lib/TWiki/Plugins/YourPlugin.pm
    • data/TWiki/YourPlugin.txt
    • pub/TWiki/YourPlugin/uparrow.gif [a required graphic]
  2. Create a zip archive with the Plugin name (YourPlugin.zip) and add the entire directory structure from Step 1. Your archive should look like this:
    • lib/TWiki/Plugins/YourPlugin.pm
    • data/TWiki/YourPlugin.txt
    • pub/TWiki/YourPlugin/uparrow.gif
>
>
  1. Distribute the Plugin files in a directory structure that mirrors TWiki. If your Plugin uses additional files, include them ALL:
    • lib/TWiki/Plugins/MyFirstPlugin.pm
    • data/TWiki/MyFirstPlugin.txt
    • pub/TWiki/MyFirstPlugin/uparrow.gif [a required graphic]
  2. Create a zip archive with the Plugin name (MyFirstPlugin.zip) and add the entire directory structure from Step 1. The archive should look like this:
    • lib/TWiki/Plugins/MyFirstPlugin.pm
    • data/TWiki/MyFirstPlugin.txt
    • pub/TWiki/MyFirstPlugin/uparrow.gif

Publishing for Public Use

Line: 197 to 197

You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web, where all Plugins submitted to TWiki.org are available for download and further development discussion. Publish your Plugin in three steps:

  1. Post the Plugin documentation topic in the TWiki:Plugins web:
Changed:
<
<
    • create a new topic using the Plugin name, ex: YourPlugin.txt;
>
>
    • create a new topic using the Plugin name, ex: MyFirstPlugin.txt;

Changed:
<
<
  1. Attach the distribution zip file to the topic, ex: YourPlugin.zip.
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: YourPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
>
>
  1. Attach the distribution zip file to the topic, ex: MyFirstPlugin.zip.
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: MyFirstPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

Changed:
<
<
-- AndreaSterbini? - 29 May 2001
-- MikeMannix? - 01 Sep 2001
>
>
-- AndreaSterbini? - 29 May 2001
-- MikeMannix? - 01 Sep 2001
-- PeterThoeny - 14 Sep 2001

 <<O>>  Difference Topic TWikiPlugins (r1.12 - 07 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO AndreaSterbini? date="999419674" format="1.0" version="1.11"
>
>
META TOPICINFO MikeMannix? date="999857462" format="1.0" version="1.12"

TOC: No TOC in "TWiki.TWikiPlugins"
Changed:
<
<

TWiki Plugins

>
>

TWiki Plugins


Plugin use and development; about the Plugin API.

Changed:
<
<

Overview

>
>

Overview


You can add Plugins to greatly extend TWiki's functionality, without alering the program core. With a plug-in approach, you can:

Line: 15 to 15

Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki.org Plugins web.

Changed:
<
<

Preinstalled Plugins

>
>

Preinstalled Plugins


TWiki comes with three Plugins as part of the standard installation.

Line: 26 to 26

  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.

Changed:
<
<

Installing Plugins

>
>

Installing Plugins


Each TWikiPlugin comes with full documentation: step-by-step installation instructions, a detailed description of any special requirements, version details, and a working example for testing.

Line: 42 to 42

  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (SomePluginDev).
  • User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.
Changed:
<
<

On-Site Pretesting

>
>

On-Site Pretesting


To test new Plugins on your installation before making them public, you may want to use one of these two approaches:

Line: 53 to 53

  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
Changed:
<
<

Managing Plugins

>
>

Managing Plugins


Ideally, after you've installed a Plugin, just read the instructions and you're set. In fact, some Plugins require additional settings or offer extra options that you can modify on Preferences pages. You may want to make a Plugin available only in certain webs, or temporarily disable it. And having to list all available Plugins will probably come up. You can handle all of these with simple procedures.

Changed:
<
<

Setting Preferences

>
>

Setting Preferences


Installed Plugins can be toggled on or off, site-wide or by web, through TWikiPreferences and individual WebPreferences:

Line: 75 to 74

    • Set DEBUG = 0
  • The settings can be retrieved as Preferences variables like %<pluginname>_<var>%, ex: %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.
Changed:
<
<

Listing Active Plugins

>
>

Listing Active Plugins


Plugin status variables let you list all active Plugins wherever needed. There are two list formats:

  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
Line: 93 to 92

Changed:
<
<

The TWiki Plugin API

>
>

The TWiki Plugin API


The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001.

Changed:
<
<

Available Core Functions

>
>

Available Core Functions


The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.

Line: 105 to 104

  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.
Changed:
<
<

Predefined Hooks

>
>

Predefined Hooks


In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.
Changed:
<
<

Plugin Version Detection

>
>

Plugin Version Detection


To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking.

Line: 122 to 121

Deleted:
<
<

Changed:
<
<

Creating Plugins

>
>

Creating Plugins


With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki.

Changed:
<
<

The DefaultPlugin Alternative

>
>

The DefaultPlugin Alternative


  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in TWikiPreferences. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.
Changed:
<
<

Anatomy of a Plugin

>
>

Anatomy of a Plugin


A basic TWiki Plugin consists of two elements:

Line: 144 to 142

The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.

Changed:
<
<

Creating the Perl Module

>
>

Creating the Perl Module


Copy file (EmptyPlugin.pm to <name>Plugin.pm =EmptyPlugin.pm= contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

Changed:
<
<

Writing the Documentation Topic

>
>

Writing the Documentation Topic


The Plugin documentation topic contains usage instructions and version details. It serves the Plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic:

Line: 180 to 178

Changed:
<
<

Packaging for Distribution

>
>

Packaging for Distribution


A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: YourPlugin.pm, and a documentation page with the same name(YourPlugin.txt).

Line: 194 to 192

    • pub/TWiki/YourPlugin/uparrow.gif

Changed:
<
<

Publishing for Public Use

>
>

Publishing for Public Use


You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web, where all Plugins submitted to TWiki.org are available for download and further development discussion. Publish your Plugin in three steps:


 <<O>>  Difference Topic TWikiPlugins (r1.11 - 02 Sep 2001 - AndreaSterbini?)
Changed:
<
<
META TOPICINFO MikeMannix? date="999393063" format="1.0" version="1.10"
>
>
META TOPICINFO AndreaSterbini? date="999419674" format="1.0" version="1.11"

TWiki Plugins

Line: 117 to 117

  • All modules require a $VERSION='0.000' variable, beginning at 1.000.
Changed:
<
<
  • The initPlugin handler checks all dependencies and returns TRUE if the initialization is OK or FALSE if something went wrong.
>
>
  • The initPlugin handler should check all dependencies and return TRUE if the initialization is OK or FALSE if something went wrong.

    • The Plugin initialization code does not register a Plugin that returns FALSE (or that has no initPlugin handler).

Line: 140 to 140

  • a documentation topic, ex: YourPlugin.txt

The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.

Added:
>
>
In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the YourPlugin topic. Other needed Perl code is best placed in a lib/TWiki/Plugins/YourPlugin/ directory.

The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.


 <<O>>  Difference Topic TWikiPlugins (r1.10 - 02 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="999317099" format="1.0" version="1.9"
>
>
META TOPICINFO MikeMannix? date="999393063" format="1.0" version="1.10"

TWiki Plugins

Changed:
<
<
TWikiPlugins allow you to add new features to TWiki without changing the core program. Using a plug-in approach means that you can:
>
>
Plugin use and development; about the Plugin API.

Changed:
<
<
  • add virtually unlimited features while keeping the main TWiki program compact and efficient;
>
>

Overview

You can add Plugins to greatly extend TWiki's functionality, without alering the program core. With a plug-in approach, you can:

  • add virtually unlimited features while keeping the main TWiki code compact and efficient;

  • heavily customize an installation and still do clean updates to new versions of TWiki;
  • rapidly develop new TWiki functions in Perl using the Plugin API.
Changed:
<
<
Everything to do with TWiki Plugins - including demos, new releases, downloads, and discussion - is available at TWiki.org, in the TWiki.org Plugins web.
>
>
Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the TWiki.org Plugins web.

Preinstalled Plugins

TWiki comes with three Plugins as part of the standard installation.

  • DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)

  • EmptyPlug is a fully functional module, minus active code; it does nothing and serves as a template for new Plugin development.

  • InterwikiPlugin is preinstalled but can be disabled or removed. Use it for quick linking to to remote sites: TWiki:Plugins expands to TWiki:Plugins on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related and other probably useful sites.

Installing Plugins

Line: 21 to 35

  1. Distribute the files to their proper locations - unzip the zip archive in your TWiki installation directory - if have a standard TWiki installation, this will distribute automatically. Otherwise, place the files according to the directory paths listed on the Plugin top in TWiki:Plugins.
  2. Check the demo example on the Plugin topic: if it's working, the installation was fine!
Changed:
<
<
Some Plugins need certain Perl modules to be pre-installed on the host system. Plugins may also use other resources, like graphics, other modules, applications, templates. In these cases, detailed instructions are in the Plugin documentation.
>
>
Special Requests: Some Plugins need certain Perl modules to be preinstalled on the host system. Plugins may also use other resources, like graphics, other modules, applications, templates. In these cases, detailed instructions are in the Plugin documentation.

Changed:
<
<
TWikiPlugin documentation pages are located at TWiki.org, in TWiki:Plugins web. Each Plugin has an doc topic (ex: SomePlugin) and a separate development page.
>
>
Each Plugin has a standard release page, located in the TWiki:Plugins web at TWiki.org. In addition to the documentation topic (SomePlugin), there's a separate development page.

  • Doc page: Read all available info about the Plugin; download the attached distribution files.
Changed:
<
<
  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (ex: SomePluginDev).
>
>
  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (SomePluginDev).

  • User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.
Changed:
<
<

Preinstalled Plugins

>
>

On-Site Pretesting


Changed:
<
<
TWiki comes with three Plugins as part of the standard installation.
>
>
To test new Plugins on your installation before making them public, you may want to use one of these two approaches:

Changed:
<
<
  • DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)
>
>
  • Method 1: Create Production and a Test installation of TWiki.
    • Duplicate the twiki/bin and twiki/lib directories for the Test version, adjusting the paths in the new lib/TWiki.cfg, the twiki/data; the twiki/templates and twiki/pub directories are shared.
    • Test Plugins and other new features in the Test installation until you're satisfied.
    • Copy the modified files to the Production installation. You can update a live TWiki installation and users won't even notice.

Changed:
<
<
  • EmptyPlug is a fully functional Plugin module, minus any active code; it does nothing but serve as a template on demand.
>
>
  • Method 2: List the Plugin under Test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.

Deleted:
<
<
  • InterwikiPlugin is included but can be disabled or removed. Use it for quick linking to frequently linked to remote sites. Ex: TWiki:Plugins expands to TWiki:Plugins - on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related sites.

Managing Plugins

Line: 76 to 92

  • DefaultPlugin: This plugin can be used to specify some simple custom rendering rules. It also renders depreciated *_text_* as bold italic text.
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to tables located in JCuckoo topics.
  • CommentPlugin: Allows users to quickly post comments to a page without an edit/preview/save cycle.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • InterwikiPlugin: Link ExternalSite:Page text to external sites based on aliases defined in the InterWikis topic
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like  :-) for smile or  :cool: for cool!
  • TablePlugin: Control attributes of tables and sorting of table columns

Changed:
<
<
TIP! To test new Plugins on your installation before making them public, you may want to use one of these two approaches:
>
>

The TWiki Plugin API


Changed:
<
<
  • Method 1: Create a Production and a Test installation of TWiki. The twiki/data, twiki/templates and twiki/pub directories are shared, and the twiki/bin and twiki/lib directories are separate. Do all tests of Plugins and other new features in the Test installation. When everything works, copy the modified files over to the Production installation. This way, you can update a live TWiki installation and users won't even notice.
>
>
The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001.

Changed:
<
<
  • Method 2: List the Plugin under test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the test web and do the testing there.
>
>

Available Core Functions


Changed:
<
<

Creating Plugins

>
>
The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.

Changed:
<
<
With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki.
>
>
DevALERT: If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.

Changed:
<
<

Anatomy of a Plugin

>
>
  • For best performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

Changed:
<
<
A basic TWiki Plugin consists of two elements:
>
>

Predefined Hooks


Changed:
<
<
  • a Perl module, ex: YourPlugin.pm
  • a documentation topic, ex: YourPlugin.txt
>
>
In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

Changed:
<
<
The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.
>
>
  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.

Changed:
<
<
The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.
>
>

Plugin Version Detection


Changed:
<
<

TWiki Plugin API

>
>
To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API GetVersion detection routine are provided for automatic compatibility checking.

Changed:
<
<
The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001.
>
>
  • All modules require a $VERSION='0.000' variable, beginning at 1.000.

Changed:
<
<
The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.
>
>
  • The initPlugin handler checks all dependencies and returns TRUE if the initialization is OK or FALSE if something went wrong.
    • The Plugin initialization code does not register a Plugin that returns FALSE (or that has no initPlugin handler).

Changed:
<
<
DevALERT: If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.
>
>

Deleted:
<
<
In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

Changed:
<
<
  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.
>
>

Creating Plugins


Changed:
<
<
  • For improve performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.
>
>
With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki.

The DefaultPlugin Alternative

  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in TWikiPreferences. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.
Added:
>
>

Anatomy of a Plugin

A basic TWiki Plugin consists of two elements:

  • a Perl module, ex: YourPlugin.pm
  • a documentation topic, ex: YourPlugin.txt

The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.

The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.


Creating the Perl Module

Copy file (EmptyPlugin.pm to <name>Plugin.pm =EmptyPlugin.pm= contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

Line: 177 to 203

  1. Attach the distribution zip file to the topic, ex: YourPlugin.zip.
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: YourPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
Changed:
<
<
-- MikeMannix? - 26 Aug 2001
>
>
-- AndreaSterbini? - 29 May 2001
-- MikeMannix? - 01 Sep 2001

 <<O>>  Difference Topic TWikiPlugins (r1.9 - 01 Sep 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="999237943" format="1.0" version="1.8"
>
>
META TOPICINFO MikeMannix? date="999317099" format="1.0" version="1.9"

TWiki Plugins

Line: 28 to 28

  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (ex: SomePluginDev).
  • User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.
Changed:
<
<

Pre-Installed Plugins

>
>

Preinstalled Plugins


TWiki comes with three Plugins as part of the standard installation.

Line: 38 to 38

  • InterwikiPlugin is included but can be disabled or removed. Use it for quick linking to frequently linked to remote sites. Ex: TWiki:Plugins expands to TWiki:Plugins - on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related sites.
Changed:
<
<

Managing Installed Plugins

>
>

Managing Plugins


Ideally, after you've installed a Plugin, just read the instructions and you're set. In fact, some Plugins require additional settings or offer extra options that you can modify on Preferences pages. You may want to make a Plugin available only in certain webs, or temporarily disable it. And having to list all available Plugins will probably come up. You can handle all of these with simple procedures.

Changed:
<
<

Set Preferences for Individual Plugins

>
>

Setting Preferences


Installed Plugins can be toggled on or off, site-wide or by web, through TWikiPreferences and individual WebPreferences:

Line: 59 to 59

    • Set DEBUG = 0
  • The settings can be retrieved as Preferences variables like %<pluginname>_<var>%, ex: %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.
Changed:
<
<

List Active Plugins Automatically

>
>

Listing Active Plugins


Plugin status variables let you list all active Plugins wherever needed. There are two list formats:

  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
Line: 83 to 83

  • Method 2: List the Plugin under test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the test web and do the testing there.

Changed:
<
<

Creating New Plugins

>
>

Creating Plugins


With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki.

Line: 113 to 113

  • For improve performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.
Changed:
<
<

Customize the DefaultPlugin

>
>

The DefaultPlugin Alternative


  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in TWikiPreferences. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.
Changed:
<
<

Create a Plugin Module in Perl

>
>

Creating the Perl Module


Copy file (EmptyPlugin.pm to <name>Plugin.pm =EmptyPlugin.pm= contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

Changed:
<
<

Create a Plugin Documentation Topic

>
>

Writing the Documentation Topic


The Plugin documentation topic contains usage instructions and version details. It serves the Plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic:

Line: 153 to 153

Changed:
<
<

Package a Plugin for Distribution

>
>

Packaging for Distribution


A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: YourPlugin.pm, and a documentation page with the same name(YourPlugin.txt).

Line: 167 to 167

    • pub/TWiki/YourPlugin/uparrow.gif

Changed:
<
<

Publish a Plugin for General Use

>
>

Publishing for Public Use


You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web, where all Plugins submitted to TWiki.org are available for download and further development discussion. Publish your Plugin in three steps:


 <<O>>  Difference Topic TWikiPlugins (r1.8 - 31 Aug 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="998903988" format="1.0" version="1.7"
>
>
META TOPICINFO MikeMannix? date="999237943" format="1.0" version="1.8"

TWiki Plugins

Deleted:
<
<

About Plugins


TWikiPlugins allow you to add new features to TWiki without changing the core program. Using a plug-in approach means that you can:

  • add virtually unlimited features while keeping the main TWiki program compact and efficient;

 <<O>>  Difference Topic TWikiPlugins (r1.7 - 27 Aug 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="998886618" format="1.0" version="1.6"
>
>
META TOPICINFO MikeMannix? date="998903988" format="1.0" version="1.7"

TWiki Plugins

Line: 11 to 11

  • heavily customize an installation and still do clean updates to new versions of TWiki;
  • rapidly develop new TWiki functions in Perl using the Plugin API.
Changed:
<
<
Everything to do with TWiki Plugins - including demos, new releases, downloads, and discussion - is available at TWiki.org, in the TWiki.org Plugins web.
>
>
Everything to do with TWiki Plugins - including demos, new releases, downloads, and discussion - is available at TWiki.org, in the TWiki.org Plugins web.

Installing Plugins

Line: 46 to 46

Set Preferences for Individual Plugins

Changed:
<
<
Installed Plugins can be toggled on or off, site-wide or by web, through TWikiPreferences and individual WebPreferences:
>
>
Installed Plugins can be toggled on or off, site-wide or by web, through TWikiPreferences and individual WebPreferences:

Changed:
<
<
  • All Plugin modules present in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS Preferences variable in TWikiPreferences. You can optionally list the installed Plugins in the INSTALLEDPLUGINS Preferences variable. This is useful to define the sequence of Plugin execution, or to specify other webs than the JCuckoo web for the Plugin topics. Settings in TWikiPreferences are:
>
>
  • All Plugin modules present in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS Preferences variable in TWikiPreferences. You can optionally list the installed Plugins in the INSTALLEDPLUGINS Preferences variable. This is useful to define the sequence of Plugin execution, or to specify other webs than the JCuckoo web for the Plugin topics. Settings in TWikiPreferences are:

    • Set INSTALLEDPLUGINS = DefaultPlugin, ...
    • Set DISABLEDPLUGINS = EmptyPlugin, ...
Line: 64 to 64

List Active Plugins Automatically

Plugin status variables let you list all active Plugins wherever needed. There are two list formats:

Changed:
<
<
  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.
>
>
  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.

DEMO: Active Plugin Variables
Line: 82 to 82

  • Method 1: Create a Production and a Test installation of TWiki. The twiki/data, twiki/templates and twiki/pub directories are shared, and the twiki/bin and twiki/lib directories are separate. Do all tests of Plugins and other new features in the Test installation. When everything works, copy the modified files over to the Production installation. This way, you can update a live TWiki installation and users won't even notice.
Changed:
<
<
  • Method 2: List the Plugin under test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the test web and do the testing there.
>
>
  • Method 2: List the Plugin under test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the test web and do the testing there.

Creating New Plugins

Line: 138 to 138

OUTLINE: Doc Topic Contents
Changed:
<
<
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:
>
>
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:

Changed:
<
<
Syntax Rules: explanation coming up
>
>
Syntax Rules: Describe any special text formatting that will be rendered.

YourPlugin Settings: Description and settings for your custom Plugin %VARIABLES%, and those required by TWiki.

Line: 175 to 175

  1. Post the Plugin documentation topic in the TWiki:Plugins web:
    • create a new topic using the Plugin name, ex: YourPlugin.txt;
Changed:
<
<
>
>

  1. Attach the distribution zip file to the topic, ex: YourPlugin.zip.
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: YourPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

 <<O>>  Difference Topic TWikiPlugins (r1.6 - 27 Aug 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO MikeMannix? date="998854083" format="1.0" version="1.5"
>
>
META TOPICINFO MikeMannix? date="998886618" format="1.0" version="1.6"

TWiki Plugins

Line: 179 to 179

  1. Attach the distribution zip file to the topic, ex: YourPlugin.zip.
  2. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: YourPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
Changed:
<
<
-- MikeMannix? - 26 Aug 2001
>
>
-- MikeMannix? - 26 Aug 2001

 <<O>>  Difference Topic TWikiPlugins (r1.5 - 26 Aug 2001 - MikeMannix?)
Changed:
<
<
META TOPICINFO PeterThoeny date="995108962" format="1.0beta2" version="1.4"

TWiki Plugins

>
>
META TOPICINFO MikeMannix? date="998854083" format="1.0" version="1.5"

TWiki Plugins


Changed:
<
<
Plugins allow you to extend the syntax or functionality of TWiki. ...
>
>

About Plugins


Changed:
<
<
TWikiPreferences has the list of installed plugins and activated plugins.
>
>
TWikiPlugins allow you to add new features to TWiki without changing the core program. Using a plug-in approach means that you can:

Changed:
<
<

How to Create a Plugin

>
>
  • add virtually unlimited features while keeping the main TWiki program compact and efficient;
  • heavily customize an installation and still do clean updates to new versions of TWiki;
  • rapidly develop new TWiki functions in Perl using the Plugin API.

Changed:
<
<
under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )
>
>
Everything to do with TWiki Plugins - including demos, new releases, downloads, and discussion - is available at TWiki.org, in the TWiki.org Plugins web.

Changed:
<
<

How to Install a Plugin

>
>

Installing Plugins


Changed:
<
<
under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )
>
>
Each TWikiPlugin comes with full documentation: step-by-step installation instructions, a detailed description of any special requirements, version details, and a working example for testing.

Changed:
<
<

Plugins under the hood

>
>
Most Plugins can be installed in three easy steps, with no programming skills required:
  1. Download the zip file containing the Plugin, documentation, and any other required files, from TWiki:Plugins.
  2. Distribute the files to their proper locations - unzip the zip archive in your TWiki installation directory - if have a standard TWiki installation, this will distribute automatically. Otherwise, place the files according to the directory paths listed on the Plugin top in TWiki:Plugins.
  3. Check the demo example on the Plugin topic: if it's working, the installation was fine!

Changed:
<
<
  • All plugin modules that exist in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS preferences variable in TWikiPreferences. You can optionally list the installed plugins in the INSTALLEDPLUGINS preferences variable. This is useful to define the sequence of plugin execution, or to specify other webs then the JCuckoo web for the plugin topics. Settings in TWikiPreferences:
    • Set INSTALLEDPLUGINS = DefaultPlugin, ...
    • Set DISABLEDPLUGINS = EmptyPlugin, ...
>
>
Some Plugins need certain Perl modules to be pre-installed on the host system. Plugins may also use other resources, like graphics, other modules, applications, templates. In these cases, detailed instructions are in the Plugin documentation.

Changed:
<
<
  • The %ACTIVATEDPLUGINS% variable shows all currently activated plugins. This variable is shown in TWikiPreferences for debug reasons.
>
>
TWikiPlugin documentation pages are located at TWiki.org, in TWiki:Plugins web. Each Plugin has an doc topic (ex: SomePlugin) and a separate development page.
  • Doc page: Read all available info about the Plugin; download the attached distribution files.
  • Dev page: Post feature requests, bug reports and general dev comments; topic title ends in Dev (ex: SomePluginDev).
  • User support: Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.

Changed:
<
<
  • Search order for plugin topics: Full web.topicname name is used if specified in INSTALLEDPLUGINS, then the TWiki web is searched, then the current web.
>
>

Pre-Installed Plugins


Changed:
<
<
  • Plugin specific settings are done in individual plugin topics. Two settings are standard for each plugin:
    • One line description, used to form the bullets describing the plugins in the TextFormattingRules topic:
      • Set SHORTDESCRIPTION = Blah blah.
    • Debug plugin, output can be seen in data/debug.txt: (Se to 0 or 1)
      • Set DEBUG = 0
    • The settings can be retrieved as preferences variables like %<pluginname>_<var>%, i.e. %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.
>
>
TWiki comes with three Plugins as part of the standard installation.

Changed:
<
<
  • The %PLUGINDESCRIPTIONS% variable shows a bullet list with descriptions of all currently activated plugins. This variable is based on %<plugin>_SHORTDESCRIPTION% preferences variables of individual topics and is shown in TextFormattingRules.
>
>
  • DefaultPlugin handles some legacy TWiki variables that may be present in long-established sites. This option can be controlled from TWikiPreferences. (Perl programmers can also add rules for simple custom processing.)

Changed:
<
<
-- PeterThoeny - 14 Jul 2001
>
>
  • EmptyPlug is a fully functional Plugin module, minus any active code; it does nothing but serve as a template on demand.

  • InterwikiPlugin is included but can be disabled or removed. Use it for quick linking to frequently linked to remote sites. Ex: TWiki:Plugins expands to TWiki:Plugins - on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related sites.

Managing Installed Plugins

Ideally, after you've installed a Plugin, just read the instructions and you're set. In fact, some Plugins require additional settings or offer extra options that you can modify on Preferences pages. You may want to make a Plugin available only in certain webs, or temporarily disable it. And having to list all available Plugins will probably come up. You can handle all of these with simple procedures.

Set Preferences for Individual Plugins

Installed Plugins can be toggled on or off, site-wide or by web, through TWikiPreferences and individual WebPreferences:

  • All Plugin modules present in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS Preferences variable in TWikiPreferences. You can optionally list the installed Plugins in the INSTALLEDPLUGINS Preferences variable. This is useful to define the sequence of Plugin execution, or to specify other webs than the JCuckoo web for the Plugin topics. Settings in TWikiPreferences are:
    • Set INSTALLEDPLUGINS = DefaultPlugin, ...
    • Set DISABLEDPLUGINS = EmptyPlugin, ...

Plugin execution order in TWiki is determined by searching Plugin topics in a specific sequence: First, full web.topicname name, if specified in INSTALLEDPLUGINS; next, the TWiki web is searched; and finally, the current web.

Plugin-specific settings are done in individual Plugin topics. Two settings are standard for each Plugin:

  1. One line description, used to form the bullets describing the Plugins in the TextFormattingRules topic:
    • Set SHORTDESCRIPTION = Blah blah woof woof.
  2. Debug Plugin, output can be seen in data/debug.txt. Set to 0=off or 1=on:
    • Set DEBUG = 0
  • The settings can be retrieved as Preferences variables like %<pluginname>_<var>%, ex: %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.

List Active Plugins Automatically

Plugin status variables let you list all active Plugins wherever needed. There are two list formats:

  • The %ACTIVATEDPLUGINS% variable lists activated Plugins by name. (This variable is displayed in TWikiPreferences for debugging use.)
  • The %PLUGINDESCRIPTIONS% variable displays a bullet list with a one-line description of each active Plugins. This variable is based on the %<plugin>_SHORTDESCRIPTION% Preferences variables of individual topics and is shown in TextFormattingRules.

DEMO: Active Plugin Variables

%ACTIVATEDPLUGINS%
On this TWiki site, the active Plugins are: DefaultPlugin, SpreadSheetPlugin, CommentPlugin, EditTablePlugin, InterwikiPlugin, RenderListPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin.

%PLUGINDESCRIPTIONS%
You can use any of these active TWiki Plugins:

  • DefaultPlugin: This plugin can be used to specify some simple custom rendering rules. It also renders depreciated *_text_* as bold italic text.
  • SpreadSheetPlugin: Add spreadsheet calculation like "$SUM( $ABOVE() )" to tables located in JCuckoo topics.
  • CommentPlugin: Allows users to quickly post comments to a page without an edit/preview/save cycle.
  • EditTablePlugin: Edit TWiki tables using edit fields, date pickers and drop down boxes
  • InterwikiPlugin: Link ExternalSite:Page text to external sites based on aliases defined in the InterWikis topic
  • RenderListPlugin: Render bullet lists in a variety of formats
  • SlideShowPlugin: Create web based presentations based on topics with headings.
  • SmiliesPlugin: Render smilies as icons, like  :-) for smile or  :cool: for cool!
  • TablePlugin: Control attributes of tables and sorting of table columns

TIP! To test new Plugins on your installation before making them public, you may want to use one of these two approaches:

  • Method 1: Create a Production and a Test installation of TWiki. The twiki/data, twiki/templates and twiki/pub directories are shared, and the twiki/bin and twiki/lib directories are separate. Do all tests of Plugins and other new features in the Test installation. When everything works, copy the modified files over to the Production installation. This way, you can update a live TWiki installation and users won't even notice.

  • Method 2: List the Plugin under test in the DISABLEDPLUGINS variable in TWikiPreferences. Redefine the DISABLEDPLUGINS variable in the test web and do the testing there.

Creating New Plugins

With a reasonable knowledge of the Perl scripting language, you can create new Plugins or modify and extend existing ones. Basic plug-in architecture uses an Application Programming Interface (API), a set of software instructions that allow external code to interact with the main program. The TWiki Plugin API Plugins by providing a programming interface for TWiki.

Anatomy of a Plugin

A basic TWiki Plugin consists of two elements:

  • a Perl module, ex: YourPlugin.pm
  • a documentation topic, ex: YourPlugin.txt

The Perl module can be a block of code that connects with TWiki alone, or it can include other elements, like other Perl modules (including other Plugins), graphics, TWiki templates, external applications (ex: a Java applet), or just about anything else it can call.

The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the Plugin API, you're ready to develop Plugins.

TWiki Plugin API

The Application Programming Interface (API) for TWikiPlugins provides the specifications for hooking into the core TWiki code from your external Perl Plugin module. The Plugin API is new to the Production version of TWiki with the TWikiReleaseSpring2001.

The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.

DevALERT: If you use functions not in Func.pm, you run the risk of creating security holes. Also, your Plugin will likely break and require updating when you upgrade to a new version of TWiki.

In addition to TWiki core functions, Plugins can use predefined hooks, or call backs, listed in the lib/TWiki/Plugins/EmptyPlugin.pm module.

  • All but the initPlugin are disabled. To enable a call back, remove DISABLE_ from the function name.

  • For improve performance, enable only the functions you really need. NOTE: outsidePREHandler and insidePREHandler are particularly expensive.

Customize the DefaultPlugin

  • DefaultPlugin can handle some outdated TWiki variables, found, for example, in sites recently updated from an old version. Settings are in TWikiPreferences. You can also add your own simple custom processing rules here, though in all but very simple cases, writing a new Plugin is preferable.

Create a Plugin Module in Perl

Copy file (EmptyPlugin.pm to <name>Plugin.pm =EmptyPlugin.pm= contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the Plugin API specs for more information.

Create a Plugin Documentation Topic

The Plugin documentation topic contains usage instructions and version details. It serves the Plugin files as FileAttachments for downloading. (The doc topic is also included in the distribution package.) To create a documentation topic:

  1. Copy the Plugin topic template from http://TWiki.org/cgi-bin/view/TWiki/EmptyPlugin. To copy the text, go to the page and:
    • click Edit
    • select all in the Edit box & copy
    • Cancel the edit
    • paste & save as a text file or new topic on your site
  2. Customize the template for your Plugin; you'll probably want to post a working version on your local TWiki site.
  3. Save your topic as a text file, for use in packaging and publishing your Plugin.

OUTLINE: Doc Topic Contents
Check EmptyPlugin on TWiki.org for the latest Plugin doc topic template. Here's a quick overview of what's covered:

Syntax Rules: explanation coming up

YourPlugin Settings: Description and settings for your custom Plugin %VARIABLES%, and those required by TWiki.

Plugins Preferences work exactly like TWikiPreferences and WebPreferences: six (6) spaces and then:

    • Set EXAMPLE = got it!

How-to Instructions: Step-by-step set-up guide, user help, whatever it takes to install and run, goes here.

Test Example: Include an example of the Plugin in action: if it works, the installation was a success!

Plugin Info: Version, credits, history, requirements - entered in a form, displayed as a table. Both are automatically generated when you create or edit a page in the TWiki:Plugins web.

Package a Plugin for Distribution

A minimum Plugin release consists of a Perl module with a WikiName that ends in Plugin, ex: YourPlugin.pm, and a documentation page with the same name(YourPlugin.txt).

  1. Distribute your Plugin files in a directory structure that mirrors TWiki. If your Plugin uses additional files, include them ALL:
    • lib/TWiki/Plugins/YourPlugin.pm
    • data/TWiki/YourPlugin.txt
    • pub/TWiki/YourPlugin/uparrow.gif [a required graphic]
  2. Create a zip archive with the Plugin name (YourPlugin.zip) and add the entire directory structure from Step 1. Your archive should look like this:
    • lib/TWiki/Plugins/YourPlugin.pm
    • data/TWiki/YourPlugin.txt
    • pub/TWiki/YourPlugin/uparrow.gif

Publish a Plugin for General Use

You can release your tested, packaged Plugin to the TWiki community through the TWiki:Plugins web, where all Plugins submitted to TWiki.org are available for download and further development discussion. Publish your Plugin in three steps:

  1. Post the Plugin documentation topic in the TWiki:Plugins web:
  2. Attach the distribution zip file to the topic, ex: YourPlugin.zip.
  3. Link from the doc page to a new, blank page named after the Plugin, and ending in Dev, ex: YourPluginDev. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)

-- MikeMannix? - 26 Aug 2001


 <<O>>  Difference Topic TWikiPlugins (r1.4 - 14 Jul 2001 - PeterThoeny)
Added:
>
>
META TOPICINFO PeterThoeny date="995108962" format="1.0beta2" version="1.4"

TWiki Plugins

Plugins allow you to extend the syntax or functionality of TWiki. ...

Line: 12 to 13

under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )

Changed:
<
<
-- PeterThoeny - 17 Feb 2001
>
>

Plugins under the hood

  • All plugin modules that exist in the lib/TWiki/Plugins directory are activated automatically unless disabled by the DISABLEDPLUGINS preferences variable in TWikiPreferences. You can optionally list the installed plugins in the INSTALLEDPLUGINS preferences variable. This is useful to define the sequence of plugin execution, or to specify other webs then the JCuckoo web for the plugin topics. Settings in TWikiPreferences:
    • Set INSTALLEDPLUGINS = DefaultPlugin, ...
    • Set DISABLEDPLUGINS = EmptyPlugin, ...

  • The %ACTIVATEDPLUGINS% variable shows all currently activated plugins. This variable is shown in TWikiPreferences for debug reasons.

  • Search order for plugin topics: Full web.topicname name is used if specified in INSTALLEDPLUGINS, then the TWiki web is searched, then the current web.

  • Plugin specific settings are done in individual plugin topics. Two settings are standard for each plugin:
    • One line description, used to form the bullets describing the plugins in the TextFormattingRules topic:
      • Set SHORTDESCRIPTION = Blah blah.
    • Debug plugin, output can be seen in data/debug.txt: (Se to 0 or 1)
      • Set DEBUG = 0
    • The settings can be retrieved as preferences variables like %<pluginname>_<var>%, i.e. %DEFAULTPLUGIN_SHORTDESCRIPTION% shows the description of the DefaultPlugin.

  • The %PLUGINDESCRIPTIONS% variable shows a bullet list with descriptions of all currently activated plugins. This variable is based on %<plugin>_SHORTDESCRIPTION% preferences variables of individual topics and is shown in TextFormattingRules.

-- PeterThoeny - 14 Jul 2001


 <<O>>  Difference Topic TWikiPlugins (r1.3 - 14 Mar 2001 - PeterThoeny)

Plugins allow you to extend the syntax or functionality of TWiki. ...

Added:
>
>
TWikiPreferences has the list of installed plugins and activated plugins.

How to Create a Plugin

under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )


 <<O>>  Difference Topic TWikiPlugins (r1.2 - 04 Mar 2001 - PeterThoeny)
Added:
>
>

TWiki Plugins


Plugins allow you to extend the syntax or functionality of TWiki. ...
Changed:
<
<
How to Create a Plugin
>
>

How to Create a Plugin


under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )

Changed:
<
<
How to Install a Plugin
>
>

How to Install a Plugin


under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )


 <<O>>  Difference Topic TWikiPlugins (r1.1 - 17 Feb 2001 - PeterThoeny)
Line: 1 to 1
Added:
>
>
Plugins allow you to extend the syntax or functionality of TWiki. ...

How to Create a Plugin

under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )

How to Install a Plugin

under construction... ( check back at http://TWiki.org/cgi-bin/view/TWiki/TWikiPlugins )

-- PeterThoeny - 17 Feb 2001


Topic: TWikiPlugins . { View | Diffs | r1.27 | > | r1.26 | > | r1.25 | More }

Revision r1.1 - 17 Feb 2001 - 08:35 - PeterThoeny
Revision r1.27 - 18 May 2004 - 06:49 - PeterThoeny