Tags:
workflow1Add my vote for this tag create new tag
, view all tags

Namespace Manager Add-On

This addon serves two mutually exclusive purposes:

  • Allows form-fills to create new topics. It supports create and view, create and edit workflows. It supports templates (with forms), forms and attachments as part of this functionality.
  • Allows flexible redirection of undefined topics which match one of the specified regular expression to corresponding actions specified. Examples of such actions (not all are yet supported) are:
    • Redirect namespace such as Main.USER_john to a template. ShowUserInfoTemplate which will pull the information from database.
    • Create namespaces such as Myinfo.MyLastModifiedTopics and redirect them to searches (using a template)
    • Force a new topic such as TaskXyz to be created against a specific template meant for this purpose, without first going through a form.
    • As a standard default action: complete control over topic creation process (such as create only, create and edit etc.)

Settings

Important Note: Please put newtopic script in the .htaccess with relevant access control requirements.

Usage 1: Form-fills for new topics

No settings.

Usage 2: Topic redirection table

Topic redirection table is used to specify the namespace redirections to actions, when user clicks on undefined topic link (usually a '?' infront of wiki word). To use this feature, you would have to change lib/TWiki/Render.pm to use newtopic in place of edit (search for edit word.) Alternately, consider applying appopriate patches in TWiki:Codev/NewTopicLinkStylePatch to make this configurable.

Enabled? Pattern Action Arg1 Arg2 Arg3 Remarks
Enabled ^TWiki.ExampleNo[\d]+OfNamespaceManager oops ExampleHandlerOfNamespaceManager     All topics with specified names directed to template

Default action: Redirects to edit script (i.e. twiki standard for undefined links).

Usage: Form fill approach to create topics

Design a Form in HTML as part of twiki topic, with action as newtopic which is provided by this plugin. (Full path to this twiki binary should be used.) The form variables can be:

Standard Paramters

Variable Required/Optional Type Description Default
topic Required string Topic name none
web Required string Web name none
text Required string/textarea Main text content ""
templatetopic Optional string Template for the new topic  
filepath Optional File Upload file interface  
filecomment Optional String Comment that goes with file  
createlink Optional radio Create a link at bottom of topic  
hidefile Optional radio Don't show the file in attachment table

And any number of User Defined Parameters can be used. They can be referenced in the new template or topic with standard syntax %URLPARAM{param}%.

Notes:

  • Sometime filename param is required for uploaded file. (Not explored fully, not sure of use cases).
  • A variable %PUTATTACHMENTHERE% can be used in the template to provide a space hoder for createlink option.
  • Document attached to a template topic is (currently) ignored.
  • A form can be attached to template and its parameters can be defined within this topic creation form.

Demo

Usage: Topic Redirection Table

A site-wide topic redirection table is defined in this Addon topic, and defines Namespace-to-action Mapping. Currently any table row in this topic with first column matching " Enabled " is treated as a redirection definition. The columns are:

Column name Purpose Examples
Enabled/Disabled Only those which are enabled are considered  
Pattern Matches with string $web.$topic using perl regexp ^TWiki.ExampleTopics[\w]+
Action Currently available options: showtemplate, edit, create  
Args Comma separated list of args, depending on arguments (See table below)  

Action specific arguments and implementation information. New topic and web are defined using variables $newtopic and $newweb. Arguments will be in $web.$topic format.

action Description Argument 1 Argument 2 Argument 3
view Redirect to view of $arg1. If no arg1 is specified, same topic is used. topic    
create Create a $newweb.$newtopic using $arg1 as new template, and then redirect to view of $newweb.$newtopic. template    
edit Create a $newweb.$newtopic using $arg1 as new template, and then redirect to edit of $newweb.$newtopic. template    
usetemplate Redirect to view of topic $arg1. template    
oops Show oops message for not being able to create the message message    
execute (Planned) Execute the named script $arg1 in ../scripts directory, and make the output available to Template $arg2 as variable executeresult script name Template  

Variables available in redirected scripts:

Variable Description
$virtualtopic The original (undefined) topic name which was redirected
$virtualweb The original (undefined) web name which was redirected

Currently only one action is supported: mapping to specified template. The intended topic name and web will be made available as URL parameters virtualtopic and virtualweb to this template.

Demo: Redirecting to template

Example: Test it with: http://www.twiki.org/cgi-bin/newtopic/TWiki/ExampleNo99OfNamespaceManager

Add-On Installation Instructions

Note: You do not need to install anything on the browser to use this add-on. The following instructions are for the administrator who installs the add-on on the server where TWiki is running.

  • Download the ZIP file from the Add-on Home (see below)
  • Unzip NamespaceManagerAddOn.zip in your twiki installation directory. Content:
    File: Description:
    data/TWiki/NamespaceManagerAddOn.txt Plugin topic
    data/TWiki/NamespaceManagerAddOn.txt,v  
    data/TWiki/NamespaceManagerExampleTemplate.txt Example template
    data/TWiki/NamespaceManagerExampleTemplate.txt,v  
    data/TWiki/NamespaceManagerAttachedForm.txt Example form attached to template
    data/TWiki/NamespaceManagerAttachedForm.txt,v  
    bin/newtopic Add-on script
    templates/oopsnewtopic.tmpl Add-on script

  • Test if the installation was successful:
    • Redirection of topics: Use the links above to see if redirection worked.
    • Form creation usage: Use the example form specified earlier to create new topic.

Add-On Info

  • Set SHORTDESCRIPTION = Support form-fills to create new topics; redirect undefined topics

Add-on Author: TWiki:Main/VinodKulkarni
Add-on Version: 03 Aug 2004 (v0.9) - Tested on TWiki:Codev/TWikibeta20040507
Change History:  
03 Aug 2004: Initial version
CPAN Dependencies: none
Other Dependencies: none
Perl Version: 5.005
License: GPL
Add-on Home: http://TWiki.org/cgi-bin/view/Plugins/NamespaceManagerAddOn
Feedback: http://TWiki.org/cgi-bin/view/Plugins/NamespaceManagerAddOnDev

Related Topic: TWikiAddOns

-- TWiki:Main/VinodKulkarni - 03 Aug 2004

Edit | Attach | Watch | Print version | History: r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r4 - 2006-10-08 - PeterThoeny
 
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.