0
votes

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>
}}}
3

3 Answers

1
votes

I've done something like this outside of Trac. As you've mentioned, you can put together a small HTML page and a few lines of Javascript to implement an interface that auto-redirects to a specific wiki page based on user-supplied parameters. Instead of trying to implement this inside Trac, you can host this page outside of Trac and link to it from the Trac interface.

For example, my system uses URLs that look like http://myserver/trac for Trac, and I'm hosting a page at http://myserver/tools/NewWikiPage that implements my "new wiki page" creation interface. I have a link to this page listed on WikiStart for easy access, but you can just as easily add it to the toolbar if you like.

I found this to be the simplest solution. It's quite possible to wrap this up and make it a Trac plugin, but for my purposes I found it sufficient to host it as a separate page.

1
votes

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.

0
votes

I am not aware of a plug-in to provide a similar CreateBox experience but I found the default Trac behavior to be pretty close. After you create a template following the instructions on PageTemplates, the next time you try to create a new page, you are presented with page similar to the one below.

In the example below, I created the page by just typing in the new URL https:///wiki/WorkFlow, where WorkFlow was the new page I wanted to create. Trac gave me suggestions as to pages I might have been looking for or the ability to create a new page based on the templates I have available.

enter image description here