This Plugin allows you to automatically create topics or attach files at topic save time. This is typically used by TWiki applications to create a set of template based topics.
%TOPICCREATE{}%
TWikiVariable is useful for creating topics based on templates
%TOPICCREATE{ <attributes> }%
Attribute | Meaning | Valid input | Default |
---|---|---|---|
template="" | Name of TWiki topic to be used as template | Any valid TWiki topic | (required) |
topic="" | Name of new TWiki topic to create | Any valid WikiWord | (required) |
disable="" | Name of the template topic containing this use of TOPICCREATE | Any valid topic name (WikiWord) | recommended |
parameters="" | List of parameters to pass to a child topic to initialize any urlparams. | Following syntax:<parameter-name>=<parameter-value> followed by any number of parameter name, value pairs separated by & | No Parameters |
Save Changes
button in preview
%TOPICCREATE{}%
variable will be removed upon saving of the topic
template
will also be copied to the new topic
%TOPICCREATE%
is recursive
%TOPICCREATE{ template="MyTemplate" topic="%TOPIC%MyNewTopicName" parameters="MyParameterName=MyParameterValue&Hello=Goodbye" }%
to create a twiki topic based on another topic MyTemplate
with the name %TOPIC%MyNewTopicName
. Any %URLPARAM{}%
with the name MyParameterName
and Hello
present in MyTemplate
will be replaced with MyParameterValue
and Goodbye
.
disable
argument, or escape it: %TOPICCRE%NOP%ATE{...}%
. The %NOP%
gets removed when a topic gets instantiated based on a template.
%TOPICATTACH{ <attributes> }%
Attribute | Meaning | Valid input | Default |
---|---|---|---|
fromtopic="" | Topic (or Web.Topic) that contains the attachment | Any valid TWiki topic | (required) |
fromfile="" | The attachment to copy from | Any attached file from fromtopic | (required) |
disable="" | Name of the template topic containing this use of TOPICATTACH | Any valid topic name (WikiWord) | (required) |
comment="" | Comment to appear for the attachment within this topic, replacing the comment that was in the fromtopic | a one line string | {omit parameter if no change desired} |
%TOPICATTACH{ fromtopic="SourceTopic" fromfile="Sample.jpg" name="Snoopy.jpg" disable="..."}%
to attach Sample.jpg
from topic SourceTopic
as Snoopy.jpg
fromtopic
if desired
fromtopic
can specify a different web if desired. For example TWiki.SomeTemplate
would be valid as a fromtopic
disable
parameter with the topic name containing the %TOPICATTACH%
.
Limitations/TODO:
name
argument to rename the topic as it is copied
TOPICATTACH
must be in the 'top level' topic being saved by a TOPICCREATE
. It can not be in a recursive/subordinate topic invoked by the TOPICCREATE.
Plugin settings are stored as preferences variables. To reference a plugin setting write %<plugin>_<setting>%
, i.e. %TOPICCREATEPLUGIN_SHORTDESCRIPTION%
data/debug.txt
)
cp
and mkdir
.
Note: You do not need to install anything on the browser to use this plugin. The following instructions are for the administrator who installs the plugin on the server where TWiki is running.
TopicCreatePlugin.zip
in your twiki installation directory. Content: File: | Description: |
---|---|
data/TWiki/TopicCreatePlugin.txt | Plugin topic |
data/TWiki/TopicCreatePlugin.txt,v | Plugin topic repository |
lib/TWiki/Plugins/TopicCreatePlugin.pm | Plugin Perl module |
lib/TWiki/Plugins/TopicCreatePlugin/Func.pm | Perl utilities |
Sandbox.CreateClientNotebook
MyTest
MyTestEnvironment
and MyTestTripLog
CreateClientNotebook
topic to the created trip log
TestTopicCreate
with this content: %TOPICCREATE{ template="TWiki.WikiWord" topic="%TOPIC%Child" }%
TestTopicCreate
you should get a new topic TestTopicCreateChild
with the content of WikiWord.
Plugin Author: | TWiki:Main.StanleyKnutson, TWiki:Main.PeterThoeny, TWiki:Main.PaulineCheung |
Plugin Version: | 21 Nov 2005 (V1.001) |
Change History: | |
11686 | Item2956 Freeze TWikiRelease04x00? and copy it to new branch MAIN |
10613 | Item2473 files in pub and data directories shouldn't be marked executable in svn (Ordnung muss sein) |
7960 | Item1238 plugins cleanup: added BuildContrib? support/infrastructure |
7585 | Item1016 initial import of TopicCreatePlugin (thanks TWiki:Main.StanleyKnutson and others) |
?1' ' | |
21 Nov 2005: | Initial TOPICCATTACH |
30 Apr 2005: | Initial version |
TWiki Dependency: | $TWiki::Plugins::VERSION 1.024 |
CPAN Dependencies: | none |
Other Dependencies: | Unix utilities cp and mkdir |
Perl Version: | 5.005 |
License: | GPL (GNU General Public License) |
TWiki:Plugins/Benchmark: | GoodStyle nn%, FormattedSearch nn%, TopicCreatePlugin nn% |
Plugin Home: | http://TWiki.org/cgi-bin/view/Plugins/TopicCreatePlugin |
Feedback: | http://TWiki.org/cgi-bin/view/Plugins/TopicCreatePluginDev |
Appraisal: | http://TWiki.org/cgi-bin/view/Plugins/TopicCreatePluginAppraisal |
Related Topics: TWikiPreferences, TWikiPlugins
-- TWiki:Main.StanleyKnutson - 21 Nov 2005
-- TWiki:Main.PeterThoeny - 30 Apr 2005