Edgewall Software

Opened 8 years ago

Last modified 7 years ago

#12265 closed enhancement

Permit arbitrary absolute wiki page names in wiki edit template= argument — at Version 3

Reported by: trachacks@… Owned by: Ryan J Ollos
Priority: normal Milestone: 1.3.2
Component: wiki system Version:
Severity: normal Keywords: PageTemplates
Cc: Branch:
Release Notes:

Absolute path to wiki page can be passed in the template argument by prefixing path with / (e.g. /TheTemplate). This is useful for plugins and links that wish to use a template that shouldn't be visible in the templates dropdown of the wiki new page form. Relative paths are still prefixed with PageTemplates/.

API Changes:
Internal Changes:

Description

Attached is a small enhancement to trac core wiki/web_ui.py. Please consider including this patch in a future version of trac.

When editing a new wiki page, it is possible to select from template pages placed under PageTemplates/, and it is possible to pass a template= argument directly along with an edit link to select the specific template to use.

I came across this feature recently when reviewing the trachacks:wiki/WikiCalendarMacro which has a base=template parameter to select the template to use when creating a new calendar subpage. For this use case, it is not really useful to be forced to place the template under PageTemplates/ where it will _also_ be visible in the new wiki page template dropdown box; these kinds of templates are only useful for the specific calendar.

To this end, I came up with this enhancement patch. If the template argument starts with a slash, e.g. template=/some/template, that absolute path is directly used as the source page, omitting the PageTemplate/ prefix that is otherwise hardcoded.

NOTE: patch is against trac 0.11.7 as that's what I'm still using. I had a look at the code in current trunk - it's unchanged, so the patch should apply with some offset.

Change History (4)

by trachacks@…, 8 years ago

Attachment: trac-absolutetemplate.patch added

comment:1 by Ryan J Ollos, 8 years ago

Milestone: 1.3.1
Owner: set to Ryan J Ollos
Status: newassigned

Sorry for the long delay in reviewing the patch. I'll look at it for milestone:1.3.1.

comment:2 by Christian Boos, 7 years ago

Milestone: 1.3.1next-dev-1.3.x

Moving to some later 1.3.x version.

comment:3 by Ryan J Ollos, 7 years ago

Milestone: next-dev-1.3.x1.3.2
Release Notes: modified (diff)

Proposed changes in [3e7d2bc7/rjollos.git].

Note: See TracTickets for help on using tickets.