Difference: TWikiScripts (4 vs. 5)

Revision 513 Jan 2007 - Main.TWikiContributor

Line: 1 to 1
Deleted:
<
<
 
Changed:
<
<

TWiki CGI and Command Line Scripts

>
>

TWiki CGI and Command Line Scripts

  Programs on the TWiki server performing actions such as rendering, saving and renaming topics.

The TWiki scripts are located in the twiki/bin and twiki/tools directories. This topic describes the interfaces to some of those scripts. All scripts in the twiki/bin directory can be called from the CGI (Common Gateway Interface) environment or from the command line. The scripts in the twiki/tools directory can only be called from the command line.

Added:
>
>
 

CGI Scripts

Details on CGI scripts located in the twiki/bin directory.
Line: 67 to 68
 
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 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 (Miscellaneous {AllowRedirectUrl}).
 
>
>
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 (Miscellaneous {AllowRedirectUrl}).
 
  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.
Line: 98 to 99
 
sitemapuseto Value for SITEMAPUSETO ''
nosearchall Value for NOSEARCHALL ''
Deleted:
<
<

action=deleteUserAccount

Unregisters (removes) the currently logged-in user.
Parameter Description Default
password Users' password none
 

action=editSettings

No parameters
Added:
>
>

action=saveSettings

Parameter Description Default
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
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 (Miscellaneous {AllowRedirectUrl}).
All other parameters may be interpreted as form fields, depending on the current form definition in the topic.
 

action=bulkRegister

See BulkRegistration.
Parameter Description Default
Line: 113 to 116
 
EmailUsersWithDetails Whether to mail registered users or not false
LogTopic Topic to save the log in Same as topic name, with 'Result' appended.
Changed:
<
<

action=saveSettings

>
>

action=changePassword

Change password, email address, or both, of a user.
 
Parameter Description Default
Changed:
<
<
text Text of the topic ''
originalrev Revision that the edit started on Most recent revision
All other parameters may be interpreted as form fields, depending on the current form definition in the topic.
>
>
username god alone knows none
oldpassword current password none
password new password none
passwordA new password confirmation none
email new email address none
password, =passwordA and email are optional. If neither or password and passwordA is set, then the user password is left unchanged. If email is unset, their email is left unchanged.

action=resetPassword

Reset the password for a single or multiple users
Parameter Description Default
LoginName list of usernames to reset none - error if not set
Introduction message to be sent alongside the reset, most often used to announce to the user that they have been given an account. ''

This is used by BulkResetPassword and ResetPassword. Only administrators can provide a list of LoginNames, non-admins can only provide a single LoginName.

BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.

action=deleteUserAccount

Unregisters (removes) the currently logged-in user.
Parameter Description Default
password Users' password none
 

oops

This script is mainly used for rendering pages containing error messages, though it is also used for some functional actions such as manage pages (move topic etc).
Line: 131 to 153
 
def Optional, can be set to the name of a single definition within template. This definition will be instantiated in the template wherever %INSTANTIATE% is seen. This lets you use a single template file for many messages. For an example, see oopsmanagebad.tmpl.  
paramN Where N is an integer from 1 upwards. These values will be substituted into template for %PARAM1% etc.  
Deleted:
<
<

passwd

Parameter Description Default
action one of changePassword or resetPassword none
Other parameters as described under manage, action=changePassword.

action=changePassword

Parameter Description Default
username Username  
oldpassword Existing password (plain text)  
password New password (plain text)  
passwordA New password confirmation (plain text)  
TopicName ?  
 

preview

This script is deprecated. Its functions are covered by the save script.
Line: 177 to 185
 
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:
<
<

resetpasswd

Reset the password for a single or multiple users
Parameter Description Default
LoginName list of usernames to reset none - error if not set
Introduction message to be sent alongside the reset, most often used to announce to the user that they have been given an account. ''

This is used by BulkResetPassword and ResetPassword. Only users belonging to the TWikiAdminGroup can provide a list of LoginNames, non-admins can only provide a single LoginName.

BulkRegistration provides the means to create multiple accounts but it does not announce those accounts to the users who own them. BulkResetPassword is used to assign the passwords, the Introduction is used to explain why they are receiving the mail.

>
>
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 (Miscellaneous {AllowRedirectUrl}).
 
 

rest

This REST (Representational State Transfer) script can be invoked via http in the same way as the other TWiki scripts (see Invocation Examples, below) to execute a function that is associated to a "subject" and a "verb" (see below). These functions are usually registered by plugins using the TWiki::Func::registerRESTHandler method. The rest script will print the result directly to the browser unless the endPoint parameter is specified, in which case it will output a redirect to the given topic.
Line: 228 to 227
 
