Difference: TWikiPlugins (34 vs. 35)

Revision 352010-05-14 - TWikiContributor

Line: 1 to 1
 

TWiki Plugins

Line: 190 to 190
 
    • select all in the Edit box & copy
    • Cancel the edit
    • go back to your site to the TWiki web
Changed:
<
<
    • In the GoBox enter your plugin name, for example MyFirstPlugin, press enter and create the new topic
>
>
    • In the JumpBox 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.
    • Important: In case you plan to publish your plugin on TWiki.org, use Interwiki names for author names and links to TWiki.org topics, such as TWiki:Main/TWikiGuest. This is important because links should work properly in a plugin topic installed on any TWiki, not just on TWiki.org.
Line: 289 to 289
 Config.spec files are read during TWiki configuration. Once a Config.spec has defined a configuration item, it is available for edit through the standard configure interface. Config.spec files are stored in the 'plugin directory' e.g. lib/TWiki/Plugins/BathPlugin/Config.spec.

Structure of a Config.spec file

Changed:
<
<
The Config.spec file for a plugin starts with the plugin announcing what it is:
>
>
The Config.spec file for an extension starts with the extension announcing what it is:
 
# ---+ BathPlugin
# This plugin senses the level of water in your bath, and ensures the plug
Line: 303 to 303
  # *NUMBER* # Enter the chain length in cm
Changed:
<
<
$TWiki::cfg{BathPlugin}{ChainLength} = '30';
>
>
$TWiki::cfg{BathPlugin}{ChainLength} = 30;
  # *BOOLEAN EXPERT*
Changed:
<
<
# Turn this option off to disable the water temperature alarm $TWiki::cfg{BathPlugin}{TempSensorEnabled} = '1';
>
>
# Set this option to 0 to disable the water temperature alarm $TWiki::cfg{BathPlugin}{TempSensorEnabled} = 1;
 
Changed:
<
<
The type (e.g. **SELECT** ) tells configure to how to prompt for the value. It also tells configure how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items $TWiki::cfg{BathPlugin}{PlugType}, $TWiki::cfg{BathPlugin}{ChainLength}, and $TWiki::cfg{BathPlugin}{TempSensorEnabled} for use in your plugin. For example,
>
>
The type (e.g. **SELECT** ) tells configure to how to prompt for the value. It also tells configure how to do some basic checking on the value you actually enter. All the comments between the type and the configuration item are taken as part of the description. The configuration item itself defines the default value for the configuration item. The above spec defines the configuration items $TWiki::cfg{BathPlugin}{PlugType}, $TWiki::cfg{BathPlugin}{ChainLength}, and $TWiki::cfg{BathPlugin}{TempSensorEnabled} for use in your plugin. For example,
 
if( $TWiki::cfg{BathPlugin}{TempSensorEnabled} && $curTemperature > 50 ) {
    die "The bathwater is too hot for comfort";
}
Changed:
<
<
The config.spec file is read by configure, and configure then writes LocalSite.cfg with the values chosen by the local site admin.
>
>
The config.spec file is read by configure, which then writes LocalSite.cfg with the values chosen by the local site admin.
  A range of types are available for use in Config.spec files:
Line: 342 to 342
  See lib/TWiki.spec for many more examples.
Changed:
<
<
Config.spec files are also used for other (non-plugin) extensions. in this case they are stored under the Contrib directory instead of the Plugins directory.
>
>
Config.spec files for non-plugin extensions are stored under the Contrib directory instead of the Plugins directory.

Note that from TWiki 5.0 onwards, CGI scripts (in the TWiki bin directory) provided by extensions must also have an entry in the Config.spec file. This entry looks like this (example taken from PublishContrib)

# **PERL H**
# Bin script registration - do not modify
$TWiki::cfg{SwitchBoard}{publish} = [ "TWiki::Contrib::Publish", "publish", { publishing => 1 } ];
PERL specifies a perl data structure, and H a hidden setting (it won't appear in configure). The first field of the data value specifies the class where the function that implements the script can be found. The second field specifies the name of the function, which must be the same as the name of the script. The third parameter is a hash of initial context settings for the script.
  TWiki:TWiki/SpecifyingConfigurationItemsForExtensions has supplemental documentation on configure settings.
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiPlugins.