#
character to enable a settting.
Use *
to indicate everyone including the guest users. DENY the WikiGuest user to restrict an action to authenticated (logged-in) users.
{FeatureAccess}{AllowRaw}
is set to acl
in configure, then the following rules can also be used: {FeatureAccess}{AllowHistory}
is set to acl
in configure, then the following rules can also be used: Users or groups allowed to change or rename this WebPreferences topic
A preference setting looks like this:
[multiple of 3 spaces] * [space] Set [space] MACRONAME [space] = [space] value
Example:
* Set WEBBGCOLOR = #FFFFC0Macros defined using preference settings are expanded by enclosing their name in percent signs. So when you write
%WEBBGCOLOR%
, it gets expanded to #FFD8AA
Preferences can also be set dynamically by using the %SET{"setting" value="value"}%
Macro. With the exception of these dynamic preference settings, preferences are always taken from the most current topic revision, even when accessing previous revisions of a topic.
Preferences can be defined in a number of places: Set
statements which occur at numerically higher locations override macros of the same name defined at lower numbered levels, unless the macro was listed in a finalpreferences setting (finalised) at a lower-numbered level. When a preference is finalized, the macro is locked to the value at that level; SET
statements at higher-numbered levels are ignored. Looking at it graphically:
Access Control rules (ACLs) are also written as preference settings. ACLs cannot be dynamically modified by the %SET{}%
macro.
3-spaces,asterisk,equals,value
* Set MYSETTING = My setting value
When using the Wysiwyg editor, click the "Bullet" button and write the setting as a simple bullet. Don't include the asterisk or the leading spaces.
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. (Not when using the Wysiwyg editor.)
Example:* Set MACRONAME = value starts here and continues herepreference settings can easily be disabled with a # sign. Example:
* #Set DENYWEBCHANGE = %USERSWEB%.UnknownUserWhatever you include in your bullet style setting will be expanded on display, exactly as if it had been entered directly (though see Parameters, below). (
%SET{}%
settings are expanded during the set process. See VarSET for further information.)
Example: Create a custom logo macro %MYLOGO%
, define the preference settings in the web's WebPreferences topic, and upload a logo file, ex: mylogo.gif
. You can upload by attaching the file to WebPreferences, or, to avoid clutter, to any other topic in the same web, e.g. LogoTopic
. Sample preference setting in WebPreferences:
* Set MYLOGO = %PUBURL%/%WEB%/LogoTopic/mylogo.gifPreference settings are case sensitive. (Foswiki by convention always writes settings in upper case.)
* Set lower = This is LOWER * Set LOWER = This is UPPER * Set LoWeR = This is MIXED Expand %lower%, %LOWER% and %LoWeR%
Expand %lower%, %LOWER% and %LoWeR%.
<!-- * Set HIDDEN = This will be invisible in the output -->You can also set preference settings in a topic by clicking the link
Edit topic preference settings
under More topic actions
. Preferences set in this manner are known as 'meta' preferences and are not visible in the topic text, but take effect nevertheless.
If the same setting appears as both an inline setting, and in topic meta settings, the meta setting will override the inline setting! There is no warning when the setting is duplicate. This should be avoided to prevent confusion.
Preview
will show the wrong thing, and you must Save
the topic to see it correctly.
If a preference is set in both a bullet and in META settings, the META will override the bullet.
If multiple bullet style Set statements are specified for the same preference, the last one encountered is assigned and will be used globally throughout the topic.
%SET{}%
style settings are assigned during the topic rendering. So unlike bullet/META settings: %SET{}
will override both META and bullet style settings unless the preference is FINALIZED.
%SET{}
is positional in the topic. Multiple %SET{}
macros for the same preference will change the value as the topic is rendered.
Foswiki always reads the bullet style settings from the most current topic revision, so viewing older revisions of a topic can show unexpected results.
%INCLUDE{
.
%SET{
style settings can be overidden when an INCLUDE is expanded, but only when referenced locally in the included topic.
In the below example about weather conditions, note the difference in the CONDITIONS expansion
Macros defined using preference settings can take parameters. These are symbols passed in the call to the macro to define local macros that will be expanded in the output. For example, Both Macros and PreferenceSettings have a Set statement that defines theNote that %CONDITIONS% expands differently when this example is viewed in Macros. This is because Set statement are not active in included topics. The including topic's set statements are used.%CONDITIONS%
macro as shown here:* Set CONDITIONS = According to [[%TOPIC%]] the %WHAT% is %STATE% today (Set in ...).The%TOPIC%
shows where the CONDITIONS macro is expanded, and the ... shows where the Set statement was actually defined. You can call this macro passing in values forWHAT
andSTATE
. For example:
%CONDITIONS{WHAT="sea" STATE="choppy"}%
- expands to
%CONDITIONS{WHAT="sea" STATE="choppy"}%
DEFAULT
gets the value of any unnamed parameter in the macro call.
default
parameter so that they expand to something even when a value isn't passed for them in the call.
* Set WEATHER = It's %DEFAULT{default="raining"}%.
%WEATHER%
expands to %WEATHER%
%WEATHER{"sunny"}%
expands to %WEATHER{"sunny"}%
%SET{}%
macro.
Local
in place of Set
in the macro definition. For example, if the user sets the following in their home topic:
* Local NOWYSIWYG = 1Then, when they are editing any other topic, they will get the Wysiwyg editor. However, when they are editing their home topic they will get the wikitext editor.
Local
can be used wherever a preference needs to take a different value depending on where the current operation is being performed.
%SHOWPREFERENCE%
can be used to get a listing of the values of all macros in their evaluation order, so you can see macro scope if you get confused.
%SHOWPREFERENCE{"CONDITIONS"}%expands into: