Table of Contents
addnewpagedeluxe Plugin
Compatible with DokuWiki
- 2024-02-06 "Kaos" yes
- 2023-04-04 "Jack Jackrum" yes
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
Similar to new_page_dialog, npd
NOTE: This Plugin is derived/forked from the original Add New Page Plugin and extend the functionality.
Installation
Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.
Description
This plugin allows you to add new-page forms to wiki pages, so that users can simply enter the title of a new page and go straight to the editing form (rather than first creating a link to the page, or typing the URL directly).
The target namespace for the new page can either be selected from a drop-down list in the new-page form, or specified in the form syntax. Only namespaces to which the user is permitted to write are shown.
The plugin can pair with the newpagetemplate Plugin to start with a predefined template instead of an empty page.
The form submit button is disabled if there is no text in the title field.
Usage
Put {{NEWPAGE}}
anywhere in a wiki page to get a new-page-title text entry box, and a namespace selection drop-down menu. More details in the Syntax section below.
Screenshots
Syntax
Basic
The basic syntax is:
{{NEWPAGE}}
Or, to specify a namespace:
{{NEWPAGE>namespace}}
Where namespace
is the target namespace for the new page.
When this is specified, the namespace selection box can either be hidden (which it is by default) or set to show only sub-namespaces of the given one.
This is configured in the main wiki configuration manager.
If @PAGE@
(or @NS@
) is given, the current page ID (or its namespace) will be used (e.g. for use in namespace templates; see below).
Creating a namespace
It is possible to use the @INPUT@
placeholder to reference the user's input in the namespace specification. For example,
{{NEWPAGE>foo:@INPUT@:start}}
will create a new namespace within the foo namespace.
Date/time-based naming
The plugin supports usage of strftime placeholders in the namespace config. This allows adding date elements to the namespace specification
{{NEWPAGE>project:notes:@INPUT@_%Y-%m-%d}} {{NEWPAGE>reports:%Y:week_%W}}
When used together with the autopage option to hide the input field, a daily page can be created with a single button click:
{{NEWPAGE>journal:%Y-%m-%d?autopage}}
Configuration overrides
It is possible to override the plugin's configuration for a single usage of the syntax, by specifying a ?
followed by the config's name with an optional no
prefix to negate it. Values for non-boolean configs can be provided with =
, separated by ;
. Multiple overrides can be given, separated by ,
or &
.
General syntax:
?[no]<option_1>[=value_1[;value_2]...][,[no]<option_2>]...
Examples:
- overwrite the default hide setting
{{NEWPAGE>namespace?nohide}}
- custom namespace exclusion and hide root
{{NEWPAGE>namespace?exclude=project;reports&noshowroot}}
New-page templates
This plugin is also compatible with the newpagetemplate plugin (note that this is a separate feature to the namespace templates described below). To specify a template to be used with the new page, use one of the following syntaxes:
{{NEWPAGE#newtpl}} | Use the newtpl template |
{{NEWPAGE#newtpl1,newtpl2}} | Present a drop-down list of newtpl1 andnewtpl2 , allowing the user to choose one |
{{NEWPAGE#newtpl1|Title One,newtpl2|Title Two}} | The same as above, but with nicer titles |
In all of these, the basic >namespace
syntax can be included before the hash #
character.
Multiple occurences
The {{NEWPAGE}}
syntax may be added multiple times on the same page.
Site templates
To include an add-new-page form in a Site Template, use the following line:
<?php echo p_render('xhtml',p_get_instructions('{{NEWPAGE}}'),$info) ?>
Namespace Templates
Add-new-page forms can also be added to Namespace Templates. The replacement patterns @ID@
and @NS@
can be used in the plugin's namespace
parameter.
Configuration and Settings
You can configure the plugin in the Config Manager of DokuWiki. There are four settings:
- Excluded namespaces (
exclude
) — A semicolon-separated list of namespaces that should be excluded from the namespace selection list. Default:wiki;playground
. - Show root namespace (
showroot
) — Whether to show the wiki's root namespace in the namespace selection list. Default: true. - Hide namespace selection (
hide
) — Hide the namespace selection list. Only applies if a namespace is given (see above). Default: true. - Hide “access denied” message (
hideACL
) — Do not show the “You are not allowed to add pages” message when the user doesn't have permission to create pages. Default: false (i.e. do show the message). - Hide the input box (
autopage
) — The preconfigured namespace is treated as a full page ID. Use with date placeholders). Default: false.
FAQ
Why is a privileged user not allowed to add pages?
Logged in as administrator, why do I get a You are not allowed to add pages error message ?
This is a known problem, caused by caching. As a workaround, add~~NOCACHE~~
to the page that contains the form.
Addnewpage form on the admin page?
Is there a possibility to add the plugin as a part of the admin page, like the plugins pagemove or upgrade?
Not currently, but this can be done by modifying your template and including the addnewpage form only when$ACT=='admin
'
More than one form per page?
Is it possible to have more than one new-page form on a page?
Yes. Nothing special needs to be done to permit this, just add the markup wherever you want the forms to appear.