This page contains all documentation topics as one long and complete reference sheet. Use the extended menu below to jump directly to sections. Doubleclick anywhere on-screen to return to the top of the page.
(You can also browse the TWiki reference as individual pages from the full topics menu.)
Server and client system requirements for TWiki 01-Sep-2001
Overview
Maintaining minimum client and server requirements is necessary to keep TWiki deployment as broad as possible.
Server Requirements
TWiki is written in Perl 5, uses a number of shell commands, and requires RCS (Revision Control System), a GNU Free Software package. TWiki is developed in a basic Linux/Apache environment. It also works with Microsoft Windows, and should have no problem on any other platform that meets the requirements:
Required Server Environment
Resource
Unix
Windows
Perl
5.005_03 or higher
Non standard Perl modules
Net::SMTP (or sendmail)
Net::SMTP, MIME::Base64, Digest::SHA1
RCS
5.7 or higher
Other external programs
ls, fgrep, egrep
Web server
Apache; others (with support for CGI, authentication, extended path) *
Current documentation covers Linux only. A TWikiOnWindows installation guide is next.
generates XHTML 1.0 pages that are compatible with HTML 3.2
minimal use of JavaScript in the user interface (degrades gracefully)
no cookies
no CSS
You can easily add capabilities, through customizing the templates, for one, while tailoring the browser requirements to your situation.
Known Issues
The new TWikiPlugins feature currently does not have compatibility guidelines for developers. Plugins can require just about anything: browser-specific functions, stylesheets (CSS), DHTML, Java applets, cookies.
Restricting read and write access to topics and webs, by users and groups
Overview
TWikiAccessControl allows you restrict access to single topics and entire webs, by individual user and by user groups, in three main areas: view; edit & attach; and rename/move/delete. These controls, combined with TWikiUserAuthentication, let you easily create and manage an extremely flexible, fine-grained privilege system.
An Important Control Consideration
Open, freeform editing is the essence of the WikiCulture - it's what makes TWiki different and often more effective than other collaboration tools. So, it is strongly recommended that decisions to restrict read or write access to a web or a topic are made with care. Experience shows that unrestricted write access works very well because:
Peer influence is enough to ensure that only relevant content is posted.
Peer editing - the ability to rearrange anything on a page - keeps topics focussed.
All content is preserved under revision control.
Edits can be undone by the TWikiAdminGroup (the default administrators group; see #ManagingGroups).
Users are encouraged to edit and refactor (condense a long topic), since there's a safety net.
As a collaboration guideline:
Create broad groups (more and varied input), and...
Avoid creating view-only users (if you can read it, you can contribute to it).
Users and Groups
Access control is based on users and groups. Users are defined by their WikiNames, an then organized into unlimited combinations under different user groups.
Managing Users
A user is created by with the TWikiRegistration form. The process generates a topic in the Main web in the new user's WikiName. The default visitor name is TWikiGuest?.
Users can be authenticated using Basic Authentication or SSL. TWikiUserAuthentication is required in order to track user identities.
Managing Groups
Groups are defined by group topics in the Main web, like the TWikiAdminGroup. To start a new group:
Create a new topic with A name that ends in Group, SomeGroup
Define two variables:
Set GROUP = < list of users and groups >
Set ALLOWTOPICCHANGE = < list of users and groups >
GROUP is a comma-separated list of users and of other groups: Set GROUP = Main.SomeUser, Main.OtherUser, Main.SomeOtherGroup
ALLOWTOPICCHANGE defines who is allowed to change the group topic; it is a comma delimited list of users and groups. You typically want to restrict that to the members of the group itself, so it should contain the name of the topic, Set ALLOWTOPICCHANGE = Main.TWikiAdminGroup
for the TWikiAdminGroup topic. (This prevents users not in the group from editing the topic and from gaining unauthorized membership to the group.)
Restricting Write Access
You can define who is allowed to make changes to a web or a topic.
Deny Editing by Topic
Denying editing of a topic also restricts attaching files to it; both privileges are assigned together.
Define one or both of these variables in a topic, preferably at the end of the page:
Set DENYTOPICCHANGE = < list of users and groups >
Set ALLOWTOPICCHANGE = < list of users and groups >
DENYTOPICCHANGE defines users or groups that are not allowed to make changes to the topic. It is a comma delimited list of users and groups. Example: * Set DENYTOPICCHANGE = Main.SomeBadBoy, Main.SomeBadGirl, Main.SomeHackerGroup
ALLOWTOPICCHANGE defines users or groups that are allowed to make changes to the topic. It is a comma delimited list of users and groups. Example: * Set ALLOWTOPICCHANGE = Main.SomeGoodGuy, Main.SomeGoodGirl, Main.TWikiAdminGroup
DENYTOPICCHANGE is evaluated before ALLOWTOPICCHANGE. Access is denied if the authenticated person is in the DENYTOPICCHANGE list, or not in the ALLOWTOPICCHANGE list. Access is granted in case DENYTOPICCHANGE and ALLOWTOPICCHANGE is not defined.
Deny Editing by Web
Restricting web-level editing blocks creating new topics, changing topics or attaching files.
Define one or both of these variable in the WebPreferences topic:
Set DENYWEBCHANGE = < list of users and groups >
Set ALLOWWEBCHANGE = < list of users and groups >
The same rules apply as for restricting topics, with these additions:
DENYTOPICCHANGE (in topic) overrides DENYWEBCHANGE (in WebPreferences)
ALLOWTOPICCHANGE (in topic) overrides ALLOWWEBCHANGE (in WebPreferences)
Restricting Rename Access
You can define who is allowed to rename, move or delete a topic, or rename a web.
Deny Renaming by Topic
To allow a user to rename, move or delete a topic, they also need write (editing) permission. They also need write access to change references in referring topics.
Define one or both of these variables in a topic, preferably at the end of the topic:
Set DENYTOPICRENAME = < list of users and groups >
Set ALLOWTOPICRENAME = < list of users and groups >
DENYTOPICCRENAME defines users or groups that are not allowed to rename the topic. It is a comma delimited list of users and groups. Example: * Set DENYTOPICRENAME = Main.SomeBadBoy, Main.SomeBadGirl, Main.SomeHackerGroup
ALLOWTOPICRENAME defines users or groups that are allowed to rename the topic. It is a comma delimited list of users and groups. Example: * Set ALLOWTOPICRENAME = Main.SomeGoodGuy, Main.SomeGoodGirl, Main.TWikiAdminGroup
DENYTOPICRENAME is evaluated before ALLOWTOPICRENAME. Access is denied if the authenticated person is in the DENYTOPICRENAME list, or not in the ALLOWTOPICRENAME list. Access is granted in case DENYTOPICRENAME and ALLOWTOPICRENAME is not defined.
Deny Renaming by Web
You can define restrictions of who is allowed to rename a netfrag.org web.
Define one or both of these variable in the WebPreferences topic:
Set DENYWEBRENAME = < list of users and groups >
Set ALLOWWEBRENAME = < list of users and groups >
The same rules apply as for topics, with these additions:
DENYTOPICRENAME (in topic) overrides DENYWEBRENAME (in WebPreferences)
ALLOWTOPICRENAME (in topic) overrides ALLOWWEBRENAME (in WebPreferences)
Restricting Read Access
You can define restrictions of who is allowed to view a netfrag.org web.
Define one or both of these variable in the WebPreferences topic:
Set DENYWEBVIEW = < list of users and groups >
Set ALLOWWEBVIEW = < list of users and groups >
Known Issues
The view restriction is not suitable for very sensitive content since there is a way to circumvent the read access restriction.
Read access restriction only works if the view script is authenticated, that means that users need to log on also just to read topics. TWikiInstallationGuide has more on Basic Authentication based on the .htaccess file.
Selective Unrestricted Web Access
There is a workaround if you prefer to have unrestricted access to view topics located in normal webs, and to authenticate users only for webs where view restriction is enabled:
Omit the view script from the .htaccess file.
Enable the $doRememberRemoteUser flag in lib/TWiki.cfg as described in TWikiUserAuthentication. netfrag.org will now remember the IP address of an authenticated user.
Copy the view script to viewauth (or better, create a symbolic link)
Addviewauth to the list of authenticated scripts in the .htaccess file.
When a user accesses a web where you enabled view restriction, netfrag.org will redirect from the view script to the viewauth script once (this happens only if the user has never edited a topic). Doing so will ask for authentication. The viewauth script shows the requested topic if the user could log on and if the user is authorized to see that web.
If you enable view restriction for a web, it is recommended to restrict search "all webs" from searching this web. Enable this restriction with the NOSEARCHALL variable in its WebPreferences, like:
Set NOSEARCHALL = on
It is not recommended to restrict view access to individual topics since all content is searchable within a web.
Hiding Control Settings
To hide access control settings from normal browser viewing, place them in comment markers.
<!--
Set DENYTOPICCHANGE = Main.SomeGroup
-->
The SuperAdminGroup
By mistyping a user or group name in the ALLOWTOPICCHANGE setting, it's possible to lock a topic so that it no-one can edit it from a browser. To avoid this:
Set the $superAdminGroup variable in lib/TWiki.cfg to the name of a group of users that are always allowed to edit/view topics.
Definition of the templates used to render all HTML pages displayed in TWiki
Overview
The new modular template system offers flexible, easy control over the layout of all TWiki pages. The master template approach groups parts that are shared by several templates - like headers and footers - in a common file. Special variables allow individual layouts to include parts from a master template - variables are mixed with regular HTML mark-up for template-specific content. Templates are used to define page layout, and also to supplydefault content for new pages.
Major changes from the previous template system
Where the old templates were each complete HTML documents, the new templates are defined using variables to include template parts from a master file. You can now change one instance of a common element to update all occurrences; previously, every affected template had to be updated. This simplifies the conversion of templates into XHTML format, and provides a more versatile solution for templates and for TWikiSkins. The new system:
separates a set of common template parts into a base template that is included by all of the related templates;
defines common variables, like a standard separator (ex: "|"), in the base template;
defines variable text in the individual templates and passes it back to the base template.
Functional Specifications
Special template directives (or preprocessor commands) are embedded in normal templates.
Use of template directives is optional, templates work without them.
All template preprocessing is done in &TWiki::Store::readTemplate() so that the caller simply gets an expanded template file (the same as before).
Directives are of the form %TMPL:<key>% and %TMPL:<key>{"attr"}%.
Directives:
%TMPL:INCLUDE{"file"}%: Includes a template file. The template directory of the current web is searched first, then the templates root (twiki/templates).
%TMPL:DEF{"var"}%: Define a variable. Text between this and the END directive is not returned, but put into a hash for later use.
%TMPL:END%: Ends variable definition.
%TMPL:P{"var"}%: Prints a previously defined variable.
Variables are live in a global name space, there is no parameter passing.
Two-pass processing, so that you can use a variable before declaring it or after.
Templates and TWikiSkins work transparently and interchangeably. For example, you can create a skin that overloads just the twiki.tmpl, like twiki.print.tmpl, that redefines the header and footer.
NOTE: The template directives work only for templates, they do not get processed in topic text.
TWiki Master Template
All common parts are defined in a master template, twiki.tmpl, that all other templates use.
Simple header with reduced links (ex: edit, attach, oops)
%TMPL:DEF{"standardfooter"}%
Footer, excluding revision and copyright parts
%TMPL:DEF{"oops"}%
Skeleton of oops dialog
Types of Template
There are two types of templates:
HTML Page Templates: Defines layout of netfrag.org pages
Template Topics: Defines default text when you create a new topic
HTML Page Templates
netfrag.org uses HTML template files for all actions like topic view, edit, preview and so on. This allows you to change the look and feel of all pages by editing just some template files.
The template files are in the twiki/templates directory. As an example, twiki/templates/view.tmpl is the template file for the twiki/bin/view script. Templates can be overloaded per web. The following search order applies:
twiki/templates/$webName/$scriptName.tmpl
twiki/templates/$scriptName.tmpl
Note:$webName is the name of the web (ex: Main), and $scriptName is the script (ex: view).
Note:TWikiSkins can be defined to overload the standard templates.
Special variables are used in templates, especially in view, to display meta data.
Template Topics
Template topics define the default text for new topics. There are three types of template topics:
All template topics are located in the TWiki web. The WebTopicEditTemplate can be overloaded. The following search order applies when you create a new topic:
The topic name specified by the templatetopic CGI parameter.
WebTopicEditTemplate in the current web.
WebTopicEditTemplate in the TWiki web.
Template Topics in Action
Here is an example for creating new topics based on a specific template topic:
Above form asks for a topic name. A hidden input tag of name "templatetopic" specifies the ExampleTopicTemplate as the template topic. Here is the HTML source of the form:
<form name="new" action="%SCRIPTURLPATH%/edit%SCRIPTSUFFIX%/%WEB%/">
* New example topic:
<input type="text" name="topic" value="ExampleTopic%SERVERTIME{$yearx$mox$day}%" size="23" />
<input type="hidden" name="templatetopic" value="ExampleTopicTemplate" />
<input type="hidden" name="onlywikiname" value="on" />
<input type="submit" value="Create" />
(date format is <nop>YYYYxMMxDD)
</form>
The "onlywikiname" parameter enforces WikiWords for topic names.
Note: Use can use the %WIKIUSERNAME% and %DATE% variables in your topic templates as the signature; those variables are expanded when a new topic is created. The standard topic signature is: -- %WIKIUSERNAME% - %DATE%
Templates by Example
Attached is an example of an oops base template oopsbase.tmpl and a example oops dialog oopstest.tmpl which is based on the base template. NOTE: This isn't the release version, just a quick, simple demo.
Base template oopsbase.tmpl
The first line declares the delimiter variable called "sep", used to separate multiple link items. The variable can be called anywhere by writing %TMPL:P{"sep"}%
Each oops template basically just defines some variables and includes the base template that does the layout work.
%TMPL:DEF{"titleaction"}% (test =titleaction=) %TMPL:END%
%TMPL:DEF{"webaction"}% test =webaction= %TMPL:END%
%TMPL:DEF{"heading"}%
Test heading %TMPL:END%
%TMPL:DEF{"message"}%
Test =message=. Blah blah blah blah blah blah blah blah blah blah blah...
* Some more blah blah blah blah blah blah blah blah blah blah...
* Param1: %PARAM1%
* Param2: %PARAM2%
* Param3: %PARAM3%
* Param4: %PARAM4%
%TMPL:END%
%TMPL:DEF{"topicaction"}%
Test =topicaction=:
[[%WEB%.%TOPIC%][OK]] %TMPL:P{"sep"}%
[[%TWIKIWEB%.TWikiRegistration][Register]] %TMPL:END%
%TMPL:INCLUDE{"oopsbase"}%
Sample screen shot of oopstest.tmpl
With URL: .../bin/oops/Test/TestTopic2?template=oopstest¶m1=WebHome¶m2=WebNotify
Known Issues
A drawback of referring to a master template is that you can only test a template from within TWiki, where the include variables are resolved. In the previous system, each template is a structurally complete HTML document with a .tmpl filename extension - it contains unresolved %VARIABLES%, but can still be previewed directly in a browser.
Skins overlay regular templates with alternate header/footer layouts; topic text is not affected
Overview
Skins are customized TWikiTemplates files. You can use skins to change the look of a netfrag.org topic, for example, the layout of the header and footer. Rendered text between header and footer does not change. You can also use skins to define an alternate view, like a view optimized for printing.
Defining Skins
Skin files are located in the twiki/templates directory and are named with the syntax: <scriptname>.<skin>.tmpl. For example, the Printable skin for the view template is view.print.tmpl.
The ?skin=name URL parameter overrides the SKIN Preference value.
-- PeterThoeny - 14 Jul 2001
TWiki Variables
Text strings expanded on the fly to display data or system info
Overview
TWikiVariables are text strings - %VARIABLE% - that expand into content whenever a page is opened. Variables are replaced by their actual values: stored data, or system info (like the date, or the current user). There are predefined variables, and Preference variables that you set. You can also define custom variables, with new names and values.
Predefined Variables
Most predefined variables return values that were either defined when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you control how the formatted results appear.
netfrag.org expands the following variables (enclosed in % percent signs):
Variable:
Expanded to:
%WIKIHOMEURL%
The base script URL of netfrag.org, is the link of the Home icon in the upper left corner, is http://TWiki.org/
%SCRIPTURL%
The script URL of netfrag.org, is https://netfrag.org/twiki/bin
%SCRIPTURLPATH%
The path of the script URL of netfrag.org, is /twiki/bin
%SCRIPTSUFFIX%
The script suffix, ex: .pl, .cgi is
%PUBURL%
The public URL of TWiki, is https://netfrag.org/twiki/pub
%PUBURLPATH%
The path of the public URL of netfrag.org, is /twiki/pub
%ATTACHURL%
The attachment URL of the current topic, is https://netfrag.org/twiki/pub/TWiki/TWikiVariables Example: If you attach a file you can refer to it as %ATTACHURL%/image.gif
%ATTACHURLPATH%
The path of the attachment URL of the current topic, is /twiki/pub/TWiki/TWikiVariables
%URLPARAM{"name"}%
Returns the value of a URL parameter. Ex: %URLPARAM{"skin"}% returns print for a .../view/TWiki/TWikiVariables?skin=print URL. Is
%WIKITOOLNAME%
Name of wiki tool, is netfrag.org
%WIKIVERSION%
Wiki tool version is 04 Sep 2004 $Rev: 1742 $
%USERNAME%
Your login username is guest
%WIKINAME%
Your Wiki username. Same as %USERNAME% if not defined in the TWikiUsers topic. Is TWikiGuest
%WIKIUSERNAME%
Your %WIKINAME% including the Main web name. Usefull for signatures. Is Main.TWikiGuest
%MAINWEB%
The Main web containing TWikiUsers, OfficeLocations? and TWikiGroups?. Is Main
%TWIKIWEB%
The web containing all documentation and configuration of netfrag.org is TWiki
%WEB%
The current web is TWiki
%BASEWEB%
The web name where the includes started, e.g. the web of the first topic of nested includes. Same as %WEB% in case there is no include.
%INCLUDINGWEB%
The web name of the topic that includes the current topic. Same as %WEB% in case there is no include.
The index topic of all registered users. Is TWikiUsers
%WIKIPREFSTOPIC%
The web preferences topic. Is TWikiPreferences
%WEBPREFSTOPIC%
The web preferences topic. Is WebPreferences
%STATISTICSTOPIC%
The web statistics topic. Is WebStatistics
%TOPIC%
The current topic name, is TWikiVariables
%BASETOPIC%
The name of the topic where the includes started, e.g. the first topic of nested includes. Same as %TOPIC% in case there is no include.
%INCLUDINGTOPIC%
The name of the topic that includes the current topic. Same as %TOPIC% in case there is no include.
%SPACEDTOPIC%
The current topic name with added spaces, for regular expression search of Ref-By, is TWiki%20*Variables
%TOPICLIST{"format"}%
Topic index of a web. The "format" defines the format of one topic item. It may include variables: The $name variable gets expanded to the topic name; the $web variable gets expanded to the name of the web.
Parameters are format, separator and web:
Format of one line, may include $name and $web variables
"$name"
format="format"
(Alternative to above)
"$name"
separator=", "
line separator
"\n" (new line)
web="Name"
Name of web
Current web
Examples:
%TOPICLIST{" * $web.$name"}% creates a bullet list of all topics.
%TOPICLIST{separator=", "}% creates a comma separated list of all topics.
%TOPICLIST{" <option>$name</option>"}% creates an option list (for drop down menus).
%WEBLIST{"format"}%
Web index, e.g. list of all webs. Hidden webs are excluded, e.g. webs with a NOSEARCHALL=on preference variable. The "format" defines the format of one web item. The $name variable gets expanded to the name of the web, $qname gets expanded to double quoted name, $marker to marker where web matches selection.
Parameters are format, separator and web:
comma sep list of Web, public expands to all non-hidden
"public"
marker="selected"
Text for $marker where item matches selection, otherwise equals ""
"selected"
selection="%WEB%"
Current value to be selected in list
section="%WEB%"
Examples: %WEBLIST{" * [[$name.Home]]"}% creates a bullet list of all webs.
%WEBLIST{"" webs="Trash,public" selection="TWiki" separator=" "}% Dropdown of all public Webs + Trash Web, current Web highlighted.
Variables can be shortened to 3 characters. Example: %GMTIME{"$day $month, $year - $hour:$min:$sec"}% is 24 Nov, 2024 - 15:30:52
%SERVERTIME%
Server time, is 24 Nov 2024 - 16:30
%SERVERTIME{"format"}%
Formatted server time. Example: %SERVERTIME{"$hou:$min"}% is 16:30
%HTTP_HOST%
HTTP_HOST environment variable, is netfrag.org
%REMOTE_ADDR%
REMOTE_ADDR environment variable, is 18.226.187.210
%REMOTE_PORT%
REMOTE_PORT environment variable, is 6126
%REMOTE_USER%
REMOTE_USER environment variable, is
%INCLUDE{"page" ...}%
Server side include to IncludeTopicsAndWebPages. Parameters are page name, and an optional pattern="(reg-exp)". The page name is:
"SomeTopic"
The name of a topic located in the current web, i.e. %INCLUDE{"WebNotify"}%
"Web.Topic"
A topic in another web, i.e. %INCLUDE{"TWiki.TWikiWebsTable"}%
"http://..."
A full qualified URL, i.e. %INCLUDE{"http://twiki.org/"}%
%STARTINCLUDE%
If present in included topic, start to include text from this location up to the end, or up to the location of the %STOPINCLUDE% variable. A normal view of the topic shows everyting exept the %STARTINCLUDE% variable itself.
%STOPINCLUDE%
If present in included topic, stop to include text at this location and ignore the remaining text. A normal view of the topic shows everyting exept the %STOPINCLUDE% variable itself.
%TOC%
Table of Contents of current topic.
%TOC{"SomeTopic" ...}%
Table of Contents. Shows a TOC that is generated automatically based on headings of a topic. Headings in WikiSyntax ("---++ text") and HTML ("<h2>text<h2>") are taken into account. (But not "<H2>text</H2>", which can be used to exclude a heading from the TOC.) Parameters are topic name, web and depth:
What sort of search is required? "topicmoved" if search for a topic that may have been moved "parent" if searcing for topics that have a specific parent i.e. its children
required
web="%WEB%"
Wiki web to search: A web, a list of webs separated by whitespace, or all webs.
required
topic="%TOPIC%"
The topic the search relates to
required
title="Title"
Text the is pre-pended to any search results
required
Example: %METASEARCH{type="topicmoved" web="%WEB%" topic="%TOPIC%" title="This topic used to exist and was moved to: "}%, you may want to use this in WebTopicViewTemplate and WebTopicNonWikiTemplate %METASEARCH{type="parent" web="%WEB%" topic="%TOPIC%" title="Children: "}%
%VAR{"NAME" web="Web"}%
Get a preference value from a web other then the current one. Example: To get %WEBBGCOLOR% of the Main web write %VAR{"WEBBGCOLOR" web="Main"}%, is #444444
[1] Note: The search form uses identical names for input fields.
[2] Note: A web can be excluded from a web="all" search if you define a NOSEARCHALL=on variable in its WebPreferences.
Preferences Variables
Additional variables are defined in the preferences ( site-level ( SL ) in TWikiPreferences, web-level ( WL ) in WebPreferences of each web, and user level ( UL ) preferences in individual user topics):
Variable:
Level:
What:
%WIKIWEBMASTER%
SL
Webmaster email address (sender of email notifications) , is webmaster@netfrag.org
%WIKIWEBLIST%
SL
List of netfrag.org webs (in upper right corner of topics)
%WEBTOPICLIST%
WL
Common links of web (second line of topics)
%WEBCOPYRIGHT%
SL , WL
Copyright notice (bottom right corner of topics)
%WEBBGCOLOR%
WL
Background color of web
%NOSEARCHALL%
WL
Exclude web from a web="all" search (set variable to on for hidden webs)
%NEWTOPICBGCOLOR%
SL , UL
Background color of non existing topic. ( UL needs authentication for topic views )
%NEWTOPICFONTCOLOR%
SL , UL
Font color of non existing topic. ( UL needs authentication for topic views )
%EDITBOXWIDTH%
SL , UL
Horizontal size of edit box, is 100
%EDITBOXHEIGHT%
SL , UL
Vertical size of edit box, is 20
%RELEASEEDITLOCKCHECKBOX%
SL , UL
Default state of the "Release edit lock" (UnlockTopic) check box in preview. Checkbox is initially checked if Set RELEASEEDITLOCKCHECKBOX = checked="checked", or unchecked if empty. If checked, make sure to click on Edit to do more changes; do not go back in your browser to the edit page, or you risk that someone else will edit the topic at the same time! Value is: checked
%DONTNOTIFYCHECKBOX%
SL , UL
Default state of the "Minor Changes, Don't Notify" (DontNotify) check box in preview. Check box is initially checked if Set DONTNOTIFYCHECKBOX = checked="checked", or unchecked if empty. Value is: checked
%ATTACHLINKBOX%
SL , UL
Default state of the link check box in the attach file page. Check box is initially checked if value is set to CHECKED , unchecked if empty. If checked, a link is created to the attached file at the end of the topic. Value is:
%HTTP_EQUIV_ON_VIEW%
SL
http-equiv meta tags for view, rdiff, attach, search* scripts.
%HTTP_EQUIV_ON_EDIT%
SL , UL
http-equiv meta tags for edit script.
%HTTP_EQUIV_ON_PREVIEW%
SL , UL
http-equiv meta tags for preview script.
%DENYWEBCHANGE%
WL
List of users and groups who are not allowed to change topics in the netfrag.org web. (More in TWikiAccessControl)
%ALLOWWEBCHANGE%
WL
List of users and groups who are allowed to change topics in the netfrag.org web. (More in TWikiAccessControl)
%DENYTOPICCHANGE%
(any topic)
List of users and groups who are not allowed to change the current topic. (More in TWikiAccessControl)
%ALLOWTOPICCHANGE%
(any topic)
List of users and groups who are allowed to change the current topic. (More in TWikiAccessControl)
%DENYWEBRENAME%
WL
List of users and groups who are not allowed to rename topics in the netfrag.org web. (More in TWikiAccessControl)
%ALLOWWEBRENAME%
WL
List of users and groups who are allowed to rename topics in the netfrag.org web. (More in TWikiAccessControl)
%DENYTOPICRENAME%
(any topic)
List of users and groups who are not allowed to rename the current topic. (More in TWikiAccessControl)
%ALLOWTOPICRENAME%
(any topic)
List of users and groups who are allowed to rename the current topic. (More in TWikiAccessControl)
%FINALPREFERENCES%
SL , WL
List of preferences that are not allowed to be overridden by next level preferences
Setting Preferences
The syntax for Preferences variables is the same anywhere in TWiki. In Edit mode, from the start of a new line: [6 spaces] * [space] Set [space] VARIABLENAME [space] = [value] Example:
Set VARIABLENAME = value
Creating Custom Variables
You can add your own preference variables for an entire site, a single web, or a single topic, using the standard syntax. Whatever you include in your variable will be expanded on display, and treated exactly as if it had been written out. So you can place formatted text, page links, image paths.
Example: Create a custom logo variable
To place a logo anywhere in a web by typing %MYLOGO%, simply define the variable on the web's WebPreferences page. You also have to upload logo.gif - this can be done by attaching a file to LogoTopic (any topic name you choose):
Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif
Additional topic data, program-generated or from TWikiForms, is stored in META variable name/value pairs
Overview
TWikiMetaData uses META variables to store topic data that's separate from the main free-form content. This includes program-generated info like FileAttachment and topic movement data, and user-defined TWikiForms info. Use META variables to format and display Meta Data.
Meta Data Syntax
Format is the same as in TWikiVariables, except all fields have a key.
%META:<type>{key1="value1" key2="value2" ...}%
Order of fields within the meta variables is not defined, except that if there is a field with key name, this appears first for easier searching (note the order of the variables themselves is defined).
Each meta variable is on one line.
\n (new line) is represented in values by %_N_ and " (double-quotes) by %_Q_%.
Example of Format
%META:TOPICINFO{version="1.6" date="976762663" author="PeterThoeny" format="1.0"}%
text of the topic
%META:TOPICMOVED{from="Codev.OldName" to="Codev.NewName"
by="JohnTalintyre" date="976762680"}%
%META:TOPICPARENT{name="NavigationByTopicContext"}%
%META:FILEATTACHMENT{name="Sample.txt" version="1.3" ... }%
%META:FILEATTACHMENT{name="Smile.gif" version="1.1" ... }%
%META:FORM{name="WebFormTemplate"}%
%META:FIELD{name="OperatingSystem" value="OsWin"}%
%META:FIELD{name="TopicClassification" value="PublicFAQ"}%
Meta Data Specifications
The current version of Meta Data is 1.0, with support for the following variables.
Format of this topic, will be used for automatic format conversion
META:TOPICMOVED
This is optional, exists if topic has ever been moved. If a topic is moved more than once, only the most recent META:TOPICMOVED meta variable exists in the topic, older ones are to be found in the rcs history.
%META:TOPICMOVED{from="Codev.OldName" to="Codev.NewName" by="talintj" date="976762680"}%
The topic from which this was created, WebHome if done from Go, othewise topic where ? or form used. Normally just topic, but is full web.topic format if parent is in a different Web. Renaming a Web will then only break a few of these references or they can be scanned and fixed.
There is no absolute need for Meta Data variables to be listed in a specific order within a topic, but it makes sense to do so a couple of good reasons:
form fields remain in the order they are defined
the diff function output appears in a logical order
The recommended sequence is:
META:TOPICINFO
text of topic
META:TOPICMOVED (optional)
META:TOPICPARENT (optional)
META:FILEATTACHMENT (0 or more entries)
META:FORM (optional)
META:FIELD (0 or more entries; FORM required)
Viewing Meta Data in Page Source
When viewing a topic the Raw Text link can be clicked to show the text of a topic (ie: as seen when editing). This is done by adding raw=on to URL. raw=debug shows the meta data as well as the topic data, ex: debug view for this topic
Rendering Meta Data
Meta Data is rendered with the %META% variable. This is mostly used in the view, preview and edit scripts.
Current support covers:
Prefix for parents, only if there are parents; default ""
suffix="..."
Suffix, only appears if there are parents; default ""
separator="..."
Separator between parents, default is " > "
Known Issues
At present, there is no Meta Data support for Plugins. However, the format is readily extendable and the Meta.pm code that supports the format needs only minor alteration.
-- JohnTalintyre - 29 Aug 2001
-- MikeMannix - 03 Dec 2001
TWiki Plugins
Plug-in enhanced feature add-ons, with a Plugin API for developers
Overview
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.
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.
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.
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.
Most Plugins can be installed in three easy steps, with no programming skills required:
Download the zip file containing the Plugin, documentation, and any other required files, from TWiki:Plugins.
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.
Check the demo example on the Plugin topic: if it's working, the installation was fine!
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.
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.
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
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.
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.
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.
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.
Setting Preferences
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 netfrag.org 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:
One line description, used to form the bullets describing the Plugins in the TextFormattingRules topic:
Set SHORTDESCRIPTION = Blah blah woof woof.
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:
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.
DefaultPlugin: This plugin can be used to specify some simple custom rendering rules. It also renders deprecated *_text_* as bold italic text.
HeadlinesPlugin: Build news portals that show headline news based on RSS news feeds from news sites.
InterwikiPlugin: Link ExternalSite:Page text to external sites based on aliases defined in the InterWikis topic.
TablePlugin: Control attributes of tables and sorting of table columns
VisualConfirmPlugin: Plugin for visual confirmation of new user registration.
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 01-Sep-2001 release.
Available Core Functions
The lib/TWiki/Func.pm implements ALL official Plugin functions. Plugins should ONLY use functions published in this module.
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.
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.
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.
All modules require a $VERSION='0.000' variable, beginning at 1.000.
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).
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 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:
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.
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
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:
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
paste & save as a text file or new topic on your site
Customize the template for your Plugin; you'll probably want to post a working version on your local TWiki site.
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: <Describe any special text formatting that will be rendered.>"
MyFirstPlugin Settings: <Description and settings for custom Plugin %VARIABLES%, and those required by TWiki.>"
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.>"
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.>"
Packaging for Distribution
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).
Distribute the Plugin files in a directory structure that mirrors TWiki. If your Plugin uses additional files, include them ALL:
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
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:
Post the Plugin documentation topic in the TWiki:Plugins web:
create a new topic using the Plugin name, ex: MyFirstPlugin.txt
Attach the distribution zip file to the topic, ex: MyFirstPlugin.zip
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.)