none
[openafs-wiki.git] / TWiki / TWikiVariables.mdwn
index 1989866..5a6e4a5 100644 (file)
@@ -1,5 +1,19 @@
+<div>
+  <ul>
+    <li><a href="#TWiki Variables"> TWiki Variables</a><ul>
+        <li><a href="#Predefined Variables"> Predefined Variables</a></li>
+        <li><a href="#Preferences Variables"> Preferences Variables</a></li>
+        <li><a href="#Setting Variable Preferences"> Setting Variable Preferences</a></li>
+        <li><a href="#Creating Custom Variables"> Creating Custom Variables</a></li>
+      </ul>
+    </li>
+  </ul>
+</div>
+
 ## <a name="TWiki Variables"></a> TWiki Variables
 
+TWikiVariables are text strings enclosed in percentage signs: <code>**%VARIABLE%**</code> that represent stored data. When a topic is rendered for viewing, defined variables replaced by their actual values. TWiki has two types of variable, predefined, and Preference-based, where you can change settings. Through Preference variables, you can even define custom variables. Clearly, they are a power TWiki feature.
+
 ### <a name="Predefined Variables"></a> Predefined Variables
 
 %WIKITOOLNAME% expands the following variables enclosed in % percent signs:
@@ -23,7 +37,7 @@
   </tr>
   <tr>
     <td><code>%SCRIPTSUFFIX%</code></td>
-    <td> The script suffix, i.e. <code>.pl</code>, is <b></b></td>
+    <td> The script suffix, ex: <code>.pl</code>, <code>.cgi</code> is <b></b></td>
   </tr>
   <tr>
     <td><code>%PUBURL%</code></td>
     <td> The path of the attachment URL of the current topic, is <b>http://www.dementia.org/twiki//view</b></td>
   </tr>
   <tr>
+    <td><code>%URLPARAM{"name"}%</code></td>
+    <td> Returns the value of a URL parameter. Ex: <code>%URLPARAM{"skin"}%</code> returns <b>print</b> for a <code>.../view/%WEB%/%TOPIC%?skin=print</code> URL. Is <b></b></td>
+  </tr>
+  <tr>
     <td><code>%WIKITOOLNAME%</code></td>
     <td> Name of wiki tool, is <b>%WIKITOOLNAME%</b></td>
   </tr>
   <tr>
     <td><code>%WIKIVERSION%</code></td>
-    <td> Wiki tool version, is <b>TWiki-4.1.2, Sat, 03 Mar 2007, build 13046</b></td>
+    <td> Wiki tool version is <b>TWiki-4.1.2, Sat, 03 Mar 2007, build 13046</b></td>
   </tr>
   <tr>
     <td><code>%USERNAME%</code></td>
-    <td> Your login username, is <b>admin</b></td>
+    <td> Your login username is <b>admin</b></td>
+  </tr>
+  <tr>
+    <td><code>%WIKINAME%</code></td>
+    <td> Your Wiki username. Same as %USERNAME% if not defined in the [[Main/TWikiUsers]] topic. Is <b>admin</b></td>
   </tr>
   <tr>
     <td><code>%WIKIUSERNAME%</code></td>
-    <td> Your Wiki username, if defined in [[Main/TWikiUsers]]. Same as %USERNAME% if not defined. Is <b>Main.admin</b></td>
+    <td> Your %WIKINAME% including the Main web name. Usefull for signatures. Is <b>Main.admin</b></td>
+  </tr>
+  <tr>
+    <td><code>%MAINWEB%</code></td>
+    <td> The Main web containing [[Main/TWikiUsers]], [[Main/OfficeLocations]] and [[Main/TWikiGroups]]. Is <b>Main</b></td>
+  </tr>
+  <tr>
+    <td><code>%TWIKIWEB%</code></td>
+    <td> The web containing all documentation and configuration of %WIKITOOLNAME% is <b>TWiki</b></td>
   </tr>
   <tr>
     <td><code>%WEB%</code></td>
-    <td> The current web, is <b>%WEB%</b></td>
+    <td> The current web is <b>%WEB%</b></td>
   </tr>
   <tr>
     <td><code>%BASEWEB%</code></td>
     <td> The web name of the topic that includes the current topic. Same as <code>%WEB%</code> in case there is no include. </td>
   </tr>
   <tr>
