Difference: TWikiScripts (16 vs. 17)

Revision 172016-11-22 - TWikiContributor

Line: 1 to 1
 

TWiki CGI and Command Line Scripts

Line: 45 to 45
 
skin Overrides the default skin path (see TWikiSkins)  
cover Specifies temporary skin path to prepend to the skin path for this script only (see TWikiSkins)  
Added:
>
>

redirectto parameter

Some scripts take the redirectto parameter. Since the parameter's effect is not simple, it's described here.

The parameter value can either be a TopicName, a Web.TopicName (optionally with parameters e.g. FooBar?param1=value1), or a URL. Please note that redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).

If the parameter value contains a ${field} or $field, it's replaced with the value of the specified field of the page (URL-encoded). To know what fields are there on the page, please look into the HTML of the page.

For the save script, special variables are available as below:

Parameter Value
$web and $topic The names of the web/topic of the topic that has just been saved. It is useful when the redirectto parameter is passed around over multiple redirections or form submissions, where the topic name is dynamically determined (e.g. using AUTOINC, custom topic creation form, and JavaScript)
$dontnotify When "Quiet Save" is used, this value is set to "checked".
 

attach

Line: 52 to 69
 
Parameter Description Default
filename Name of existing attachment (if provided, this is a "manage attachment" action) none (in which case this is a "new attachment" action)
Added:
>
>
redirectto The attach script itself does not do anything special with this parameter. But the attach template is written so that the parameter's value is propagated to upload, which is called when attachments are uploaded.  
 

changes

Line: 89 to 107
 
contenttype Optional parameter that defines the application type to write into the CGI header. Defaults to text/html. May be used to invoke alternative client applications  
anyname Any parameter can passed to the new topic; if the template topic contains %URLPARAM{"anyname"}%, it will be replaced by its value  
breaklock If set, any lease conflicts will be ignored, and the edit will proceed even if someone is already editing the topic.  
Changed:
<
<
redirectto If the user continues from edit to save, and if the save (or cancels the edit) process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
>
>
redirectto The edit script itself does not do anything special with this parameter. But the edit template is written so that the parameter's value is propagated to save, which is called when a topic is saved.  
 
t Provide a unique URL each time a topic is edited, typically specifying parameter t=%SERVERTIME{$epoch}% in an edit link. This is done to prevent browsers from caching an edit session, which could result in editing outdated content. The parameter name and value is arbitrary, but must be unique each time.  

Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.

  1. The first sequence of ten or more X characters in the topic name will be converted on save to a number such that the resulting topic name is unique in the target web.
Changed:
<
<
Note: Most skins support the definition of EDIT_SKIN, which is used as the value of the cover parameter in edit URLs. This allows you to override the default edit skin on a web, topic or user basis.
>
>
ALERT! Notes:
  • Most skins support the definition of EDIT_SKIN, which is used as the value of the cover parameter in edit URLs. This allows you to override the default edit skin on a web, topic or user basis.

  • This is not a behavior of the edit script, but most skins' view template refers to the SAVEREDIRECTTO preference variable. If it's defined, the edit links on the view page gets redirectto parameter with the value of SAVEREDIRECTTO.
 

login

Line: 149 to 170
 
Parameter Description Default
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
Changed:
<
<
redirectto If the savesettings process is successful, save will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
>
>
redirectto If the savesettings process is successful, save will redirect to the topic or URL specified by this parameter. Please read here for details.  
 All other parameters may be interpreted as form fields, depending on the current form definition in the topic.

Line: 248 to 269
 
confirm if defined, requires a second level of confirmation  
currentwebonly if defined, searches current web only for links to this topic  
nonwikiword if defined, a non-wikiword is acceptable for the new topic name  
Changed:
<
<
redirectto If the rename process is successful, rename will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
>
>
redirectto If the rename process is successful, rename will redirect to the topic or URL specified by this parameter. Please read here for details.  
 
disablefixlinks Bypass fixing WikiWord links in the rename destination topic if rename is done across webs. Fixing links in the renamed topic such as from SomeLink to Otherweb.SomeLink is usually desirable so that links in the copied topic still point to the same target off (links are fixed)

Note: The rename script can only be called via http POST method, not GET. Make sure you specify method="post" if you call the rename script via a form action.

Line: 262 to 283
 
newweb destination web name current web
newtopic destination topic name current topic
nonwikiword if defined, a non-wikiword is acceptable for the destination topic name  
Changed:
<
<
redirectto If the copy process is successful, copy will redirect to this topic or URL. The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
 
>
>
redirectto If the copy process is successful, copy will redirect to the topic or URL specified by this parameter. Please read here for details.  
 
