internal package
Foswiki::Plugins::MultiTopicSavePlugin
This plugin enables saving content incl form data to multiple topics using
only a single submit.
It is typically used where you list content of a number of topics in a formatted
search which present the content as an HTML form with fields for each topic.
A submit button makes a rest call that causes this plugin to save the changed
date to all the topics listed.
initPlugin($topic, $web, $user) -> $boolean
-
$topic
- the name of the topic in the current CGI query
-
$web
- the name of the web in the current CGI query
-
$user
- the login name of the user
-
$installWeb
- the name of the web the plugin topic is in (usually the same as $Foswiki::cfg{SystemWebName}
)
Called to initialise the plugin. If everything is OK, should return
a non-zero value. On non-fatal failure, should write a message
using
Foswiki::Func::writeWarning
and return 0. In this case
%FAILEDPLUGINS% will indicate which plugins failed.
In the case of a catastrophic failure that will prevent the whole
installation from working safely, this handler may use 'die', which
will be trapped and reported in the browser.
Note: Please align macro names with the Plugin name, e.g. if
your Plugin is called FooBarPlugin, name macros FOOBAR and/or
FOOBARSOMETHING. This avoids namespace issues.
_topicLock($web, $topic, $mode) -> ($success, $message)
This is the which will lock or unlock a topic
The parameter is:
-
$session
- The Foswiki object associated to this session.
-
$mode
- "locked" or "released", default "released"
The sub returns
-
$success
- 0 = failed, 1 = success
-
$message
- a message how it went.
Note: Message from this sub is not yet used in the plugin. Nice to have
Fetch the raw unrendered content of a formfield
The parameter is:
-
$field
- Field name to fetch.
-
$web
- Web name of topic
-
$topic
- Topic name
The sub returns
- String - The raw content in the field
- Returns '' if topic does not exist or no access rights
_encodeValue($value) -> $value
This function returns the input string encoded for view in TML tables
We encode the most common destroyers of TML tables:
newlines and vertical bars
_encodeHTMLEntities($value) -> $value
This function encodes special characters to html entities
so values can be used in input fields in edit mode
restMultiTopicSave($session) -> $text
This is the sub which is called called by the
rest
script with multitopicsave.
The parameter is:
-
$session
- The Foswiki object associated to this session.
Additional parameters can be recovered via the query object in the $session, for example:
my $query = $session->{request};
my $web = $query->{param}->{web}[0];
For more information, check
CommandAndCGIScripts
For information about handling error returns from REST handlers, see
Foswiki::Support.Faq1
Since: Foswiki::Plugins::VERSION 2.0