+    <td><code>%HOMETOPIC%</code></td>
+    <td> The home topic in each web. Is <b>[[Main/WebHome]]</b></td>
+  </tr>
+  <tr>
+    <td><code>%NOTIFYTOPIC%</code></td>
+    <td> The notify topic in each web. Is <b>[[Main/WebNotify]]</b></td>
+  </tr>
+  <tr>
+    <td><code>%WIKIUSERSTOPIC%</code></td>
+    <td> The index topic of all registered users. Is <b>TWikiUsers</b></td>
+  </tr>
+  <tr>
+    <td><code>%WEBPREFSTOPIC%</code></td>
+    <td> The web preferences topic. Is <b>WebPreferences</b></td>
+  </tr>
+  <tr>
+    <td><code>%STATISTICSTOPIC%</code></td>
+    <td> The web statistics topic. Is <b>WebStatistics</b></td>
+  </tr>
+  <tr>
     <td><code>%TOPIC%</code></td>
     <td> The current topic name, is <b>%TOPIC%</b></td>
   </tr>
     <td> The current topic name with added spaces, for regular expression search of Ref-By, is <b></b></td>
   </tr>
   <tr>
+    <td><code>%TOPICLIST{"format"}%</code></td>
+    <td> Topic index of a web. The "format" defines the format of one topic item. It may include variables: The <code>$name</code> variable gets expanded to the topic name; the <code>$web</code> variable gets expanded to the name of the web. Parameters are format, separator and web: <table border="1" cellpadding="0" cellspacing="0">
+        <tr>
+          <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
+          <th bgcolor="#99CCCC"><strong> Description: </strong></th>
+          <th bgcolor="#99CCCC"><strong> Default: </strong></th>
+        </tr>
+        <tr>
+          <td><code>"format"</code></td>
+          <td> Format of one line, may include <code>$name</code> and <code>$web</code> variables </td>
+          <td><code>"$name"</code></td>
+        </tr>
+        <tr>
+          <td><code>format="format"</code></td>
+          <td> (Alternative to above) </td>
+          <td><code>"$name"</code></td>
+        </tr>
+        <tr>
+          <td><code>separator=", "</code></td>
+          <td> line separator </td>
+          <td><code>"\n"</code> (new line) </td>
+        </tr>
+        <tr>
+          <td><code>web="Name"</code></td>
+          <td> Name of web </td>
+          <td> Current web </td>
+        </tr>
+      </table> Examples: <br /><code>%TOPICLIST{"   * $web.$name"}%</code> creates a bullet list of all topics. <br /><code>%TOPICLIST{separator=", "}%</code> creates a comma separated list of all topics. <br /><code>%TOPICLIST{" &lt;option&gt;$name&lt;/option&gt;"}%</code> creates an option list (for drop down menus). </td>
+  </tr>
+  <tr>
+    <td><code>%WEBLIST{"format"}%</code></td>
+    <td> Web index, e.g. list of all webs. Hidden webs are excluded, e.g. webs with a <code>NOSEARCHALL=on</code> preference variable. The <code>"format"</code> defines the format of one web item. The <code>$name</code> variable gets expanded to the name of the web, <code>$qname</code> gets expanded to double quoted name, <code>$marker</code> to <code>marker</code> where web matches <code>selection</code>. Parameters are format, separator and web: <table border="1" cellpadding="0" cellspacing="0">
+        <tr>
+          <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
+          <th bgcolor="#99CCCC"><strong> Description: </strong></th>
+          <th bgcolor="#99CCCC"><strong> Default: </strong></th>
+        </tr>
+        <tr>
+          <td><code>"format"</code></td>
+          <td> Format of one line, may include <code>$name</code> variable </td>
+          <td><code>"$name"</code></td>
+        </tr>
+        <tr>
+          <td><code>format="format"</code></td>
+          <td> (Alternative to above) </td>
+          <td><code>"$name"</code></td>
+        </tr>
+        <tr>
+          <td><code>separator=", "</code></td>
+          <td> line separator </td>
+          <td><code>"\n"</code> (new line) </td>
+        </tr>
+        <tr>
+          <td><code>webs="public"</code></td>
+          <td> comma sep list of Web, public expands to all non-hidden </td>
+          <td><code>"public"</code></td>
+        </tr>
+        <tr>
+          <td><code>marker="selected"</code></td>
+          <td> Text for <code>$marker</code> where item matches <code>selection</code>, otherwise equals <code>""</code></td>
+          <td><code>"selected"</code></td>
+        </tr>
+        <tr>
+          <td><code>selection</code></td>
+          <td> Current value e.g. current for current Web, =section="%WEB%" </td>
+        </tr>
+      </table> Examples: <br /><code>%WEBLIST{"   * [[$name.WebHome]]"}%</code> creates a bullet list of all webs. <br /><code>%WEBLIST{"<select><option $marker="$marker" value="$qname">$name</option>" webs="Trash,public" selection="%WEB%" separator=" "}%</select></code> Dropdown of all public Webs + Trash Web, current Web highlighted. </td>
+  </tr>
+  <tr>
     <td><code>%GMTIME%</code></td>
