Search code examples
pluginstrac

Does TRAC have a similar thing to MediaWiki's "CreateBox"?


I have previously used MediaWiki's excellent CreateBox plugin to make page creation really easy.

Essentially, CreateBox presents the user with some pre-defined parameters (e.g. name of page possibly with suggestions from the current date) which will be used to populate a template (PageTemplates are perfect targets for this).

Is there an equivalent plugin/feature for TRAC? (must work with 0.11.7) It would be really amazing if there were a drop-down menu for creating new wiki pages, with the PageTemplates as the options.

UPDATE: the answer is to use ParameterizedPageTemplates to get the /newpage/ handler which accepts /newpage/?page=Page&template=Template formatted URLs. Then use TRAC's built-in HTML processor to create a form input like this

{{{
#!html
<form name="input" action="/project/template/newpage">
    <input type="text" name="page" />
    <input type="submit" name="template" value="Template" />
</form>
}}}

Solution

  • A plugin has recently been written that I think does what you want:

    https://github.com/netjunki/trac-NewPageMacro

    It provides a [[NewPage]] macro that you can insert in your wiki pages. It supports parameters for wiki page templates, specifying a parent page, and some other customizations; and it includes a permission check before rendering the form.