TWikiDocumentation < TWiki < TWiki TWiki Reference Manual (TWiki-6.0.0, Mon, 14 Oct 2013, build 26523)

This page contains all documentation topics as one long, complete reference sheet.

Related Topics: TWikiSite, TWikiHistory, TWikiPlannedFeatures, TWikiEnhancementRequests, UserDocumentationCategory, AdminDocumentationCategory

TWiki System Requirements

Server and client requirements

Low client and server base requirements are core features that keep TWiki widely deployable, particularly across a range of browser platforms and versions. Many Plugins and contrib modules exist which enhance and expand TWiki's capabilities; they may have additional requirements. Server Requirements

TWiki is written in 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.

Resource Required Server Environment * Perl 5.8.0 or higher (5.8.4 or higher is recommended) RCS 5.7 or higher (including GNU diff) Optional, TWiki includes a pure perl implementation of RCS that can be used instead (although it's slower) GNU diff GNU diff 2.7 or higher is required when not using the all-Perl RcsLite. Install on PATH if not included with RCS (check version with diff -v) Must be the version used by RCS, to avoid problems with binary attachments - RCS may have hard-coded path to diff GNU df Used by the site statistics to record disk usage statistics, optional. The df command is pre-installed on Linux and OS-X. On Windows install the CoreUtils for Windows. GNU patch For upgrades only: GNU patch is required when using the TWiki:Codev.UpgradeTWiki script GNU fgrep, Modify command line parameters in configure if you use non-GNU grep programs egrep zip Zip archive command line utility. Used by the BackupRestorePlugin to create and restore from backups. Cron/scheduler • Unix: cron • Windows: cron equivalents Web server Apache is well supported; see TWiki:TWiki.InstallingTWiki#OtherWebServers for other servers

Required CPAN Modules

Most of the CPAN libraries listesd below are part of a standard Perl installation so you most likely have them all!

TWiki System Requirements 1 TWikiDocumentation < TWiki < TWiki See TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries

The following Perl CPAN modules are used by TWiki:

Module Preferred Comment version Algorithm::Diff Included in TWiki distribution CGI >=3.18 Versions 2.89 and 3.37 must be avoided. Most version from 3.15 and onwards should work. CGI::Carp >=1.26 Config >=0 Cwd >=3.05 Data::Dumper >=2.121 Encode >=2.1 Error Included in TWiki distribution File::Copy >=2.06 File::Find >=1.05 File::Spec >=3.05 File::Temp >=0.18 Included with perl 5.6 and later FileHandle >=2.01 HTML::Parser >=3.28 Needed by the WysiwygPlugin for WYSIWYG editing HTML::Entities >=1.25 Needed by the WysiwygPlugin for WYSIWYG editing IO::File >=1.10 Net::SMTP >=2.29 Used for sending mail Text::Diff Included in TWiki distribution Time::Local >=1.11

Optional CPAN Modules

The following Perl modules may be used by TWiki:

See TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries

Module Preferred Description version Archive:: May be required by the Extensions Installer in configure if command line tar or unzip is not available Authen::SASL Used for SMTP Authentication CGI::Cookie >=1.24 Used for session support CGI::Session >=3.95 Used for session support Crypt::SMIME >=0.09 Required if S/MIME-signed administrative e-mail is enabled. Digest::base Digest::SHA1 Locale::Maketext::Lexicon >=0 Used for I18N support Net::SMTP >=2.29 Used for sending mail URI Used for configure Most of them will probably already be available in your installation. You can check version numbers with the configure script, or if you're still trying to get to that point, check from the command line like this: perl -e 'use FileHandle; print $FileHandle::VERSION."\n"'

Required CPAN Modules 2 TWikiDocumentation < TWiki < TWiki Client Requirements

The TWiki standard installation has relatively low browser requirements:

• HTML 3.2 compliant • Cookies, if persistent sessions are required

CSS and Javascript are used in most skins, although there is a low-fat skin (Classic skin) available that minimises these requirements. Some skins will require more recent releases of browsers. The default skin (Pattern) is tested on IE 6, Safari, and Mozilla 5.0 based browsers (such as Firefox).

You can easily select a balance of browser capability versus look and feel. Try the installed skins at TWikiSkinBrowser and more at TWiki:Plugins.SkinPackage . Important note about TWiki Plugins

• Plugins can require just about anything - browser-specific functions, stylesheets (CSS), Java applets, cookies, specific Perl modules,... - check the individual Plugin specs.

%STOPSECTION{"requirements"}%

Related Topics: AdminDocumentationCategory

Back to top

TWiki Installation Guide

The following is installation instructions for the TWiki 5.0 production release on an Apache web server on Linux. Visit TWiki:TWiki.InstallingTWiki for the latest updates to this guide and supplemental information for installing or upgrading TWiki, including notes on installing TWiki on different platforms, environments and web hosting sites.

If you are upgrading from a previous version of TWiki, you probably want to read TWikiUpgradeGuide instead. Preparing to install TWiki

Before attempting to install TWiki, you are encouraged to review the AdminSkillsAssumptions. This guide assumes the user installing TWiki has, at a minimum, basic knowledge of server administration on the system on which TWiki is to be installed. While it is possible to install TWiki with FTP access alone (for example, on a hosted site), it is tricky and may require additional support from your hosting service (for example, in setting file ownership and installing missing Perl CPAN libraries).

To help setup a correct Apache configuration, you are very much encouraged to use the automatic tool TWiki:TWiki.ApacheConfigGenerator which generates the contents for an Apache config file for TWiki based on your inputs.

While this installation guide specifically describes installation on an Apache web server on Linux, TWiki should be fine with any web server and OS that meet the system requirements (see below). For additional notes on installing TWiki on other systems, see TWiki:TWiki.InstallingTWiki#OtherPlatforms .

TWiki Installation Guide 3 TWikiDocumentation < TWiki < TWiki If you are installing TWiki without Unix/Linux root (administrator) privileges (for example, on a hosted domain), see "Notes on Installing TWiki on Non-Root Account" below for supplemental instructions to the basic steps presented below.

If you are upgrading from an earlier major version of TWiki such as Cairo (TWiki-3) or TWiki 4.x you will need the information found at TWikiUpgradeGuide.

One of the more difficult tasks is installation of additional CPAN libraries. See TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries.

If you need help, ask a question in the TWiki:Support.WebHome web or on TWiki:Codev.TWikiIRC (irc.freenode.net, channel #twiki).

Basic Installation

1. Download the TWiki distribution from http://TWiki.org/ . (Example - download TWiki-5.0.0.tgz for Linux) 2. Copy the downloaded package into the directory where you want to install TWiki (Example: /home/httpd ). Unpack the distribution in it (Example: tar xvfz TWiki-5.0.0.tgz). The unpack will create a directory called which contains the TWiki package. In the rest of this document we assume this directory is called twiki. ♦ Note: TWiki does not allow spaces in the directory names. Especially on Windows sure to use a directory path without spaces. 3. Setup access file and directory rights to enable the webserver user (the user Apache runs the CGI scripts as) to read and write inside the twiki directory. ♦ Warning: Do not just just run a chmod - 770 twiki. The access rules have different meaning for files and directories. This is the most common mistake installers make. ♦ The distribution tgz has the file and directory access rights setup to work with a reasonable security level that will work for all types of installations including shared hosting. ♦ The ownership of the twiki directory tree is normally set to the user that unpacked the tgz and will have to be changed to the webserver user using the command chown -R user:group /path/to/twiki. The webserver username varies from Distributions. Examples for some major distributions: ◊ RedHat, Fedora, CentOS, Gentoo, Mandriva : chown -R apache:apache /path/to/twiki ◊ debian/Ubuntu/Kubunto : chown -R www-data:www-data /path/to/twiki ◊ Suse : chown -R wwwrun:www /path/to/twiki ♦ If you mistakenly change the access rights in a way that makes TWiki stop working, simply run the script found at TWiki:TWiki.SettingFileAccessRightsLinuxUnix to set the access right of the entire TWiki tree back to the distributed defaults. ♦ It is possible to define tighter access rules than the ones given by default after the installation is complete. But how tight they should be depends on your distribution and local needs. Typically you may want to limit all access from world if the webserver machine has login access for other users than root and the web server administrator. For a dedicated web server made just for running TWiki with limited login access the default access rights have a good safety level. 4. Check the Perl installation. Ensure that Perl 5 and the Perl CGI are installed on your system. ♦ The default location of Perl is /usr/bin/perl. If it's somewhere else, change the path to Perl in the first line of each script in the twiki/bin directory. ♦ Some systems require a special extension on perl scripts (e.g. .cgi or .pl). This is normally only needed under Windows and only where perl scripts are only recognized by file extension. Linux and Unix users should normally never need to do this. If necessary, rename

Preparing to install TWiki 4 TWikiDocumentation < TWiki < TWiki all files in twiki/bin (i.e. rename view to view.pl etc). If you do this, make sure you set the ScriptSuffix option in configure (Step 6). 5. Create the file LocalLib.cfg located as twiki/bin/LocalLib.cfg ♦ There is a template for this file in twiki/bin/LocalLib.cfg.txt. Simply copy LocalLib.cfg.txt to LocalLib.cfg. Make sure the ownership and access rights of the copy are the same as LocalLib.cfg.txt ♦ The file twiki/bin/LocalLib.cfg must contain a setting for $twikiLibPath, which must point to the absolute file path of your twiki/lib e.g. /var/www/twiki/lib. ♦ If you need to install additional CPAN modules, but can't update the main Perl installation files on the server, you can set $CPANBASE to point to your personal CPAN install. Don't forget that the webserver user has to be able to read those files as well. 6. Choose best configuration method for your webserver. There are two ways to configure Apache: config file included from httpd.conf or .htaccess files ♦ Apache config file: The recommended method is using a config file. With a config file you can put the entire TWiki configuration in ONE file (typically named twiki.conf). Performance is much better with a config file, and one file gives the best overview and ensures that you get a safe installation . However using a config file requires that you can restart Apache which again means that you need root or sudo access to stop and start Apache. The TWiki apache config file is included from the main Apache config file http.conf. Most distributions have a directory from which any file that ends with .conf gets included when you restart Apache (Example RedHat/Fedora/Centos: /etc/httpd/conf.d). If you use a virtual host setup in Apache you should include the twiki.conf file from inside the desired virtual host config in your Apache configuration. ♦ .htaccess file: This should only be used when you cannot use a config file. Performance is slowed down because Apache has to look through all directories in search for possible .htaccess files each time someone views a page in TWiki. Normally this is the only way to control Apache in a shared host environment where you have no root or sudo privileges. 7. Configure the webserver ♦ Unless you are an Apache expert setting up the webserver can be quite difficult. But TWiki has three resources that make setting up Apache easier. ◊ The best and easiest way is to use webpage TWiki:TWiki.ApacheConfigGenerator which contains a tool that can generate a safe and working config file for TWiki on Apache. ◊ In the root of the twiki installation you find an example config file twiki_httpd_conf.txt ◊ In the root of the twiki installation and in the twiki/bin directory you find example .htaccess files you can copy and modify. The files contains help text explaining how to set them up. In twiki/bin you find .htaccess.txt which can be copied to .htaccess and defined access to the CGI scripts. In the root of TWiki you find pub-htaccess.txt which you can copy to pub/.htaccess, subdir-htaccess.txt which you can copy to all directories as .htaccess except bin and pub, and you find root-htaccess.txt which you can copy to .htaccess in the twiki root directory. But again only use .htaccess files if you do not have root priviledges. ♦ If you are unsure about how to do this on your system, see TWiki:TWiki.InstallingTWiki#OtherPlatforms for links to information about various server setups. ♦ Note: When you use config files you need to restart Apache each time you change a setting to make the new setting active. 8. Protect the configure script ♦ You should never leave the configure script open to the public. Limit access to the twiki/bin/configure script to either localhost, an IP address or a specific user using basic Apache authentication. The TWiki:TWiki.ApacheConfigGenerator lets you setup who

Basic Installation 5 TWikiDocumentation < TWiki < TWiki has access to the configure script. Also the example twiki-httpd-conf.txt and bin/.htaccess.txt files includes the needed setting to protect the configure script. ♦ If you limit the access to a particular user then you need to setup a .htpasswd file that contains the user name and password that Apache will authenticate against. Per default both TWiki:TWiki.ApacheConfigGenerator and the example config files and .htaccess files uses twiki/data/.htpasswd but this file does not exist until you have TWiki running and have registered the first user. You therefore have two options. Either limit the access to localhost or an IP address, or make a .htpasswd file. To make a .htpasswd file change directory to twiki/data and issue the command htpasswd - .htpasswd username and enter your password when asked. The username must match the Require user username directive in the Apache config file or .htaccess file. Do not use a username you will later use to register in TWiki because TWiki will then claim that you are already registered. 9. Run the configure script from your browser (enter http://yourdomain/twiki/bin/configure into your browser address bar) ♦ Specify and reenter a password. This is your configure password, as well as the admin user password once TWiki is running. ◊ Note: In case you forgot the password, you can reset it by deleting $TWiki::cfg{Password} from LocalSite.cfg file from {TWIKI_ROOT}/lib directory. ♦ When you run configure for the first time, you can only edit the General Path Settings section. Save these settings, and then return to configure to continue configuration. ♦ Resolve any errors or warnings it tells you about. ♦ If your webserver can be accessed by more than one domain name make sure to add the additional alternative URLs to {PermittedRedirectHostUrls} ♦ When you return to configure you now need to setup Mail and Proxies. Especially the {WebMasterEmail}, and {SMTP}{MAILHOST} must be defined to enable TWiki to send administrative emails, such as for registration and notification of topic changes. Many ISPs have introduced authentication when sending emails to fight spam so you may also have to set {SMTP}{Username} and {SMTP}{Password}. If you do not want to enable mailing or want to enable it later you can uncheck {EnableEmail}. ♦ If you want administrative e-mails to be signed, see S/MIME setup instructions below.

You now have a basic, unauthenticated installation running. At this point you can just point your web browser at http://yourdomain.com/twiki/bin/view and start TWiki-ing away! Important Server Security Settings

Before you continue any further there are some basic and very important security settings you have to make sure are set correctly.

1. As already described above you should protect the configure script from general access. The configure script is designed for use by administrators only and should be restricted to invocation by them only, by using the basic Apache authentication. Because of this there has not been put much effort into hardening the script. The configure script cannot save any settings once the password has been saved the first time, but the script could still be vulnerable to specially crafted field values and the script reveals many details about the webserver that you should not display in public. 2. You absolutely must turn off any kind of PHP, Perl, Python, Server Side Includes etc in the pub directory. TWiki has some built-in protection which renames files with dangerous filenames by appending .txt to the filename. But this is a secondary security measure. The essential action that you must take is to turn off any possible execution of any of the attached files. Most Linux distributions have a default Apache installation which has PHP and server side include (SSI) enabled.

Important Server Security Settings 6 TWikiDocumentation < TWiki < TWiki 3. Make sure that you deny access to all other twiki directories than the bin and pub directories. When you have access to the Apache config files the twiki_httpd_conf.txt file mentioned above also contains protection of these directories. For those that do not have access to the Apache config files a sample subdir-htaccess.txt file can be copied as .htaccess to the data, lib, locale, templates, tools and working directories. 4. Attachments are not secured by default to the access control setting of the topic. In other words, anyone can read them if they know the direct URL of the attachment, which includes name of the web, topic and attachment. You can configure TWiki to secure attachments.

The TWiki:TWiki.ApacheConfigGenerator as well as the example twiki_httpd_conf.txt and example htaccess.txt files include the needed settings that protect against all 4 security elements. Next Steps

Once you have TWiki installed and running, you might consider the following optional steps for setting up and customizing your TWiki site. Many of the references below refer to topics within your TWiki installation. For example, TWiki.TWikiSkins refers to the TWikiSkins topic in your TWiki web. Easy way to jump directly to view the pages is to open your own TWiki in your browser and write TWiki.TWikiSkins in the Jump test box to the right in the top bar and hit Enter. You can find these topics in the on-line reference copy at the official TWiki website: TWiki Release 5.0

Enable Authentication of Users

This step provides for site access control and user activity tracking on your TWiki site. This is particularly important for sites that are publicly accessible on the web. This guide describes only the most common of several possible authentication setups for TWiki and is suitable for public web sites. For information about other setups, see TWikiUserAuthentication, and TWiki:TWiki.TWikiUserAuthenticationSupplement .

These are the steps for enabling "Template Login" which asks for a username and password in a web page, and processes them using the Apache 'htpasswd' password manager. Users can log in and log out.

1. Under the Security Settings pane of configure : 1. Select TWiki::LoginManager::TemplateLogin for {LoginManager}. 2. Select TWiki::Users::HtPasswdUser for {PasswordManager}. 3. Save your configure settings. 4. Register yourself using the TWikiRegistration topic. Check that the password manager recognizes the new user. Check that a new line with the username and encrypted password is added to the data/.htpasswd file. If not, you probably got a path wrong, or the permissions may not allow the webserver user to write to that file. 2. Edit a topic (by clicking on the Edit link at beginning or end of topic) to check if authentication works.

You are strongly encouraged to read TWikiUserAuthentication, TWiki:TWiki.TWikiUserAuthenticationSupplement , and TWiki:TWiki.SecuringTWikiSite for further information about managing users and security of your TWiki site.

Note: The other LoginManager option TWiki::LoginManager::ApacheLogin uses a basic Apache type authentication where the browser itself prompts you for username and password. Most will find the TemplateLogin looking nicer. But ApacheLogin is required when you use Apache authentication methods like mod_ldap where all authentication is handled by an Apache module and not by the TWiki perl code. When you use ApacheLogin the apache configuration must be set up to require authentication of the some but

Next Steps 7 TWikiDocumentation < TWiki < TWiki not all the scripts in the bin directory. This section in the Apache config (or .htaccess) controls this

require valid-user

The TWiki:TWiki.ApacheConfigGenerator includes this section when you choose ApacheLogin. In the example twiki_httpd_conf.txt and bin/.htaccess.txt files this section is commented out with #. Uncomment the section when you use ApacheLogin. It is important that this section is commented out or removed when you use TemplateLogin.

Define the Administrator User(s)

Administrators have read and write access to any topic in TWiki, irrespectively of TWiki access controls. When you install TWiki one of the first things you will want to do is define yourself as an administrator. You become an administrator simply by adding yourself to the TWikiAdminGroup. It is the WikiName and not the login name you add to the group. Editing the Main.TWikiAdminGroup topic requires that you are an administrator. So to add the first administrator you need to login using the internal TWiki admin user login and the password you defined in configure.

• Navigate to the Main.TWikiAdminGroup topic • Follow carefully the steps TWikiAdminGroup of how to become an admin • Note that if you use ApacheLogin you have to be registered and logged in before you use the internal admin login

Set TWiki Preferences

Preferences for customizing many aspects of TWiki are set simply by editing a special topic with TWiki.

• TWikiPreferences. Read through it and identify any additional settings or changes you think you might need. You can edit the settings in TWiki.TWikiPreferences but these will be overwritten when you later upgrade to a newer TWiki version. Instead copy any settings or variables that you want to customize from TWiki.TWikiPreferences and paste them into Main.TWikiPreferences. When you later upgrade TWiki simply avoid overwriting the data/Main/TWikiPreferences.txt file and all your settings will be kept. Settings in Main.TWikiPreferences overrides settings in both TWiki.TWikiPreferences and any settings defined in plugin topics. See notes at the top of TWiki.TWikiPreferences for more information. Enable Email Notification

Each TWiki web has an automatic email notification service that sends you an email with links to all of the topics modified since the last alert. To enable this service:

1. Confirm the Mail and Proxies settings in the Configure interface. 2. Setup a cron job (or equivalent) to call the tools/mailnotify script as described in the MailerContrib topic.

Enable Authentication of Users 8 TWikiDocumentation < TWiki < TWiki Enable Signed Email Notification

TWiki administrative e-mails are an attractive target for SPAM generators and phishing attacks. One good way to protect against this possibility to enable S/MIME signatures on all administrative e-mails. To do this, you need an an X.509 certificate and private key for the the {WebMasterEmail} email account. Obtain these as you would for any other S/MIME e-mail user.

To enable TWiki to sign administrative e-mails:

1. Enable e-mail as described above 2. If necessary, convert your certificate and key files to PEM format ( openssl has all the necessary utilities) 3. Place the certificate anyplace convenient that the webserver can read. It should be protected against write. The conventional place under linux is /etc/pki/tls/certs 4. Place the key file in a secure location that only the webserver can read. It must not be readable by anyone else, and must not be served by the webserver. 5. Using the configure script, change the following settings under Mail and Proxies: 1. Follow the directions under {MailProgram} to enable an external mail program such as sendmail. Net::SMTP is not supported. 2. Enter the full path to the certificate file in the {SmimeCertificateFile} configuration variable 3. Enter the full path to the private key file in the {SmimeKeyFile} configuration variable 4. Save the configuration 6. Re-run the configure script an resolve any errors that it identifies

All out-going administrative e-mails will now be signed. Enable WebStatistics

You can generate a listing manually, or on an automated schedule, of visits to individual pages, on a per web basis. For information on setting up this feature, see the TWikiSiteTools topic. Automate removal of expired sessions and lease files

Per default TWiki cleans out expired session and lease files each time any topic is viewed. This however comes at a cost of lower performance. It is an advantage to define a negative value in configure for {Sessions}{ExpireAfter} (turn on expert mode to see it), and install a crjob to run the tools/tick_twiki.pl script. Read The topic TWikiScripts#tick_twiki_pl for details how to do this. Enable Localisation

TWiki now supports displaying of national (non-ascii) characters and presentation of basic interface elements in different languages. To enable these features, see the Localisation section of configure. For more information about these features, see TWiki:TWiki.InternationalizationSupplement .

Tailor New Users Home Topic

When a new users registers on your TWiki, a home topic is created for them based on the NewUserTemplate topic (and its UserForm). It contains additional resources you can use to:

• Localize the user topic.

Enable Signed Email Notification 9 TWikiDocumentation < TWiki < TWiki

• Add a default ALLOWTOPICCHANGE so only the user can edit their own home topic. We do not encourage this for Intranet sites as it sends a wrong signal to new users, but it can be necessary on a public TWiki to prevent spam. • Add and remove fields defined in the UserForm

If you choose to tailor anything you are strongly adviced to copy NewUserTemplate and UserForm to the Main web and tailor the Main web copies. TWiki will look for the NewUserTemplate in the Main web first and if it does not exist it uses the default from the TWiki web. By creating a Main.NewUserTemplate and its Main.UserForm you will not loose your tailorings next time you upgrade TWiki.

If you added or removed fields from the user form you may also need to tailor TWikiRegistration. Install Plugins

TWiki:Plugins.WebHome is an extensive library of plugins for TWiki, that enhance functionality in a huge number of ways. A few plugins are pre-installed in the TWiki distribution. For more information on these, see InstalledPlugins.

You activate installed plugin in the Plugins section of configure. In this section you also find a Find More Extensions button which opens an application which can install additional plugins from the TWiki.org website. If you are behind a firewall or your server has no access to the Internet it is also possible to install plugins manually. Manual installation instructions for the plugins can be found in the plugin topics on TWiki.org. Additional documentation on TWiki plugins can be found at TWiki:TWiki.TWikiPluginsSupplement .

Some plugins require that you define their settings in configure. You fill find these under the Extensions section of configure. Customize Your TWiki!

The real power of TWiki lies in it's flexibility to be customized to meet your needs. You can with small means change the looks of the default skins (called TopMenuSkin and PatternSkin) by reading the PatternSkinCustomization.

At the official TWiki website you can find more resources. A good place to start for exploring what's possible is TWiki:TWiki.TWikiAdminCookBook which offers tips and tricks for customizing your TWiki site. Many of these are appropriate to implement immediately after installing TWiki and before adding content so now's a good time to look at these. Customization of Special Pages

Some pages are meant to be customized after choice of authentication. If you do not use the internal TWiki password manager the topics that contains the features for changing and resetting passwords and changing the email address should be changed to a note describing how to perform these tasks in your organization. The topics are:

• ChangePassword • ResetPassword • ChangeEmailAddress

Tailor New Users Home Topic 10 TWikiDocumentation < TWiki < TWiki WYSIWYG vs Raw Edit

From TWiki release 4.2.0 on the WYSIWYG editor has been replaced by a much better and more powerful editor and it was decided that WYSIWYG would be the default edit mode. An Edit Raw link is available for those that have a need or preference for this mode.

However you may prefer to have the same user interface as in TWiki 4.1 where Edit was the raw text editor and you had a WYSIWYG button. This is possible by adding the following setting in the Main.TWikiPreferences, WebPreferences or user hompages:

• Set EDITMETHOD = raw Copyright, License and Classification Statements

In the bottom of each topic you will find a default copyright messages saying "Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors." It is a setting WEBCOPYRIGHT that defines this. This is often not adequate.

• If your TWiki is used in a commercial application without public access you should replace this by your normal copyright notice. You should also consider adding classifications (e.g. For Internal Use Only) so people do not have to add this manually to every new topic. • If your TWiki is public with public access you need to decide which copyright and license the contributions should be covered by. For open source type applications licenses such as the GNU Free Documentation License, FreeBSD Documentation License, and Creative Commons license are possible licenses to consider. Remember that once people have started contributing it is difficult and not correct to change or impose licenses on existing contributions.

You change the copy right statement globally by taking these steps.

• Copy the setting WEBCOPYRIGHT from TWiki.TWikiPreferences to Main.TWikiPreferences and alter the copied text to your need. • You can create a unique message for each web by adding the WEBCOPYRIGHT setting to WebPreferences in each web. E.g. adding a confidencial classification to a very restricted web. • The WEBCOPYRIGHT in TWiki.WebPreferences covers the documentation that comes with TWiki and is covered by the original TWiki Copyright and GPL License. You will normally leave this unchanged. Troubleshooting

The first step is to re-run the configure script and make sure you have resolved all errors, and are satisfied that you understand any warnings.

If by any chance you forgot the "admin" password, the same is used in "configure" script, then please login to the server. Delete $TWiki::cfg{Password}= ' ...'; . Set the new password using "configure" script.

Failing that, please check TWiki:TWiki.InstallingTWiki on TWiki.org, the supplemental documentation that help you install TWiki on different platforms, environments and web hosting sites. For example:

• For Unix or Linux, check TWiki:Codev.TWikiOnUnix and TWiki:Codev.TWikiOnLinux . • For Windows, check the TWiki:Codev.WindowsInstallCookbook . • For MacOS X, check TWiki:Codev.TWikiOnMacOSX .

WYSIWYG vs Raw Edit 11 TWikiDocumentation < TWiki < TWiki It is also advisable to review TWiki:Codev/KnownIssuesOfTWiki05x00 .

If you need help, ask a question in the TWiki:Support web or on TWiki:Codev/TWikiIRC (irc.freenode.net, channel #twiki) Appendices

TWiki System Requirements

Low client and server base requirements are core features that keep TWiki widely deployable, particularly across a range of browser platforms and versions. Many Plugins and contrib modules exist which enhance and expand TWiki's capabilities; they may have additional requirements.

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.

Resource Required Server Environment * Perl 5.8.0 or higher (5.8.4 or higher is recommended) RCS 5.7 or higher (including GNU diff) Optional, TWiki includes a pure perl implementation of RCS that can be used instead (although it's slower) GNU diff GNU diff 2.7 or higher is required when not using the all-Perl RcsLite. Install on PATH if not included with RCS (check version with diff -v) Must be the version used by RCS, to avoid problems with binary attachments - RCS may have hard-coded path to diff GNU df Used by the site statistics to record disk usage statistics, optional. The df command is pre-installed on Linux and OS-X. On Windows install the CoreUtils for Windows. GNU patch For upgrades only: GNU patch is required when using the TWiki:Codev.UpgradeTWiki script GNU fgrep, Modify command line parameters in configure if you use non-GNU grep programs egrep zip Zip archive command line utility. Used by the BackupRestorePlugin to create and restore from backups. Cron/scheduler • Unix: cron • Windows: cron equivalents Web server Apache is well supported; see TWiki:TWiki.InstallingTWiki#OtherWebServers for other servers

Required CPAN Modules

Most of the CPAN libraries listesd below are part of a standard Perl installation so you most likely have them all!

See TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries

The following Perl CPAN modules are used by TWiki:

Module Comment

Troubleshooting 12 TWikiDocumentation < TWiki < TWiki

Preferred version Algorithm::Diff Included in TWiki distribution CGI >=3.18 Versions 2.89 and 3.37 must be avoided. Most version from 3.15 and onwards should work. CGI::Carp >=1.26 Config >=0 Cwd >=3.05 Data::Dumper >=2.121 Encode >=2.1 Error Included in TWiki distribution File::Copy >=2.06 File::Find >=1.05 File::Spec >=3.05 File::Temp >=0.18 Included with perl 5.6 and later FileHandle >=2.01 HTML::Parser >=3.28 Needed by the WysiwygPlugin for WYSIWYG editing HTML::Entities >=1.25 Needed by the WysiwygPlugin for WYSIWYG editing IO::File >=1.10 Net::SMTP >=2.29 Used for sending mail Text::Diff Included in TWiki distribution Time::Local >=1.11

Optional CPAN Modules

The following Perl modules may be used by TWiki:

See TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries

Module Preferred Description version Archive::Tar May be required by the Extensions Installer in configure if command line tar or unzip is not available Authen::SASL Used for SMTP Authentication CGI::Cookie >=1.24 Used for session support CGI::Session >=3.95 Used for session support Crypt::SMIME >=0.09 Required if S/MIME-signed administrative e-mail is enabled. Digest::base Digest::SHA1 Locale::Maketext::Lexicon >=0 Used for I18N support Net::SMTP >=2.29 Used for sending mail URI Used for configure Most of them will probably already be available in your installation. You can check version numbers with the configure script, or if you're still trying to get to that point, check from the command line like this: perl -e 'use FileHandle; print $FileHandle::VERSION."\n"'

Required CPAN Modules 13 TWikiDocumentation < TWiki < TWiki Client Requirements

The TWiki standard installation has relatively low browser requirements:

• HTML 3.2 compliant • Cookies, if persistent sessions are required

CSS and Javascript are used in most skins, although there is a low-fat skin (Classic skin) available that minimises these requirements. Some skins will require more recent releases of browsers. The default skin (Pattern) is tested on IE 6, Safari, and Mozilla 5.0 based browsers (such as Firefox).

You can easily select a balance of browser capability versus look and feel. Try the installed skins at TWikiSkinBrowser and more at TWiki:Plugins.SkinPackage .

Important note about TWiki Plugins

• Plugins can require just about anything - browser-specific functions, stylesheets (CSS), Java applets, cookies, specific Perl modules,... - check the individual Plugin specs.

%STOPSECTION{"requirements"}%

Related Topics: AdminDocumentationCategory

Notes on Installing TWiki on Non-Root Account

The following supplemental notes to the Basic Installation instructions apply to installing TWiki on a system where you don't have Unix/Linux root (administrator) privileges, for example, on a hosted Web account or an intranet server administered by someone else.

Referring to the Basic Installation steps presented above:

• Step 2: If you cannot unpack the TWiki distribution directly in your installation directory, you can unpack the distribution on your local PC and then manually create the directory structure on your host server and upload the files as follows: ♦ Using the table below, create a directory structure on your host server ♦ Upload the TWiki files by FTP (transfer as text except for the image files in pub directory.) ♦ Note: Don't worry if you are not able to put the twiki/lib directory at the same level as the twiki/bin directory (e.g. because CGI bin directories can't be under your home directory and you don't have root access). You can create this directory elsewhere and configure the twiki/bin/setlib.cfg file (done in Step 2). TWiki dir: What it is: Where to Example: copy: twiki start-up root TWiki dir /home/smith/twiki/ pages twiki/bin CGI bin CGI-enabled /home/smith/twiki/bin dir twiki/lib library files same level as /home/smith/twiki/lib twiki/bin twiki/locale language dir secure from/home/smith/twiki/locale files public access twiki/pub public files htdoc enabled /home/smith/twiki/pub dir

Client Requirements 14 TWikiDocumentation < TWiki < TWiki

twiki/data topic data dir secure from/home/smith/twiki/data public access twiki/templates web dir secure from/home/smith/twiki/templates templates public access twiki/tools TWiki dir secure from/home/smith/twiki/tools utlilities public access twiki/working Temporary dir secure from/home/smith/twiki/working and internal public access files

• Step 3: Files in the pub directory must be readable as a url. This means that directory permissions should be set to 755 (or 775 ) and file permissions should be set to 644 (or 664). If you can run a chmod command, you can accomplish this in two quick steps by running these commands from the root direct: ♦ chmod -R 755 pub ♦ chmod 644 `find pub -type f -print` ♦ In addition, you should create a .htaccess file in the pub directory, using the template included in the root level of the distribution entitled pub-htaccess.txt. ♦ Note: This setup does not provide for absolute security for TWiki attachments. For more information, see TWiki:Codev.SecuringYourTWiki .

• Step 6: In order to run the configure script, create a file called .htaccess in the bin directory that includes the following single line: SetHandler cgi-script . This informs the server to treat all the perl scripts in the bin directory as scripts.

For additional information about installing TWiki on a hosted accounts, see TWiki:TWiki.InstallingTWiki#WebHostingSites Installing Manually Without Configure

It is highly recommended to use run configure from the browser when setting up TWiki. Configure does a lot of the hard work for you.

But there may be instances where you do not want to use configure or where configure simply won't run because of a missing dependency.

The manual steps you have to take are:

• Copy the file lib/TWiki.spec to lib/LocalSite.cfg • Remove the comment # in front of $TWiki::cfg{DefaultUrlHost}, $TWiki::cfg{ScriptUrlPath}, $TWiki::cfg{PubUrlPath}, $TWiki::cfg{PubDir}, $TWiki::cfg{TemplateDir}, $TWiki::cfg{DataDir}, $TWiki::cfg{LocalesDir}, and $TWiki::cfg{OS} and make sure these settings have the correct values. • Make sure to define at least these settings: $TWiki::cfg{LoginManager}, $TWiki::cfg{WebMasterEmail}, $TWiki::cfg{SMTP}{MAILHOST}, $TWiki::cfg{SMTP}{SENDERHOST}.

Back to top

Notes on Installing TWiki on Non-Root Account 15 TWikiDocumentation < TWiki < TWiki TWiki Upgrade Guide

This guide covers upgrading from a previous version of TWiki (such as TWiki-4.3) to TWiki-5.1 Overview

TWiki-5.1 is a minor release introducing mostly usability enhancements, feature enhancements, and adds extensions to strengthen TWiki as an enterprise collaboration platform. Use this guide to upgrade a previous TWiki release to TWiki-5.1. Use the TWikiInstallationGuide if you do not have data to carry forward. Upgrade Requirements

• Please review the AdminSkillsAssumptions before you upgrade TWiki • Review supplemental document TWiki:TWiki.TWikiUpgradeTo05x01 for latest information and experience notes. • To upgrade from a release prior to TWiki Release 01-Sep-2004, start with TWiki:TWiki.UpgradingTWiki on TWiki.org • To upgrade from a standard TWiki Release 01-Sep-2004 to the latest TWiki-5.1 Production Release, follow the instructions below • Once the upgrade has been applied, an existing earlier installation will still be able to read all the topics, but should not be used to write. Make sure you take a backup! Major Changes Compared to Earlier TWiki Releases

See TWikiReleaseNotes04x00, TWikiReleaseNotes04x01, TWikiReleaseNotes04x02, TWikiReleaseNotes04x03, TWikiReleaseNotes05x00 and TWikiReleaseNotes05x01

New Upgrade Option with BackupRestorePlugin

TWiki now as a new solution to backup, restore and upgrade TWiki sites. It can be used via browser and on the command line. The BackupRestorePlugin is pre-installed in TWiki-5.1 and later releases; it can be installed in older TWiki releases as low as TWiki-2001-09-01 (Athens Release) to easily create a backup that can be restored on a new TWiki release. This offers an easy upgrade path for TWiki. The plugin is currently in Beta, check TWiki:Plugins.BackupRestorePlugin for updates.

Upgrade Procedure

The following steps are a rough guide to upgrading only. It is impossible to give detailed instructions, as what you have to do may depend on whether you can configure the webserver or not, and how much you have changed distributed files in your current TWiki release.

The main steps are:

1. Install the new TWiki version, configure it, and get it to work similar to the old version 2. Install additional extensions (plugins) -- make sure to use the latest versions 3. Copy all the non-default webs from the old installation to the new 4. Copy the users from old installation to the new including all their topics from Main 5. Apply customizations to your skin (logos, menu bars etc) 6. Apply preferences from old installation

TWiki Upgrade Guide 16 TWikiDocumentation < TWiki < TWiki After the extensions are installed (or upgraded) in step 2, take a "golden" backup. That will come in handy for your next patch or upgrade: By checking the differences between the golden copy and your production copy, you will be able to identify all the modifications that you have applied to the core or extensions.

Installation

• Follow the installation instructions at TWiki:TWiki.TWikiInstallationGuide . Install the new release in a new directory. Do not install on top of the old release. • Use the configure script to configure TWiki. ♦ If you are upgrading from a 4.x.x release, you can carry over the configure settings from the old release. ♦ You need to run configure and save the configuration once when you upgrade as this will update the altered and added settings. ♦ You can also choose to start with a fresh configuration and walk through all the settings using your old twiki/lib/LocalSite.cfg as a reference. This way you will not have old obsolete settings in the new LocalSite.cfg. ♦ If at any time during the installation you want to start over from fresh, delete the LocalSite.cfg file and re-run configure. • Additional resources ♦ TWiki:TWiki.InstallingTWiki#OtherPlatforms ♦ TWiki:TWiki.ApacheConfigGenerator ♦ TWiki:TWiki.SettingFileAccessRightsLinuxUnix ♦ If you upgrade from an older TWiki your lib/TWiki.cfg from the old TWiki installation is a good resource for some of the settings you will need but you cannot reuse the old TWiki.cfg. • Make sure you have a working basic TWiki before you continue

Install Extensions

• From TWiki-4.1.0 on the configure script which you ran during installation supports installation of additional plugins. • Manual installation is possible. Follow the instruction on the plugin page at twiki.org. • Check the plugin topics from your old TWiki installation. There may be plugin settings that you want to transfer to the new TWiki installation. Hint: For an easier upgrade later on, set the plugin preferences settings in the Main.TWikiPreferences topic, not in the plugin topic. To identify the plugin, prefix the name of the setting with the capitalized name of the plugin. For example, to change the DEFAULT_TYPE setting of the CommentPlugin, create a COMMENTPLUGIN_DEFAULT_TYPE setting in Main.TWikiPreferences. • Typical plugin settings you may have altered. ♦ CommentPlugin - Set DEFAULT_TYPE ♦ EditTablePlugin - Set CHANGEROWS, Set QUIETSAVE, and Set EDITBUTTON ♦ InterwikiPlugin - Set RULESTOPIC ♦ InterWikis - If you added your own rules you should save this topic and not overwrite it. ♦ SlideShowPlugin - Make sure you did not change the embedded 'Default Slide Template' If you did you should save it. It is a bad idea to do. It is better to define your own slide show templates as separate topics that do not get overwritten when you upgrade. ♦ SmiliesPlugin - Did you add your own smileys? ♦ TablePlugin - Set TABLEATTRIBUTES. • Remember that a plugin must be activated in configure. • To avoid having to re-apply plugin settings each time you upgrade a plugin or TWiki itself, define the altered plugin settings in Main.TWikiPreferences instead.

Upgrade Procedure 17 TWikiDocumentation < TWiki < TWiki Copy your old webs to new TWiki

• Webs come in pairs, such as twiki/data/Engineering (for page content) and twiki/pub/Engineering (for attachments). • When upgrading from Cairo or earlier it may be necessary to unlock the rcs files in data and pub directories from the old installation using the following shell commands: ♦ find data -name '*,v' -exec rcs -u -M '{}' \; ♦ find pub -name '*,v' -exec rcs -u -M '{}' \; • Copy your local webs over to the data and pub directories of the new install. Do not copy the default webs: TWiki, Main, Trash, Sandbox, _default, and _empty. • Make sure all data and pub files and directories are owned by the webserver user. • Note: TWiki's WebChanges topics depend on the file timestamp. If you touch the .txt files make sure to preserve the timestamp, or to change them in the sequence of old file timestamps.

Copy Users And Their Topics From Main Web

• Copy all the topics from the Main web and corresponding pub/Main directories from the old TWiki to the new TWiki but do not overwrite any of the new topics already inside the new Main directory! • Manually merge all the users from the old Main.TWikiUsers topic to the new TWiki. If you upgrade from Cairo you can simply use the old file and add the missing new system users to the list of users. If you upgrade from TWiki-4.0.x simply use the old topic. Starting from 4.2.0 TWiki no longer ships with a Main.TWikiUsers topic. When you register the first user TWiki now checks for an existing Main.TWikiUsers and if it does not exist it gets created. • If you use data/.htpasswd for authentication copy this file from the old TWiki to the new. ♦ If you upgrade from Cairo and you are using the Htpasswd login manager, then note that email addresses for users have moved out of user topics and into the password file. There is a script that performs this extra upgrade step for you - see tools/upgrade_emails.pl. • The old Sandbox web may have a lot of useful topic and users may use it actively for drafts. Manually select the topics (remember the corresponding pub directories) from the old Sandbox web and copy them to the one of the new TWiki. Decide if you want to overwrite the sandbox homepage and left menu bar or keep the new. • If you added or removed fields from the user topic form you may also have tailored TWiki.TWikiRegistration. Make sure you either reuse the registration topic from the old installation or apply the same field changes to the new TWiki.TWikiRegistration topic. • Starting from 4.2.0 TWiki ships with NewUserTemplate and UserForm in the TWiki web. If you choose to tailor anything you are strongly advised to copy NewUserTemplate and UserForm to the Main web and tailor the Main web copies. TWiki will look for the NewUserTemplate in the Main web first and if it does not exist it uses the default from the TWiki web. By creating a Main.NewUserTemplate and its Main.UserForm you will not loose your tailorings next time you upgrade TWiki. • Make sure all data and pub files and directories are owned by the webserver user.

Apply Customizations To The Skin

• Add Logos, update top bar and left bar as required. • Apply any desired changes to style sheets and templates. The default TopMenuSkin is based on the PatternSkin. • Additional resources: ♦ TWiki:TWiki.UpgradingTWiki04x00PatchReleases ♦ PatternSkinCustomization ♦ PatternSkinCssCookbook

Copy your old webs to new TWiki 18 TWikiDocumentation < TWiki < TWiki Apply Preferences From Old Installation

• Transfer any customized and local settings from TWiki.TWikiPreferences to the topic pointed at by {LocalSitePreferences} (Main.TWikiPreferences). Per default this is Main.TWikiPreferences. This avoids having to write over files in the distribution on a later upgrade. • If you changed any of the topics in the original TWiki distribution, you will have to transfer your changes to the new install manually. There is no simple way to do this, though a suggestion is to use 'diff' to find changed files in the data/TWiki of the old and new TWiki installation, and transfer the changes into the new TWiki install. If you can run a GUI on your server, you may find that using a visual diff tool like WinMerge, meld, kdiff3, xxdiff, etc. is helpful. • Compare the WebPreferences topics in the old TWiki Installation with the default from the new TWiki installation and add any new Preferences that may be relevant. • Compare the WebLeftBar topics in the old TWiki Installation with the default from the new TWiki installation and add any new feature that you desire. Customization of Special Pages

Some pages in the TWiki web are meant to be customized after choice of authentication. If you do not use the internal TWiki password manager the topics that contains the features for changing and resetting passwords and changing the email address should be changed to a note describing how to perform these tasks in your organization. If you have made such customizations remember to replace these topics in the TWiki web with the tailored versions from your old installation. The topics are:

• TWiki.ChangePassword • TWiki.ResetPassword • TWiki.ChangeEmailAddress Upgrading from Cairo to TWiki-4 (additional advice)

Favicon

TWiki-4's PatternSkin introduces the use of the favicon feature which most browsers use to show a small icon in front of the URL and for bookmarks.

In TWiki-4 it is assumed that each web has a favicon.ico file attached to the WebPreferences topic. When you upgrade from Cairo to TWiki-4 you do not have this file and you will get flooded with errors the error log of your web server. There are two solutions to this.

• Attach a favicon.ico file to WebPreferences in each web. • Preferred: Change the setting of the location of favicon.ico in TWikiPreferences so all webs use the favicon.ico from the TWiki web. This is the fastest and easiest solution.

To change the location of favicon.ico in TWikiPreferences to the TWiki web add the following setting to Main.TWikiPreferences:

* Set FAVICON = %PUBURLPATH%/%SYSTEMWEB%/%WEBPREFSTOPIC%/favicon.ico

TWikiUsers topic in Main web

Your old Main.TWikiUsers topic will work in the new TWiki but you will need to ensure that the following four users from the TWikiUsersTemplate topic are copied to the existing TWikiUsers topic in proper alphabetical order:

Apply Preferences From Old Installation 19 TWikiDocumentation < TWiki < TWiki

* TWikiContributor - 2005-01-01 * TWikiGuest - guest - 1999-02-10 * TWikiRegistrationAgent - 2005-01-01 * UnknownUser - 2005-01-01

What these users are:

• TWikiContributor - placeholder for a TWiki developer, and is used in TWiki documentation • TWikiGuest - guest user, used as a fallback if the user can't be identified • TWikiRegistrationAgent - special user used during the new user registration process • UnknownUser - used where the author of a previously stored piece of data can't be determined

You additionally need to ensure that TWikiUsers has the Set ALLOWTOPICCHANGE = TWikiAdminGroup, TWikiRegistrationAgent access control setting. Otherwise people will not be able to register. Important Changes since TWiki-4.0.5

Supported Perl version

TWiki 4.0.5 worked on Perl version 5.6.X. Reports from users has shown that unfortunately TWiki 4.1.0 does not support Perl versions older then 5.8.0. It is the goal that TWiki should work on at least Perl version 5.6.X but none of the developers have had access to Perl installations older than 5.8.0.

Since TWiki 4.1.0 has some urgent bugs the development team decided to release TWiki 4.1.1 without resolving the issue with Perl 5.6.X. We will however address this and try and resolve it for a planned 4.1.2 release. The TWiki community is very interested in contributions from users that have fixes for the code which will enable TWiki to run on older versions of Perl.

See the WhatVersionsOfPerlAreSupported topic to keep up to date with the discussion how to get back support for earlier Perl versions.

Template spec changed

Until TWiki 4.0.5 TWikiTemplates the text inside template definition blocks (anything between %TMPL:DEF{"block"}% and %TMPL:END% was stripped of leading and trailing white space incl new lines.

This caused a lot of problems for skin developers when you wanted a newline before or after the block text.

From TWiki 4.1.0 this has changed so that white space is no longer stripped. Skins like PatternSkin and NatSkin have been updated so that they work with the new behavior. But if you use an older skin or have written your own you will most likely need to make some adjustments.

It is not difficult. The general rule is - if you get mysterious blank lines in your skin, the newline after the %TMPL:DEF{"block"}% needs to be removed. Ie. the content of the block must follow on the same line as the TMPL:DEF.

The spec change have the same impact on CommentPlugin templates where you may have to remove the first line break after the TMPL:DEF. See the CommentPluginTemplate for examples of how comment template definitions should look like in TWiki-4.1.X

An example: A CommentPlugin template that adds a comment as appending a row to a table. Before the spec change this would work.

TWikiUsers topic in Main web 20 TWikiDocumentation < TWiki < TWiki

%TMPL:DEF{OUTPUT:tabletest}%%POS:BEFORE% |%URLPARAM{"comment"}%| -- %WIKIUSERNAME% - %DATE% | %TMPL:END%

From Twiki 4.1.0 the old template definition will add an empty line before the new table row. To fix it simply remove the new line before the table.

%TMPL:DEF{OUTPUT:tabletest}%%POS:BEFORE%|%URLPARAM{"comment"}%| -- %WIKIUSERNAME% - %DATE% | %TMPL:END%

The advantage of the spec change is that now you can add leading and trailing white space including new lines. This was not possible before. Important Changes since TWiki-4.1.0

New location for session and other temporary files

An upgrader upgrading to 4.1.1 should note the following important change

The directory for passthrough files and session files have been replaced by a common directory for temporary files used by TWiki. Previously the two configure settings {PassthroughDir} and {Sessions}{Dir} were by default set to /tmp. These config settings have been replaced by {TempfileDir} with the default setting value /tmp/twiki. If the twiki directory does not exist twiki will create it first time it needs it.

It is highly recommended no longer to use the tmp directory common to other web applications and the new default will work fine for most. You may want to delete all the old session files in /tmp after the upgrade to 4.1.1. They all start with cgisess_. It is additionally highly recommended to limit write access to the {TempfileDir} for security reasons if you have non-admin users with login access to the webserver just like you would do with the other webserver directories. Important Changes since TWiki-4.1.2

New WYSIWYG Editor

TWiki now ships with a new WYSIWYG editor based on TinyMCE replaces the Kupu based editor. TinyMCE is not a perfect Wysiwyg editor but it is magnitudes better than the Kupu editor

The WysiwygPlugin that drives the engine behind both TinyMCE has additionally been heavily improved so that less TWiki Applications are negatively affected by editing WYSIWYG

When TinyMCEPlugin is enabled the Edit button per default becomes WYSIWYG editing mode. A new Raw Edit link has been added to enable application developers to edit the good old way

The WYSIWYG button has been removed.

NEWTOPICLINKSYMBOL removed

The NEWTOPICLINKSYMBOL preference which was deprecated in 4.1 has now been removed from the code. If you want to control the appearance of new links, you can use NEWLINKFORMAT.

Template spec changed 21 TWikiDocumentation < TWiki < TWiki UserForm and NewUserTemplate Customization

When a new user registers on TWiki his user topic is created based on the NewUserTemplate and UserForm.

The NewUserTemplate was located in the TWiki web and the UserForm in the Main web. When upgrading TWiki these were some of the topics you had to take care not to overwrite.

From 4.2.0 the UserForm and NewUserTemplate are distributed in the TWiki web. If you create the two in the Main web the Main web version will be used instead. So if you tailor the user topic format or the form then you should always copy the two files to the Main web and modify the ones in the Main web. When you later upgrade TWiki your tailored template and form will not be overwritten.

TWikiUsers no longer distributed

The Main.TWikiUsers topic contains all the registered users. It is a topic you do not want to overwrite when you upgrade TWiki.

From 4.2.0 this file is no longer included in the TWiki distribution. When you register the first time TWiki creates the Main.TWikiUsers topic in the Main web if it does not exist already. This means that you can now upgrade TWiki without risk of overwriting the important TWikiUsers topic.

• For new installers this makes no difference at all • For upgraders this is one less problem to worry about as your important Main.TWikiUsers topic now no longer gets overwritten when upgrading.

New working directory

A new directory working which per default is located in the twiki root, has been introduced which contains:

• registration_approvals - with 4.2.0 it is moved to here from the data directory. • tmp - so we now avoid having to fight with special access rights and /tmp directory that gets cleaned out when booting. • work_areas - with 4.2.0 it is moved to here from the pub directory. Configure automatically moved the directory when you upgrade.

Note: Remember to restrict access to this new directory when you upgrade.

The configuration setting {WorkingDir} defines the container directory for temporary files, extensions' work areas, and intermediate registration data. The default is working under your installation root.

Take care for that change if you run your own routine to delete obsolete session files, which will now be found under working/tmp/cgisess*.

New Internal Admin Login

TWiki 4.2 introduces a new Internal Admin Login feature which uses "admin" (configurable) as username and the password used for configure to become temporary administrator. When you do a new installation you need to use this feature as Main.TWikiAdminGroup is now access restricted by default to avoid security attacks during the hours an installation may take. From configure there is a link to the TWikiAdminGroup topic and on TWikiAdminGroup the step by step instructions are written in a yellow box. Our advice is not to remove this help text in case you need it later.

UserForm and NewUserTemplate Customization 22 TWikiDocumentation < TWiki < TWiki Important Changes since TWiki-5.0.0

New TopMenuSkin

The TopMenuSkin adds pulldown menus for better usability and corporate/modern look&feel. This skin is based on the PatternSkin, which used the WebLeftBar in each web for navigation. The TopMenuSkin has a new WebTopBar that defines the menu structure in each web. A default menu is shown in case WebTopBar is missing in a web, so you do not need to add a WebTopBar topic to all your existing webs. See TopMenuSkin#WebSpecific instructions in case you need a customized menu structure in a specific web. Important Changes since TWiki-5.1.0

New Page Bookmarks Feature

A new bookmark feature has been introduced that replaces the personal left-bar links. Bookmarking a page is now a simple point and click operation: In the Account pulldown menu, select "Bookmark this page...". Existing bookmarks can be managed with an edit table in Main.Bookmarks topic, accessible via the "----- Bookmarks -----" pulldown menu of the Account pulldown.

The personal left-bar topics such as JohnSmithLeftBar are no longer used. Ask users to select the "----- Bookmarks -----" pulldown menu of the Account pulldown to initially create the bookmarks topic, then to either bookmark pages, or to manually copy & paste old left-bar links to the bookmarks topic.

User Profile Pages Tailored for Workplace

Previous user profile pages had a bare bone look and the form fields were more tailored for public TWiki sites. TWiki-5.1 brings a more visual/modern page layout with profile picture selector, as well as default form fields tailored for the workplace.

Changes to the TWiki.UserForm:

Renamed:

• FirstName to First Name (no change in %META:FIELD name) • LastName to Last Name (no change in %META:FIELD name) • OrganisationName to Organization • OrganisationURL to URL • Profession to Titles • VoIP to Skype ID • State to Region

Removed:

• Address • InstantMessaging (IM) • HomePage • Comment

Added:

• Department • Status Update

Important Changes since TWiki-5.0.0 23 TWikiDocumentation < TWiki < TWiki When upgrading user profile pages pay attention to the renamed and removed fields.

Back to top

TWiki User Authentication

TWiki site access control and user activity tracking options Overview

Authentication, or "login", is the process by which a user lets TWiki know who they are.

Authentication isn't just to do with access control. TWiki uses authentication to identify users, so it can keep track of who made changes, and manage a wide range of personal settings. With authentication enabled, users can personalise TWiki and contribute as recognised individuals, instead of shadows.

TWiki authentication is very flexible, and can either stand alone or integrate with existing authentication schemes. You can set up TWiki to require authentication for every access, or only for changes. Authentication is also essential for access control.

Quick Authentication Test - Use the %USERINFO% variable to return your current identity:

• You are guest, TWikiGuest,

TWiki user authentication is split into four sections; password management, user mapping, user registration, and login management. Password management deals with how users personal data is stored. Registration deals with how new users are added to the wiki. Login management deals with how users log in.

Once a user is logged on, they can be remembered using a Client Session stored in a cookie in the browser (or by other less elegant means if the user has disabled cookies). This avoids them having to log on again and again.

TWiki user authentication is configured through the Security Settings pane in the configure interface.

Please note FileAttachments are not protected by TWiki User Authentication.

Tip: TWiki:TWiki.TWikiUserAuthenticationSupplement on TWiki.org has supplemental documentation on user authentication.

Password Management

As shipped, TWiki supports the Apache 'htpasswd' password manager. This manager supports the use of .htpasswd files on the server. These files can be unique to TWiki, or can be shared with other applications (such as an Apache webserver). A variety of password encodings are supported for flexibility when re-using existing files. See the descriptive comments in the Security Settings section of the configure interface for more details.

You can easily plug in alternate password management modules to support interfaces to other third-party authentication databases.

TWiki User Authentication 24 TWikiDocumentation < TWiki < TWiki User Mapping

Often when you are using an external authentication method, you want to map from an unfriendly "login name" to a more friendly WikiName. Also, an external authentication database may well have user information you want to import to TWiki, such as user groups.

By default, TWiki supports mapping of usernames to wikinames, and supports TWiki groups internal to TWiki. If you want, you can plug in an alternate user mapping module to support import of groups etc.

User Registration

New user registration uses the password manager to set and change passwords and store email addresses. It is also responsible for the new user verification process. the registration process supports single user registration via the TWikiRegistration page, and bulk user registration via the BulkRegistration page (for admins only).

The registration process is also responsible for creating user topics, and setting up the mapping information used by the User Mapping support.

Note: If you are restricting the entire Main web to TWikiGuest, you are required to add TWikiRegistrationAgent to ALLOWWEBCHANGE in your Main/WebPreferences. By doing so, new users are able to register without any errors.

Login Management

Login management controls the way users have to log in. There are three basic options; no login, login via a TWiki login page, and login using the webserver authentication support.

No Login (select none in configure)

Does exactly what it says on the tin. Forget about authentication to make your site completely public - anyone can browse and edit freely, in classic Wiki style. All visitors are given the TWikiGuest default identity, so you can't track individual user activity.

Note: This setup is not recommended on public websites for security reasons; anyone would be able to change system settings and perform tasks usually restricted to administrators.

Template Login (select TWiki::LoginManager::TemplateLogin in configure)

Template Login asks for a username and password in a web page, and processes them using whatever Password Manager you choose. Users can log in and log out. Client Sessions are used to remember users. Users can choose to have their session remembered so they will automatically be logged in the next time they start their browser.

User Mapping 25 TWikiDocumentation < TWiki < TWiki Enabling Template Login

1. Use the configure interface to 1. select the TWiki::LoginManager::TemplateLogin login manager (on the Security Settings pane). 2. select the appropriate password manager for your system, or provide your own. 3. there is also an EXPERT configure setting {TemplateLogin}{PreventBrowserRememberingPassword} that you can set to prevent Browsers from remembering username and passwords if you are concerned about public terminal usage. 2. Register yourself in the TWikiRegistration topic. Check that the password manager recognises the new user. If you are using .htpasswd files, check that a new line with the username and encrypted password is added to the .htpasswd file. If not, you probably got a path wrong, or the permissions may not allow the webserver user to write to that file. 3. Create a new topic to check if authentication works. 4. Edit the TWikiAdminGroup topic in the Main web to include users with system administrator status. This is a very important step, as users in this group can access all topics, independent of TWiki access controls.

TWikiAccessControl has more information on setting up access controls.

At this time TWikiAccessControls cannot control access to files in the pub area, unless they are only accessed through the viewfile script. If your pub directory is set up in the webserver to allow open access you may want to add .htaccess files in there to restrict access.

You can create a custom version of the TWikiRegistration form by copying the topic, and then deleting or adding input tags in your copy. The name="" parameter of the input tags must start with: "Twk0..." (if this is an optional entry), or "Twk1..." (if this is a required entry). This ensures that the fields are carried over into the user profile page correctly. Do not modify the version of TWikiRegistration shipped with TWiki, as your changes will be overwritten next time you upgrade.

The default new user template page is in TWiki.NewUserTemplate. The same variables get expanded as in the template topics. You can create a custom new user profile page by creating the Main.NewUserTemplate topic, which will then override the default.

Apache Login (select TWiki::LoginManager::ApacheLogin in configure)

Using this method TWiki does not authenticate users internally. Instead it depends on the REMOTE_USER environment variable, which is set when you enable authentication in the webserver.

The advantage of this scheme is that if you have an existing website authentication scheme using Apache modules such as mod_auth_ldap or mod_auth_mysql you can just plug in directly to them.

The disadvantage is that because the user identity is cached in the browser, you can log in, but you can't log out again unless you restart the browser.

TWiki maps the REMOTE_USER that was used to log in to the webserver to a WikiName using the table in TWikiUsers. This table is updated whenever a user registers, so users can choose not to register (in which case their webserver login name is used for their signature) or register (in which case that login name is mapped to their WikiName).

Enabling Template Login 26 TWikiDocumentation < TWiki < TWiki The same private .htpasswd file used in TWiki Template Login can be used to authenticate Apache users, using the Apache Basic Authentication support.

Warning: Do not use the Apache htpasswd program with .htpasswd files generated by TWiki! htpasswd wipes out email addresses that TWiki plants in the info fields of this file.

Enabling Apache Login using mod_auth

You can use any other Apache authentication module that sets REMOTE_USER.

1. Use configure to select the TWiki::LoginManager::ApacheLogin login manager. 2. Use configure to set up TWiki to create the right kind of .htpasswd entries. 3. Create a .htaccess file in the twiki/bin directory. There is an template for this file in twiki/bin/.htaccess.txt that you can copy and change. The comments in the file explain what need to be done. If you got it right, the browser should now ask for login name and password when you click on the Edit. If .htaccess does not have the desired effect, you may need to "AllowOverride All" for the directory in httpd.conf (if you have root access; otherwise, e-mail web server support) At this time TWikiAccessControls do not control access to files in the pub area, unless they are only accessed through the viewfile script. If your pub directory is set up to allow open access you may want to add .htaccess files in there as well to restrict access 4. You can create a custom version of the TWikiRegistration form by copying the default topic, and then deleting or adding input tags in your copy. The name="" parameter of the input tags must start with: "Twk0..." (if this is an optional entry), or "Twk1..." (if this is a required entry). This ensures that the fields are carried over into the user profile page correctly. Do not modify the version of TWikiRegistration shipped with TWiki, as your changes will be overwritten next time you upgrade. The default new user template page is in TWiki.NewUserTemplate. The same variables get expanded as in the template topics. You can create a custom new user profile page by creating the Main.NewUserTemplate topic, which will then override the default. 5. Register yourself in the TWikiRegistration topic. Check that a new line with the username and encrypted password is added to the .htpasswd file. If not, you may have got a path wrong, or the permissions may not allow the webserver user to write to that file. 6. Create a new topic to check if authentication works. 7. Edit the TWikiAdminGroup topic in the Main web to include users with system administrator status. This is a very important step, as users in this group can access all topics, independent of TWiki access controls.

TWikiAccessControl has more information on setting up access controls.

Logons via bin/logon

Any time a user requests a page that needs authentication, they will be forced to log on. It may be convenient to have a "logon" link as well, to give the system a chance to identify the user and retrieve their personal settings. It may be convenient to force them to log on.

The bin/logon script enables this. If you are using Apache Login, the bin/logon script must be setup in the bin/.htaccess file to be a script which requires a valid user. Once authenticated, it will redirect the user to the view URL for the page from which the logon script was linked.

Apache Login (select TWiki::LoginManager::ApacheLogin inconfigure) 27 TWikiDocumentation < TWiki < TWiki Sessions

TWiki uses the CPAN:CGI::Session and CPAN:CGI::Cookie modules to track sessions. These modules are de facto standards for session management among Perl . If you can't use Cookies for any reason, CPAN:CGI::Session also supports session tracking using the client IP address.

You don't have to enable sessions to support logins in TWiki. However it is strongly recommended. TWiki needs some way to remember the fact that you logged in from a particular browser, and it uses sessions to do this. If you don't enable sessions, TWiki will try hard to remember you, but due to limitations in the browsers it may also forget you (and then suddenly remember you again later!). So for the best user experience, you should enable sessions.

There are a number of TWikiVariables available that you can use to interrogate your current session. You can even add your own session variables to the TWiki cookie. Session variables are referred to as "sticky" variables.

Getting, Setting, and Clearing Session Variables

You can get, set, and clear session variables from within TWiki web pages or by using script parameters. This allows you to use the session as a personal "persistent memory space" that is not lost until the web browser is closed. Also note that if a session variable has the same name as a TWiki preference, the session variables value takes precedence over the TWiki preference. This allows for per-session preferences.

To make use of these features, use the variables:

%SESSION_VARIABLE{ "varName" }% Read a session variable %SESSION_VARIABLE{ "varName" set="varValue" }% Set a session variable %SESSION_VARIABLE{ "varName" clear="" }% Clear a session variable Special read-only session variables:

• %SESSION_VARIABLE{"AUTHUSER"}% - user ID, current value: • %SESSION_VARIABLE{"SESSION_REQUEST_NUMBER"}% - number of pages accessed by current user since login, current value:

Notes:

• You cannot override access controls preferences this way. • You can use the SetGetPlugin to set and get variables that are not user specific. This plugin can store variables persistently if needed.

Cookies and Transparent Session IDs

TWiki normally uses cookies to store session information on a client computer. Cookies are a common way to pass session information from client to server. TWiki cookies simply hold a unique session identifier that is used to look up a database of session information on the TWiki server.

For a number of reasons, it may not be possible to use cookies. In this case, TWiki has a fallback mechanism; it will automatically rewrite every internal URL it sees on pages being generated to one that also passes session information.

Sessions 28 TWikiDocumentation < TWiki < TWiki TWiki Username vs. Login Username

This section applies only if you are using authentication with existing login names (i.e. mapping from login names to WikiNames).

TWiki internally manages two usernames: Login Username and TWiki Username.

• Login Username: When you login to the intranet, you use your existing login username, ex: pthoeny. This name is normally passed to TWiki by the REMOTE_USER environment variable, and used internally. Login Usernames are maintained by your system administrator.

• TWiki Username: Your name in WikiNotation, ex: PeterThoeny, is recorded when you register using TWikiRegistration; doing so also generates a user profile page in the Main web.

TWiki can automatically map an Intranet (Login) Username to a TWiki Username if the {AllowLoginName} is enabled in configure. The default is to use your WikiName as a login name.

NOTE: To correctly enter a WikiName - your own or someone else's - be sure to include the Main web name in front of the Wiki username, followed by a period, and no spaces, for example Main.WikiUsername or %USERSWEB%.WikiUsername. This points WikiUsername to the Main web, where user profile pages are located, no matter which web it's entered in. Without the web prefix, the name appears as a NewTopic everywhere but in the Main web.

Changing Passwords

If your {PasswordManager} supports password changing, you can change and reset passwords using forms on regular pages.

• The ChangePassword form ( TWiki/ChangePassword ) • The ResetPassword form ( TWiki/ResetPassword )

Changing E-mail Addresses

If the active {PasswordManager} supports storage and retrieval of user e-mail addresses, you can change your e-mail using a regular page. As shipped, this is true only for the Apache 'htpasswd' password manager.

• The ChangeEmailAddress form ( TWiki/ChangeEmailAddress )

Controlling access to individual scripts

You may want to add or remove scripts from the list of scripts that require authentication. The method for doing this is different for each of Template Login and Apache Login.

• For Template Login, update the {AuthScripts} list using configure • For Apache Login, add/remove the script from .htaccess

TWiki Username vs. Login Username 29 TWikiDocumentation < TWiki < TWiki How to choose an authentication method

One of the key features of TWiki is that it is possible to add HTML to topics. No authentication method is 100% secure on a website where end users can add HTML, as there is always a risk that a malicious user can add code to a topic that gathers user information, such as session IDs. The TWiki developers have been forced to make certain tradeoffs, in the pursuit of efficiency, that may be exploited by a hacker.

This section discusses some of the known risks. You can be sure that any potential hackers have read this section as well!

At one extreme, the most secure method is to use TWiki via SSL (Secure Sockets Layer), with a login manager installed and Client Sessions turned off.

Using TWiki with sessions turned off is a pain, though, as with all the login managers there are occasions where TWiki will forget who you are. The best user experience is achieved with sessions turned on.

As soon as you allow the server to maintain information about a logged-in user, you open a door to potential attacks. There are a variety of ways a malicious user can pervert TWiki to obtain another users session ID, the most common of which is known as a cross-site scripting attack. Once a hacker has an SID they can pretend to be that user.

To help prevent these sorts of attacks, TWiki supports IP matching, which ensures that the IP address of the user requesting a specific session is the same as the IP address of the user who created the session. This works well as long as IP addresses are unique to each client, and as long as the IP address of the client can't be faked.

Session IDs are usually stored by TWiki in cookies, which are stored in the client browser. Cookies work well, but not all environments or users permit cookies to be stored in browsers. So TWiki also supports two other methods of determining the session ID. The first method uses the client IP address to determine the session ID. The second uses a rewriting method that rewrites local URLs in TWiki pages to include the session ID in the URL.

The first method works well as long as IP addresses are unique to each individual client, and client IP addresses can't be faked by a hacker. If IP addresses are unique and can't be faked, it is almost as secure as cookies + IP matching, so it ranks as the fourth most secure method.

If you have to turn IP matching off, and cookies can't be relied on, then you may have to rely on the second method, URL rewriting. This method exposes the session IDs very publicly, so should be regarded as "rather dodgy".

Most TWiki sites don't use SSL, so, as is the case with most sites that don't use SSL, there is always a possibility that a password could be picked out of the aether. Browsers do not encrypt passwords sent over non-SSL links, so using Apache Login is no more secure than Template Login.

Of the two shipped login managers, Apache Login is probably the most useful. It lets you do this sort of thing: wget --http-user=RogerRabbit --http-password=i'mnottelling http://www.example.com/bin/save/Sandbox/StuffAUTOINC0?text=hohoho,%20this%20is%20interesting i.e. pass in a user and password to a request from the command-line. However it doesn't let you log out.

Template Login degrades to url re-writing when you use a client like dillo that does not support cookies. However, you can log out and back in as a different user.

Finally, it would be really neat if someone was to work out how to use certificates to identify users.....

See TWiki:TWiki.SecuringTWikiSite for more information.

How to choose an authentication method 30 TWikiDocumentation < TWiki < TWiki Back to top TWiki Access Control

Restricting read and write access to topics and webs, by Users and groups

TWiki Access Control allows you restrict access to single topics and entire webs, by individual user and by user Groups. Access control, combined with TWikiUserAuthentication, lets you easily create and manage an extremely flexible, fine-grained privilege system.

Tip: TWiki:TWiki.TWikiAccessControlSupplement on TWiki.org has additional documentation on access control.

An Important Control Consideration

Open, freeform editing is the essence of WikiCulture - what makes TWiki different and often more effective than other collaboration tools. For that reason, it is strongly recommended that decisions to restrict read or write access to a web or a topic are made with great care - the more restrictions, the less Wiki in the mix. 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 for anyone to rearrange all content on a page - keeps topics focused. • In TWiki, content is transparently preserved under revision control: ♦ Edits can be undone by the administrator (per default a member of TWikiAdminGroup; 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-based Groups (for more and varied input), and... • Avoid creating view-only Users (if you can read it, you should be able to contribute to it). Permissions settings of the webs on this TWiki site

Web Sitemap VIEW CHANGE RENAME Listed DENY ALLOW DENY ALLOW DENY ALLOW Main on TWiki on TWikiAdminGroup TWikiAdminGroup CEMon on CreamGroup MassimoSgaravatto CREAM on CreamGroup MassimoSgaravatto CreamGroup Cloud on CloudGroup CloudGroup Cyclops on MarcoVerlato MarcoVerlato DGAS on SiteManagerGroup SiteManagerGroup EgeeJra1It on EgeeJra1Group EgeeJra1Group Gows on MarcoVerlato MarcoVerlato GridOversight on GridOversightGroup GridOversightGroup IGIPortal on PortalGroup IGIRelease on IGIReleaseGroup IGIReleaseGroup MPI on MpiGroup MpiGroup

TWiki Access Control 31 TWikiDocumentation < TWiki < TWiki

MarcheCloud on on MarcheCloudPilotaCNAF Middleware on MiddlewareGroup MiddlewareGroup Operations on OperationsGroup TWikiAdminUser Sandbox on Security on SecurityGroup SecurityGroup SiteAdminCorner on GiuseppeLaRocca GiuseppeLaRocca OperationsGroup OperationsGroup Training on TrainingGroup TWikiAdminUser UserSupport on UserSupportGroup TwikiAdminUser VOMS off VomsGroup WMS on WmsGroup MassimoSgaravatto SaraBertocco WMSMonitor on WeNMR on MarcoVerlato MarcoVerlato Please Note:

• A blank in the the above table may mean either the corresponding control is absent or commented out or that it has been set to a null value. The two conditions have dramatically different and possibly opposed semantics. • TWikiGuest is the guest account - used by unauthenticated users. • The TWiki web must not deny view to TWikiGuest; otherwise, people will not be able to register.

Note: Above table comes from SitePermissions Authentication vs. Access Control

Authentication: Identifies who a user is based on a login procedure. See TWikiUserAuthentication.

Access control: Restrict access to content based on users and groups once a user is identified.

Users and Groups

Access control is based on the familiar concept of Users and Groups. Users are defined by their WikiNames. They can then be organized in unlimited combinations by inclusion in one or more user Groups. For convenience, Groups can also be included in other Groups.

Managing Users

A user can create an account in TWikiRegistration. The following actions are performed:

• WikiName and encrypted password are recorded using the password manager if authentication is enabled. • A confirmation e-mail is sent to the user. • A user profile page with the WikiName of the user is created in the Main web. • The user is added to the TWikiUsers topic.

The default visitor name is TWikiGuest. This is the non-authenticated user.

Permissions settings of the webs on this TWiki site 32 TWikiDocumentation < TWiki < TWiki Managing Groups

The following describes the standard TWiki support for groups. Your local TWiki may have an alternate group mapping manager installed. Check with your TWiki administrator if you are in doubt.

Groups are defined by group topics located in the Main web. To create a new group, visit TWikiGroups and enter the name of the new group ending in Group into the "new group" form field. This will create a new group topic with two important settings:

• Set GROUP = < list of Users and/or Groups > • Set ALLOWTOPICCHANGE = < list of Users and/or Groups >

The GROUP setting is a comma-separated list of users and/or other groups. Example:

• Set GROUP = SomeUser, OtherUser, SomeGroup

The ALLOWTOPICCHANGE setting 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. This prevents users not in the group from editing the topic to give themselves or others access. For example, for the MarketingGroup topic write:

• Set ALLOWTOPICCHANGE = MarketingGroup

Note: TWiki has strict formatting rules. Make sure you have a real bullet. (In raw edit it is three or six spaces, an asterisk, and an extra space in front of any access control rule.)

The Super Admin Group

A number of TWiki functions (for example, renaming webs) are only available to administrators. Administrators are simply users who belong to the SuperAdminGroup. This is a standard user group, the name of which is defined by {SuperAdminGroup} setting in configure. The default name of this group is the TWikiAdminGroup. The system administrator may have chosen a different name for this group if your local TWiki uses an alternate group mapping manager but for simplicity we will use the default name TWikiAdminGroup in the rest of this topic.

You can create new administrators simply by adding them to the TWikiAdminGroup topic. For example,

• Set GROUP = RobertCailliau, TimBernersLee

A member of the Super Admin Group has unrestricted access throughout the TWiki, so only trusted staff should be added to this group.

Restricting Access

You can define who is allowed to read or write to a web or a topic. Note that some plugins may not respect access permissions.

• Restricting VIEW blocks viewing and searching of content. When you restric VIEW to a topic or web, this also restricts INCLUDE and Formatted SEARCH from showing the content of the topics. • Restricting CHANGE blocks creating new topics, changing topics or attaching files. • Restricting RENAME prevents renaming of topics within a web.

Managing Groups 33 TWikiDocumentation < TWiki < TWiki Note that there is an important distinction between CHANGE access and RENAME access. A user can CHANGE a topic, but thanks to version control their changes cannot be lost (the history of the topic before the change is recorded). However if a topic or web is renamed, that history may be lost. Typically a site will only give RENAME access to administrators and content owners.

Controlling access to a Web

You can define restrictions on who is allowed to view a TWiki web. You can restrict access to certain webs to selected Users and Groups, by:

• authenticating all webs and restricting selected webs: Topic access in all webs is authenticated, and selected webs have restricted access. • authenticating and restricting selected webs only: Provide unrestricted viewing access to open webs, with authentication and restriction only on selected webs.

• You can define these settings in the WebPreferences topic, preferable towards the end of the topic: ♦ Set DENYWEBVIEW = < comma-delimited list of Users and Groups > ♦ Set ALLOWWEBVIEW = < comma-delimited list of Users and Groups > ♦ Set DENYWEBCHANGE = < comma-delimited list of Users and Groups > ♦ Set ALLOWWEBCHANGE = < comma-delimited list of Users and Groups > ♦ Set DENYWEBRENAME = < comma-delimited list of Users and Groups > ♦ Set ALLOWWEBRENAME = < comma-delimited list of Users and Groups >

For example, set this to restrict a web to be viewable only by the MarketingGroup:

• Set ALLOWWEBVIEW = Main.MarketingGroup

If your site allows hierarchical webs, then access to sub-webs is determined from the access controls of the parent web, plus the access controls in the sub-web. So, if the parent web has ALLOWWEBVIEW set, this will also apply to the subweb. Also note that you will need to ensure that the parent web's FINALPREFERENCES does not include the access control settings listed above. Otherwise you will not be able override the parent web's access control settings in sub-webs.

Creation and renaming of sub-webs is controlled by the WEBCHANGE setting on the parent web (or ROOTCHANGE for root webs). Renaming is additionally restricted by the setting of WEBRENAME in the web itself.

Note: If you restrict access to the Main, make sure to add the TWikiRegistrationAgent so that users can register. Example:

• Set ALLOWWEBCHANGE = TWikiAdminGroup, TWikiRegistrationAgent

Note: For Web level access rights Setting any of these settings to an empty value has the same effect as not setting them at all. Please note that the documentation of TWiki 4.0 and earlier versions of TWiki 4.1 did not reflect the actual implementation, e.g. an empty ALLOWWEBVIEW does not prevent anyone from viewing the web, and an an empty DENYWEBVIEW does not allow all to view the web.

Restricting Access 34 TWikiDocumentation < TWiki < TWiki Controlling access to a Topic

• You can define these settings in any topic, preferable towards the end of the topic: ♦ Set DENYTOPICVIEW = < comma-delimited list of Users and Groups > ♦ Set ALLOWTOPICVIEW = < comma-delimited list of Users and Groups > ♦ Set DENYTOPICCHANGE = < comma-delimited list of Users and Groups > ♦ Set ALLOWTOPICCHANGE = < comma-delimited list of Users and Groups > ♦ Set DENYTOPICRENAME = < comma-delimited list of Users and Groups > ♦ Set ALLOWTOPICRENAME = < comma-delimited list of Users and Groups >

For example, set this to restrict a topic to be viewable only by the MarketingExecGroup:

• Set ALLOWTOPICVIEW = Main.MarketingExecGroup

Remember when opening up access to specific topics within a restricted web that other topics in the web - for example, the WebLeftBar - may also be accessed when viewing the topics. The message you get when you are denied access should tell you what topic you were not permitted to access.

Be careful with empty values for any of these.

• Set ALLOWTOPICVIEW = This means the same as not setting it at all. (This was documented wrong in versions 4.0.X, 4.1.0 and 4.1.1)

• Set DENYTOPICVIEW = Since TWiki 4.0 this means do not deny anyone the right to view this topic. If DENYTOPICVIEW is set to an empty value anyone has access even if ALLOWTOPICVIEW or ALLOWWEBVIEW is defined. This allows to have very restrictive default access rights to an entire web and still allow individual topics to have more open access.

The same rules apply to ALLOWTOPICCHANGE/DENYTOPICCHANGE and APPLYTOPICRENAME/DENYTOPICRENAME. Setting ALLOWTOPICCHANGE or ALLOWTOPICRENAME to en empty value means the same as not defining it. Setting DENYTOPICCHANGE or DENYTOPICRENAME to an empty value means that anyone can edit or rename the topic.

If the same setting is defined multiple times the last one overrides the previous. They are not OR'ed together.

The setting to an empty has caused confusion and great debate and it has been decided that the empty setting syntax will be replaced by something which is easier to understand in a later version of TWiki. A method to upgrade will be provided. Please read the release notes carefully when you upgrade.

See "How TWiki evaluates ALLOW/DENY settings" below for more on how ALLOW and DENY interacts.

Controlling access to a Topic 35 TWikiDocumentation < TWiki < TWiki Securing File Attachments

By default, TWiki does not secure file attachments. Without making the following changes to the twiki.conf file, it is possible for anyone who has access to the server to gain access to an attachment if they know the attachment's fully qualified path, even though access to the topic associated with the attachment is secured. This is because attachments are referred to directly by Apache, and are not by default delivered via TWiki scripts. This means that the above instructions for controlling to topics do not apply to attachments unless you make the changes as described below.

An effective way to secure attachments is to apply the same access control settings to attachments as those applied to topics. This security enhancement can be accomplished by instructing the webserver via Apache's mod_rewrite module to redirect accesses to attachments via the TWiki viewfile script, which honors the TWiki access controls settings to topics.

The preferred method to secure attachments is by editing the twiki.conf file to include:

ScriptAlias /twiki/bin/ /filesystem/path/to/twiki/bin/ Alias /twiki/pub/ /filesystem/path/to/twiki/pub/

RewriteEngine on RewriteCond %{REQUEST_URI} !^/+twiki/+pub/+(TWiki|Sandbox)/+.+ RewriteRule ^/+twiki/+pub/+(.*)$ /twiki/bin/viewfile/$1 [L,PT]

Notes:

• You can use TWiki:TWiki/ApacheConfigGenerator to generate the Apache config file for TWiki. • You will need to restart your Apache server after this change. • Images embedded in topics will load slower since attached images will also be delivered by the viewfile script. The TWiki web and Sandbox web are excluded for performance reasons. • As an alternative to editing the twiki.conf file used by Apache, you can make the same change directly to the .htaccess file in the /twiki/bin directory. • The viewfile script sets the mime type based upon file name suffix. Unknown types are served as text/plain which can result in corrupt files.

Controlling who can manage top-level webs

Top level webs are a special case, because they don't have a parent web with a WebPreferences. So there has to be a special control just for the root level.

• You can define these settings in the Main.TWikiPreferences topic, preferable towards the end of the topic: ♦ Set DENYROOTCHANGE = < comma-delimited list of Users and Groups > ♦ Set ALLOWROOTCHANGE = < comma-delimited list of Users and Groups >

Note that you do not require ROOTCHANGE access to rename an existing top-level web. You just need WEBCHANGE in the web itself.

How TWiki evaluates ALLOW/DENY settings

When deciding whether to grant access, TWiki evaluates the following rules in order (read from the top of the list; if the logic arrives at PERMITTED or DENIED that applies immediately and no more rules are

Securing File Attachments 36 TWikiDocumentation < TWiki < TWiki applied). You need to read the rules bearing in mind that VIEW, CHANGE and RENAME access may be granted/denied separately.

1. If the user is an administrator ♦ access is PERMITTED. 2. If DENYTOPIC is set to a list of wikinames ♦ people in the list will be DENIED. 3. If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = ) ♦ access is PERMITTED i.e no-one is denied access to this topic. Attention: Use this with caution. This is deprecated and will likely change in the next release. 4. If ALLOWTOPIC is set 1. people in the list are PERMITTED 2. everyone else is DENIED 5. If DENYWEB is set to a list of wikinames ♦ people in the list are DENIED access 6. If ALLOWWEB is set to a list of wikinames ♦ people in the list will be PERMITTED ♦ everyone else will be DENIED 7. If you got this far, access is PERMITTED Access control and INCLUDE

ALLOWTOPICVIEW and ALLOWTOPICCHANGE only applies to the topic in which the settings are defined. If a topic A includes another topic B, topic A does not inherit the access rights of the included topic B.

Examples: Topic A includes topic B

• If the included topic B has ALLOWTOPICCHANGE set to block editing for a user, it does not prevent editing the including topic A. • If the included topic B has ALLOWTOPICVIEW set to block view for a user, the user can still view topic A but he cannot see the included topic B. He will see a message No permission to view B

Access Control quick recipes

Restrict Access to Whole TWiki Site

For a firewalled TWiki, e.g. an intranet wiki or extranet wiki, you want to allow only invited people to access your TWiki. In this case, enable user authentication with ApacheLogin and lock down access to the whole twiki/bin and twiki/pub directories to all but valid users. In the Apache .htaccess file or the appropriate .conf file, replace the

require valid-user

If needed, you can further restrict access to selected webs with ALLOWWEBVIEW and other access control settings.

Note: With this configuration, someone with access to the site needs to register new users.

How TWiki evaluates ALLOW/DENY settings 37 TWikiDocumentation < TWiki < TWiki Authenticate all Webs and Restrict Selected Webs

Use the following setup to authenticate users for topic viewing in all webs and to restrict access to selected webs. Requires TWikiUserAuthentication to be enabled.

1. Set require valid-user on your view script in .htaccess or the appropriate Apache .conf file. As of 4.x, this looks like: FilesMatch "(attach|edit|manage|rename|save|view|upload|mail|logon|.*auth).*" (normally view is not in that list). 2. Restrict view access to selected Users and Groups. Set one or both of these variables in its WebPreferences topic: ♦ Set DENYWEBVIEW = < list of Users and Groups > ♦ Set ALLOWWEBVIEW = < list of Users and Groups > ♦ Note: DENYWEBVIEW is evaluated before ALLOWWEBVIEW. Access is denied if the authenticated person is in the DENYWEBVIEW list, or not in the ALLOWWEBVIEW list. Access is granted if DENYWEBVIEW and ALLOWWEBVIEW are not defined. 3. If you still want public users to be able to register automatically follow TWiki:TWiki.RegisterOnViewRestrictedSite .

Authenticate and Restrict Selected Webs Only

Use the following setup to provide unrestricted viewing access to open webs, with authentication only on selected webs. Requires TWikiUserAuthentication to be enabled.

1. Restrict view access to selected Users and Groups. Set one or both of these variables in its WebPreferences topic: ♦ Set DENYWEBVIEW = < list of Users and Groups > ♦ Set ALLOWWEBVIEW = < list of Users and Groups > ♦ Note: DENYWEBVIEW is evaluated before ALLOWWEBVIEW. Access is denied if the authenticated person is in the DENYWEBVIEW list, or not in the ALLOWWEBVIEW list. Access is granted if DENYWEBVIEW and ALLOWWEBVIEW are not defined.

Hide Control Settings

Tip: To hide access control settings from normal browser viewing, you can put them into the topic preference settings by clicking the link Edit topic preference settings under More topic actions menu. Preferences set in this manner are not visible in the topic text, but take effect nevertheless. Access control settings added as topic preference settings are stored in the topic meta data and they override settings defined in the topic text.

Alternatively, place them in HTML comment markers, but this exposes the access setting during ordinary editing.

Obfuscating Webs

Another way of hiding webs is to keep them hidden by not publishing the URL and by preventing the all webs search option from accessing obfuscated webs. Do so by enabling the NOSEARCHALL variable in WebPreferences:

Authenticate all Webs and Restrict Selected Webs 38 TWikiDocumentation < TWiki < TWiki

• Set NOSEARCHALL = on

This setup can be useful to hide a new web until content its ready for deployment, or to hide view access restricted webs.

Note: Obfuscating a web without view access control is very insecure, as anyone who knows the URL can access the web.

Read-only Skin Mode

It is possible to turn the PatternSkin and TopMenuSkin into read-only mode by removing the edit and attach controls (links and buttons). This is mainly useful if you have TWiki application pages or dashboards where you do not want regular users to change content. The read-only skin mode is not a replacement for access control; you can use it in addition to access control. Details at PatternSkinCustomization#ReadOnlySkinMode.

Back to top

TWiki Text Formatting

These instructions are for contributors who prefer to use the Raw Edit over the default WYSIWYG editor. Working in TWiki is as easy as typing in text. You don't need to know HTML, though you can use it if you prefer. Links to topics are created automatically when you enter WikiWords. And TWiki shorthand gives you all the power of HTML with a simple coding system that takes no time to learn. It's all laid out below.

TWiki Editing Shorthand

Formatting Command: You write: You get: Paragraphs: 1st paragraph 1st paragraph Blank lines will create new paragraphs. 2nd paragraph 2nd paragraph Headings: ---++ Sushi Three or more dashes at the beginning of a line, ---+++ Maguro ---+++!! Not in TOC Sushi followed by plus signs and the heading text. One plus creates a top level heading, two pluses a second level heading, etc. The maximum heading Maguro depth is 6. Not in TOC You can create a table of contents with the %TOC% variable. If you want to exclude a heading from the TOC, put !! after the ---+. Empty headings are allowed and won't appear in the table of contents. Bold Text: *Bold* Bold Words get shown in bold by enclosing them in * asterisks. Italic Text: _Italic_ Italic Words get shown in italic by enclosing them in _

TWiki Text Formatting 39 TWikiDocumentation < TWiki < TWiki underscores. Bold Italic: __Bold italic__ Bold italic Words get shown in bold italic by enclosing them in __ double-underscores. Fixed Font: =Fixed font= Fixed font Words get shown in fixed font by enclosing them in = equal signs. Bold Fixed Font: ==Bold fixed== Bold fixed Words get shown in bold fixed font by enclosing them in double equal signs. You can follow the closing bold, italic, or _This works_, This works, other (* _ __ = ==) indicator with normal _this does not _ _this does not _ _this fails punctuation, such as commas and full stops. too_ _this fails too_ Make sure there is no space between the text and the indicators. All words enclosed by the indicators need to be on the same line. Separator (Horizontal Rule): ------Three or more three dashes at the beginning of a line.. Bulleted List: * level 1 Multiple of three spaces, an asterisk, and another * level 2 • level 1 * back on 1 space. * A bullet ♦ level 2 For all the list types, you can break a list item broken over • back on 1 over several lines by indenting lines after the first three lines • A bullet broken one by at least 3 spaces. * last bullet over three lines • last bullet Numbered List: 1. Sushi Multiple of three spaces, a type character, a dot, 1. Dim Sum 1. Sushi 1. Fondue and another space. Several types are available 2. Dim Sum besides a number: A. Sushi 3. Fondue Type Generated Style Sample A. Dim Sum Sequence A. Fondue 1. Sushi 1. Arabic numerals 1, 2, 3, 4... i. Sushi 2. Dim Sum A. Uppercase letters A, B, C, D... i. Dim Sum 3. Fondue a. Lowercase letters a, b, c, d... i. Fondue I. Uppercase Roman I, II, III, IV... 1. Sushi Numerals 2. Dim Sum 3. Fondue i. Lowercase Roman i, ii, iii, iv... Numerals Definition List: $ Sushi: Japan Three spaces, a dollar sign, the term, a colon, a $ Dim Sum: S.F. Sushi space, followed by the definition. Japan Dim Sum Deprecated syntax: Three spaces, the term with S.F. no spaces, a colon, a space, followed by the definition.

Not in TOC 40 TWikiDocumentation < TWiki < TWiki

Table: | *L* | *C* | *R* | L C R Each row of the table is a line containing of one | A2 | B2 | C2 | | A3 | B3 | C3 | A2 B2 C2 or more cells. Each cell starts and ends with a | multi span ||| A3 B3 C3 vertical bar '|'. Any spaces at the beginning of a | A5-7 | 5 | 5 | multi span line are ignored. |^| six | six | |^| seven | seven | A5-7 5 5 six six • | *bold* | header cell with text in | split\ | over\ seven seven asterisks | 3 lines | split over 3 lines • | center-aligned | cell | A9 | B9 | C9 | with at least two, and equal number of A9 B9 C9 spaces on either side • | right-aligned | cell with more spaces on the left • | 2 colspan || and multi-span columns with multiple |'s right next to each other • |^| cell with caret indicating follow-up row of multi-span rows • You can split rows over multiple lines by putting a backslash '\' at the end of each line • Contents of table cells wrap automatically as determined by the browser • Use %VBAR% or | to add | characters in tables. • Use %CARET% or ^ to add ^ characters in tables.

The TablePlugin provides the |^| multiple-span row functionality and additional rendering features WikiWord Links: WebStatistics WebStatistics CapitalizedWordsStuckTogether (or WikiWords) Sandbox.WebNotify will produce a link automatically if preceded by WebNotify whitespace or parenthesis. Sandbox.WebHome If you want to link to a topic in a different web Sandbox write Otherweb.TopicName. Sandbox.Subweb.TopicName To link to a topic in a subweb write TopicName Otherweb.Subweb.TopicName. The link label excludes the name of the web, e.g. only the topic name is shown. As an exception, the name of the web is shown for the WebHome topic. Dots '.' are used to separate webs and subwebs from topic names and therefore cannot be used in topic names.

It's generally a good idea to use the TWikiVariables %SYSTEMWEB% and %USERSWEB% instead of TWiki and Main. Anchors: [[WikiWord#NotThere]] WikiWord#NotThere You can define a reference inside a TWiki topic [[#MyAnchor][Jump]]

Not in TOC 41 TWikiDocumentation < TWiki < TWiki

(called an anchor name) and link to that. To Jump define an anchor write #AnchorName at the #MyAnchor To here beginning of a line. The anchor name must be a To here WikiWord of no more than 32 characters. To link to an anchor name use the [[MyTopic#MyAnchor]] syntax. You can omit the topic name if you want to link within the same topic. Forced Links: [[WikiWord]] WikiWord Use double square brackets to create forced links: [[WikiWord#TheSyntax]] Write [[link]] or [[link][label]] to WikiWord#TheSyntax force a link. Use the former for singleton words [[WikiSyntax][wiki syntax]] and if automatic linking is disabled. Use the latter wiki syntax one to specify a link label other than the link. For [[http://gnu.org/][GNU]] the link, you can use internal link references (e.g. [[Singleton]] GNU WikiWords) and URLs (e.g. http://TWiki.org/ ). Anchor names can be added to create a link to escaped: Singleton a specific place in a document. ![[WikiSyntax]] To "escape" double square brackets that would escaped: otherwise make a link, prefix the leading left [[WikiSyntax]] square bracket with an exclamation point. Prevent a Link: !SunOS SunOS Prevent a WikiWord from being linked by prepending it with an exclamation point. Disable Links: RedHat & SuSE You can disable automatic linking of WikiWords RedHat & SuSE by surrounding text with and tags. It is possible to turn off all auto-linking with a NOAUTOLINK preferences setting. Mailto Links: [email protected] [email protected] E-mail addresses are linked automatically. To [[mailto:[email protected]]\ create e-mail links that have more descriptive [Mail]] Mail link text, specify subject lines or message bodies, or omit the e-mail address, you can write [[mailto:?subject=\ Hi [[mailto:user@domain][descriptive Hi][Hi]] text]]. Verbatim Text: class CatAnimal { Surround code excerpts and other formatted text class CatAnimal { void purr() { void purr() { with and tags. } verbatim tags disable HTML code. Use } }

 and 
tags instead if you want the } HTML code within the tags to be interpreted. NOTE: Preferences variables (* Set NAME = value) are set within verbatim tags. Literal Text: | Not | A | Table | TWiki generates HTML code from TWiki | Not | A | Table | shorthand. Experts surround anything that must be output literally in the HTML code, without the application of TWiki shorthand rules, with .. tags. any HTML within literal tags must be well formed

Not in TOC 42 TWikiDocumentation < TWiki < TWiki i.e. all tags must be properly closed before the end of the literal block. TWiki Variables are expanded within literal blocks. Protected Text: This div is required Experts protect text from mangling by

This div is required WYSIWYG editors using
.. tags. Sticky tags don't have any effect on normal topic display; they are only relevant when content has to be protected from a WYSIWYG editor (usually because it isn't well-formed HTML, or because it is HTML that WYSIWYG would normally filter out or modify). Protected content appears as plain text in the WYSIWYG editor.

Using HTML, CSS and JavaScript

You can use most HTML tags in TWiki topics without a problem. This is useful where you want to add some content that is formatted in a way that is not supported using TWiki shorthand, for example, you can write deleted text to get deleted text.

There are a few usability and technical considerations to keep in mind:

• On collaboration pages, it's better not to use HTML, but to use TWiki shorthand instead - this keeps the text uncluttered and easy to edit using the plaintext editor. • If you must use HTML, use XHTML 1.0 Transitional syntax. • Use .. tags around blocks of HTML to avoid accidental interpretation of TWiki shorthand within the HTML. • Script tags may be filtered out, at the discretion of your TWiki administrator.

Recommendations when pasting HTML from other sources (using the plain-text editor):

• Copy only text between and tags. • Remove all empty lines. TWiki inserts

paragraph tags on empty lines, which causes problems if done between HTML tags that do not allow paragraph tags, like for example between table tags. • Remove leading spaces. TWiki might interpret some text as lists. • Do not span a tag over more than one line. TWiki requires that the opening and closing angle brackets - <...> - of a HTML tag are on the same line, or the tag will be broken. • In your HTML editing program, save without hard line breaks on text wrap.

When using a WYSIWYG editor, you can just copy-paste directly into the editor, and the content will be converted to TWiki shorthand automatically when you save.

It is also possible to add Cascading Style Sheets (CSS ) and JavaScript code to TWiki pages, which can be used to make TWiki application more interactive. To prevent TWiki from interpreting some text as markup, it can be enclosed in HTML-escaped

-tags.

JavaScript Example: CSS Example:

Hyperlinks

Being able to create links without any special formatting is a core TWiki feature, made possible with WikiWords and inline URLs.

Internal Links

• GoodStyle is a WikiWord that links to the GoodStyle topic located in the current web.

• NotExistingYet is a topic waiting to be written because it is a red-link. Create the topic by clicking on the link. (Try clicking, but then, Cancel - creating the topic would wreck this example!)

External Links

• http://..., https://..., ftp://..., gopher://..., news://..., file://..., telnet://... and mailto:...@... are linked automatically.

• Write [[URL][label]] to get an external link with a descriptive text for the link, such as [[http://google.com/][Google home page]] to get Google home page .

• E-mail addresses like [email protected] are linked automatically. TWiki Variables

TWiki Variables are names enclosed in percent signs that are that are expanded to some other text when the topic is displayed. For example, %TOPIC% is expanded to TWikiVariablesQuickStart. Some variables can take arguments in curly braces - for example, %INCLUDE{"OtherTopic" ARG="arg"}%.

Many TWiki variables are built-in, and others are predefined for your convenience. TWikiVariables describes how you can also define your own TWiki Variables at the entire site, individual web, or individual topic level. Variables are fully expanded before any of the TWiki text formatting rules are applied.

Commonly used variables:

• %TOC% : Automatically generates a table of contents based on headings in a topic - see the top of this page for an example. • %WEB% : The current web, is TWiki. • %TOPIC% : The current topic name, is TWikiVariablesQuickStart. • %ATTACHURL% : The attachment URL of the current topic. Example usage: If you attach a file to a topic you can refer to it as %ATTACHURL%/image.gif to show the URL of the file or the image in your text. • %INCLUDE{"SomeTopic"}% : Server side include, includes another topic. The current web is the default web. Example: %INCLUDE{"TWiki.SiteMap"}% • %SEARCH{"sushi"}% : Inline search showing the search result embedded in a topic. FormattedSearch gives you control over formatting, used to create web-based applications. • Documentation Graphics: There are many graphics available to use in your topics. Use %ICON{"help"}%, %ICON{"tip"}%, and %ICON{"warning"}% to get: , , and , respectively. • See all TWiki variables.

Hyperlinks 44 TWikiDocumentation < TWiki < TWiki To "escape" a variable, prefix it with an exclamation mark. Write: !%SOMEVARIABLE% to get: %SOMEVARIABLE%. TWikiPlugin Formatting Extensions

Plugins can extend the functionality of TWiki into many other areas. There are a huge number of TWiki plugins available from the Plugins web on TWiki.org.

Currently enabled plugins on this TWiki installation, as listed by %PLUGINDESCRIPTIONS%:

• SpreadSheetPlugin (2013-10-10, $Rev: 26482 (2013-10-14) $): Add spreadsheet calculation like "$SUM( $ABOVE() )" to TWiki tables or anywhere in topic text • BackupRestorePlugin (2013-02-16, $Rev: 25448 (2013-10-14) $): Administrator utility to backup, restore and upgrade a TWiki site • ColorPickerPlugin (2013-02-15, $Rev: 25074 (2013-10-14) $): Color picker, packaged for use in TWiki forms and TWiki applications • CommentPlugin (2013-02-10, $Rev: 24977 (2013-10-14) $): Quickly post comments to a page without an edit/preview/save cycle • DatePickerPlugin (2013-09-04, $Rev: 26272 (2013-10-14) $): Pop-up calendar with date picker, for use in TWiki forms, HTML forms and TWiki plugins • EditTablePlugin (2013-01-13, $Rev: 25108 (2013-10-14) $): Edit TWiki tables using edit fields, date pickers and drop down boxes • ExplicitNumberingPlugin (1.6, $Rev: 19806 (2010-11-09) $): Use the ##., ##.. etc. notation to insert outline numbering sequences (1, 1.1, 2, 2.1) in topic's text. Also support numbered headings. • GoogleAnalyticsPlugin (2011-05-14, $Rev: 21272 (2011-05-14) $): Adds Google Analytics javascript code to specified pages • HeadlinesPlugin (2013-02-16, $Rev: 25104 (2013-10-14) $): Show headline news in TWiki pages based on RSS and ATOM news feeds from external sites • InterwikiPlugin (2013-02-12, $Rev: 25126 (2013-10-14) $): Text ExternalSite:Page links to a page on an external site based on aliases defined in a rules topic • JQueryPlugin (2013-09-28, $Rev: 26439 (2013-10-14) $): jQuery JavaScript library for TWiki • PreferencesPlugin (2013-09-08, $Rev: 26286 (2013-10-14) $): Allows editing of preferences using fields predefined in a form • RenderListPlugin (2013-01-28, $Rev: 24820 (2013-10-14) $): Render bullet lists in a variety of formats • SetGetPlugin (2013-01-28, $Rev: 24822 (2013-10-14) $): Set and get variables in topics, optionally persistently across topic views • SlideShowPlugin (2013-04-07, $Rev: 25715 (2013-10-14) $): Create web based presentations based on topics with headings. • SmiliesPlugin (2013-01-13, $Rev: 24784 (2013-10-14) $): Render smilies as icons, like :-) for or :eek: for • TablePlugin (2013-09-25, $Rev: 26425 (2013-10-14) $): Control attributes of tables and sorting of table columns • TagMePlugin (2013-10-23, $Rev: 26549 (2013-10-25) $): Tag wiki content collectively or authoritatively to find content by keywords • TwistyPlugin (2013-03-22, $Rev: 25508 (2013-10-14) $): Twisty section JavaScript library to open/close content dynamically

Check on current Plugin status and settings for this site in TWikiPreferences. Common Editing Errors

TWiki formatting rules are fairly simple to use and quick to type. However, there are some things to watch out

TWiki Variables 45 TWikiDocumentation < TWiki < TWiki for, taken from the TextFormattingFAQ:

• Q: Text enclosed in angle brackets like is not displayed. How can I show it as it is? ♦ A: The '<' and '>' characters have a special meaning in HTML, they define HTML tags. You need to escape them, so write '<' instead of '<', and '>' instead of '>'. Example: Type 'prog <filename>' to get 'prog '.

• Q: Why is the '&' character sometimes not displayed? ♦ A: The '&' character has a special meaning in HTML, it starts a so called character entity, i.e. '©' is the © copyright character. You need to escape '&' to see it as it is, so write '&' instead of '&'. Example: Type 'This & that' to get 'This & that'.

Related topics: WikiSyntax, WikiWord, WikiNotation, TextFormattingRules, TWikiEditingShorthand, TWikiRenderingShortcut, TWikiShorthand, TWikiVariablesQuickStart

Back to top

TWiki Variables

Special text strings expand on the fly to display user data or system info

TWikiVariables are text strings - %VARIABLE% or %VARIABLE{ parameter="value" }% - that expand into content whenever a topic is rendered for viewing. There are two types of variables:

1. Preferences variables: Can be defined and changed by the user 2. Predefined variables: Defined by the TWiki system or by plugins (for example, the SpreadSheetPlugin introduces a %CALC{}% variable) Using Variables

To use a variable type its name. For example,

• type %T% to get (a preferences variable) • type %TOPIC% to get TWikiVariables (a predefined variable) • type %CALC{ "$UPPER(Text)" }% to get TEXT (a variable defined by a plugin)

Note:

• To leave a variable unexpanded, precede it with an exclamation point, e.g. type !%TOPIC% to get %TOPIC% • Variables are expanded relative to the topic they are used in, not the topic they are defined in • Type %ALLVARIABLES% to get a full listing of all variables defined for a particular topic Variable Names

Variable names must start with a letter. The following characters can be letters, numbers and the underscore '_'. You can use both upper-case and lower-case letters and you can mix the characteres. E.g. %MYVAR%, %MyVar%, %My2ndVar%, and %My_Var% are all valid variable names. Variables are case sensitive. %MyVAR% and %MYVAR% are not the same variable.

TWiki Variables 46 TWikiDocumentation < TWiki < TWiki By convention all settings, predefined variables and variables used by plugins are always UPPER-CASE.

Preferences Variables

Unlike predefined variables, preferences variables can be defined by the user in various places.

Setting Preferences Variables

You can set variables in all the following places:

1. system level in TWiki.TWikiPreferences 2. plugin topics (see TWikiPlugins) 3. local site level in Main.TWikiPreferences 4. user level in individual user topics in Main web 5. web level in WebPreferences of each web 6. topic level in topics in webs 7. session variables (if sessions are enabled)

Settings at higher-numbered levels override settings of the same variable at lower numbered levels, unless the variable was included in the setting of FINALPREFERENCES at a lower-numbered level, in which case it is locked at the value it has at that level.

If you are setting a variable and using it in the same topic, note that TWiki reads all the variable settings from the saved version of the topic before it displays anything. This means you can use a variable anywhere in the topic, even if you set it somewhere inconspicuous near the end. But beware: it also means that if you change the setting of a variable you are using in the same topic, preview will show the wrong thing, and you must save the topic to see it correctly.

The syntax for setting variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets): [multiple of 3 spaces] * [space] Set [space] VARIABLENAME [space] = [space] value

Examples:

* Set VARIABLENAME1 = value * Set VARIABLENAME2 = value

Spaces between the = sign and the value will be ignored. You can split a value over several lines by indenting following lines with spaces - as long as you don't try to use * as the first character on the following line.

Example:

* Set VARIABLENAME = value starts here and continues here

Whatever you include in your variable will be expanded on display, exactly as if it had been entered directly.

Example: Create a custom logo variable

• To place a logo anywhere in a web by typing %MYLOGO%, define the Variable on the web's WebPreferences topic, and upload a logo file, ex: mylogo.gif. You can upload by attaching the

Variable Names 47 TWikiDocumentation < TWiki < TWiki file to WebPreferences, or, to avoid clutter, to any other topic in the same web, e.g. LogoTopic. Sample variable setting in WebPreferences:

* Set MYLOGO = %PUBURL%/%WEB%/LogoTopic/mylogo.gif

You can also set preferences variables on a topic by clicking the link Edit topic preference settings under More topic actions. Use the same * Set VARIABLENAME = value syntax. Preferences set in this manner are not visible in the topic text, but take effect nevertheless.

Parameterized Variables (Macros)

It is possible to pass parameters to TWiki variables. This is called a macro in a .

To define a parameterized variable, set a variable that contains other variables, such as:

* Set EXAMPLE = Example variable using %DEFAULT%, %PARAM1% and %PARAM2% * Set DEMO = Demo using %DEFAULT{ default="(undefined)" }%, %PARAM1{ default="(undefined)" }% and %PARAM2{ default="(undefined)" }%

A special %DEFAULT% variable denotes the default (nameless) parameter of the calling variable. Variables optionally may list a default="..." parameter that gets used in case the calling variable does not specify that parameter.

To use a parameterized variable (or call a macro), add parameters within the curly brackets, such as:

* %EXAMPLE{ "foo" PARAM1="bar" PARAM2="baz" }% * %DEMO{ "demo" PARAM2="parameter 2" }% -- note that PARAM1 is missing which resolves to:

• %EXAMPLE{ "foo" PARAM1="bar" PARAM2="baz" }% • %DEMO{ "demo" PARAM2="parameter 2" }% -- note that PARAM1 is missing

Parameters in the variable definition are expanded using the following sequence:

1. Parameter from variable call. In above example, %PARAM1% gets expanded to bar. 2. Session variable and preferences settings Example

Define variables:

* Set DRINK = red wine * Set FAVORITE = My %DEFAULT{default="favorite"}% dish is %DISH{default="steak"}%, my %DEFAULT{default="favorite"}% drink is %DRINK%.

The default can be defined with a default parameter (%DISH{default="steak"}%), or as a preferences setting (Set DRINK = ...).

Use Variables:

%FAVORITE{ DISH="Sushi" DRINK="Sake" }%

Returns:

Setting Preferences Variables 48 TWikiDocumentation < TWiki < TWiki %FAVORITE{ DISH="Sushi" DRINK="Sake" }%

%FAVORITE{}%

Returns: %FAVORITE{}%

%FAVORITE{ "preferred" }%

Returns: %FAVORITE{ "preferred" }%

Access Control Variables

These are special types of preferences variables to control access to content. TWikiAccessControl explains these security settings in detail.

Local values for variables

Certain topics (a users home topic, web site and default preferences topics) have a problem; variables defined in those topics can have two meanings. For example, consider a user topic. A user may want to use a double-height edit box when they are editing their home topic - but only when editing their home topic. The rest of the time, they want to have a normal edit box. This separation is achieved using Local in place of Set in the variable definition. For example, if the user sets the following in their home topic:

* Set EDITBOXHEIGHT = 10 * Local EDITBOXHEIGHT = 20

Then when they are editing any other topic, they will get a 10 high edit box. However when they are editing their home topic, they will get a 20 high edit box. Local can be used wherever a preference needs to take a different value depending on where the current operation is being performed.

Use this powerful feature with great care! %ALLVARIABLES% can be used to get a listing of the values of all variables in their evaluation order, so you can see variable scope if you get confused.

Frequently Used Preferences Variables

The following preferences variables are frequently used. They are defined in TWikiPreferences#Miscellaneous_Settings:

• %BB% - line break and bullet combined • %BB2% - level 2 bullet with line break • %BB3% - level 3 bullet with line break • %BB4% - level 4 bullet with line break • %BR% - line break • %BULLET% - bullet sign • %CARET% - caret symbol • %VBAR% - vertical bar • %H% - Help icon • %I% - Idea icon • %M% - Moved to icon • %N% - New icon • %P% - Refactor icon • %Q% - Question icon

Example 49 TWikiDocumentation < TWiki < TWiki

• %S% - Pick icon • %T% - Tip icon • %U% - Updated icon • %X% - Alert icon • %Y% - Done icon • %RED% text %ENDCOLOR% - colored text (also %YELLOW%, %ORANGE%, %PINK%, %PURPLE%, %TEAL%, %NAVY%, %BLUE%, %AQUA%, %LIME%, %GREEN%, %OLIVE%, %MAROON%, %BROWN%, %BLACK%, %GRAY%, %SILVER%, %WHITE%) • %REDBG% text %ENDBG% - colored background (also %YELLOWBG%, %ORANGEBG%, %PINKBG%, %PURPLEBG%, %TEALBG%, %NAVYBG%, %BLUEBG%, %AQUABG%, %LIMEBG%, %GREENBG%, %OLIVEBG%, %MAROONBG%, %BROWNBG%, %BLACKBG%, %GRAYBG%, %SILVERBG%, %WHITEBG%)

There are additional useful preferences variables defined in TWikiPreferences, in Main.TWikiPreferences, and in WebPreferences of every web.

Predefined Variables

Most predefined variables return values that were either set in the configuration when TWiki was installed, or taken from server info (such as current username, or date and time). Some, like %SEARCH%, are powerful and general tools.

• Predefined variables can be overridden by preferences variables (except TOPIC and WEB) • Plugins may extend the set of predefined variables (see individual plugin topics for details) • Take the time to thoroughly read through ALL preference variables. If you actively configure your site, review variables periodically. They cover a wide range of functions, and it can be easy to miss the one perfect variable for something you have in mind. For example, see %INCLUDINGTOPIC%, %INCLUDE%, and the mighty %SEARCH%. Search predefined variables List of all predefined variables

This TWiki: - TWiki-6.0.0, Mon, 14 Oct 2013, build 26523

ACTIVATEDPLUGINS -- list of currently activated plugins

• Syntax: %ACTIVATEDPLUGINS% • Expands to: SpreadSheetPlugin, BackupRestorePlugin, ColorPickerPlugin, CommentPlugin, DatePickerPlugin, EditTablePlugin, ExplicitNumberingPlugin, GoogleAnalyticsPlugin, HeadlinesPlugin, InterwikiPlugin, JQueryPlugin, PreferencesPlugin, RenderListPlugin, SetGetPlugin, SlideShowPlugin, SmiliesPlugin, TablePlugin, TagMePlugin, TwistyPlugin • Related: PLUGINDESCRIPTIONS, FAILEDPLUGINS, PLUGINVERSION, TWikiPlugins, InstalledPlugins

ADDTOHEAD -- add HTML to the HTML head section of the current page

Frequently Used Preferences Variables 50 TWikiDocumentation < TWiki < TWiki

• Useful for TWiki applications to add custom CSS or JavaScript to the HTML head section of a topic. Supplied TWiki variables will be expanded. %ADDTOHEAD{}% expands in-place to an empty string, unless there is an error in which case the variable expands to an error string. • Syntax: %ADDTOHEAD{ "..." text="..." }% • Supported parameters: Parameter: Description: Comment: "..." ID of the head block, such as "MY_CSS" Optional but recommended text="..." HTML text to add to the head section Mutually exclusive with topic="" topic="Web.TopicName" Name of topic that contains the full HTML text to Mutually add to the head section, such as exclusive with topic="Main.MyCssTopic" text="" requires="..., ..." Comma-separated list of other IDs this one Optional depends on • Example: %ADDTOHEAD{ "MYBOX_CSS" text="" }%

ALLVARIABLES -- list of currently defined TWikiVariables

• Syntax: %ALLVARIABLES% • Expands to: a table showing all defined TWikiVariables in the current context

AQUA -- start aqua colored text

• AQUA is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %AQUA% aqua text %ENDCOLOR% • Expands to: aqua text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: ENDCOLOR, REDBG, TWikiPreferences rendering shortcuts, StandardColors

ATTACHURL -- full URL for attachments in the current topic

• Syntax: %ATTACHURL% • Expands to: https://wiki-igi.cnaf.infn.it/twiki/pub/TWiki/VarATTACHURL • Example: If you attach a file you can refer to it as %ATTACHURL%/image.gif • Related: ATTACHURLPATH, PUBURL, PUBURLPATH, SCRIPTURL, SCRIPTURLPATH, FileAttachments

ATTACHURLPATH -- path of the attachment URL of the current topic

• Syntax: %ATTACHURLPATH% • Expands to: /twiki/pub/TWiki/VarATTACHURLPATH • Related: ATTACHURL, PUBURL, PUBURLPATH, SCRIPTURL, SCRIPTURLPATH, FileAttachments

ADDTOHEAD -- add HTML to the HTML head section of the current page 51 TWikiDocumentation < TWiki < TWiki AUTHREALM -- authentication realm

• String defined as {AuthRealm} in configure. This is used in certain password encodings, and in login templates as part of the login prompt. • Syntax: %AUTHREALM% • Expands to: Enter your LoginName. (Typically First name and last name, no space, no dots, capitalized, e.g. JohnSmith, unless you chose otherwise). Visit TWikiRegistration if you do not have one. • Related: TWikiUserAuthentication, SESSIONID, SESSIONVAR, LOGIN, LOGOUT, SESSION_VARIABLE

BASETOPIC -- base topic where an INCLUDE started

• The name of the topic where a single or nested INCLUDE started - same as %TOPIC% if there is no INCLUDE • Syntax: %BASETOPIC% • Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, TOPIC

BASEWEB -- base web where an INCLUDE started

• 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. • Syntax: %BASEWEB% • Syntax: %BASEWEB{format="..."}% -- see WEB for format documentation • Related: BASETOPIC, INCLUDINGWEB, INCLUDE, WEB

BB -- bullet with line break

• Line break and bullet without indentation. • Type: Preference variable - TWikiRenderingShortcut. • Syntax: %BB% • Expands to: • • Related: BB2, BB3, BB4, BR, BULLET, CARET, VBAR, TWikiPreferences rendering shortcuts

BB2 -- level 2 bullet with line break

• Line break and bullet, level 2. • Type: Preference variable - TWikiRenderingShortcut. • Syntax: %BB2% • Expands to: • • Related: BB, BB3, BB4, BR, BULLET, CARET, VBAR, TWikiPreferences rendering shortcuts

BB3 -- level 3 bullet with line break

• Line break and bullet, level 3. • Type: Preference variable - TWikiRenderingShortcut.

AUTHREALM -- authentication realm 52 TWikiDocumentation < TWiki < TWiki

• Syntax: %BB3% • Expands to: • • Related: BB, BB2, BB4, BR, BULLET, CARET, VBAR, TWikiPreferences rendering shortcuts

BB4 -- level 4 bullet with line break

• Line break and bullet, level 4. • Type: Preference variable - TWikiRenderingShortcut. • Syntax: %BB4% • Expands to: • • Related: BB, BB2, BB3, BR, BULLET, CARET, VBAR, TWikiPreferences rendering shortcuts

BLACK -- start black colored text

• BLACK is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %BLACK% black text %ENDCOLOR% • Expands to: black text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: ENDCOLOR, REDBG, TWikiPreferences rendering shortcuts, StandardColors

BLUE -- start blue colored text

• BLUE is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %BLUE% blue text %ENDCOLOR% • Expands to: blue text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: ENDCOLOR, REDBG, TWikiPreferences rendering shortcuts, StandardColors

BR -- line break

• Type: Preference variable - TWikiRenderingShortcut. • Syntax: %BR% • Expands to: • Related: BB, BB2, BB3, BB4, BULLET, CARET, VBAR, TWikiPreferences rendering shortcuts

BROWN -- start brown colored text

• BROWN is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %BROWN% brown text %ENDCOLOR%

BB3 -- level 3 bullet with line break 53 TWikiDocumentation < TWiki < TWiki

• Expands to: brown text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: ENDCOLOR, REDBG, TWikiPreferences rendering shortcuts, StandardColors

BULLET -- bullet sign

• Bullet sign, useful to create a bullet list in a TWiki table, such as | %BULLET% One %BB% Two %BB% Three | • Type: Preference variable - TWikiRenderingShortcut. • Syntax: %BULLET% • Expands to: • • Related: BB, BB2, BB3, BB4, BR, CARET, VBAR, TWikiPreferences rendering shortcuts

CALC{"formula"} -- add spreadsheet calculations to tables and outside tables

• The %CALC{"formula"}% variable is handled by the SpreadSheetPlugin. There are around 80 formulae, such as $ABS(), $EXACT(), $EXISTS(), $GET()/$SET(), $IF(), $LOG(), $LOWER(), $PERCENTILE(), $TIME(), $VALUE(). • Syntax: %CALC{"formula"}% • Examples: ♦ %CALC{"$SUM($ABOVE())"}% returns the sum of all cells above the current cell ♦ %CALC{"$EXISTS(Web.SomeTopic)"}% returns 1 if the topic exists ♦ %CALC{"$UPPER(Collaboration)"}% returns COLLABORATION • Related: IF, IfStatements, SpreadSheetPlugin

CARET -- caret symbol

• The caret variable can be used in TWiki tables. • Type: Preference variable - TWikiRenderingShortcut. • Syntax: %CARET% • Expands to: ^ • Related: BB, BB2, BB3, BB4, BR, BULLET, VBAR, TWikiPreferences rendering shortcuts

COMMENT{ attributes } -- insert an edit box into the topic to easily add comments.

• A %COMMENT% without parameters shows a simple text box. • A %COMMENT{}% can handle the following parameters: Parameter Description Default type This is the name of the template to use for this comment. Comment "below" templates are defined in a TWiki template - see customization. If this attribute is not defined, the type is whatever is defined by COMMENTPLUGIN_DEFAULT_TYPE, either in this topic or in your WebPreferences. default Default text to put into the textarea of the prompt. target Name of the topic to add the comment to

BROWN -- start brown colored text 54 TWikiDocumentation < TWiki < TWiki

the current topic location Regular expression specifying the comment location in the target topic. Read carefully the CommentPlugin documentation! mode For compatibility with older versions only, synonymous with type nonotify Set to "on" to disable change notification for target topics "off" noform Set to "on" to disable the automatic form that encloses your comment "off" block - remember to insert

tags yourself! See CommentPluginExamples#noform for an example. nopost Set to "on" to disable insertion of the posted text into the topic. "off" remove Set to "on" to remove the comment prompt after the first time it is "off" clicked. button Button label text "Add comment" • See CommentPlugin for more information • Related: HIDE, TWikiForms

DATE -- signature format date

• Syntax: %DATE% • Expands to: 2021-10-05 • Date format defined as {DefaultDateFormat} in configure, default $year-$mo-$day • Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details. • Related: DISPLAYTIME, GMTIME{"format"}, SERVERTIME

DISPLAYTIME -- display date and time

• Syntax: %DISPLAYTIME% • Expands to: 2021-10-05 - 17:07 • Date part of the format is displayed as defined by the {DefaultDateFormat} in configure, default $year-$mo-$day. The time is shown as hh:mm (24 hour clock) • Related: DISPLAYTIME{"format"}, GMTIME, SERVERTIME

DISPLAYTIME{"format"} -- formatted display time

• Formatted time - either GMT or Local server time, depending on {DisplayTimeValues} setting in configure, default $year-$mo-$day. Same format qualifiers as %GMTIME% • Syntax: %DISPLAYTIME{"format"}% • Supported variables: $seconds, $minutes, $hours, $day, $wday, $dow, $month, $mo, $year, $ye, $tz, $iso, $rcs, $http, $epoch • Example: %DISPLAYTIME{"$hou:$min"}% expands to 17:07 • Related: DISPLAYTIME, GMTIME, SERVERTIME

EDITACTION -- Selects an edit template

• EDITACTION defined in a topic or preference setting will define the use of an editaction template instead of the standard edit. If EDITACTION is defined as text, then hide the form. If EDITACTION is defined as form hide the normal text area and only edit the form.

COMMENT{ attributes } -- insert an edit box into the topic to easily addcomments. 55 TWikiDocumentation < TWiki < TWiki

• Syntax: Set EDITACTION = text|form • Expands to: %EDITACTION% • Related: TWikiScripts#edit • When EDITACTION is defined as text or form the Edit and Edit Raw buttons simply add ;action=text or ;action=form to the URL for the edit script. If you have defined EDITACTION in a topic setting or preference setting you can still edit the topic content or the form by removing the ;action=form or ;action=text from the edit URL in the browser and reload.

EDITTABLE{ attributes } -- edit TWiki tables using edit fields and other input fields

• The %EDITTABLE{}% variable is handled by the EditTablePlugin • Syntax: %EDITTABLE{ attributes }%

• Supported attributes: Attribute Comment Default header Specify the header format of a new table like "|*Food*|*Drink*|". (no header) Useful to start a table with only a button format The format of one column when editing the table. A cell can be a text input "text, 16" field, or any of these edit field types: for all cells • Text input field (1 line): | text, , | • Textarea input field: | textarea, x, | • Drop down box: | select, ,

EDITACTION -- Selects an edit template 56 TWikiDocumentation < TWiki < TWiki

headerislabel Table header cells are read-only (labels) if "on"; header cells can be edited if "on" "off" or "0" editbutton Set edit button text, e.g. "Edit this table"; set button image with alt EDITBUTTON text, e.g. "Edit table, plugin setting %PUBURL%/%SYSTEMWEB%/TWikiDocGraphics/edittopic.gif"; hide edit button at the end of the table with "hide" (Note: Button is automatically hidden if an edit button is present in a cell) buttonrow Set to top to put the edit buttons above the table. bottom javascriptinterface Use javascript to directly move and delete row without page refresh. Enable JAVASCRIPTINTERFACE with "on", disable with "off". plugin setting

• Example: %EDITTABLE{ format="| text, 20 | select, 1, one, two, three |" changerows="on" }% | *Name* | *Type* | | Foo | two | • Related: See EditTablePlugin for more details

ENCODE{"string"} -- encodes a string to HTML entities

• Encode "special" characters to HTML numeric entities. Encoded characters are: ♦ all non-printable ASCII characters below space, except newline ("\n") and linefeed ("\r") ♦ HTML special characters "<", ">", "&", single quote (') and double quote (") ♦ TWiki special characters "%", "[", "]", "@", "_", "*", "=" and "|" • Syntax: %ENCODE{"string"}% • Supported parameters: Parameter: Description: Default: "string" String to encode required (can be empty) type="url" Encode special characters for URL parameter use, like a (this is the double quote into %22 default) type="quotes" Escape double quotes with backslashes (\"), does not type="url" change other characters. This type does not protect against cross-site scripting. type="moderate" Encode special characters into HTML entities for moderate type="url" cross-site scripting protection: "<", ">", single quote (') and double quote (") are encoded. Useful to allow TWiki variables in comment boxes. type="safe" Encode special characters into HTML entities for cross-site type="url" scripting protection: "<", ">", "%", single quote (') and double quote (") are encoded. type="entity" Encode special characters into HTML entities, like a doubletype="url" quote into ". Does not encode newline (\n) or linefeed (\r). type="html" Encode special characters into HTML entities. In addition type="url" to type="entity", it also encodes space, \n and \r. Useful to encode text properly in HTML input fields. • Example: %ENCODE{"spaced name"}% expands to spaced%20name • Notes: ♦ Values of HTML input fields should encoded as "html". Example:

EDITTABLE{ attributes } -- edit TWiki tables using edit fields and otherinput fields 57 TWikiDocumentation < TWiki < TWiki

♦ Double quotes in strings must be escaped when passed into other TWiki variables. Example: %SEARCH{ "%ENCODE{ "string with "quotes"" type="quotes" }%" noheader="on" }% ♦ Use type="moderate", type="safe" or type="entity" to protect user input from URL parameters and external sources against cross-site scripting (XSS). type="entity" is the safest mode, but some TWiki applications might not work. type="safe" provides a safe middle ground, type="moderate" provides only moderate cross-site scripting protection.

• Related: FORMFIELD, QUERYPARAMS, URLPARAM

ENDBG -- end background color section

• ENDBG is a rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of background colors. • Syntax: %REDBG% red background %ENDBG% • Expands to: red background • Note: %BG% section must end with %ENDBG%. If you want to switch from one background color to another one you first need to end the active background color with %ENDBG%, such as %REDBG% some text %ENDBG% %GREENBG% more text %ENDBG%. • Related: VarENDCOLOR, VarREDBG, TWikiPreferences rendering shortcuts, StandardColors

ENDCOLOR -- end colored text

• ENDCOLOR is a rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %RED% red text %ENDCOLOR% • Expands to: red text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: VarENDBG, VarAQUA, VarBLACK, VarBLUE, VarBROWN, VarGRAY, VarGREEN, VarLIME, VarMAROON, VarNAVY, VarOLIVE, VarORANGE, VarPINK, VarPURPLE, VarRED, VarSILVER, VarTEAL, VarWHITE, VarYELLOW, TWikiPreferences rendering shortcuts, StandardColors

ENDSECTION{"name"} -- marks the end of a named section within a topic

• Syntax: %ENDSECTION{"name"}% • Syntax: %ENDSECTION{type="include"}% • Syntax: %ENDSECTION{type="templateonly"}% • Syntax: %ENDSECTION{type="expandvariables"}% • Supported parameter: Parameter: Description: "name" Name of the section. type="..." Type of the section being terminated; supported types "section", "include", "templateonly", "expandvariables"

ENCODE{"string"} -- encodes a string to HTML entities 58 TWikiDocumentation < TWiki < TWiki

• If the STARTSECTION is named, the corresponding ENDSECTION must also be named with the same name. If the STARTSECTION specifies a type, then the corresponding ENDSECTION must also specify the same type. If the section is unnamed, ENDSECTION will match with the nearest unnamed %STARTSECTION% of the same type above it. • Related: ENDSECTION, INCLUDE, STARTINCLUDE, STARTSECTION, STOPINCLUDE

ENV{"varname"} -- inspect the value of an environment variable

• Returns the current value of the environment variable in the CGI (Common Gateway Interface) environment. This is the environment that the TWiki scripts run in on the web server. • Note: For security reasons, only those variables whose names match the regular expression in {AccessibleENV} in the Security Settings/Miscellaneous section of configure can be displayed. Any other variable will just be shown as an empty string, irrespective of its real value. • Example: %ENV{MOD_PERL}% displays as: not set • If a variable is undefined (as against being set to the empty string) it will be returned as not set. • Related: HTTP_HOST, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER

EXAMPLEVAR -- example variable

• The %EXAMPLEVAR{}% variable is handled by the EmptyPlugin • Syntax: %EXAMPLEVAR{"text" format="..."}% • Parameter text="..." - example text. • Parameter format="..." - format of report. • Example: %EXAMPLEVAR{"hello" format="| $topic: $summary |"}% • Related: EmptyPlugin

FAILEDPLUGINS -- debugging for plugins that failed to load, and handler list

• Syntax: %FAILEDPLUGINS% • Expands to: See TWikiPlugins#FAILEDPLUGINS • Related: PLUGINDESCRIPTIONS, ACTIVATEDPLUGINS, PLUGINVERSION, TWikiPlugins, InstalledPlugins

FORMFIELD{"fieldname"} -- renders a field in the form attached to some topic

• Syntax: %FORMFIELD{"fieldname"}% • Supported parameters: Parameter: Description: Default: "fieldname" The name of a TWiki form field required topic="..." Topic where form data is located. May be of the form Current topic Web.TopicName format="..." Format string. Variable $value expands to the field value, "$value" $title to the raw field name, $name to the field name, $attributes to the attributes, $type to the form field type, $size to the size, and $definingTopic to the form definition topic.

ENDSECTION{"name"} -- marks the end of a named section within atopic 59 TWikiDocumentation < TWiki < TWiki

default="..." Text shown when no value is defined for the field "" alttext="..." Text shown when field is not found in the form "" newline="$br" Convert newlines in textarea to other delimiters. Variable $br no expands to
tag, and $n to a newline. Other text is conversion encoded based on encode parameter. encode="html" Encode special characters into HTML entities. If a FORMFIELD "" (no is passed into an HTML form field it should be encoded as encoding) "html". Additional encodings available: encode="quote", encode="moderate", encode="safe", encode="entity" and encode="url". See ENCODE for details. • Example: %FORMFIELD{"ProjectName" topic="Projects.SushiProject" default="(not set)" alttext="ProjectName field not found"}% • Example: • Related: ENCODE, METASEARCH, SEARCH, FormattedSearch, QuerySearch, SearchHelp

GET{"name"} -- get a variable

• Get the value of a named variable, previously set with %SET{}%. The %SET{}% and %GET{}% variables are handled by the SetGetPlugin. • Syntax: %GET{ "name" default="..." }% • Supported attributes: Attribute Comment Default "name" Name of variable. (required) default="..." Text shown if variable is not found. "" (empty string) • Example: %GET{"lunch"}% returns Sushi if the following has been previously set: %SET{ "lunch" value="Sushi" default="undecided" }% - see more examples • Related: IF, SET, SetGetPlugin, SpreadSheetPlugin#FuncGET

GMTIME -- GM time

• Syntax: %GMTIME% • Expands to: 2021-10-05 - 17:07 • Date format defined as {DefaultDateFormat} in configure, default $year-$mo-$day • Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details. • Related: DISPLAYTIME, GMTIME{"format"}, SERVERTIME

GMTIME{"format"} -- formatted GM time

• Syntax: %GMTIME{"format"}% • Supported variables: Variable: Unit: Example $seconds seconds 59 $minutes minutes 59 $hours hours 23 $day day of month 31 $wday day of the Week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) Thu

FORMFIELD{"fieldname"} -- renders a field in the form attached to sometopic 60 TWikiDocumentation < TWiki < TWiki

$dow day of the week (Sun = 0) 2 $week number of week in year (ISO 8601) 34 $month short name of month Dec $mo 2 digit month 12 $year 4 digit year 1999 $ye 2 digit year 99 $tz either "GMT" (if set to gmtime), GMT or offset such as "-0700" (if set to servertime) $iso ISO format timestamp 2021-10-05T17:07:55Z $rcs RCS format timestamp 2021/10/05 17:07:55 $http E-mail & http format timestamp Tue, 05 Oct 2021 17:07:55 GMT $epoch Number of seconds since 00:00 on 1st January, 1970 1633453675 • Variables can be shortened to 3 characters • Example: %GMTIME{"$day $month, $year - $hour:$min:$sec"}% expands to 05 Oct, 2021 - 17:07:55 • Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details. • Related: DISPLAYTIME, GMTIME, REVINFO, SERVERTIME

GRAY -- start gray colored text

• GRAY is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %GRAY% gray text %ENDCOLOR% • Expands to: gray text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: ENDCOLOR, REDBG, TWikiPreferences rendering shortcuts, StandardColors

GREEN -- start green colored text

• GREEN is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors. • Syntax: %GREEN% green text %ENDCOLOR% • Expands to: green text • Note: %% text must end with %ENDCOLOR%. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%. • Related: ENDCOLOR, REDBG, TWikiPreferences rendering shortcuts, StandardColors

GROUPS -- a formatted list of groups

• Expands to a formatted list of user groups in your TWiki. • Syntax: %GROUPS% • The variable is intended to be used in TWikiGroups, to allow a group listing for various user mapping managers. • Related: REMOTE_USER, USERINFO, USERNAME, WIKIUSERNAME, WIKIUSERSTOPIC

GMTIME{"format"} -- formatted GM time 61 TWikiDocumentation < TWiki < TWiki H -- help icon

• Type: Preference variable - TWikiRenderingShortcut. • Syntax: %H% • Expands to: • Related: I, ICON, M, N, P, Q, S, T, U, X, Y, TWikiDocGraphics

HEADLINES{"url"} -- show RSS and ATOM feeds in TWiki pages

• The %HEADLINES{"url"}% variable is handled by the HeadlinesPlugin. • Syntax: %HEADLINES{ "http://..." }% • Parameters: (all but the first one are optional) "..." Source of RSS or ATOM feed; this can be a URL (starting with http) or a web.topic location for internal feeds refresh="60" Refresh rate in minutes for caching feed; "0" for no caching limit="12" Maximum number of items shown header="..." Header. May include these variables: - $channeltitle, $title: title of channel (channel.title) - $channellink, $link: link of channel (channel.link) - $channeldescription, $description: description (channel.description) - $channeldate, $date: publication date of the channel (channel.pubDate) - $rights: copyrights of the channel (channel.copyright) - $imagetitle: title text for site (image.title) - $imagelink: link for site (image.link) - $imageurl: URL of image (image.url) - $imagedescription: description of image (image.description) format="..." Format of one item. May include these variables: - $title: news item title (item.title) - $link: news item link (item.link) - $description: news item description (item.description) - $date: the publication date (item.pubDate, item.date) - $category: the article category (item.category) Details • Example: %HEADLINES{ "http://slashdot.org/slashdot.rdf" header="*[[$link][$title]]:* $description" format="$t* [[$link][$title]]" limit="4" }% shows the latest Slashdot news in bullet list format • Related: HeadlinesPlugin

HIDE -- hide content in topic view

• Text inside the HIDE is removed when viewing the topic. This can be used to remove large amounts of text from being sent to the browser, such as the user list in Main.TWikiUsers if there are many thousands of users. • Syntax: %HIDE{ any text }% • Expands to: (empty string) • Notes: ♦ Using HIDE is not a replacement for access control, because edit and raw view still show the content. ♦ Variables inside HIDE still get expanded because variables execute inside out, e.g. you can't use it to speed up slow variables.

H -- help icon 62 TWikiDocumentation < TWiki < TWiki

♦ also hide content from the user, but unlike HIDE, HTML comments are sent to the browser. • Related: NOP, STARTINCLUDE

HOMETOPIC -- home topic in each web

• Syntax: %HOMETOPIC% • Expands to: WebHome, renders as WebHome • Related: NOTIFYTOPIC, STATISTICSTOPIC, TOPIC

HTTP -- get HTTP headers

• Called with the name of an HTTP header field, returns its value. Capitalization and the use of hyphens versus underscores are not significant. • Syntax: %HTTP% • Syntax: %HTTP{"Header-name"}% • Examples: %HTTP% %HTTP{"Accept-language"}% %HTTP{"User-Agent"}% Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36 • Note: You can see the HTTP headers your browser sends to the server on a number of sites e.g. http://www.ericgiguere.com/tools/http-header-viewer.html • Related: HTTPS, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER

HTTP_HOST -- environment variable

• Syntax: %HTTP_HOST% • Expands to: wiki-igi.cnaf.infn.it • Related: ENV, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER

HTTPS -- get HTTPS headers

• The same as %HTTP% but operates on the HTTPS environment variables present when the SSL protocol is in effect. Can be used to determine whether SSL is turned on. • Syntax: %HTTPS% • Syntax: %HTTPS{"Header-name"}% • Related: HTTP, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER

I -- idea icon

• Type: Preference variable - TWikiRenderingShortcut. • Syntax: %I% • Expands to: • Related: H, ICON, M, N, P, Q, S, T, U, X, Y, TWikiDocGraphics

HIDE -- hide content in topic view 63 TWikiDocumentation < TWiki < TWiki ICON{"name"} -- small documentation graphic or icon of common attachment types

• Generates the HTML img tag of a small graphic image attached to TWikiDocGraphics. Images typically have a 16x16 pixel size. You can select a specific image by name, or you can give a full file path or URL, in which case the type of the file will be used to select one of a collection of common file type icons. • Syntax: %ICON{"name"}% • Supported parameters: Parameter: Description: Default: "name" Name of icon required format="..." Format of icon. Supported variables (with %ICON{"person"}% example): format="$img" • $name - name of icon (person) • $type - type of icon (gif) • $filename - icon filename (person.gif) • $web - web where icon is defined (TWiki) • $topic - topic where icon is defined (TWikiDocGraphics) • $description - icon description (Person) • $width - width of icon ('16') • $height - height of icon ('16') • $img - full img tag of icon () • $info - icon tag with usage info in title • $url - URL of icon (http://example.com/pub/TWiki/TWikiDocGraphics/person.gif) • $urlpath - URL path of icon (/pub/TWiki/TWikiDocGraphics/person.gif) default="else" Alternate icon if named icon is not defined default="$name" • Examples: ♦ %ICON{"flag-gray"}% returns: ♦ %ICON{"pdf"}% returns: ♦ %ICON{"smile.pdf"}% returns: ♦ %ICON{"/home/sweet/home.pdf"}% returns: ♦ %ICON{"http://twiki.org/doc/xhtml.xsl"}% returns: ♦ %ICON{"bubble" format="$description icon is defined in $web.$topic"}% returns: Speech bubble icon is defined in TWikiDocGraphics • Graphic samples: arrowbright, bubble, choice-yes, hand • File type samples: bmp, doc, gif, hlp, html, mp3, pdf, ppt, txt, xls, xml, zip • Related: ICONURL, ICONURLPATH, TWikiPreferences, FileAttachments, TWikiDocGraphics

ICONURL{"name"} -- URL of small documentation graphic or icon

• Generates the full URL of a TWikiDocGraphics image, which TWiki renders as an image. The related %ICON{"name"}% generates the full HTML img tag. Specify image name or full filename (see ICON for details on filenames.) • Syntax: %ICONURL{"name"}% • Examples: ♦ %ICONURL{"arrowbright"}% returns https://wiki-igi.cnaf.infn.it/twiki/pub/TWiki/TWikiDocGraphics/arrowbright.gif ♦ %ICONURL{"novel.pdf"}% returns https://wiki-igi.cnaf.infn.it/twiki/pub/TWiki/TWikiDocGraphics/pdf.gif ♦ %ICONURL{"/queen/boheme.mp3"}% returns

ICON{"name"} -- small documentation graphic or icon of common attachment types 64 TWikiDocumentation < TWiki < TWiki https://wiki-igi.cnaf.infn.it/twiki/pub/TWiki/TWikiDocGraphics/wav.gif • Related: ICONURLPATH, ICON, TWikiPreferences, FileAttachments, TWikiDocGraphics

ICONURLPATH{"name"} -- URL path of small documentation graphic or icon

• Generates the URL path of a TWikiDocGraphics image, typically used in an HTML img tag. Specify image name or full filename (see ICON for details on filenames.) • Syntax: %ICONURLPATH{"name"}% • Examples: ♦ %ICONURLPATH{"locktopic"}% returns /twiki/pub/TWiki/TWikiDocGraphics/locktopic.gif ♦ %ICONURLPATH{"eggysmell.xml"}% returns /twiki/pub/TWiki/TWikiDocGraphics/xml.gif ♦ %ICONURLPATH{"/doc/xhtml.xsl"}% returns /twiki/pub/TWiki/TWikiDocGraphics/xsl.gif • Related: ICONURL, ICON, TWikiPreferences, FileAttachments, TWikiDocGraphics

IF{"condition" ...} -- simple conditionals

• Evaluate a condition and show one text or another based on the result. See details in IfStatements • Syntax: %IF{"CONDITION" then="THEN" else="ELSE"}% shows "THEN" if "CONDITION" evaluates to TRUE, otherwise "ELSE" will be shown • Example: %IF{"defined FUNFACTOR" then="FUNFACTOR is defined" else="FUNFACTOR is not defined"}% renders as FUNFACTOR is not defined • Related: GET, SET, IfStatements, $IF() of SpreadSheetPlugin, QuerySearch

INCLUDE{"page"} -- include other topic or web page

• Merges the content of a specified page into the current one before rendering. • Syntax: %INCLUDE{"page" ...}% • Supported parameters: Parameter: Description: Default: "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.SiteMap"}% "http://..." A full qualified URL, i.e. %INCLUDE{"http://twiki.org:80/index.html"}%. Supported content types are text/html and text/plain. if the URL resolves to an attachment file on the server this will automatically translate to a server-side include. pattern="..." Include a subset of a topic or a web page. Specify a none RegularExpression that scans from start ('^') to end and contains the text you want to keep in parenthesis, e.g., pattern="^.*?(from here.*?to here).*". IncludeTopicsAndWebPages has more. headingoffset="2" Adjust the level of headings in the included topic. A "2" or no adjustment "+2" increases the level by two, e.g. a ---+ H1 turns into a ---+++ H3. Positive and negative values are supported.

ICONURL{"name"} -- URL of small documentation graphic or icon 65 TWikiDocumentation < TWiki < TWiki

Adjusted min and max levels are H1 and H6, respectively. hidetoc="on" Remove %TOC% in included content. Useful to show table of TOC_HIDE_IF_ contents in individual topics, while suppressing them if INCLUDED setting included in a big master document. rev="2" Include a previous topic revision; N/A for URLs top revision raw="on" When a page is included, normally TWiki will process it, doing disabled the following: 1) Alter relative links to point back to originating host, 2) Remove some basic HTML tags (html, head, body, script) and finally 3) Remove newlines from HTML tags spanning multiple lines. If you prefer to include exactly what is in the source of the originating page set this to on. raw="on" is short for disableremoveheaders="on", disableremovescript="on", disableremovebody="on", disablecompresstags="on" and disablerewriteurls="on". literal="on" While using the raw option will indeed include the raw content, disabled the included content will still be processed and rendered like regular topic content. To disable parsing of the included content, set the literal option to "on". disableremoveheaders="on" Bypass stripping headers from included HTML (everything disabled until first tag) disableremovescript="on" Bypass stripping all