-    <td> GM time, is <b>29 Jun 2010 - 15:26</b></td>
+    <td> GM time, is <b>29 Jun 2010 - 15:28</b></td>
   </tr>
   <tr>
     <td><code>%GMTIME{"format"}%</code></td>
           <td> 2 digit year </td>
           <td> 99 </td>
         </tr>
-      </table> Variables can be shortened to 3 characters. Example: <br /><code>%GMTIME{"$day $month, $year - $hour:$min:$sec"}%</code> is <br /><b>29 Jun, 2010 - 15:26:26</b></td>
+      </table> Variables can be shortened to 3 characters. Example: <br /><code>%GMTIME{"$day $month, $year - $hour:$min:$sec"}%</code> is <br /><b>29 Jun, 2010 - 15:28:11</b></td>
   </tr>
   <tr>
     <td><code>%SERVERTIME%</code></td>
-    <td> Server time, is <b>29 Jun 2010 - 11:26</b></td>
+    <td> Server time, is <b>29 Jun 2010 - 11:28</b></td>
   </tr>
   <tr>
     <td><code>%SERVERTIME{"format"}%</code></td>
-    <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:26</b></td>
+    <td> Formatted server time. <br /> Example: <code>%SERVERTIME{"$hou:$min"}%</code> is <b>11:28</b></td>
   </tr>
   <tr>
     <td><code>%HTTP_HOST%</code></td>
     <td> REMOTE_USER environment variable, is <b></b></td>
   </tr>
   <tr>
-    <td><code>%INCLUDE{"SomeTopic"}%</code></td>
-    <td> Server side include, includes another topic. The current Wiki web is searched by default. Example: <code><b>%INCLUDE{"TWiki.TWikiWebsTable"}%</b></code></td>
+    <td><code>%INCLUDE{"page" ...}%</code></td>
+    <td> Server side include to [[Main/IncludeTopicsAndWebPages]]. Parameters are page name, and an optional <code>pattern="(reg-exp)"</code>. The page name is: <table border="1" cellpadding="0" cellspacing="0">
+        <tr>
+          <td><code>"SomeTopic"</code></td>
+          <td> The name of a topic located in the current web, i.e. <code>%INCLUDE{"WebNotify"}%</code></td>
+        </tr>
+        <tr>
+          <td><code>"Web.Topic"</code></td>
+          <td> A topic in another web, i.e. <code>%INCLUDE{"TWiki.TWikiWebsTable"}%</code></td>
+        </tr>
+        <tr>
+          <td><code>"http://..."</code></td>
+          <td> A full qualified URL, i.e. <code>%INCLUDE{"http://twiki.org/"}%</code></td>
+        </tr>
+      </table>
+    </td>
   </tr>
   <tr>
     <td><code>%STARTINCLUDE%</code></td>
   </tr>
   <tr>
     <td><code>%TOC%</code></td>
-    <td> Table of Content of current topic. </td>
+    <td> Table of Contents of current topic. </td>
   </tr>
   <tr>
     <td><code>%TOC{"SomeTopic" ...}%</code></td>