action_preview preview edited text  
action_addform Redirect to the "change form" page.  
action_replaceform... Redirect to the "change form" page.  
Changed:
<
<
action_delRev Administrators only delete the most recent revision of the topic - all other parameters are ignored. You have to be a member of TWikiAdminGroup to use this, and not all store implementations will support it.  
action_repRev Administrators only replace the text of the most recent revision of the topic with the text in the text parameter. text must included embedded meta-data tags. All other parameters are ignored. You have to be a member of TWikiAdminGroup to use this, and not all store implementations will support it.  
>
>
action_delRev Administrators only delete the most recent revision of the topic - all other parameters are ignored. You have to be an administrator to use this, and not all store implementations will support it.  
action_repRev Administrators only replace the text of the most recent revision of the topic with the text in the text parameter. text must included embedded meta-data tags. All other parameters are ignored. You have to be an administrator to use this, and not all store implementations will support it.  
 
onlynewtopic If set, error if topic already exists  
onlywikiname If set, error if topic name is not a WikiWord  
dontnotify if defined, suppress change notification  
Line: 272 to 271
 
Parameter: Description: Default:
"text" Search term. Is a keyword search, literal search or regular expression search, depending on the type parameter. SearchHelp has more required
search="text" (Alternative to above) N/A
Changed:
<
<
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See TWikiVariables#VarSEARCH for more details. Current web
>
>
web="Name"
web="Main, Know"
web="all"
Comma-separated list of webs to search. See TWikiVariables#VarSEARCH for more details. Current web
 
topic="WebPreferences"
topic="*Bug"
Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. All topics in a web
excludetopic="Web*"
excludetopic="WebHome, WebChanges"
Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. None
type="keyword"
type="literal"
type="regex"
Do a keyword search like soap "web service" -shampoo; a literal search like web service; or RegularExpression search like soap;web service;!shampoo %SEARCHVAR- DEFAULTTYPE% preferences setting (literal)
scope="topic"
scope="text"
scope="all"
Search topic name (title); the text (body) of topic; or all (both) "text"
order="topic"
order="created"
order="modified"
order="editby"
order=
 "formfield(name)"
Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of TWikiForms. The sorting is done web by web; in case you want to sort across webs, create a formatted table and sort it with TablePlugin's initsort Sort by topic name
limit="all"
limit="16"
Limit the number of results returned. This is done after sorting if order is specified All results
Changed:
<
<
date="..." limits the results to those pages with latest edit time in the given TimeInterval. All results
>
>
date="..." limits the results to those pages with latest edit time in the given time interval. All results
 
reverse="on" Reverse the direction of the search Ascending search
casesensitive="on" Case sensitive search Ignore case
bookview="on" BookView search, e.g. show complete topic text Show topic summary
Line: 312 to 311
  see TWikiSiteTools#WebStatistics_site_statistics for updating statistics using cron.
Deleted:
<
<

twiki

Single-script interface to the functionality of all the other scripts. Experimental, not for production use. Read the code if you want to know more.
 

upload

Uploads an attachment to a topic. The HTTP request is expected to be in multipart/form-data format.
Parameter Description Default
Line: 335 to 331
 
raw=debug As raw=on, but also shows the metadata (forms etc) associated with the topic.  
raw=text Shows only the source of the topic, as plain text (Content-type: text/plain). Only shows the body text, not the form or other meta-data.
raw=all Shows only the source of the topic, as plain text (Content-type: text/plain), with embedded meta-data. This may be useful if you want to extract the source of a topic to a local file on disc.  
Changed:
<
<
section Allows to view only a part of the topic delimited by a named section (see VarSTARTSECTION). If the given section is not present, no topic content is displayed.  
>
>
section Allows to view only a part of the topic delimited by a named section (see VarSTARTSECTION). If the given section is not present, no topic content is displayed.  
 
contenttype Allows you to specify a different Content-Type: (e.g. contenttype=text/plain)  
rev Revision to view (e.g. rev=45)  
template Allows you to specify a different skin template, overriding the 'view' template the view script would normally use. The default template is view. For example, you could specify /twiki/bin/view/TWiki/TWikiScripts?template=edit. This is mainly useful when you have specialised templates for a TWiki Application.  
Added:
>
>
topic redirects (at the beging of the cgi script running) to show the spcified Web.Topic, or, redirects to a URL, if allowed by {AllowRedirectUrl} and {PermittedRedirectHostUrls}  
  ALERT! For historical reasons, the view script has a special interpretation of the text skin. In earlier TWiki versions the skin=text parameter was used like this: http://.../view/MyWeb/MyTopic?skin=text&contenttype=text/plain&raw=on
Line: 352 to 349
 
filename name of attachment  
rev Revision to view  
Added:
>
>
Instead of using the filename parameter, you can append the attachment name to the end of the URL path (after the topic) e.g. http://twiki.ufba.br/twiki/bin/viewfile/Webname/TopicName/Attachment.gif
 

Command Line Scripts

Details on command line scripts located in the twiki/tools directory.
 
This site is powered by the TWiki collaboration platformCopyright � 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