none
[openafs-wiki.git] / TWiki / TWikiPlugins.mdwn
index 13d1f94..33c3982 100644 (file)
@@ -1,17 +1,26 @@
 <div>
   <ul>
     <li><a href="#TWiki Plugins"> TWiki Plugins</a><ul>
-        <li><a href="#Installing Plugins"> Installing Plugins</a></li>
+        <li><a href="#Overview"> Overview</a></li>
         <li><a href="#Preinstalled Plugins"> Preinstalled Plugins</a></li>
+        <li><a href="#Installing Plugins"> Installing Plugins</a><ul>
+            <li><a href="#On-Site Pretesting"> On-Site Pretesting</a></li>
+          </ul>
+        </li>
         <li><a href="#Managing Plugins"> Managing Plugins</a><ul>
             <li><a href="#Setting Preferences"> Setting Preferences</a></li>
             <li><a href="#Listing Active Plugins"> Listing Active Plugins</a></li>
           </ul>
         </li>
+        <li><a href="#The TWiki Plugin API"> The TWiki Plugin API</a><ul>
+            <li><a href="#Available Core Functions"> Available Core Functions</a></li>
+            <li><a href="#Predefined Hooks"> Predefined Hooks</a></li>
+            <li><a href="#Plugin Version Detection"> Plugin Version Detection</a></li>
+          </ul>
+        </li>
         <li><a href="#Creating Plugins"> Creating Plugins</a><ul>
-            <li><a href="#Anatomy of a Plugin"> Anatomy of a Plugin</a></li>
-            <li><a href="#TWiki Plugin API"> TWiki Plugin API</a></li>
             <li><a href="#The _DefaultPlugin Alternative"> The DefaultPlugin Alternative</a></li>
+            <li><a href="#Anatomy of a Plugin"> Anatomy of a Plugin</a></li>
             <li><a href="#Creating the Perl Module"> Creating the Perl Module </a></li>
             <li><a href="#Writing the Documentation Topic"> Writing the Documentation Topic</a></li>
             <li><a href="#Packaging for Distribution"> Packaging for Distribution</a></li>
   </ul>
 </div>
 
-## <a name="TWiki Plugins"></a> TWiki Plugins
+# <a name="TWiki Plugins"></a> TWiki Plugins
 
-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.
 
-- add virtually unlimited features while keeping the main TWiki program compact and efficient;
+## <a name="Overview"></a> 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.
 
-Everything to do with TWiki Plugins - including demos, new releases, downloads, and discussion - is available at TWiki.org, in the ** [[TWiki.org Plugins web|Main/TWiki:Plugins]]**.
+Everything to do with TWiki Plugins - demos, new releases, downloads, development, general discussion - is available at TWiki.org, in the **[[TWiki.org Plugins web|Main/TWiki:Plugins]]**.
+
+## <a name="Preinstalled Plugins"></a> 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|Main/WebHome#Customize_the_DefaultPlugin]] 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: <code>**TWiki:Plugins**</code> 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.
 
 <a name="InstallPlugin"></a>
 
-### <a name="Installing Plugins"></a> Installing Plugins
+## <a name="Installing Plugins"></a> 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.
 
@@ -45,29 +68,30 @@ Most Plugins can be installed in three easy steps, with no programming skills re
 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!
 
-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.
 
-TWikiPlugin documentation pages are located at TWiki.org, in TWiki:Plugins web. Each Plugin has an doc topic (ex: <code>**SomePlugin**</code>) 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 (<code>**SomePlugin**</code>), there's 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 <code>**Dev**</code> (ex: <code>**SomePluginDev**</code>).
+- **Dev page:** Post feature requests, bug reports and general dev comments; topic title ends in <code>**Dev**</code> (<code>**SomePluginDev**</code>).
 - **User support:** Post installation, how to use type questions (and answers, if you have them) in the TWiki:Support web.
 
-### <a name="Preinstalled Plugins"></a> Preinstalled Plugins
+### <a name="On-Site Pretesting"></a> On-Site Pretesting
 
-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|Main/WebHome#Customize_the_DefaultPlugin]] for simple custom processing.)
+To test new Plugins on your installation before making them public, you may want to use one of these two approaches:
 
-- **EmptyPlug** is a fully functional Plugin module, minus any active code; it does nothing but serve as a template on demand.
+- **Method 1:** Create Production and a Test installation of TWiki.
+  - Duplicate the <code>**twiki/bin**</code> and <code>**twiki/lib**</code> directories for the Test version, adjusting the paths in the new <code>**lib/TWiki.cfg**</code>, the <code>**twiki/data**</code>; the <code>**twiki/templates**</code> and <code>**twiki/pub**</code> 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.
 