-    <td> Table of Content. Shows a TOC that is generated automatically based on headings of a topic. Headings in [[Main/WikiSyntax]] (<code>"---++ text"</code>) and HTML (<code>"&lt;h2&gt;text&lt;h2&gt;"</code>) are taken into account. Parameter is composed of the topic name, followed by optional <code>name="value"</code> pairs: <table border="1" cellpadding="0" cellspacing="0">
+    <td> Table of Contents. Shows a TOC that is generated automatically based on headings of a topic. Headings in [[Main/WikiSyntax]] (<code>"---++ text"</code>) and HTML (<code>"&lt;h2&gt;text&lt;h2&gt;"</code>) are taken into account. (But not <code>"&lt;H2&gt;text&lt;/H2&gt;"</code>, which can be used to exclude a heading from the TOC.) Parameters are topic name, web and depth: <table border="1" cellpadding="0" cellspacing="0">
         <tr>
-          <th bgcolor="#99CCCC"><strong> Pair: </strong></th>
+          <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
           <th bgcolor="#99CCCC"><strong> Description: </strong></th>
           <th bgcolor="#99CCCC"><strong> Default: </strong></th>
         </tr>
         <tr>
+          <td><code>"TopicName"</code></td>
+          <td> topic name </td>
+          <td> Current topic </td>
+        </tr>
+        <tr>
           <td><code>web="Name"</code></td>
           <td> Name of web </td>
           <td> Current web </td>
       </table> Examples: <code><b>%TOC{depth="2"}%</b></code>, <code><b>%TOC{"TWikiDocumentation" web="TWiki"}%</b></code></td>
   </tr>
   <tr>
-    <td><code>%SEARCH{"str" ...}%</code></td>
-    <td> Inline search, shows a search result embedded in a topic. Parameter is composed of the search term (enclosed in double quotes), followed by optional <code>name="value"</code> pairs: [1] <table border="1" cellpadding="0" cellspacing="0">
+    <td><code>%SEARCH{"text" ...}%</code></td>
+    <td> Inline search, shows a search result embedded in a topic. Parameters are the search term, web, scope, order and many more: [1] <table border="1" cellpadding="0" cellspacing="0">
         <tr>
-          <th bgcolor="#99CCCC"><strong> Pair: </strong></th>
+          <th bgcolor="#99CCCC"><strong> Parameter: </strong></th>
           <th bgcolor="#99CCCC"><strong> Description: </strong></th>
           <th bgcolor="#99CCCC"><strong> Default: </strong></th>
         </tr>
         <tr>
-          <td><code>search="food"</code></td>
-          <td> Search term, (either regex or literal, depending on the <code>regex</code> parameter) </td>
-          <td> (used if initial search term is missing) </td>
+          <td><code>"text"</code></td>
+          <td> Search term. (Is a regular expression or literal, depending on the <code>regex</code> parameter) </td>
+          <td> required </td>
+        </tr>
+        <tr>
+          <td><code>search="text"</code></td>
+          <td> (Alternative to above) </td>
+          <td> N/A </td>
         </tr>
         <tr>
           <td><code>web="Name"</code><br /><code>web="Main Know"</code><br /><code>web="all"</code></td>
-          <td> Wiki web to search: A web, a list of webs separated by whitespace, or all webs <code>[2]</code></td>
+          <td> Wiki web to search: A web, a list of webs separated by whitespace, or <code>all</code> webs. [2] </td>
           <td> Current web </td>
         </tr>
         <tr>
