AutoViewTemplatePlugin
Automatically sets VIEW_TEMPLATE and EDIT_TEMPLATE
Description
This plugin sets the VIEW_TEMPLATE and EDIT_TEMPLATE variables according to a
corresponding form definition. So when you attach a new form to a topic, this
plugin will enable the corresponding view/edit template automatically. This
comes in very handy for applications where users create new topics
without the help of a topic creator wizard, e.g. creating a new topic for a yet
non-existing TWikiWord. Together with the appropriate application
settings, this plugin will then assure that the data the user enters is handled
appropriately during view and edit.
There are two modes on how the name of the template is derived:
-
exist (default) and
-
section.
Mode "exist"
A topic that has a
MyForm TWikiForm attached to it, will be displayed
using the view template
MyViewTemplate and editted using the
MyEditTempalte
if they exist. The template name is derived by stripping off the suffix
...Form from the form name and appending
...View. The TWiki engine will
then use the template name
MyView to search for the correct template along
the template search path, for example using a topic
MyViewTemplate. Remember
the engine appends yet another
...Template to the name for templates stored
in topics.
Mode "section"
A topic with a
MyForm will be displayed/editted using the template name
stored in the named section
viewtemplate/edittemplate . For example given the
MyForm form definition topic contains a section
viewtemplate whose only
content is
MyOtherView, then this will be used to view the topic. Likewise,
the content of the
edittemplate section in
MyForm will read to find the
edit template.
By default existing values for VIEW_TEMPLATE and EDIT_TEMPLATE have priority.
You can override this behaviour in
configure.
Plugin Installation Instructions
- Just download the zip or tgz and unzip it into your twiki directory.
- Plugin configuration is done via
configure. data/TWiki/AutoViewTemplatePlugin.txt | Plugin doc page |
lib/TWiki/Plugins/AutoViewTemplatePlugin.pm | Plugin Perl module |
Plugin Info
--
TWikiContributor - 29 Oct 2007