-- **InterwikiPlugin** is included but can be disabled or removed. Use it for quick linking to frequently linked to remote sites. Ex: <code>**TWiki:Plugins**</code> expands to TWiki:Plugins - on TWiki.org. You can add your own shortcuts and URLs to the existing directory of Wiki-related sites.
+- **Method 2:** List the Plugin under <code>**Test**</code> in the DISABLEDPLUGINS variable in [[TWikiPreferences]]. Redefine the DISABLEDPLUGINS variable in the Test web and do the testing there.
 
-### <a name="Managing Plugins"></a> Managing Plugins
+## <a name="Managing Plugins"></a> Managing Plugins
 
 Ideally, after you've [[installed a Plugin|Main/WebHome#InstallPlugin]], 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.
 
-#### <a name="Setting Preferences"></a> Setting Preferences
+### <a name="Setting Preferences"></a> Setting Preferences
 
 Installed Plugins can be **toggled on or off**, site-wide or by web, through TWikiPreferences and individual WebPreferences:
 
@@ -86,7 +110,7 @@ Installed Plugins can be **toggled on or off**, site-wide or by web, through TWi
 
 - The settings can be retrieved as Preferences variables like <code>**%&lt;pluginname&gt;\_&lt;var&gt;%**</code>, ex: <code>**%DEFAULTPLUGIN\_SHORTDESCRIPTION%**</code> shows the description of the DefaultPlugin.
 
-#### <a name="Listing Active Plugins"></a> Listing Active Plugins
+### <a name="Listing Active Plugins"></a> Listing Active Plugins
 
 Plugin status variables let you list all active Plugins wherever needed. There are two list formats:
 
@@ -109,56 +133,65 @@ Plugin status variables let you list all active Plugins wherever needed. There a
 > - [[TablePlugin]] <span>(1.020, 12339)</span>:
 > - [[TwistyPlugin]] <span>(1.2.0, $Rev: 12154$)</span>:
 
-**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 <code>**twiki/data**</code>, <code>**twiki/templates**</code> and <code>**twiki/pub**</code> directories are shared, and the <code>**twiki/bin**</code> and <code>**twiki/lib**</code> 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.
+<a name="PluginAPI"></a>
 
-- **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.
+## <a name="The TWiki Plugin API"></a> The TWiki Plugin API
 
-<a name="CreatePlugins"></a>
+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.
 
-### <a name="Creating Plugins"></a> Creating Plugins
+### <a name="Available Core Functions"></a> Available Core Functions
 
-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|Main/WebHome#PluginAPI]] Plugins by providing a programming interface for TWiki.
+The <code>**lib/TWiki/Func.pm**</code> implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.
 
-#### <a name="Anatomy of a Plugin"></a> Anatomy of a Plugin
+<span><font>**DevALERT:**</font></span> If you use functions not in <code>**Func.pm**</code>, 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.
 
-A basic TWiki Plugin consists of two elements:
+- For best performance, enable only the functions you really need. NOTE: <code>**outsidePREHandler**</code> and <code>**insidePREHandler**</code> are particularly expensive.
 
-- a Perl module, ex: <code>**YourPlugin.pm**</code>
-- a documentation topic, ex: <code>**YourPlugin.txt**</code>
+### <a name="Predefined Hooks"></a> Predefined Hooks
 
-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.
+In addition to TWiki core functions, Plugins can use **predefined hooks**, or **call backs**, listed in the <code>**lib/TWiki/Plugins/EmptyPlugin.pm**</code> module.
 