@@ -349,6 +492,16 @@ Additional variables are defined in the preferences ( site-level ( **_SL_** ) in
     <td> Vertical size of edit box, is <b> <code>%EDITBOXHEIGHT%</code> </b></td>
   </tr>
   <tr>
+    <td><code>%RELEASEEDITLOCKCHECKBOX%</code></td>
+    <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
+    <td> Default state of the "Release edit lock" ([[Main/UnlockTopic]]) check box in preview. Checkbox is initially checked if <code>Set RELEASEEDITLOCKCHECKBOX = checked="checked"</code>, or unchecked if empty. If checked, make sure to click on <u>Edit</u> to do more changes; do <strong>not</strong> go back in your browser to the edit page, or you risk that someone else will edit the topic at the same time! Value is: <b><code>%RELEASEEDITLOCKCHECKBOX%</code></b></td>
+  </tr>
+  <tr>
+    <td><code>%DONTNOTIFYCHECKBOX%</code></td>
+    <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
+    <td> Default state of the "Minor Changes, Don't Notify" ([[Main/DontNotify]]) check box in preview. Check box is initially checked if <code>Set DONTNOTIFYCHECKBOX = checked="checked"</code>, or unchecked if empty. Value is: <b><code>%DONTNOTIFYCHECKBOX%</code></b></td>
+  </tr>
+  <tr>
     <td><code>%ATTACHLINKBOX%</code></td>
     <td><strong><em>SL</em></strong> , <strong><em>UL</em></strong></td>
     <td> Default state of the link check box in the attach file page. Check box is initially checked if value is set to <code>CHECKED</code> , unchecked if empty. If checked, a link is created to the attached file at the end of the topic. Value is: <b><code>%ATTACHLINKBOX%</code></b></td>
@@ -389,17 +542,44 @@ Additional variables are defined in the preferences ( site-level ( **_SL_** ) in
     <td> List of users and groups who are <strong>allowed</strong> to change the current topic. (More in [[Main/TWikiAccessControl]]) </td>
   </tr>
   <tr>
+    <td><code>%DENYWEBRENAME%</code></td>
+    <td><strong><em>WL</em></strong></td>
+    <td> List of users and groups who are <strong>not allowed</strong> to rename topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
+  </tr>
+  <tr>
+    <td><code>%ALLOWWEBRENAME%</code></td>
+    <td><strong><em>WL</em></strong></td>
+    <td> List of users and groups who are <strong>allowed</strong> to rename topics in the %WIKITOOLNAME% web. (More in [[Main/TWikiAccessControl]]) </td>
+  </tr>
+  <tr>
+    <td><code>%DENYTOPICRENAME%</code></td>
+    <td><strong><em>(any topic)</em></strong></td>
+    <td> List of users and groups who are <strong>not allowed</strong> to rename the current topic. (More in [[Main/TWikiAccessControl]]) </td>
+  </tr>
+  <tr>
+    <td><code>%ALLOWTOPICRENAME%</code></td>
+    <td><strong><em>(any topic)</em></strong></td>
+    <td> List of users and groups who are <strong>allowed</strong> to rename the current topic. (More in [[Main/TWikiAccessControl]]) </td>
+  </tr>
+  <tr>
+    <td>
+      <p>
+      </p>
+    </td>
     <td><code>%FINALPREFERENCES%</code></td>
     <td><strong><em>SL</em></strong> , <strong><em>WL</em></strong></td>
     <td> List of preferences that are not allowed to be overridden by next level preferences</td>
   </tr>
 </table>
 
-**_Notes:_**
+### <a name="Setting Variable Preferences"></a> Setting Variable Preferences
+
+- The syntax for Preferences variables is the same anywhere in TWiki. In Edit mode, from the start of a new line: <br />[6 spaces] \* [space] Set [space] VARIABLENAME [space] = [value] <br />**_Example:_**
+  - <code>**Set VARIABLENAME = value**</code>
+
+### <a name="Creating Custom Variables"></a> Creating Custom Variables
 
-- Preferences variables ( on site-level, web-level and user level ) are defined by bullet lines with this syntax:
-  - `Set VARIABLENAME = value`
-- Additional preferences variables can be defined on all three level as needed. Example:
-  - `Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif`
+- You can add your own preference variables for an entire site, a single web, or a single topic, using the standard syntax. Whatever you include in your variable will be expanded on display, and treated exactly as if it had been written out. So you can place formatted text, page links, image paths.<br />**_Example:_** To place a logo anywhere in a web by typing <code>**%MYLOGO%**</code>, define the variable in the web's [[WebPreferences]] topic, like this (in this case, you also have to upload <code>**logo.gif**</code> to the same directory):
+  - <code>**Set MYLOGO = %PUBURLPATH%/%MAINWEB%/LogoTopic/logo.gif**</code>
 
--- [[PeterThoeny]] - 24 Mar 2001 <br />
+-- [[MikeMannix]] - 30 Aug 2001 <br />