overwrite By default, copy does not happen if the destination topic already exists. If this parameter is 'on', the destination topic is deleted if exists before copying takes place off (no overwrite)
disablefixlinks Bypass fixing WikiWord links in the copy destination topic if copy is done across webs. Fixing links in the copied topic such as from SomeLink to Otherweb.SomeLink is usually desirable so that links in the copied topic still point to the same target off (links are fixed)
Line: 330 to 351
 
originalrev Revision on which the edit started.  
edit The script to use to edit the topic when action is checkpoint edit
editparams The parameter string to use to edit the topic  
Changed:
<
<
redirectto The save process will redirect to this topic or URL if it is successful. (Typically this would be the URL that was being viewed when edit was invoked). The parameter value can be a TopicName, a Web.TopicName, or a URL.
Note: Redirect to a URL only works if it is enabled in configure (Security setup > Miscellaneous {AllowRedirectUrl}).
view topic being edited
>
>
redirectto The save process will redirect to the topic or URL specified by this parameter if it is successful. Please read here for details. Please read notes on redirectto below as well. view topic being saved
 
Changed:
<
<
Any errors will cause a redirect to an oops page.
>
>
ALERT! Notes:
 
Changed:
<
<
The parameters are interpreted in according to the following rules.
>
>
  • Any errors will cause a redirect to an oops page.
 
Changed:
<
<
  1. The first sequence of ten or more X characters in the topic name will be converted to a number such that the resulting topic name is unique in the target web.
  2. When the action is save, checkpoint, quietsave, or preview:
>
>
  • It is possible to get auto-incremented topic names: Add AUTOINC<n> (such as AUTOINC0001, <n> being one or more consecutive digits) to the topic name; it will be converted to a number to make a unique topic name in the web. For example, ItemAUTOINC0001 makes Item0001, Item0002, Item0003, ... (detail)

  • When the action is save, checkpoint, quietsave, or preview:
 
    1. The new text is taken from the text parameter, if it is defined,
      • otherwise it is taken from the templatetopic, if it is defined, (new topic only)
      • otherwise it is taken from the previous version of the topic, if any,
Line: 350 to 372
 
      • otherwise it is taken from the previous version of the topic, if any,
      • otherwise it defaults to the empty string.
Changed:
<
<
Merging is only enabled if the topic text comes from text and originalrev is > 0 and is not the same as the revision number of the most recent revision. If merging is enabled both the topic and the meta-data are merged.
>
>
  • Merging is only enabled if the topic text comes from text and originalrev is > 0 and is not the same as the revision number of the most recent revision. If merging is enabled both the topic and the meta-data are merged.
 
Changed:
<
<
Form field values are passed in parameters named 'field' - for example, if I have a field Status the parameter name is Status.
>
>
  • Form field values are passed in parameters with names matching the field names - for example, if the form has a field named Status, specify a parameter named Status.
 
Changed:
<
<
ALERT! Note: The save script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the save script via a form action. Example:
<form name="new" action="%SCRIPTURLPATH{save}%/Sandbox/" method="post">
    ...
</form>
It is not possible to call save from an <a href=""> link.
>
>
  • As a security precaution, it is not possible to use save in an <a href=""> link. The save script can only be called via http POST method, not GET. Make sure to specify the "post" method if you call the save script via a form action. Example:
    <form name="new" action="%SCRIPTURLPATH{save}%/Sandbox/" method="post">
        ...
    </form>

  • There are two things to mention about the redirectto parameter.
    • You may create a new topic name containing AUTOINC<n> and you may want to redirect to a URL containing the newly created topic's name. This is tricky but you can achieve that by putting AUTOINC in the redirectto parameter. Let's say you create new topics by specifying ItemAUTOINC000 as the topic name, then ItemAUTOINC in redirectto is replaced with the appropriate ItemNNN. For example, if the latest existing topic is Item012, a new topic named Item013 is created, and the web client is redirected to a URL having Item013.
    • When the "Quiet save" button is clicked, TWiki processes as if the dontnotify field has the value checked. Here's a concrete example. Let's say redirectto=WebHome?t=$dontnotify parameter is present to an edit URL.
      • If "Save" button is clicked, you are redirected to WebHome?t=
      • If "Quiet save" button is clicked, you are redirect to WebHome?t=checked
 

search

Line: 425 to 452
 
filecomment Comment to associate with file in attachment table  
createlink If defined, will create a link to file at end of topic  
changeproperties If defined, this is a property change operation only - no file will be uploaded. null
Added:
>
>
redirectto The upload process will redirect to the topic or URL specified by this parameter. Please read here for details. Even if an error or warning ocurrs, clicking the OK link below the message redirects you to the specified topic or URL.  
 
updatefield If defined and if the value matches the name of a form field, it will update that form field with the format defined by the updateformat parameter.  
updateformat Format of the value of the form field indicated by the updatefield parameter. The default is the name of the attached file, but can be set to include more, such as the path to the image, %PUBURL%/%BASEWEB%/%BASETOPIC%/$filename. $filename
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiScripts.