Flexible handling of topic variables
The main purpose of this plugin is to allow to set topic variables when saving a topic.
Url parameters posted to
will be parsed and stored into the current topic.
Parameters must have the form:
Local+<key>=<value> will create a local topic variable called
key with value =value
Set+<key>=<value> will create a normal topic variable called
key with value =value (note if stored in a user topic these take effect on all of the site for this user; see the Foswiki documentation for a more in depth explanation)
Unset+<key>=<value> will remove a topic variable called
key from the topic
Default+<key>=<value> defines the default values for a variable
key is set to this value, it will actually be remove from the topic as it is being set to a default value
In addition to setting topic variables via url parameters of a
this plugin provides means to read and write topic variables in
WikiApplications. Among other use cases these can be used to create
appropriate html forms for topic variables as far as the function is not
provided by standard TML part of the Foswiki core.
When SETVAR and UNSERVAR are parsed during the discourse of creating the current page they
don't set the topic variable immediately. Instead they create a definition rule
. All definition rules
are collected and applied to the topic at the end of the parsing process. That way multiple SETVAR
and UNSERVAR - that potentially contradict each other - stack up. The last rule on the stack
wins and decides wether a variable is set or deleted. This allows to create more extensive rule sets.
This sets topic variable
if the formfield
of the current topic
This allows to set topic variables based on the value of a formfield value. For example, that's useful
to create access control settings automatically.
This unsets topic variable
when formfield formfield
of the current topic
This displays a variable
as stored in topic
and formats it using
. It's type can be any of the known Foswiki meta data specifies like
etc. When no definition of
was found the
value is returned. Instead of extracting a variable from
it can also be extracted from a specific scope.
Normally all scopes are layered above each other and only the value defined in
the scope with highest precedence is returned. So when ever a variable is set
in a topic, it will potentially override its definition on web level or user
level. You may use the
parameter to bypass this logic and extract a
specific value from the given scope specifier.
Multiple variables can be returned by one call if you use a
holding a regular expression. GETVAR will return all variable values of
matches on the variable name. The list of
variables will be displayed using
and appended by
will be omitted when no matching variable was found.
string may contain the standard escape parameters
$n as well as
$value - the value of the current variable
$name - the name of the current variable
$title - the title and the
$type - which is
Session depending on the type and scope of the variable
Display a table of all definition rules as far as collected by SETVAR and UNSERVAR.
You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server.
Open configure, and open the "Extensions" section. Use "Find More Extensions" to get a list of available extensions. Select "Install".
If you have any problems, or if the extension isn't available in
, then you can still install manually from the command-line. See http://foswiki.org/Support/ManuallyInstallingExtensions
for more help.