Difference: TWikiFuncDotPm (3 vs. 4)

Revision 416 Jan 2007 - Main.TWikiContributor

Line: 73 to 73
 
  • $web - Web name, e.g. 'Main'
  • $topic - Topic name, e.g. 'WebNotify'
  • $script - Script name, e.g. 'view'
Added:
>
>
  • ... - an arbitrary number of name,value parameter pairs that will be url-encoded and added to the url. The special parameter name '#' is reserved for specifying an anchor. e.g. getScriptUrl('x','y','view','#'=>'XXX',a=>1,b=>2) will give .../view/x/y?a=1&b=2#XXX
 Return: $url URL, e.g. "http://example.com:80/cgi-bin/view.pl/Main/WebNotify"

Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)

Line: 144 to 146
 

setSessionValue( $key, $value ) -> $boolean

Changed:
<
<
Set a session value via the client session module
>
>
Set a session value.
 
  • $key - Session key
  • $value - Value associated with key
Return: true if function succeeded
Line: 154 to 156
 

clearSessionValue( $key ) -> $boolean

Changed:
<
<
Clear a session value via the client session module
  • $key - Session key
Return: true if function succeeded
>
>
Clear a session value that was set using setSessionValue.
  • $key - name of value stored in session to be cleared. Note that you cannot clear AUTHUSER.
Return: true if the session value was cleared
 Since: TWiki::Plugins::VERSION 1.1
Line: 227 to 231
 
    • WebPreferences topic has: * Set WEBBGCOLOR = #FFFFC0
    • my $webColor = TWiki::Func::getPreferencesValue( 'WEBBGCOLOR', 'Sandbox' );
Added:
>
>
NOTE: As of TWiki4.1, if $NO_PREFS_IN_TOPIC is enabled in the plugin, then preferences set in the plugin topic will be ignored.
 

getPluginPreferencesValue( $key ) -> $value

Line: 238 to 245
 Since: TWiki::Plugins::VERSION 1.021 (27 Mar 2004)
Added:
>
>
NOTE: As of TWiki4.1, if $NO_PREFS_IN_TOPIC is enabled in the plugin, then preferences set in the plugin topic will be ignored.
 

getPreferencesFlag( $key, $web ) -> $value

Line: 253 to 263
 
    • Use "MYPLUGIN_SHOWHELP" for $key
    • my $showHelp = TWiki::Func::getPreferencesFlag( "MYPLUGIN_SHOWHELP" );
Added:
>
>
NOTE: As of TWiki4.1, if $NO_PREFS_IN_TOPIC is enabled in the plugin, then preferences set in the plugin topic will be ignored.
 

getPluginPreferencesFlag( $key ) -> $boolean

Line: 264 to 277
 Since: TWiki::Plugins::VERSION 1.021 (27 Mar 2004)
Added:
>
>
NOTE: As of TWiki4.1, if $NO_PREFS_IN_TOPIC is enabled in the plugin, then preferences set in the plugin topic will be ignored.
 

getWikiToolName( ) -> $name

Line: 473 to 490
 Since: TWiki::Plugins::VERSION 1.000 (14 Jul 2001)
Changed:
<
<

checkTopicEditLock( $web, $topic ) -> ( $oopsUrl, $loginName, $unlockTime )

>
>

checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )

 Check if a lease has been taken by some other user.
  • $web Web name, e.g. "Main", or empty
  • $topic Topic name, e.g. "MyTopic", or "Main.MyTopic"
Return: ( $oopsUrl, $loginName, $unlockTime ) - The $oopsUrl for calling redirectCgiQuery(), user's $loginName, and estimated $unlockTime in minutes, or ( '', '', 0 ) if no lease exists.
Added:
>
>
  • $script The script to invoke when continuing with the edit
 Since: TWiki::Plugins::VERSION 1.010 (31 Dec 2002)
Line: 814 to 841
 Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Changed:
<
<

redirectCgiQuery( $query, $url )

>
>

redirectCgiQuery( $query, $url, $passthru )

 Redirect to URL
  • $query - CGI query object. Ignored, only there for compatibility. The session CGI query object is used instead.
  • $url - URL to redirect to
Changed:
<
<
Return: none, never returns
>
>
  • $passthru - enable passthrough.

Return: none

Print output to STDOUT that will cause a 302 redirect to a new URL. Nothing more should be printed to STDOUT after this method has been called.