-The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the [[Plugin API|Main/WebHome#PluginAPI]], you're ready to develop Plugins.
+- All but the initPlugin are disabled. To enable a call back, remove <code>**DISABLE\_**</code> from the function name.
 
-<a name="PluginAPI"></a>
+### <a name="Plugin Version Detection"></a> Plugin Version Detection
 
-#### <a name="TWiki Plugin API"></a> TWiki Plugin API
+To eliminate the incompatibility problems bound to arise from active open Plugin development, a Plugin versioning system and an API <code>**GetVersion**</code> detection routine are provided for automatic compatibility checking.
 
-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 <code>**$VERSION='0.000'**</code> variable, beginning at <code>**1\.000**</code>.
 
-The <code>**lib/TWiki/Func.pm**</code> implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.
+- The <code>**initPlugin**</code> 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 <code>**initPlugin**</code> handler).
 
-<span><font>**DevALERT:**</font></span> If you use functions not in <code>**Func.pm**</code>, 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.
+- <code>**$VERSION='1.000'**</code> is the current setting in <code>**TWiki::Plugins.pm**</code> and in the preinstalled system Plugins ([[DefaultPlugin]], [[EmptyPlugin]], [[InterwikiPlugin]]).
 
-In addition to TWiki core functions, Plugins can use **predefined hooks**, or **call backs**, listed in the <code>**lib/TWiki/Plugins/EmptyPlugin.pm**</code> module.
+<a name="CreatePlugins"></a>
 
-- All but the initPlugin are disabled. To enable a call back, remove <code>**DISABLE\_**</code> from the function name.
+## <a name="Creating Plugins"></a> Creating Plugins
 
-- For improve performance, enable only the functions you really need. NOTE: <code>**outsidePREHandler**</code> and <code>**insidePREHandler**</code> 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|Main/WebHome#PluginAPI]] Plugins by providing a programming interface for TWiki.
 
-#### <a name="The _DefaultPlugin Alternative"></a> The DefaultPlugin Alternative
+### <a name="The _DefaultPlugin Alternative"></a> 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.
 
-#### <a name="Creating the Perl Module"></a> Creating the Perl Module
+### <a name="Anatomy of a Plugin"></a> Anatomy of a Plugin
+
+A basic TWiki Plugin consists of two elements:
+
+- a Perl module, ex: <code>**YourPlugin.pm**</code>
+- a documentation topic, ex: <code>**YourPlugin.txt**</code>
+
+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. In particular, files that should be web-accessible (graphics, Java applets ...) are best placed as attachments of the <code>**YourPlugin**</code> topic. Other needed Perl code is best placed in a <code>**lib/TWiki/Plugins/YourPlugin/**</code> directory.
+
+The Plugin API handles the details of connecting your Perl module with main TWiki code. When you're familiar with the [[Plugin API|Main/WebHome#PluginAPI]], you're ready to develop Plugins.
+
+### <a name="Creating the Perl Module"></a> Creating the Perl Module
 
 Copy file ([`EmptyPlugin.pm`](http://twiki.org/lib/TWiki/Plugins/EmptyPlugin.pm) to <code>**&lt;name&gt;Plugin.pm**</code> <code>**EmptyPlugin.pm**</code> contains no executable code, so it does nothing, but it's ready to be used. Customize it. Refer to the [[Plugin API|Main/WebHome#PluginAPI]] specs for more information.
 
 <a name="CreatePluginTopic"></a>
 
-#### <a name="Writing the Documentation Topic"></a> Writing the Documentation Topic
+### <a name="Writing the Documentation Topic"></a> 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|Main/WebHome#CreatePluginPackage]].) To create a documentation topic:
 
@@ -196,7 +229,7 @@ The Plugin documentation topic contains usage instructions and version details.
 
 <a name="CreatePluginPackage"></a>
 
-#### <a name="Packaging for Distribution"></a> Packaging for Distribution
+### <a name="Packaging for Distribution"></a> Packaging for Distribution
 
 A minimum Plugin release consists of a Perl module with a [[WikiName]] that ends in <code>**Plugin**</code>, ex: <code>**YourPlugin.pm**</code>, and a documentation page with the same name(<code>**YourPlugin.txt**</code>).
 
@@ -211,7 +244,7 @@ A minimum Plugin release consists of a Perl module with a [[WikiName]] that ends
 
 <a name="PublishPlugin"></a>
 
-#### <a name="Publishing for Public Use"></a> Publishing for Public Use
+### <a name="Publishing for Public Use"></a> 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:
 
@@ -221,4 +254,4 @@ You can release your tested, packaged Plugin to the TWiki community through the
 2. **Attach** the distribution zip file to the topic, ex: <code>**YourPlugin.zip**</code>.
 3. **Link** from the doc page to a new, blank page named after the Plugin, and ending in <code>**Dev**</code>, ex: <code>**YourPluginDev**</code>. This is the discussion page for future development. (User support for Plugins is handled in TWiki:Support.)
 
--- [[MikeMannix]] - 26 Aug 2001
+-- [[AndreaSterbini]] - 29 May 2001 <br /> -- [[MikeMannix]] - 01 Sep 2001