The $passthru parameter allows you to pass the parameters that were passed to the current query on to the target URL, as long as it is another URL on the same TWiki installation. If $passthru is set to a true value, then TWiki will save the current URL parameters, and then try to restore them on the other side of the redirect. Parameters are stored on the server in a cache file (see {PassthroughDir} in =configure).

Note that if $passthru is set, then any parameters in $url will be lost when the old parameters are restored. if you want to change any parameter values, you will need to do that in the current CGI query before redirecting e.g.

my $query = TWiki::Func::getCgiQuery();
$query->param(-name => 'text', -value => 'Different text');
TWiki::Func::redirectCgiQuery(
  undef, TWiki::Func::getScriptUrl($web, $topic, 'edit'), 1);
$passthru does nothing if $url does not point to a script in the current TWiki installation.
 Since: TWiki::Plugins::VERSION 1.000 (7 Dec 2002)
Line: 984 to 1042
 would let you do this: %EXEC{"ps -Af" silent="on"}%
Added:
>
>
Registered tags differ from tags implemented using the old TWiki approach (text substitution in commonTagsHandler) in the following ways:
  • registered tags are evaluated at the same time as system tags, such as %SERVERTIME. commonTagsHandler is only called later, when all system tags have already been expanded (though they are expanded again after commonTagsHandler returns).
  • registered tag names can only contain alphanumerics and _ (underscore)
  • registering a tag FRED defines both %FRED{...}% and also %FRED%.
  • registered tag handlers cannot return another tag as their only result (e.g. return '%SERVERTIME%';). It won't work.
 

registerRESTHandler( $alias, \&fn, )

Added:
>
>
 Should only be called from initPlugin.

Adds a function to the dispatch table of the REST interface

Line: 1147 to 1213
 Parse a web and topic name, supplying defaults as appropriate.
  • $web - Web name, identifying variable, or empty string
  • $topic - Topic name, may be a web.topic string, required.
Changed:
<
<
Return: the parsed Web/Topic pai
>
>
Return: the parsed Web/Topic pair
 Since: TWiki::Plugins::VERSION 1.1
Line: 1156 to 1222
 
( '', 'Topic' ) ( 'Main', 'Topic' )
( '', '' ) ( 'Main', 'WebHome' )
( '', 'Web/Topic' ) ( 'Web', 'Topic' )
Added:
>
>
( '', 'Web/Subweb/Topic' ) ( 'Web/Subweb', 'Topic' )
 
( '', 'Web.Topic' ) ( 'Web', 'Topic' )
Added:
>
>
( '', 'Web.Subweb.Topic' ) ( 'Web/Subweb', 'Topic' )
 
( 'Web1', 'Web2.Topic' ) ( 'Web2', 'Topic' )
Changed:
<
<
( 'Main', 'Topic' ) ( 'Main', 'Topic' )
( 'TWiki', 'Topic' ) ( 'TWiki', 'Topic' )
where Main and TWiki are the web names set in $cfg{UsersWebName} and $cfg{SystemWebName} respectively.
>
>
Note that hierarchical web names (SubWeb?) are only available if hierarchical webs are enabled in configure.

The symbols %USERSWEB%, %SYSTEMWEB%, %DOCWEB%, %MAINWEB% and %TWIKIWEB% can be used in the input to represent the web names set in $cfg{UsersWebName} and $cfg{SystemWebName}. For example:

Input Return
( '%USERSWEB%', 'Topic' ) ( 'Main', 'Topic' )
( '%SYSTEMWEB%', 'Topic' ) ( 'TWiki', 'Topic' )
( '', '%DOCWEB%.Topic' ) ( 'TWiki', 'Topic' )
 

writeWarning( $text )

Line: 1296 to 1369
 

getDataDir( ) -> $dir

Changed:
<
<
DEPRECATED since 1.1 - use the content handling functions to manipulate topics instead
>
>
DEPRECATED since 1.1 - use the "Webs, Topics and Attachments" functions to manipulate topics instead
 Get data directory (topic file root)
Line: 1309 to 1382
 

getPubDir( ) -> $dir

Changed:
<
<
DEPRECATED since 1.1 - use the content handling functions to manipulateattachments instead
>
>
DEPRECATED since 1.1 - use the "Webs, Topics and Attachments" functions to manipulateattachments instead
 Get pub directory (file attachment root). Attachments are in $dir/Web/TopicName
 
This website uses only proprietary and third party technical cookies to ensure the correct operation of its web pages and to improve its services.
By continuing to navigate the website you consent to the use of cookies. To learn more, or deny your consent, consult the privacy policy
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.