BatchEdit is an admin plugin that allows you to use regular expressions to search and replace text on DokuWiki pages. As it works with raw DokuWiki text, the plugin can be also used to modify markup of the pages. This can be very helpful when there are multiple pages with similar markup. For example, you can update pages created from a namespace template if you decide to change the template.
Download and Installation
Search and install the plugin using the Extension Manager. Refer to :Plugins on how to install plugins manually.
After installation BatchEdit shows up on the Administration page. When started, the plugin displays a form with four primary edit fields:
Namespace – allows you to select a top level namespace that contains pages to search in. All the namespaces below the selected one will be included in the search as well. Multiple namespaces may be specified separated by a comma. Standard name resolution of the namespaces applies here (e.g. “.” stands for the current namespace, etc.). Namespaces preceded with a hyphen are excluded from the search. If no namespaces are not provided, BatchEdit will search through the entire wiki.
Search for – depending on selected options this can be plain text string, regular expression, or fully qualified regular expression including delimiters and modifiers. BatchEdit uses Perl-compatible syntax of regular expression as defined by PHP PCRE extension.
Replace with – the replacement text or pattern. For the syntax see preg_replace documentation.
Edit summary – summary of the replacement. This field has the same purpose as the Edit summary field of the DokuWiki text editor.
Below the edit fields there are two buttons:
Preview – shows the search results with corresponding replacements but does not do the replacement itself.
Apply – replaces selected (see below) matches. If there are no selected matches it acts identical to the Preview button.
BatchEdit displays search matches in separate boxes, which are grouped per page. Next to the page identifier and on every match box there is a check box, which is used to mark matches for replacement. In order to prevent unexpected results the check box is unchecked by default requiring the user to confirm every replacement. The match box is split in two parts: matched text with some context on the left side; and the same fragment with applied replacement on the right. Both the matched text and the replacement are highlighted.
After the replacement, the matches show up with no check box in the caption and replaced text is highlighted with green.
Configuration
BatchEdit uses two types of configuration options:
User-specific options – all options available on BatchEdit page are individual for each user. These options are stored in a browser cookie, so strictly speaking they are browser-specific.
Global options – can be modified on DokuWiki configuration page. They control aspects of BatchEdit operation, which are rarely (if ever) to be changed.
Technical details
Performance
BatchEdit performs caching of the search results to avoid repeating the search when replacement is applied. Yet on every preview attempt the DokuWiki server reads all the pages from a hard drive. To reduce the server load and search time use Namespace field that limits the search scope or limit the number of search results in Advanced options.
Concurrent page edits
Because of two-staged approach of Preview&Apply, there is a possibility that while one user verifies and marks matches for replacement some other user modifies one of the involved pages. To prevent any data corruption BatchEdit locks pages during replacement and verifies that matched text is still located at the match offset. If any of the marked matches cannot be found at expected offsets, replacement for that page is rejected.
This verification still leaves a possibility that replacement will be applied to a different instance of the original text that happened to be at the exactly right offset after the edit, but likelihood of that is rather small. Anyway, it's recommended that administrators take care to minimize DokuWiki activity when BatchEdit is used.
Page lookup
BatchEdit uses DokuWiki page index to get the list of existing pages instead of going through the data directories. Because of the missing or incomplete index BatchEdit may show less search results than expected. This is often the case for a freshly migrated wiki. You can use Searchindex Manager plugin to get the index up to date.
This limitation also applies to the “special” pages (e.g. namespace templates), which are not listed in the index and therefore cannot be edited by BatchEdit.
Version History
2023-06-16
Added support for replacement in multiple namespaces
Please report bugs or feature requests at the bug tracker.
2023/10/31 23:14
· Alan Shea
Block Quote Plugin
The blockquote plugin creates semantically correct quotes by using the blockquote XHTML tag. In contrast to the default wiki markup for quoting, the content of the quote can contain any wiki markup which then gets interpreted as it would outside of the quote environment. Thus, also nested quotes are possible.
Syntax
The plugin provides two additional pairs of markup tags, the blockquote and the cite markup. The blockquote allows an additional citation source to be given after the blockquote keyword in the opening tag. The cite markup was mainly created to allow the addition of more complex citation sources (including links, text formatting etc) inside the blockquote environment, although it can also be used standalone. See the examples below.
Examples
Loads of markup
The following code
<blockquote>
Test with loads of markup...
Another paragraph with a little [[http://nowhere|link]] to nowhere. Oh, and while we are at it, what about some **bold**, some //italic// and some __underlined__ text? And finally, an itemization:
* item 1
* item 1.1
* item 1.2
* item 2
- ordered item 2.1
- ordered item 2.2
- ordered item 2.2.1
* item 3
Works :-)
</blockquote>
results in
Test with loads of markup…
Another paragraph with a little link to nowhere. Oh, and while we are at it, what about some bold, some italic and some underlined text? And finally, an itemization:
item 1
item 1.1
item 1.2
item 2
ordered item 2.1
ordered item 2.2
ordered item 2.2.1
item 3
Works
The cite attribute
The following code
<blockquote J. Random Hacker>Test with a cite attribute...</blockquote>
results in
Test with a cite attribute…
The cite command
The following code
<blockquote>Test with a cite command...<cite>J. Random Hacker, [[http://localhost/~jrhacker]]</cite></blockquote>
The bookcreator plugin allow to select some pages from wiki and export to create a little book PDF or text (like a similar function of Wikipedia)
The component for syntax, displays the list of pages selected for exporting and manage selections; the component for action, handle the selection by a add/removing pages, show a toolbar (like a similar toolbar of Wikipedia).
On the list of selected pages, You can use drag and drop to change the order, save your selection for restore in a second time or share with other users.
To work, this plugin needs cookies; the PDF export required dw2pdf plugin; the TEXT ONLY export required text plugin.
Usage
To use this plugin, use these two simple ways:
~~BOOK~~
or
~~ARCHIVEBOOK:number&sort~~
in the page 'wiki:ebook' (create it first).
With ~~BOOK~~ You can show and manage your list of selected pages
Reset all selection
Exclude a page from list
View the excluded pages and “include” them back
Create the PDF book on selected pages
Create a printable version of selected pages
Extract only text of selected pages
Drag and drop to change exporting order of page (use Tool-Man JavaScript library )
Set a title for the PDF document
Save and restore selections on a specific namespace (use ACL's rights)
With ~~ARCHIVEBOOK:number&sort~~ You can show a list of saved selections (books) anywhere into your wiki
Restore a selection to manage/export again
sort by date/title
show only first number selections
Optionally you can specify the number of selections to display and the order. Default is 10 items ordered by date (first last updated). Each of selection is linked to book's page for it.
Installation
To add or remove a page to selection, you simply need to call the page passing it a “do=addtobook” PHP argument. The easiest way to implement this is to add a button or similar somewhere in your template design.
Default template
Use the following to add another button in the upper or bottom button row of the default template1)
2023/08/11 23:47
Box Plugin
Highlight particularly important parts of your wiki in boxes that stand out with Box Plugin.
A simple box:
<box> the box contents </box>
the box contents
Some more complex boxes
<box 80% round orange|a title> the box contents</box>
a title
the box contents
<box 50% left blue>the box contents</box|a caption>
<boxwidthclassescolours| title text> contents text </box>
width — any legal CSS width value
classes — any number of classes which use the styles in your template or the plugin's own stylesheet to determine the look of the box. The box plugins comes with the following classes already defined:
round — box will have rounded corners
blue — blue colour scheme
red — red colour scheme
green — green colour scheme
orange — orange colour scheme
left — float the box left within the wiki page
right — float the box right within the wiki page
if no classes are specified the default styles will be used, that is square corners in a colour scheme based on the default DokuWiki colour scheme.
colours — 1-4 colours in CSS hex or RGB notation, e.g. #F00 #fcab94 rgb(255,255,0). The colours are applied in order to:
content background
title background
outer box background
borders
if less than four colours are specified, the first colour is used for the missing colours.
title text — text (including DokuWiki markup) displayed above the box contents, with distinct style.
caption text — text (no markup allowed) displayed below the box contents, with distinct style.
The opening <box … > including the title must all appear on one line. The box contents can appear over as many lines as are needed.
See the plugin in action here. The sample page shows all the styles available with the plugin.
This is a test of the box using named color rgb colors and I want a border but don't know how to add one. There, it's done… but what colors are available?
Oh, I see now (I read the docs) and everything is ok.
The bottom credits goes here (if only I could align this right)
<divclass='box'><bclass='xtop'><bclass='xb1'></b><bclass='xb2'></b><bclass='xb3'></b><bclass='xb4'></b></b><divclass='xbox'><pclass='box_title'>Title text would go here</p><divclass='box_content'><p>Including this html snippet of a box</p><p>All those <b> tags handle the rounded corners</p></div></div><bclass='xbottom'><bclass='xb4'></b><bclass='xb3'></b><bclass='xb2'></b><bclass='xb1'></b></b></div>
That means, you can simply put a <btable> tag on the page and gets a fully selectable boolean table with export functionality.
[id]
the ID of the btable; must be unique2); appears as title
required
[column]
an option for which users can tick a checkbox whether it's 'true' or not ('false')
required
[row]
an option which users can select from a combobox to insert boolean values for it
required
<btable Test>
<columns>
Person A ^ Person B ^ Person C ^ Person D ^ Person E
</columns>
<rows>
10-10-2007 ^ 17-10-2007 ^ 24-10-2007
</rows>
</btable>
<btable Test Double>
<columns>
Person A ^ Person B ^ Person C ^ Person D ^ Person E
</columns>
<rows>
10-10-2007 ^ 17-10-2007 ^ 24-10-2007
</rows>
</btable>
2023/08/11 23:47
Bureaucracy Plugin
The bureaucracy plugin allows you to create an HTML form right within DokuWiki. Input format validation is automatically handled by the plugin and requires no coding. User input can be emailed to a preconfigured address or used to create new pages using a template.
Recommended additional Plugins
On an open wiki, you might want to use the CAPTCHA plugin to avoid automated spam. When it is installed, Bureaucracy automatically integrates the captcha check in its form submission handling.
The SMTP plugin may help when your DokuWiki can't send mails.
When you use Bureaucracy's template action, you can add in the template a dataentry of the Data plugin that structures and stores your information for good accessibility, whereas the dataentry you can use placeholders of bureaucracy to place information from the form.
The recent Struct plugin draws heavy inspiration from the data plugin and allows for central management of wanted structured data while keeping the functionality of the data plugin. The struct plugin supports integration with the Bureaucracy Plugin. This allows reusing the input mechanisms of the different types in Bureaucracy forms and creation of structured data when pages are created through Bureaucracy's template action.
Additional Actions
An additional plugin to look at is pagemod, which adds a pagemod action for the Bureaucracy plugin to add data to an existing page (in addition to the current templating and mailing functionality)
Additional Fields
The Data plugin can not only be useful in templates as mentioned above, but it also provides a data_aliastextbox field that lets you create fields with types and type aliases of the data plugin. Some of these types have a nice layout e.g. pagesuggestions or listing using predefined options from type aliases. See example.
With Struct plugin, you can use any field from any defined schema as a field in a bureaucracy form. You can also add a whole schema to the form.
Warning
Without the CAPTCHA, this plugin should only be used on closed wikis, because it could easily be abused as a spam gateway.
Usage
Let's start with an example:
<form>
Action mail me@example.com
Thanks "Thanks for submitting your valuable data."
Fieldset "A set of fields"
Textbox "Employee Name" "=Your Name"
number "Your Age" >13 <99
email "Your E-Mail Address"
textbox "Occupation (optional)" !
password "Some password"
fieldset "even more fields"
select "Please select an option" "Peaches|Apples|Oranges"
static "Some static text that could be an agreement"
yesno "Read the agreement?"
textarea "Tell me about your self"
textbox "You need to write 'agree' here" /^agree$/
submit "Submit Query"
</form>
As you can see, you can define a email address where the data should be sent to and a thank you text to be shown when a user submitted the form. What follows are the various fields to fill in.
Field definitions
Fields are defined by giving a type and a label.
For fieldsets and the submit button, the label is optional.
Some fields, like the select type, need a third parameter.
Additional constraints can be added after the main options.
Arguments need to be wrapped in double quotes when they contain spaces e.g. "S p a c e s"
Including a " by using "" e.g. "With ""quotes"" in the string"
The plugin takes care of validating the form, the field types, and set constraints.
Fields
action
The first parameter needs to be a supported action (see below).
Currently supported are mail, template, script.
Or if respective plugin is installed: pagemod or struct_lookup.
Additional parameters for type mail:
one or more email addresses to send the data to (required)
Additional parameters for type template:
name of a page or namespace (trailing colon) to use as template or a single underscore _ to try and use the target namespace template (use an absolute path) (required)
namespace:prefix or namespace: (mind the trailing colon) where new pages shall be created (optional)
separator to use when combining multiple fields into the pagename (optional)
Additional parameters for type script:
the name of the script-file in the conf/plugin/bureaucracy/ directory
Multiple actions can be defined by adding another action field
thanks
define a text to be displayed when the form was submitted. (optional)
fieldset
creates a new set of fields
a label is optional
Can be shown/hidden depending on the value of another field above it (see below)
Switching depends on the field given as second parameter (optional)
Fieldset is displayed as that field is set
or has an exact match with the value given as third parameter (optional)
static
adds some static text to the form
wiki
similar to static, but parses the input as Wiki syntax
should be used sparsely as it is computationally expensive
textbox
creates a single line input field
needs a label
password
creates a single line password input field
needs a label
email
creates a single line input field
needs a label
the input is validated to be a valid email address
argument @@ marks emailadress as Reply-To address for mail action
In mail action: all options will be joined by “, ” in e-mail message
In template action:
if field is marked with “@” all selected options will be joined with page separator
during template substitution all options will be joined by “, ” or you can provide optional separator: @@Label(separator)@@
radio
creates a set of radiobuttons
needs a label
needs a second argument containing the radio options separated by a pipe | char
( "Peaches|Apples|Oranges" )
hidden
creates an invisible field with static data
needs a label
needs a default value parameter ( "=some value" )
hiddenautoinc
needs a label
creates an invisible field with a number that increases by 1 on each form submit
submit
creates a submit button (required)
a button label is optional
user / users
a DokuWiki user or list of DokuWiki users
needs a label
provides autocompletion
date
a date in the format YYYY-MM-DD
needs a label
provides a date picker
time
a time in the format (H)H:MM(:SS)
needs a label
usemailtemplate template_id
the content of the <code html>..</code> and <code text>..</code> at the template page is used in the email of the mail action, instead of default table with field values.
template_id is absolute or relative pageid. If relative, it is solved against the pageid of the form
addpage page_tpl page_tgt
adds another page page_tgt based on a template page page_tpl
only for use with the template action
if page_tpl is absolute or relative pageid. If relative, it is solved against the pageid of the form
page_tgt is relative to destination of page created by action field. e.g. action field tries to create new:destination, then addpage will try to add new:destination:page_tgt
When in the action field a ! is given as template, that template is skipped and only template(s) added by addpage are used.
labels
parameter is a wiki page containing a list of label translations
file
let user select a file for upload (which is added to media by template action, or added as attachment in mail action)
needs a label
an optional addition parameter specifies the namespace to which the upload should go to. . and .. can be used to reference namespaces relative to the new page. Defaults to .
Start with a > followed by a number to require numeric data bigger than the given number
Start with a < followed by a number to require numeric data smaller than the given number
Start with a = to set a default value, you can also use placeholders here
Use a single ! char to make a field optional
Use a single ^ char to give a field the focus (possible for only one field at a page)
Use a single @ char to make its value be used for the pagename in template mode (the value will be appended to the pagename, separated by an underscore)
Use a double @@ to mark the value of a field as Reply-To address for mail mode
Use a number of 0000 for a number field, for completing inputted values with leading zeros upto the same length
Use a ++ for a number field to make it auto-increment the counter on each form submit.
Enclose a regular expression with / chars to require the the regexp to match before the field is accepted (case insensitive). Examples (for additional information see below):
/^[^\/:]+$/ nice for pagenames, the chars / and : aren't allowed
/^[0-9 \/()+\-]+$/ nice for phone numbers, allows only numbers and the chars ()-+/
Set message for if regular expressions don't match by using **Message. Example:
textbox "Your pagename" /^[^\/:]+$/ "**Don't use / or : in your page name"
Only for dataplugin field: start with a _ to define type alias.
A simple guide to Regular Expressions
A regular expression is used to define a pattern of text. In its simplest case (as used here) if the pattern can be found then the text is accepted, if the test fails then the text is rejected. Under bureaucracy, when the submit button is pushed text boxes are compared to their regular expressions. If the test passes, then submit can continue, if the test fails then submit rejects the form and asks for a correction.
The simplest possible regular expression (regex) is a single character: /a/. This states that the input text (the string) must contain somewhere within it the letter “a”. “access” would pass, as would “backups” but “Hello World” would fail.
The regex may contain a number of characters: /abc/ which requires that the string “abc” be found somewhere. “Learn your abc” passes but “a bc” fails (there is a space between the “a” and “b”).
Frequently you want to select one of a number of characters. Square brackets group a number of alternatives together: /[abc]/ means that either “a” or “b” or “c” must occur somewhere within the string. Ranges are possible, [a-z] means any lowercase letter. Putting things together, /rfc[0-9][0-9][0-9][0-9]/ matches any four digit request for comments such as “rfc0248” or “rfc4027”.
The brackets are called meta-characters, that is they don't represent real characters (like for instance “a”) but do affect how the string is interpreted. There are a number of meta-characters the most important of which are:
“^” which matches the start of a string.
“$” which matches the end of a string.
“*” which means that the character before it may appear 0 or more times.
“+” which means that the character before it must appear 1 or more times.
“\” means treat the next character as an ordinary character, not a meta-character.
For example /^[yn]$/ means that the string must start with a “y” or and “n” and have no characters following. “y” and “n” are therefore the only possible strings. /^I[0-9]+$/ matches US interstate roads: “I12”, “I66” and so forth. Somewhat confusingly “^” has another meaning when it occurs immediately after a left bracket, it negates the contents. /[^ab]/ matches any character other than and “a” or “b”.
Looking now at the examples above. /^[^\/:]+$/ starts at the beginning of the string (“^”) accepts any character other than “/” or “:” (“[^\/:]”, note the “\” to make the “/” into a normal slash), accepts these characters 1 or more times (“+”) and then needs to see the end of the string “$”. “/home/doc.txt” fails, there are slashes present. “ puzzled ” is acceptable.
Finally /^[0-9 \/()+\-]+$/. The whole string consists of a one or more characters (“^” to “+$”). These characters must be (“[” to “]”) numbers (“0-9”), spaces (“ ”), slashes and parenthesis (“\/” and “()”), pluses and minuses (“+\-”).
By default all labels are used as provided. Eg. they are displayed in the form and they are used as placeholders for the template mode. In some cases you might want to use simpler names for the fields but still have more extensive labels displayed in the form.
This can be achieved with defining label translations in a separate wiki page and give this page in the labels field:
<form>
action mail me@example.com
labels mylabels
fieldset "field"
textbox "name"
number "age" >13 <99
submit "submit"
</form>
The translation page needs to contain a single wiki list with items named label = translation:
* field = Tell us about yourself"
* name = Your Name
* age = Your Age
* submit = Send your Data
The above would result in the following form:
Note: double slashes // cannot be used in the translation field on the translation page — http://forum.dokuwiki.org/u/SFITCS2016-12-15 22:27
Dependencies with Fieldsets
Sometimes part of a form should only be asked when a certain answer was picked for a previous question. Simple dependencies like that can be created by using Fieldsets.
Consider the following example:
<form>
action mail me@example.com
fieldset "Your Order"
textbox "Your Name"
select "What do you want" "Car|Blimp"
fieldset "Car Parameters" "What do you want" "Car"
number "Number of Wheels"
textbox "Extras"
fieldset "Blimp Parameters" "What do you want" "Blimp"
select "Filling" "Helium|Hot Air"
number "Size"
fieldset "Payment"
yesno "Can you pay right now?"
fieldset "Details" "Can you pay right now?"
textbox "Name"
number "Amount"
fieldset "Confirm Order"
submit "Submit Query"
</form>
In this example, a user can select to order a car or a blimp. Depending on his choice, the second or third fieldset will be hidden or shown accordingly. The second parameter for the fieldset field references a previously defined field and the third parameter the value that field shall have to display the fieldset. Only exact matches are supported here, so best combine this feature with a select field as shown above.
When the user marks the checkbox of the yesno field in the fourth fieldset the fifth fieldset is shown, so the correct details can be noted. Here is no third parameter given to the fieldset, because it will check if the referred yesno field is set (It will not look for the default values eventually set by “=Value” “!Not Value”. If you need the value of the yesno in a template, you have to provide the default values explicitly.).
NOTE:
Apparently dependencies don't work when the choice is provided by “radio” (only “select” and “yesno” work) for some reason. There might by a logical explanation for this, maybe.
Dependencies with Fieldsets - creating two levels of selects
How to use dependencies to adapt a select list. Example:
To show only the shown value of both select fields “Sparepart1” and “Sparepart2” in a template, use the construct
@@Sparepart1|@@@@Sparepart2|@@
The chosen one will be filled out and the not chosen one will be replaced by an empty string (“”).
Prefilling fields from Links
Sometimes you may want to link to a bureaucracy form and pre-fill one or more fields. This can be easily achieved by adding parameters to your link using @-wrapped field names.
Imagining the form given in the previous section is on a page called orderform. Here is how you could link to a form for ordering Hot Air blimps:
[[orderform?@What do you want@=Blimp&@Filling@=Hot Air|Order a Hot Air Blimp!]]
Action Modes
Bureaucracy does three things:
it displays a neat form
it validates user input
it sends the user's input to an action mode
The last step is where the data is processed. The action to use is defined in the action field, as described above. Currently three modes are supported: mail, template, and script. Additional modes (e.g. to store the data in a database) can easily be added.
Mail Mode
This is a simple action. When used default, all user input will be sent by email to the configured email address. See the example above how to use it. You may specify multiple recipient mail addresses separated by commas.
Example to automate email to an address which the user enters:
If you add the field usemailtemplate you can define alternative content for the email. The template should contain two code blocks with text and html version of the message. Other text on the page is ignored. In the template you can use placeholders.
With the subject field you can replace the default subject
and by marking field(s) with the option @@ you add Reply-To address(es) to the mail.
Example:
action mail @MAIL@ forename@surname.name
usemailtemplate your:template
subject "new special subject"
======Mail template page======
<code html>
Dear @@Your Name@@,
You are <b>great<b>, you just <i>purchased</i> our @@What do you want@@!
We will deliver it fast as possible, see the
<a href="http://example.com/conditions">conditions</a>.
Kind regards,
Future Machines company
</code>
<code text>
Dear @@Your Name@@,
You are great, you just purchased our @@What do you want@@!
We will deliver it fast as possible, see [1].
Kind regards,
Future Machines company
[1] http://example.com/conditions
</code>
Template Mode
This action uses given pages as template, will replace defined placeholders with the user input and create wiki pages. This is a very powerful, but somewhat complex concept.
or a whole namespace (with trailing colon). When a namespace is given, all contained sub namespaces and pages will be copied to the destination and replacement patterns will be applied in all pages.
when you specify an underscore (_) as template name, the plugin will attempt to use the configured namespace template of the destination namespace.
and ! skips this template, but requires at least one via the addpage field
destination tells bureaucracy where to create the new page[s]. This is usually a namespace (trailing colon). See section below for more detail.
separator new page names can be created by using multiple form field values. This character defines how these should be concatenated (see method 1 of section below)
Defining the destination(s)
When using the template mode you need to define where resulting pages should be created. There are multiple ways to do this.
Method 1 The simplest way is to specify an output namespace and mark up your naming fields using the @ character. Here's an example:
<form>
action template userstpl users: :
fieldset "Create Your User Page"
select "What's your Continent?" "Europe|N. America|S. America|Asia|Australia|Africa" @
textbox "What's your Name?" @
textarea "Enter a short bio" !
submit
</form>
This would create a new page using the continent and name fields. Eg. if I fill in “Europe” and “Andi” for those fields, the resulting page would be users:europe:andi.
Method 2 Sometimes you want some more control over the resulting pagename(s). This can be achieved by using placeholders in the destination parameter and omitting the @ marker in the field definitions.
Placeholders are the field names surrounded by @@ characters. Additionally any strftime parameters can be used. Let's have another example:
<form>
action template userstpl "users:%Y:@@What's your Name?@@:start"
fieldset "Create Your User Page"
select "What's your Continent?" "Europe|N. America|S. America|Asia|Australia"
textbox "What's your Name?"
textarea "Enter a short bio" !
yesno "Do have publication?"
fieldset "Add your publications" "Do have publication?"
textarea "Publications:"
addpage users:publicationtemplate publications
fieldset "Finish"
submit
</form>
The above would create a namespace based on the current year and my name and create a start page within it: users:2012:andi:start
Method 3 When working with Dependencies with Fieldsets you might want to add additional pages when a fieldset is shown, but skip the page when the fieldset is hidden. This can be achieved with the special addpage field.
Just put it in the fieldset of question:
addpage additionaltpl somepage
The second fieldset from the example above adds a publication page, via a checkbox. Here the template for additional page is located on absolute path: users:publicationtemplate.
Only when the yesno field is checked, the additional page is created on users:2012:andy:start:publications
Creating Templates
The templates need to contain the same fields as your form, and some other placeholders are available too. Some of them can be used as default values for form fields:
Placeholder
action
@@Field label@@ ##Field label##
Will be replaced by the actual values the user filled into
the form.
Will be replaced with a result of the corresponding dokuwiki function. arg can be both a static value, eg. @curNS(some:test:value)@ or the placeholder of a field, eg. @p_get_first_heading(@@field@@)@.
@@Field label|Nice alternative@@
For empty field the text Nice alternative is shown
@NSBASE@
(only template action) Namespace that contains new page.
eg. if the new page is foo:bar:baz:bang, @NSBASE@ will contain baz
Replaced by % char, needed to avoid accidental time
replacements in your template.
@DATE(<datetime>,%%Y-%%m-%%e)@ @DATE(<datetime>)@
Accepts different datetime formats, which are outputted in the
requested strftime format. Providing no format returns date
with format of the config:dformat setting.
Print current: year, month, day, time as hh:mm
and time as hh:mm:ss
@TABLEHTML@, @TABLETEXT@
(only mail action) html or text table of all field values
<noinclude>…</noinclude>
Tags with their content are removed
<noreplace>…</noreplace>
The content between <noreplace>…</noreplace> is preserved without performing any replacements but tags itself are removed.
@LANG@
Languagecode as configured
@TRANS@
Languagecode obtained from page id of form
For the userstpl from the example above, you could have the following page:
====== @@What's your Name?@@ ======
I'm living in @@What's your Continent?@@. I'm a user since %Y-%m-%d.
@@Enter a short bio|FIXME please fill in your biography@@
The result then would look somewhat like this with all the user data filled in:
====== Andreas Gohr ======
I'm living in Europe. I'm a user since 2007-12-23.
It's me :-)
ACL Checking & runas Option
By default this plugin will check for ACLs in template mode using the permissions of the user filling the form. This means the user needs to have at least read permissions for the template and create permissions for the namespace where the new page should be saved.
However sometimes you may want to give anonymous users a way to create pages in a restricted namespace without giving them any direct access. This is where the runas option comes into play. With this option you can specify a username in the config manager. The user you specify here will always be used for checking the permissions mentioned above, regardless of the user filling the form. This way you can specify the needed access for this particular virtual user in the ACL manager.
Note: the runas user does not need to exist. In fact it is recommended to use a non existing user. Even when it exists, permission checks are done on user level only, groups of the user will be ignored.
Accessing user field infos
When using a user or users field, additional data of the selected users can be used in the template:
'@@user.name@@' replaced by user full name
'@@user.mail@@' replaced by user e-mail address
'@@user.grps@@' replaced by user grps, comma separated
'@@user.grps(separator)@@' replaced by user groups, separated by 'separator'
'@@users(separator)@@' - replaced by list of user's nicks, separated by 'separator'
'@@users(separator).name' - replaced by list of user's full names, separated by 'separator'
'@@users(separator).mail' - replaced by list of user's emails, separated by 'separator'
separator may be omitted then the comma is used as a separator. Eg. @@users.mail@@, @@users.name@@
@@users.grps@@ is not supported
Script Mode
This action gives the data to a PHP script supplied by the administrator. The script then can do whatever it wants with the data.
That means the class has to have the handleData($fields, $thanks) method with the fields and the thanks-message as parameters. It returns a thanks-message on success or false on error.
Example
This is a simple script handler that will just print the form's arguments in DokuWiki's debug log.
<?phpuse dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface;class helper_plugin_bureaucracy_handler_example implements bureaucracy_handler_interface {/**
* Log the form fields to DokuWiki's debug log
*/publicfunction handleData($fields,$thanks){
dbglog($fields,__FILE__.': '.__LINE__);
dbglog($thanks,__FILE__.': '.__LINE__);return$thanks;}}
Examples
Checkbox field
Example code for checkbox field:
yesno "Are you happy?" "=Yes sir" "!No sir"
yesno "Show fieldset?"
fieldset "Shown on checking the box" "Show fieldset?"
textbox "Share your praise"
The checkbox returns the default value Yes sir for checking the field, and No sir for unchecking. Leaving out default value(s) does result in no return value.
When a fieldset refers to a yesno field, no third argument is needed, instead it checks if the yesno is set. No default values are required for yesno where the fieldset depends on, unless you like a return value to your mail or template from that yesno field of course.
Number field
number "One"
number "Two" ++
number "Third" >3 <40
hiddenautoinc "Four (notice: conflicts with Two)"
number "Fifth" 000
number "Sixth" ++ 000
One Number field accepts only numbers
Two Number field it remembers the last number and increment it with one, you can change it
Third Number field accept any number between 3 and 40
Fourth Number field is hidden, and increment every time a form is saved. (At the moment this field conflict with an autoincrementing number field. So don't combine in one form.)
Fifth Number field returns values which are completed with leading zeros. Input of 23 will be returned as 023.
Sixth Number is a combination of Two and Fifth
Development
Adding a new field type
To add a new type, you need to implement a Helper Plugin inheriting from helper_plugin_bureaucracy_field. There you probably want to overwrite the renderfield() method and probably some other methods as well. Your field will automatically be available as type <plugin>_<component>. Eg. lib/plugins/foo/helper/bang.php creates a new type foo_bang.
If you need more control over adding one or more fields, you can implement an Action Plugin hooking to PLUGIN_BUREAUCRACY_FIELD_UNKNOWN. This event only has a BEFORE event and provides the following data:
$data = array(
'fields' => &array(), // the fields initialized so far - add yours here
'args' => array() // the tokenized line, args[0] should be your plugin
);
In your handler you need to check that args[0] is the field type you want to register. If it is, you need to call preventDefault() and add your own field(s) to the fields array. The added field has to be a descendant of helper_plugin_bureaucracy_field!
Adding a new action
To add a new action create a new Helper Plugin inheriting from helper_plugin_bureaucracy_action. This works similar to adding a new field described above.
Theres is also an Event you can hook called PLUGIN_BUREAUCRACY_ACTION_UNKNOWN. Again, there's only a preventable BEFORE event.
describe passed data in detail. For now check the source.
Influence Template mode
Saving the final page in template mode triggers an event called PLUGIN_BUREAUCRACY_TEMPLATE_SAVE. In the before mode you can prevent saving the page or modify it's content. The after event is triggered after a page has been created.
Passed data:
$data = array(
'patterns' => &array(), // list of PREG patterns to be replaced
'values' => &array(), // values for the above patterns
'id' => string, // ID of the page being written
'template' => &string, // the loaded template text
'form' => string, // the page the bureaucracy form was on
'fields' => helper_plugin_bureaucracy_field[], // all the fields of the form
);
Hook into email action
The event PLUGIN_BUREAUCRACY_EMAIL_SEND gives developers of other plugins access to the submitted form data before it is actually sent in the actionmail.php.
This makes it easier to provide custom fields in bureaucracy emails.
The event data includes the form fields info and all the values, so they can be processed by third-party plugins:
Important! These are hacks - there is no guarantee they'll always work, and they will not survive updates.
If it breaks you get to keep the pieces.
Customise the Date Format
NOTE: The configuration setting for the PHP strftime function in /conf/dokuwiki.php also need to be changed (can also be changed via Admin→Configuration)
$conf['dformat'] = '%d/%m/%Y %H:%M';
To change the default date format from yy-mm-dd to dd-mm-yy (e.g. for Australia)
Change the jQuery datepicker format /plugins/bureaucracy/script/datepicker.js from:-
/**
* Init datepicker for all date fields
*/
jQuery(function(){
jQuery('.bureaucracy__plugin .datepicker').datepicker({
dateFormat:"yy-mm-dd",
changeMonth:true,
changeYear:true});});
to this:-
/**
* Init datepicker for all date fields
*/
jQuery(function(){
jQuery('.bureaucracy__plugin .datepicker').datepicker({
dateFormat:"dd-mm-yy",
changeMonth:true,
changeYear:true});});
Change the Bureaucracy error message in /bureaucracy/lang/en/lang.php from:-
$lang['e_date']='"%s" needs to be a valid date in the format yyyy-mm-dd.';
to this:-
$lang['e_date']='"%s" needs to be a valid date in the format dd-mm-yyyy.';
Change the Bureaucracy date validation in /bureaucracy/helper/fielddate.php from:-
* Validate field input
**@throws Exception when empty or wrong date format
*/protectedfunction _validate(){
parent::_validate();$value=$this->getParam('value');if(!is_null($value)&&!preg_match('/^\d{4}-\d{2}-\d{2}$/',$value)){thrownew Exception(sprintf($this->getLang('e_date'),hsc($this->getParam('display'))));}}}
to this:-
* Validate field input
**@throws Exception when empty or wrong date format
*/protectedfunction _validate(){
parent::_validate();$value=$this->getParam('value');if(!is_null($value)&&!preg_match('/^\d{2}-\d{2}-\d{4}$/',$value)){thrownew Exception(sprintf($this->getLang('e_date'),hsc($this->getParam('display'))));}}}
As of release 2016-03-11 it is also necessary to change this:-
This is a simple plugin that will display CSV data in table form. The data can either be inline between <csv> and </csv> or be read from a file in the media area using <csv namespace:test.csv></csv>. You can also give an HTTP URL to a CSV file instead of an uploaded media file.
If you are planning to use csv files in the media area, you will most likely need to include the .csv file extension in mime.local.conf so you can upload .csv files. Something like this should get you started:
csv text/csv
The <csv> tag allows for additional options to be specified as well as a file reference.
Option
Description
Default value
file=<filename>
where <filename> can be any <namespace:file.csv> or <http url>
hdr_rows=<n>
Format the first <n> rows of data from the CSV as column headers
1
hdr_cols=<n>
Format the first <n> columns of each row as column headers
0
span_empty_cols=[01]
Create colspans for each empty (two adjacent commas) cell following a cell with content
0
delim=<char>
The delimiter used between cells. Specify tab for a tab separated file.
,
Other options of the form <key>=<value> are possible but not used for displaying csv data yet.
Cells that include a comma as part of the data are expected to be contained between double quotes, which is the typical behaviour of most systems when exporting .csv files.
Empty lines in the csv file or data are displayed as horizontal separators in the table.
Use with a Google Docs Spreadsheet
The HTTP URL can be a shared Google Docs Spreadsheet.
The following explains how to export a spreadsheet in CSV format via a URL.
To link to a Google spreadsheet:
Open your spreadsheet in Google Docs.
Click the “Share” botton in the toolbar, and choose “Anyone with the link” for Visibility.
Open your spreadsheet in Google Docs.
From the spreadsheet menu select: File | Publish as a Web Page
Sheets to Publish: “All Sheets”, and check the box “Automatically republish when changes are made” to ensure your data is auto updated.
Click “Start Publishing”. This will activate the options in the box “Get a link to the published data”, below.
Change the export type from “Web Page” to “CSV (comma-separated values)”.
Change “All sheets” to “Sheet1” (or select the sheet you want to export)
Change “All Cells” to the specific range you want to export, beginning with the header row. Use Excel-style notation, like “A1:C6” for the first 3 columns and the first 6 rows.
Click “Republish now”
Copy the link (check it ends with output=csv) and paste it into your dokuwiki CSV table using the file= attribute described above.
plugin:EditX moves or renames pages with their entire edit history, and will also delete pages with or without deleting the edit history.
Go to the edit page and click on the link in the the header: Page management for page name (or simply use the action ?do=editx in the URL)
use the form to manage a page rename or deletion for the current page.
Moving a page
Move moves a page and all histories to the targeted name, leaving a redirection text on the old page. The move summary will be left in the source page history, the target page history, recent changes, and will be sent to the subscribers or the source of the target page.
If the target page exists or has a conflicting file (page, meta or attic files), the move cannot be done. Therefore if you move a page from A to B, you cannot move B back to A until you delete (no history) page A via this plugin or manually.
Authority requirements
edit authority of the source page
edit authority of the target page
being in groups or users defined in user_rename
Moving a page (Without redirection)
If you want to perform a move without leaving a redirection and a note in the history, just check the checkbox No redirect, the source will be totally removed just as delete does.
Authority requirements
delete file authority of the source page
edit authority of the target page
being in groups or users defined in user_rename_nr
Deleting a page
Delete removes all files in pages/ meta/ and attic/ related to the page, except .mlist. The delete summary will be left in the source page history, recent changes, and will be sent to the subscribers of the source page.
If no delete history is checked, there will be no history in the source page but still in the recent changes.
Authority requirements
delete file authority of the page
being in groups or users defined in user_delete
Configuration
Here are configs in the configuration manager:
redirecttext: Text left after moving a page, and @ID@ refers to the target page. If it's left blank, the default text (in the language pack) is used.
If you have Redirector plugin installed, you can fill in ~~REDIRECT>:@ID@~~ or #REDIRECT :@ID@.
user_rename: The groups and/or users allowed to perform page name (note that edit authority is still needed, see above documentation), listed in comma seperated form.
If you want to enable for all with edit authority, leave it blank.
If you want to disable for all, write an impossible “user name” such as -.
user_rename_nr: similar to above
user_delete: similar to above
2023/08/11 23:47
File List Plugin
The filelist plugin provides a syntax for adding linked and sorted lists of files as selected by wildcard based glob patterns to a wiki page and thus allows dynamically including file listings of arbitrary filesystem locations and media namespaces. Using the additional filename command, one can also add a single link to a file out of a list anywhere in the text, which can be used to automatically keep download links for software releases up to date with the most recent upload.
Usage
The filelist plugin provides two new commands to be used in wiki pages, filelist and filename. The general command syntax for both is the following:
{{[ command ]>[ pattern ][ parameterlist ]}}
command must be either filelist or filename.
pattern is a searching pattern for files to include in the generated list, defined using the pattern syntax of the unix fnmatch function. An example: If you want to include all files ending on .txt in the folder some/path/3), you would use some/path/*.txt as the pattern (and the parameter direct=1, see parameters below). Analogue to this, to include all jpeg media files in :some:namespace, you'd use :some:namespace:*.jpg.
parameterlist can be used to define optional, & separated parameters (defined as key-value-pairs). For a list of supported parameters, see below.
Paths
The filelist plugin supports both absolute as well as relative paths into the filesystem or Dokuwiki media namespaces. All paths are checked against a whitelist of allowed paths for scanning (as defined via the configuration setting ''allowed_absolute_paths''). Paths which are not located below these whitelisted paths are not allowed for globbing and thus filelist/filename calls to such paths fail. Per default, the Dokuwiki basedir as defined in DOKU_INC is included in this whitelist and mapped to the Dokuwiki base-URL, DOKU_URL.
Relative paths into the filesystem are interpreted relative to the Dokuwiki basedir. Relative media paths (without a leading : that is) are interpreted relative to the namespace of the currently active page. Thus, :snippets:dokuwiki:* and * would be interpreted the same on the current page :snippets:dokuwiki:filelist.
Parameters
Name
Description
Possible values
Default
direct
Whether to interpret the given pattern as a direct path in the file system or as an dokuwiki media id. Defaults to media id.
0 or 1
0
sort
The property by which to sort the internal file list. By default, the file name is used, with upper case being sorted before lower case (use iname for a case insensitive sorting criteria).
name, iname, ctime, mtime, size
name
order
Whether to sort the internal file list ascending or descending. Sorting in ascending order is the default.
asc, desc
asc
filelist specific parameters
offset
The offset in the internal file list from which on to display the list. Default is an offset of 0.
any numeric value
0
limit
The number of files to display, beginning at index offset. A number of 0 means to display all available files.
any numeric value
0
style
The style to use for display. list creates an unordered bullet list (the default), olist an ordered list, table a table view and page a heading/section based view of the selected files.
list, olist, table, page
list
tableheader
Whether to show the table header describing the table columns. Off by default.
0 or 1
0
tableshowdate
Whether to show the file modification date in the table view. Off by default.
0 or 1
0
tableshowsize
Whether to show the file size in the table view. Off by default.
0 or 1
0
recursive
Whether to do a recursive file crawl starting at the defined basepath. If this parameter is set to 1, the whitecard part of the search pattern is applied to each found subdirectory. If no files are found, the subdirectory is not included in the search result. All display styles besides table will show the result in a hierarchical structure; table will first flatten the result by prepending all found files with there subtree pathname (note that this happens before sorting).
0 or 1
0
titlefile
The filename of a file which to lookup in each subtree if recursive is set to 1 and whose content to use as title for the directory. It will be ignored in the results of the filelisting itself. Defaults to _title.txt. Example: A _title.txt file containing “My special title” found during a crawl on the subpath my/subpath will be rendered as having the name “My special title” instead of “subpath”.
any filename
_title.txt
filename specific parameters
index
Which specific item to select for display from the internal file list. The default is the first one.
The Gallery Plugin allows you to embed an automatically created image gallery into a page.
Author : Andreas Gohr
Syntax
A basic gallery can be added by selecting a namespace like this:
{{gallery>namespace}}
All image files in the selected namespace will be added to the image gallery. Don't forget the “:” in front of the namespace.
Instead of using a whole namespace of images, you can also specify a single image – this makes most sense when combined with the lightbox mode (see below).
{{gallery>namespace:someimage.jpg}}
The created gallery can be aligned by using white space (defaults to centered):
Instead of a namespace, you can also give an HTTP(s) URL to any Media RSS or ATOM feed with enclosures (as produced by most photo sharing sites like Flickr). The images will then be pulled from that feed instead:
{{gallery>http://www.23hq.com/rss/schabloni}}
Note: since the question mark is used to separate the parameters (see next section) the URL can not contain any question mark. To use such a feed URL with the gallery plugin, just use one of the many short URL services like http://bit.ly.
E.g. instead of http://api.flickr.com/services/feeds/photos_public.gne?id=22019303@N00&lang=en-us&format=rss_200 use a shortened URL like http://bit.ly/HurZM.
Additionally, to have thumbnail creation correctly working you need to set config:fetchsize big enough to get the remote images downloaded.
Parameters
A number of parameters can be set by appending them with ? character to the namespace or image. Each parameter needs to be separated with a & character. Defaults for all parameters can be set in the config manager. If a parameter is enabled by default it can be disabled in the syntax by prefixing it with the syllable no. E.g. the parameter cache is usually enabled and can be disabled using the keyword nocache. Below is a list of all recognized parameters
Parameter
Default
Description
<number>x<number>
120x120
Sets the size for thumbnails. Unless the crop option is set, this is a boundary box into which the thumbnail will be fitted, maintaining the correct aspect ratio.
<number>X<number>
800X600
Sets the size for the linked images in direct mode. This is a boundary box into which the image will be fitted, maintaining the correct aspect ratio. Note the uppercase X.
<number>
5
The number images per row in the gallery table. If you specify a 0 no table is used instead all thumbnails are added in a sequence.
=<number>
=0
Limits the output to the given number of images. 0 means all.
+<number>
+0
Skip the first number of images. Useful with the option above.
~<number>
~0
Add a pagination for the thumbnails displaying the number of given thumbnails per page. 0 disables pagination. Pagination is added through JavaScript - when no JavaScript is available all thumbnails are displayed
cache
enabled
Usually the output of the created gallery is cached. When the images in your selected namespace change, you have to manually force an update of the gallery page's cache. To disable the cache for the page showing the gallery, set nocache as option.
crop
disabled
Make thumbnails the exact given thumbnail size big, cropping when needed.
direct
disabled
Link thumbnails with the bigger sized images not with their detail page
lightbox
disabled
Show images in a fancy JavaScript modal browsing window, see below for details. Setting this option automatically implies the direct mode
reverse
disabled
Reverse the order of the displayed images
recursive
enabled
Find images in the given namespace and all sub namespaces
random
disabled
Sort images randomly. You might want to use nocache as well
modsort
disabled
Sort images by file modification date
datesort
disabled
Sort images by EXIF date
titlesort
disabled
Sort images by EXIF title
showname
disabled
Show filename below thumbnails
showtitle
disabled
Show the EXIF tag Headline as title below thumbnails
anything containing a *
jpg,gif,png images
This can be used to filter the list of files found in the given namespace. * work as simple wildcard symbol.
This displays all images beginning with image_ and ending in .jpg from the namespace images:vacation. Thumbnails are cropped to 80×80 pixels and images will be opened in lightbox mode.
Example:
{{gallery>?crop&lightbox}}
This displays all images in the current namespace using 2 parameters. Parameterlist begins with ? additional ones are concatenated with &.
About the Lightbox mode
This mode will open the clicked picture inside the current browser window without leaving the current page4).
You can close the picture view by clicking the X button in the lower right corner or anywhere outside the picture. You can move to the next or previous image by using the arrow buttons in the lower left corner, your keyboard or by clicking the left or right side of the image.
The picture is downsized if necessary to fit into the current browser window. You can enlarge it with the expand button in the top right corner.
The following keys can be used to navigate:
Key
Action
→
next image
←
previous image
ESC
close the image view
Manipulate EXIF Tags
If you want to show a title below the image using the parameter showtitle it may appear that the title shown is not as you expected (e.g. einstein.jpg instead of Albert Einstein).
If you want to adapt the image's subtitle shown in the gallery, you have to manipulate the EXIF Tag called Headline.
You could use the ExifTool for which even a Windows GUI exists to adapt the EXIF data to your needs.
Known Limitations and Caveats
Uploading Images
Uploading images is beyond the scope of this plugin. Do not request any features regarding this.
Upload the files manually via FTP to the data/media directory. Keep in mind that image names need to be valid :pagenames, all lowercase, no spaces or special chars!
Caching
The gallery output is cached by default. When you add pictures later, they may not show up in the gallery: add &purge=true to the end of the URL to clear the cache. See :caching for details.
Optionally use the nocache parameter of the plugin (not recommended).
EXIF Data Problems
Problems with accessing EXIF or IPTC data in the images, should be reported as DokuWiki bugs and not for this plugin. All EXIF handling is in DokuWiki core. Currently EXIF Data is expected in UTF-8 encoding. There are some problems fetching the correct date from images, these are fixed in the current development version of DokuWiki.
Lightbox Problems
When the lightbox mode doesn't work and instead images are simply opened in the same window, the JavaScript was not correctly loaded. This is most likely a Browser-Cache issue. Simply follow the steps described for fixing a similar problem with the faq:toolbar. Also make sure you don't have any conflicting plugin installed. You should not install any additional lightbox plugin.
Images are not Resized
There are different reasons why thumbnails are not created:
libGD extension is missing ⇒ Install the extension or configure DokuWiki to use imagemagick
libGD extension is installed, but the source image size + overhead is larger than memory_limit set in php.ini ⇒ Lower the source image size or increase the memory_limit
MediaRSS feed displays "nothing found"
When no images from your feed are shown, be sure you don't have a question mark in your URL. Use an URL shortener as suggested above. Also be sure your feed URL (before shortening) starts with http:// or https:// and not with feed://. The latter is just a renamed HTTP link - simply rename it back.
External Images are not Resized
As written above, you need to increase the config:fetchsize config option. Also make sure LibGD or ImageMagick are installed.
Demo Installations
Here are a few user provided examples of the gallery plugin in use:
Be sure to read the Known Limitations and Caveats section first. Questions should be asked in the forum. Bugs and feature wishes should be reported in the issue tracker. Any comments/discussions on this page will be removed.
2023/08/11 23:47
iframe Plugin
---- plugin ----
description: Allows external URLs to be loaded into an iframe in your DokuWiki page
author : Christopher Smith
email : chris@jalakai.co.uk
type : syntax
lastupdate : 2023-08-17
compatible : Lemming, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather, Igor
depends :
conflicts :
similar :
tags : embed, include
To install the plugin manually, download the source to your plugin folder, lib/plugins and extract its contents. That will create a new plugin folder, lib/plugins/iframe, and install the plugin.
The folder will contain:
conf/default.php default settings
conf/metadata.php settings information for the config plugin
lang/xx/lang.php language strings for config plugin
syntax.php plugin script
That is an URL to embed, followed by several optional parameters. The following parameters are recognized:
width and height are optional. When only one value is given it is assumed to be the height. Otherwise the first value is width and the second value is height. You can give the values in px, em, pt or %. When no unit is given pxis is NOT assumed (you have to give the value). Defaults values are: width - 98%, height - 400px.
noscroll will disable the scrollbars of the iframe
noborder will disable the frame border, note that your CSS might still add borders or may disable them without using this setting
Optionally an alignment can be given as left or right to have the iframe floating to the left or right. Should be used with a width.
fullscreen will include the allowfullscreen attribute.
An alternate text is optional. If not specified an empty string will be used.
See the plugin in action:
Configuration
The plugin has one configuration setting, which can be set via the admin/configuration settings page.
$js_ok — default value - false, set to true to enable JavaScript URLs.
This should never be enabled in public wikis as it opens a XSS security hole.
Acknowledgments
The plugin was created in response to an idea mentioned by Styno.
Modern web browsers will by default NOT embed stuff from “HTTP-only” sources in an HTTPS environment5) - browsers will show dialogs on top or bottom of the page's window (noted for IE and SeaMonkey) or a symbol at the beginning (Firefox) or the end (Chrome) of the URL bar, allowing situative or general settings for “mixed content”. Should be no problem if you keep your site consistent (use relative url paths for local sources), but may be confusing in test cases.
Discussion
This used to be the right spot for this, but maybe not these days?
First a big thanks to Christopher for this plugins, it's because I want to use it a lot more in my newest wiki that I took the time to figure out why it was broken(it's not).
Some one (like me) upgrading their DokuWiki from the 2008-05-05 release using the older release of this plugin (2006-12-17) will think its broken.
I know I did, but after studying the source code and doing some experiments I realized what is really wrong is that the syntax changed, (a lot) between then and now. The old 2006 release requires brackets for its arguments, the 2008 release chokes on brackets and creates bad URL's. I suspect this is well known to people who follow the forums, but a surprise to those like me who simply visit the plugin pages every few years. To fix simply change your pages that use this plugin from using brackets to using a leading space and all will be well. Examples (all url's point to a private, off Internet server):
Iframe release
year
Example valid usage
2006-12-17
{{url>http://asimov/DokuWiki/[80%,400px]|iFrame not installed}}
OLD SYNTAX
2008-10-31
{{url>http://asimov/DokuWiki/ 80%,400px|iFrame not installed}}
NEW SYNTAX
2008-10-31
{{url>http://asimov/DokuWiki/|iFrame not installed}}
2006-12-17
{{url>http://asimov/DokuWiki/|iFrame not installed}}
Notice how if no arguments are given, then the same syntax works fine for both releases. Perhaps this is why this
plugin is tagged as 'broken' by some? Also keep in mind the original 2006 release only supported frame width, height.
New version supports floats, and invisible borders. (which I think is really cool)
Regardless, it's a great plugin, thank you Christopher Smith for your work then and now.
PS. Yes I know doc above says the same thing, but sometimes you have to hit people over the head before they listen.
Tip to use together with survey-tool
The iFrame is a great means to link your Wiki to for example Survey-tools like SurveyGizmo. In wiki's with registered users you can even use the username as a key to string together the two environments, by using the value of @USER@ as URL parameter sguid. The result is great, persistent dynamic content in the iFrame specific for the current user.
To achieve this, a very small addition to iFrame is needed so that it accepts @USER@ as a variable. In syntax.php, line 96 simply replace:
Independent from this: A useful extension of this plugin to avoid security problems would be, to restrict the possible URL's through a list in the configuration.
{{page>wiki:syntax#Tables}} will include the section about tables of the syntax page.
{{namespace>project_foo}} will include all pages in the project_foo namespace.
{{page>blog:mypage&tags&comments}} will include the page blog:mypage and show the tags from the tag plugin and the number of comments from the discussion plugin. Both plugins need to be installed for this example.
Syntax
Simply enclose the ID of the page to be included in double curly brackets:
The plugin offers four syntaxes, {{page>...}} , {{section>...}} , {{namespace>...}} and {{tagtopic>...}}.
Section is aimed more at including sections, page at including whole pages and namespace at including whole namespaces. Tagtopic includes all pages with a tagtopictag.
Configuration
The plugin can be configured in the DokuWiki configuration manager available in the admin menu. These settings also affect the blog plugin which uses the include plugin to generate the blog page.
noheader
Don't display the header of the inserted section
firstseconly
Display only the first section of the included page
showtaglogos
Show/hide an image for the first tag (if the page has tags)
showfooter
Show/hide page footer below the included page
showlink
Makes the first headline of a included page/section a link to the included page/section
showpermalink
Show/hide a permalink to the included page in the page footer
showdate
Show/hide creation date of the page in the page footer
showuser
Show/hide user name of the page creator in the page footer
showcomments
Show/hide number of comments in the page footer (requires the discussion plugin)
showlinkbacks
Show/hide number of linkbacks in the page footer (requires the linkback or backlinks2 plugin)
showtags
Show/hide tags in the page footer (requires the tag plugin)
showeditbtn
Show/hide edit button below the included page
doredirect
Redirect back to original page after an edit
usernamespace
Namespace for user pages (see showuser configuration) (default user)
doindent
Indent included pages relative to the section of the page they get included in
linkonly
Display only a link instead of the whole page content
title
Show the title instead of the page id
pageexists
Only list page ids of existing pages (see existlink)
existlink
Display a link and do so only if page page-id exists
noparlink
Don't put the link into a par environment (for inline lists)
Macros
Simple macros are possible to serve a page on a per user or per date base. These are:
@USER@
username
@NAME@
full name of user
@GROUP@
first group the user belongs to
@YEAR@
4-digit year
@MONTH@
2-digit month
@WEEK@
2-digit ISO week number
@DAY@
2-digit day
@DATE<expr>@
use a calculated date instead of today in date macros
<expr> in @DATE<expr>@ can be one of:
PYEAR
previous year
NYEAR
next year
PMONTH
previous month
NMONTH
next month
PWEEK
previous week
NWEEK
next week
YESTERDAY
yesterday's date
TOMORROW
tomorrow's date
Examples:
{{page>@MONTH@:@DAY@:birthdays}}
includes the page birthdays in namespace <month>:<day>: eg. 10:15: birthdays for the 15th of october.
{{page>@USER@:message}}
incudes the page message from the namespace <user> of the logged in user
{{page>foo@DATENWEEK@@YEAR@:@WEEK@}}
includes the page <weekno> from the namespace foo<year> with next week's date e.g. foo2012:01 for the 27th of december 2011
Flags
You may use flags to override default all configuration settings:
Setting
Default
Alternative
firstseconly
fullpage
includes the whole page
firstseconly
includes only the first section of a wiki page
showfooter
footer
shows a footer below the page with info about the included page
nofooter
hides the page info footer
showeditbtn
editbtn
shows a button to edit (or create) the included page
noeditbtn
hides the edit (or create) button
noindent
fullpage
page section and header retained on the same level as source page
IndexMenu allows you to insert a fully customizable index or a list of pages starting from a specified namespace.
Quick Syntax
All the syntax options can be easily accessed with the indexmenu picker in the :edit window:toolbar.
Main
Options
{{indexmenu>ns[#n][ns1[#n] ns2[#n] …]
|[js[#theme]] [tsort] …}}
Arguments inside “[]” parenthesis are optional. The # char is always required with related options.
Full syntax
Settings before the “|” separator:
Main
Action
Note
ns
Main namespace name. Index starts from here. Syntax complies with DokuWiki namespaces paths.
“.” refers to the namespace of the page containing the indexmenu syntax and not to the current DokuWiki namespace context 6) (see the context option for this feature). “..” or an empty value shows the root site namespace.
#n
n is a number that specifies how many namespace levels to display open under the main namespace.
If it's not defined then the whole tree, till the deeper node, will be open. If 0 or 1 it'll display only nodes under the main namespace. For example: “#2” will display “root:myns1:myns2” but will keep myns2 closed thus hiding “root:myns1:myns2:myns3”. Optional.
ns1[#n] ... nsn[#n]
A list of optional namespaces inside the main namespace. Every namespace will be opened or closed at the specified n level. Syntax complies with DokuWiki namespaces.
If n is not defined then all namespaces are open, if 0 they are closed. “.” refers to the namespace of the page containing the indexmenu syntax and not to the current DokuWiki namespace context 7) (see the context option for this feature). “..” or an empty value shows the root site namespace. Optional.
Optional settings after the “|” separator:
Option
Action
Note
js
JavaScript render method: the index is an expandable tree menu.
Without n, all nodes are open, with it, nodes are open till n level.
navbar
The tree opens itself automatically at the current page namespace. Useful in a navigation sidebar.
It works with or without js option. Without js option, the indexmenu page is never cached (just like the default DokuWiki index page) and the DokuWiki loading could be slower depending on the amount of child nodes displayed.
context
Relativemain namespace and optional namespaces will refer to the current DokuWiki namespace context 8) instead of to the namespace of the page containing the indexmenu syntax. Useful in a navigation sidebar.
It works with or without js option. In both cases, the indexmenu page is never cached so the DokuWiki loading could be slower depending on the amount of child nodes displayed (In js mode, when a lot of nodes are usually displayed, the max option is recommended). It automatically enable the nocookie option.
tsort
Sort (only) pages by title.
Useful when config:useheading is on. By default namespaces are not sorted, you need the nsort option for this.
dsort
Sort (only) pages by date creation (first the oldest).
By default namespaces are not sorted, you need the nsort option for this.
msort[#meta]
Sort (only) pages by a custom :devel:metadata information. Without the meta parameter, it looks for the custom sorting number specified with the {{indexmenu_n>N}} syntax (see the below metadata-tag-syntax). meta should refer to the :devel:metadata#data structure (Array values are managed through the “:” separator, for example: “msort#date:modified).
By default, pages without metadata tag are sorted by page name (the default DokuWiki way), but you can override this behaviour adding also the tsort or dsort option in the indexmenu syntax. By default namespaces are not sorted, you need the nsort option for this.
rsort
Reverse the sorting of pages.
By default namespaces are not sorted, you need the nsort option for this.
nsort
Sort also namespaces according to page sort options.
To use in addition to the above sort options. tsort option will apply to headpages.
nons
Exclude namespaces nodes from index. It shows only the pages.
Without js, the closing n namespace option prevents to display nodes below the n namespace level.
nopg
Exclude pages nodes from index. It shows only the namespaces.
max#n[#m]
If initially closed, the node at n level will retrieve all its child nodes through the AJAX mechanism when opened for the first time. Optionally, the nodes after the n level can be retrieved with AJAX every m sublevels instead of in one go.
It affects the server loading and speeds up the loading of pages in DokuWiki with an high amount of pages. It works only in js. Cookie are automatically disabled, just like with nocookie.
theme
Theme name for indexmenu icons
A theme is a set of icons inside images directory as described in theme-tutorial. Admins can download and share themes in admin panel. It works only in js
id#[random|n]
Cookie ID for a js indexmenu where the previously opened/closed nodes by a user are stored.
Useful when a page is uncached and you don't use the nocookie option because it forces the same cookie preventing un-useful cookies created every time a page is viewed by the user. By default is always random even when this option is not specified, but you can force it to be a n fixed number ( i.e id#20 ). Read the js-does-not-remember-its-previous-state section. ATTENTION: ID must be unique for every indexmenu in your DokuWiki site or you'll get strange js behaviors. It works only in js
maxjs#n
It sets how many js tree levels to render when page loads. Remaining nodes are rendered (slightly slower) only when they are open by users, by optional namespaces option, by cookies or by navbar option.
Default n is 1 so that it will speed up the page loading, above all with an high amount of pages. It affects only the user-client CPU speed, not the webserver load. It works only in js
nocookie
Disable cookies. By default js indexmenu remember selected,open and closed nodes by user during navigation. With this option it doesn't remember them and the tree is blocked to its start status.
It works only in js
noscroll
Disable the JavaScript scrolling feature. It could solve visualization problems.
It works only in js
notoc
Disable the TOC-preview feature.
It works only in js
Examples
A sample of an indexmenu JS index that could be used inside a navigation sidebar. Its initial status is blocked by the nocookie option, so, when the page is reloaded, it doesn't remember the open and closed nodes by the user.:
{{indexmenu>..#1|js navbar nocookie}}
JS navigation index with “thread” theme where nodes after the third level are retrieved with Ajax every 2 sublevels. Pages are sorted by title and custom sort number:
Standard DokuWiki index showing only pages inside wiki:plugins and lower namespaces (max two levels):
{{indexmenu>:wiki:plugins#2|nons}}
Js tree showing pages and namespaces both sorted by reverse title. For example,if “archive” contains stuff (“news”,”oldnews“,etc) that you need to quickly organize by time, you could create numbered headpages for every namespace (i.e renaming “oldnews” in “news 2006”, “news” in “news 2010” and so on) and sort them from new to older:
{{indexmenu>:archive#1|js tsort nsort rsort}}
Standard index showing the tree of the current context 9) opened at the second level .
{{indexmenu>playground#2|context}}
Show all current namespace pages .
{{indexmenu>.:#1|context}}
JS tree showing all (and only) the namespaces of the “private” namespace sorted by date creation. “private” is relative and refers to the private namespace under the page containing the indexmenu syntax.
{{indexmenu>private|js nopg dsort}}
Metadata tag syntax
By default nodes on the same tree level are sorted by name (or by title/date if you use the tsort/dsort syntax), but you can also specify a custom sort number for every page inserting a metadata tag in the pages with this syntax:
{{indexmenu_n>N}}
Where N is a number.
Then you need to use the “msort” option in your indexmenu tree syntax.
If you have the show_sort option enabled in the Configuration Manager, a notice is displayed to admins (only) on every page with this metadata tag (the text defaults to “Indexmenu sort number: N”).
Examples:
You can change the order of this tree containing a mix of standard and config:useheading pages:
-Root
|_don
|_Mirror sessions (headline title of the ":mirror" page)
|_pachuco
|_At the radar station (headline title of the ":radar" page)
|_van
|_vliet
in this way:
{{indexmenu>..#1|msort}}
-Root
|_vliet {{indexmenu_n>1}}
|_van {{indexmenu_n>2}}
|_don {{indexmenu_n>3}}
|_Mirror sessions (headline title of the ":mirror" page)
|_pachuco
|_At the radar station (headline title of the ":radar" page)
Pages without sort number, like the last three pages, are sorted by page name as default, but you can force a different sort:
{{indexmenu>..#1|tsort msort}}
-Root
|_vliet {{indexmenu_n>1}}
|_van {{indexmenu_n>2}}
|_don {{indexmenu_n>3}}
|_At the radar station (headline title of the ":radar" page)
|_Mirror sessions (headline title of the ":mirror" page)
|_pachuco
Put the sidebar template directory in the lib/tpl directory alongside the default template. Then, add the following to your conf/local.php file:
$conf['template']='sidebar';
If you want a tagline, you can define it as follows:
$conf['tagline']='Your own tagline';
Defining sidebar content
The content of the sidebar is defined in a page called sidebar. You can use a sidebar page per namespace. You have to define the page in a normal wiki way if it doesn't exist yet. (Hint: in DokuWiki, simply searching for the page makes it easy to create it.) The template searches for the sidebar page first in the current namespace, and then higher on if none was found. If no sidebar page is found, the index is displayed by default.
2023/08/11 23:47
nspages Plugin
---- plugin ----
description: Present a table of contents of the pages of a selected namespace
author : Guillaume Turri
email : guillaume.turri@gmail.com
type : Syntax
lastupdate : 2023-07-11
compatible : 2017-02-19, 2016-06-26a, 2009-12-25, Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, ponder stibbons, Hrun, Detritus, Greebo, Hogfather, Igor, 2023-04-04
depends :
conflicts :
similar : catlist, dir, dirlisting, nstoc, pagequery, pagelist, pageindex, pglist
tags : listing, menu, namespace, navigation
This plugin nicely displays a table of content of the pages -and optionally the subnamespaces- of a given (sub)namespace.
If you're discovering this plugin and want to have a glimpse at what you can do with it, the first section, which shows some common usages, is made for you
If you're interested in understanding all the options, in order to use it to best fit your needs, you may want to jump directly to the 2nd section.
Some examples and common usages
The very first steps
Using this plugin is easy: just write
<nspages>
(You may also use the button from the toolbar.)
You will get a list of your pages displayed in columns, like this:
If you're interested in the list of the namespaces instead of the list of pages, try this:
<nspages -subns -nopages>
Pictures!
Now let's do something more colorful: if you have pictures in your pages you can do this:
<nspages -usePictures>
it will represent each page using their first picture, like this:
Tree
One last example: instead of displaying the content of a single namespace, let's display a hierarchy of pages as a tree. For the hype, let's use a whole bunch of options together (you can look at the next section in order to understand what each of those option does):
<nspages -tree -r -exclude -subns -pagesInNs -h1 -textNs="All my content as a tree!">
Bam, you get a tree like this:
This was just to get you started. This plugin is highly configurable and has a lot more features we haven't mentioned yet (other ways to display pages, to filter out some pages, to display pages with another order, …). The next section gives all the details
path_to_a_namespace represents the path to the wanted namespace. It can be an absolute (ex: namespace1:subnamespace) or a relative path (ex: .:subnamespace). If no path is specified, the current namespace is selected.
-option may be one of the following (it is possible to specify several options):
Common options
-subns
displays the subnamespaces of the selected namespace (and provide links to their main page)
-nopages
do not list the pages of the selected namespace (of course this option is useful only if you use -subns)
-exclude:nameOfPage
won't include the page nameOfPage. This option may be used several times in order to exclude several pages
-exclude:subNs:
won't include the subnamespace subNs. This option may also be used more than once
-exclude
won't include the current page
-h1
will display the first h1 title found. If a page doesn't contain such a title, the name of the page is used instead
-textPages="some text"
some text will be displayed instead of the default text, to introduce the pages list. i.e. changes the “Pages in this namespace” text. Set to ="" to remove.
-textNS="some text"
some text will be displayed instead of the default text, to introduce the namespaces list
-title
alias of -h1
-simpleList
display the list on a single column
-numberedList
display the list on a single column, as an ordered list
-simpleLine
display the list on a single line (incompatible with -simpleList)
-simpleLineBreak
display the list on a single column, separated only by line breaks (incompatible with the previous flags)
-usePictures
display the first image of each page. (Note that you can include a 1×1 pixel size image as the 1st picture on a page if you want this page to be represented by this image in a nspages TOC.)
-tree
group the items per namespaces. To be used with the -r flag. Eg:
<nspages -r -subns -nopages -tree>
-nbCol=3
Change the number of columns to use (default is 3)
-sortId
Sort the pages according to their id, even if -title is used
Prefix the pages by the date of their last modification
-sortByCreationDate
Sort the pages by date of creation
-pagesInNs
The pages will appear among the namespaces
-r
recurse : display the pages of the subnamespaces (if used with “-subns” it will display the sub-subnamespaces). You may use just -r to check every subnamespace, or e.g. -r=3 to have a depth limit to 3 levels
-exclude:[page1 subNs: page2]
an easier syntax to exclude several pages/subnamespaces
-pregPagesOn
-pregPagesOff
-pregNSOn
-pregNSOff
Enable the use of regex to select the documents that should be displayed. Eg: -pregPagesOn=“/doku/i” will display only pages which contains “doku” in their id.
Several options may be used, and each of them may be used several times.
Behaves like -pregPagesOn and -pregPagesOff & Co, but filters on the title (instead of the id).
-anchorName=myName
Add anchors on each title-letters, to let link directly to them. Anchors will look like, e.g. for the letter A: nspages_myName_A
-actualTitle
print an actual html title (not just a bold and underlined text)
-actualTitle=n
print an actual html title <hn>
-idAndTitle
Use the format “id of the item - title of the item”
-nbItemsMax=n
Display at most n pages or subnamespaces
-hideNoPages
Hide page header and “no pages” message if no pages present
-hideNoSubns
Hide subnamespace header and “no subnamespace” message if no subns present
-defaultPicture
Specify the picture to display when -usePictures is used and a page doesn't contain any picture. Can be used to point at either a local file (
-defaultPicture="{{:my:picture.png}}"
) or remote one (
-defaultPicture="https://some/picture.png"
)
-showhidden
Include pages that are normally excluded from search with the hidepages config parameter. Useful for creating table of contents for hidden namespaces.
-dictionaryOrder="<locale>"
Sort according to the locale specified (see the doc). Example of usage:
-dictionaryOrder="sk_SK"
-customTitle="[{date.created}] {title} by {user}"
Use a custom format to display the title, replacing {xxx} with the associated metadata. See below for more explanations
-includeItemsInTOC
Also displays the pages in the table of contents generated by Dokuwiki (the one which appears on the top right of each page with the default template)
-sortByMetadata="date.created"
Sort the pages using the given metadata. (it can be used along with option -reverse)
-sidebar
You should use this if you use nspages to display a dynamic list of items in a sidebar. See below for more information
ex: <nspages path_to_a_namespace -exclude> or <nspages -subns -nopages> will work.
Installation
Search and install the plugin using the Extension Manager. Refer to :Plugins on how to install plugins manually.
Option -customTitle
(Because the array above is too concise to give all the details about this option)
This option accepts a string as an argument. The name of the pages will be displayed using this format. The {xxx} part are replaced by the metadata of the page.
For instance
<nspages :my-namespace -customTitle="[{date.created}] {title} by {user}">
could display:
[1613513556] <Title of page 1> by Stancu
[1624663245] <Title of page 2> by Guillaume
Some important details about this option:
Nspages will render by default only the metadata title, user, and date.created. Admins can configure it to accept more metadata. The reason to not allow everything by default is to ensure this feature won't leak private information (for instance allowing to display the IP of the editors would be a bad idea on a public wiki)
The list of metadata available by default in Dokuwiki is available in the documentation
It can be use along with other plugins that adds support for custom metadatas (like the meta plugin). (Don't forget to add those other metadata in the accept-list of nspages)
Here is an example of sidebar generated with nspages:
To get this sidebar I just put
<nspages -simpleList -h1 -sidebar>
on the page :sidebar of my instance of DokuWiki.
The tricky part is that since I do not specify a namespace then I expect nspages to consider the namespace of the current page. But by default nspages will consider that the current page is :sidebar (because it is where it is defined), whereas want makes sense to me is that the current page is interpreted as the page that I'm currently browsing.
That's the point of the -sidebar option. In practice it:
tells nspages that the “current page” should be interpreted as the page currently browsed
does not cache the resolution of the resolution of the namespace (because it may change at every page that I browse)
(a consequence is that it makes no sense to both specify a namespace and have the -sidebar option, so that case will just display an error)
To put it in a nutshell: it you use nspages to generate a sidebar, then you should add the -sidebar option
Some (important) points
With version older than 2014-08-10, you should put ~~NOCACHE~~ in the pages where you use this plugin, to make sure that if you create or remove a page in the namespace, it will be taken into account. Now, nspages automatically deactivate the cache on the pages where it is used (you can deactivate this behaviour on the admin panel).
The CSS sheet should be taken into account in order for this plugin to work correctly; but because of the cache system it may not be the case the first time you use this plugin (even if ~~NOCACHE~~ is specified). The easier way to resolve this is to make sure your cache is invalidated by touching conf/local.php (eg. by resaving your configuration)
Currently, you may not use a > in the -textPages and -textNS options, since it is understood as the end of the <nspages> tag
When you change the default markup inserted by the toolbar button (throught the admin dashboard), you may need to purge your caches to have this change taken into effect (see also the bug report):
This plugin extends DokuWiki syntax to enable the removal of one level of section indenting.
In native DokuWiki, all the content between headings is included in a section. The indentation for a particular section corresponds to the heading it follows. DokuWiki doesn't provide a way to finish a section and move back to the indentation level of the previous section - at least not without using another heading. This plugin makes that possible.
sorts the pages (reverse) alphabetically by pagename
Example
<pagelist&header&comments>
...
</pagelist>
This will show a list of pages with a header line and a comments column (if the Discussion Plugin is installed).
Configuration
The plugin can be configured using the DokuWiki configuration manager available in the admin menu. The settings also apply to plugins which use the helper component of the pagelist plugin, like for example the archive component of the plugin:blog plugin.
style
List style (default, list, table)
showheader
Show table header
showdate
Shows/hides the date column (hide, creation date, modification date)
showuser
Shows/hides the user column (hide, creator, contributors)
showdesc
Shows/hides a short description taken from the first paragraph of a page (hide, max. 160 characters, max. 500 characters)
showcomments
Shows/hides comments of a page (requires the plugin:discussion plugin)
showlinkbacks
Shows/hides linkbacks of a page (requires the linkback plugin)
showtags
Shows/hides tags of a page (requires the plugin:tag plugin)
sort
Sorts the pages alphabetically by pagename
2023/08/11 23:47
pagemod plugin
Overview
I created this plugin because I have long wished for a way to add data structured in a specific way to a page in a repetitive fashion. A clear example of this is adding data to a table. How about a form on that page which could ask the right questions and when submitted add the information submitted as an additional row at the end of the table.
When I saw the plugin:bureaucracy plugin I knew it could be done and the way that plugin is written lends itself well to extension and so here it is and it works loosely in the following way:
A form exists on a page (created by the plugin:bureaucracy plugin), this can be the page to be modified or it can be another page.
A results placeholder sits on a page, this placeholder is enclosed by the pagemod tags
The form is filled in and submitted inline with the plugin:bureaucracy requirements and the pagemod action rewrites the target page, replacing the placeholders with the output of parsing. It then adds another placeholder, so that you can continue to add to the page.
That's really the functionality, its quite simple.
So here are the features:
The form and the target can be the same page or different pages (i.e. a page can update itself or another page).
Each pagemod enclosure has an id, so multiple forms can be used to update different parts of a page.
The form can update multiple sections of a page. That is there can be multiple pagemod enclosures with different parts of the data in each, it will parse all of them as long as they have the same id as the submitting form.
A person can update page that they don't have write access to. Only read access is required to modify a page via the form. This is not a bug, its a feature. It means you can prevent people from modifying a page unless they do it via a form.
If want people to only have access to read the resultant page, but not change it, protect the form page.
If you don't want people to have access to read the resultant page, deny them read access, then the form will also not work for them.
(Does this mean they still have access to the form, but it generates an error when they try to use it?)
To make bureaucracy use the pagemod action, you need to add action pagemod with the following parameters:
target : This is a page id which can include a namespace, so pagemod:same_page or whatever. Since 2009/10/12 release : You can use the special target _self to denote the same page as the enclosure.
pagemod_id : This is to identify which pagemod enclosures to translate
Template Syntax
Defining a pagemod template is done within a page with the following code:
<pagemod <pagemod_id> <params>>
wiki text while will be parsed for transform tags like @@field from form@@ or ##field2 from form##
the contents of this section are invisible and will not show up on this page.
</pagemod>
some other wiki text
then some more
^ table header 1 ^ table header 2 ^
<pagemod table_adder output_before>| @@table value 1@@ | @@table value 2@@ |
</pagemod>
The pagemod enclosure starts with:
<pagemod <pagemod_id> <params>>
where the following is true:
pagemod_id : This is the id of the pagemod. The form has an pagemod_id, it will modify all the pagemod enclosures with the same id.
params : params are separated by , and can be one of the following:
output_after : indicates that the output of the translation must come after the rewrite of the pagemod enclosure, the default is to output before the rewrite
output_before : this is the default behaviour, to output the translation before the rewrite of the pagemod enclosure
The pagemod enclosure ends with the following:
</pagemod>
and the contents are not shown when the wiki page is viewed. Translation of the contents of the pagemod enclosure is done inline with the bureaucracy plugin's template function.
Since release 2009/10/12 There also exists the concept of meta variables, they are variables that are generated by the plugin at runtime. They are the following
@@meta.date@@ : The current date in dd/mm/yyyy
@@meta.datetime@@ : The current datetime according to ISO 8601
@@meta.date.format.format@@ : The current date in the format you specify. This format is the one used by the PHP date() function found here (e.g. @@meta.date.format.d/m/Y@@ will achieve the same as @@meta.date@@)
@@meta.user.id@@ : The user who submitted the form's username
@@meta.user.mail@@ : The users email address (if we know it)
@@meta.user.name@@ : The users full name (if we know it)
@@meta.page.id@@ : The full id of the page
@@meta.page.name@@ : The name of the page
@@meta.page.namespace@@ : The namespace of the page
New meta information tag requests should be sent to me for implementation.
2010-03-20 I added a auto-increment meta tag to your plugin. I needed it for a bug tracker/feature request system. If you're interested, I'll send it to you. Just send me an email to laplix¢2010¢at$gmail$dot¢com (remove the money symbols). It is not fully tested yet (right now, I only tested it with _self) but it does what I want, so…
Sounds like a useful addition.. Could you share your code here?? Cheers!
Conclusion
Please let me know of any bugs or issues, requests. I know a large number of people have requested a plugin like this, so I hope people find it useful.
Feedback
Non-editable runtime values (ADDED 2009-10-12)
We're using this plugin to log activity reports so I required the feature to include some non-editable runtime values like current date and user attributes in pagemod's output. I've done it this way:
I've no experience in PHP so maybe this solution isn't optimal but it does work — Dmitry Rubinstain.
From Author : This is now possible using the meta tags described in the documentation above
Autodetect current page id (ADDED 2009-10-12)
This plugin rocks ! IMHO, it provides such great features that it should be advertised on the front page. I'm planning to use it as a commenting system. Would it be possible to auto-detect the current page id (like the plugin:backlinks2 plugin does) ? For example :
<form>
action pagemod auto new_comment
fieldset "Add your comments below"
textbox "Name"
select "Rate it" "Excellent|Good|Bad"
textarea "Comment"
submit
</form>
It would save an incredible amount of time when you have to insert forms in many pages ! — Laynee 2009/10/05 16:22
From Author : This is now possible using the _self target described in the documentation above
Woohooh! The new version works like a charm ! Thank you very much :) — Laynee 2009/10/12 16:00
Minimalistic Guestbook
I used this plugin for a minimalistic guestbook. Although my wiki can be edited by everyone, I think visitors would be more willing to leave a message through a little form. See http://windhoff.net/wiki/playground/playground how it works. An javascript based alternative to this is the plugin:disqus.
Error message in combination with bureaucracy plugin
Hi, I installed pagemod together with the bureaucracy plugin, but I can't get them to work. After submitting data through a bureaucracy form (e.g. the demo-page) I receive the following error:
Fatal error: Class 'syntax_plugin_bureaucracy_actions' not found in /lib/plugins/bureaucracy/actions/pagemod.php on line 7
What am I doing wrong? I tried this on DokuWiki 2009-12-25c as well as on older versions, with same error.
I've updated my installation to DokuWiki 2009-12-25c, Pagemod 2009-10-12 and Bureaucracy 2010-01-22. I now encounter the same error. I guess Pagemod needs to be updated to work with the latest versions of Bureaucracy. I reinstalled my old version of Bureaucracy (it should be this one) and now it works — Laynee 2010/02/03 18:03
Replace in the file bureaucracy/actions/pagemod.php from line 32 to 40 with that
// run through fields and prepare replacements
foreach($data as $opt) {
$label = preg_quote($opt->getParam('label'));
$value = $opt->getParam('value');
if(in_array($opt->getParam('cmd'),$this->nofield)) continue;
$label = preg_replace('/([\/\.])/','\\\$1',$label);
$patterns[] = '/(@@|##)'.$label.'(@@|##)/i';
$values[] = $value;
}
— Rdemont 2010/02/19
I tried both solutions above, but still remain with the same error. Something else I might be missing? — LWolf 2010/02/25
Its a type syntax_plugin_bureaucracy_actions needs to be replaced by syntax_plugin_bureaucracy_action. At least, this worked for me — Gerione 2010/3/4
I have the same big problem ! Help me please — Ph LAPEYRIE 2010/03/16 23:25
THE SOLUTION = Rdemont + Gerione. It's all right for me. — Ph LAPEYRIE 2010/03/16 23:51
From Author : Fixed, now working with the new bureacracy, thanks for the help.
Multiple forms on one page (RESOLVED)
Multiple forms + pagemod sections on one page (and not only, read more) do not work.
Scenario 1: I have one page (name it: materials) with two pagemod forms and two datasets,
each pair with different id (exactly: am311 and cm113 if that matters),
both pairs identical otherwise (same fields, same structure).
Scenario 2: I have one page with form (materials) and two datasets with data (materials:am311 and materials:cm113)
each pair with different id (exactly: am311 and cm113 if that matters),
both pairs forms/datasets identical otherwise (same fields, same structure).
In both scenarios, data gets added to both datasets, instead of one of them (am311 or cm113).
From Author : This is not a bug in this module, its a bug in bureaucracy. If you have multiple bureaucracy forms on a page, the result is always generated from the first's parameters (action parameters) since it doesn't set these in the form, but re-reads them from the page
From Author : This bug is fixed by redeploying bureaucracy with the file with my patch detailed here, I have mailed Andreas and asked him to include my fix in his code.
From Author : This bug appears to have been fixed, many thanks to the bureaucracy maintainer for this
small bug for @@meta.user.id@@
Great plugin ! I use it all the time. small bug for @@meta.user.id@@ which doesn't work for me :
I think it should use return $INFO['user']; instead of return $INFO['userinfo']['user'];
From Author : I cannot replicate this, both accessors work
2011-11-15 From besancon@math.jussieu.fr: I have the same bug with @@meta.user.id@@. According to http://www.dokuwiki.org/devel:environment#global_variables, you get the login name with $INFO['client'] instead of $INFO['userinfo']['user'] which is not documented at all. You have to correct file “bureaucracy/actions/pagemod.php” on line 109 by changing
return $INFO['userinfo']['user'];
to
return $INFO['client'];
Question on Period Use in Field Name
I was wondering if there is a way to use the period in field names, so you could make numbered items like “1. What is your name?”, etc. (using a period currently breaks the template) The only way I'm able to do this currently is writing a static “1. What is your name?” which is followed immediately by a “Name [ ]” line, which gets really cluttered if you're trying to do something like a numbered questionnaire.
On the other hand, is there any way to show a field title like “Please enter you name”, but assign it to a variable like @@name@@ for use in the pagemod tag? I apologize if this question is better asked on the bureaucracy plugin page.— Kououken 2010/03/02
From Author : Fixed in 1.2
Is it possible to check the value of a placeholder?
Hi! I am quite new to wikis, so please forward me to the right place if my question is wrong here. Is there any way to check the value of a placeholder and treat the form depending on its value? Something like “if @@name@@=='Green' then <show output of the form>”? Anna 2010/03/03
From Author : This isn't functionality I am looking at adding, because its open ended in terms of possibilities
Shows an empty screen after submitting the form
After I submit the form the page reloads but shows only the header, footer and sidebar without the content.
The results output doesn't work regardless that I try to add them to the same or another page.
The other bureaucracy actions (email and template) work fine.
I have the same problem and I can't find any solutions on this page. I would like to add that my DokuWiki is hosted on a “UniServer” installation and I'm running the latest version of DokuWiki and bureaucracy, but my page only shows the header other then that it's as described above. I'm hoping to bring some attention to this problem by placing this comment — Ric 2010/05/10 23:49
The same happens here, just a blank page after submit when using the “Minimalistic Guestbook” – Any suggestions? — Rainer2010-09-28
From Author : I cannot replicate this even using the latest software,firefox/opera and ie7, please can you give me more information, like does it work, but just not display? What platform version etc
From Author : This has been confirmed fixed by the bug raiser, no idea what I did, but nevertheless the bug has moved on
Drop-down Boxes
I already asked this on the bureaucracy page but maybe it could be implemeted here. Is there a way to use multiple drop-downboxes where the input in the first box affects which options are available in the 2nd one and so on? Thanks! - Paul
From Author - This will have to be done in the bureaucracy plugin, I don't have much to do with the front end.
Multiple actions
When looking for the possibility of using both mail and pagemod actions from the same form, I came across a small extension to the pagemod plugin, namely the 'pagemodandmail' action handler. However, likely because both buraucracy and pagemod has come in new versions, I had to do som small adjustments to make it work. So this is the version 1.2 compliant version of the extension.
To install, add the following piece of code as a file named 'pagemodandmail.php' in dokuwikilib/plugins/bureaucracy/actions directory:
<?php // charset=utf-8
/**
* Action pagemod followed by sendemail for DokuWiki plugin bureaucracy
*/
class syntax_plugin_bureaucracy_action_pagemodandmail extends syntax_plugin_bureaucracy_action {
/**
* Simply extract the relevant arguments and call the relevant actions
*/
function run($data, $thanks, $argv) {
global $ID;
global $conf;
require_once(DOKU_PLUGIN . 'bureaucracy/actions/action.php');
require_once(DOKU_PLUGIN . 'bureaucracy/actions/pagemod.php');
require_once(DOKU_PLUGIN . 'bureaucracy/actions/mail.php');
$pagemodargs = array_slice($argv,0,2);
$emailargs = array_slice($argv,2);
$class = 'syntax_plugin_bureaucracy_action_pagemod';
$pagemodder = new $class();
$pagemodsuccess = $pagemodder->run($data, $thanks, $pagemodargs);
$class = 'syntax_plugin_bureaucracy_action_mail';
$emailer = new $class();
$emailsuccess = $emailer->run($data, $thanks, $emailargs);
$rmsg = '';
if (!$pagemodsuccess) {$rmsg .= "Pagemod failed";}
if (!$emailsuccess) {$rmsg .= "Emailing failed";}
if ($rmsg=='') {return $thanks;}
else {return $rmsg.join(',',$errors);}
}
}
<form>
action pagemod _self,another:page:somewhere:else id
fieldset "Ereignis eingeben"
textbox "Ereignis:" /^((?!<\/code>).|\n)*$/
date "Gültig von:"
date "bis:"
textarea "Details:" /^((?!<\/code>).|\n)*$/
submit "Ereignis veröffentlichen"
</form>
making it possible to have one form which places the info on more than one page? - Andy
Bugs
I experienced this: if the @@Variable@@ is on the begining of the line, it allways expand into empty string, even if I fill the form. And I found another difference - with bureaucracy template mode, not filled variables were kept as were, but with pagemod mode, they are replaced with empty strings.
Use of plugin is problematic if you use it with tables AND use edittable plugin - see description in edittable.
Is there a size/length constraint? I am responding to a new page question and it will not let me post a long response.
You can also use this syntax since 20120612 version:
#REDIRECT namespace:page
2023/08/11 23:47
tablecalc plugin
Overview
Sometimes one may need to do simple calculations in DokuWiki table. The idea was taken from plugin:tablemath plugin, but conception changed a little bit. With the help of the plugin:tablecalc plugin you would be able to insert Excel styles formulas into the table
Download and Installation
Download and install the plugin using the Plugin Manager using the following URL. Refer to :Plugins on how to install plugins manually.
To perform a calculation you need to insert XL-style formula into work sheet. Any expression must be started with ~~= and finished by ~~. You can use direct range specification for functions (like XL does) or a special range() function. The range consists of a reference to the start cell and to the finish cell, like this:
r0c4
Please note, that row (r) and column (c) index starts from zero. Row and column prefixes can be swapped. The following is equal of the above:
c4r0
You can also reference to multiple cells in one range:
|r0c0:r1c1||
Furthermore you can use multiple ranges:
r0c0:r1c1,r0c3:r1c4
There is a recommendation not to use references for non-existing cells. For example, this is not correct (though it will work, returning “3”):
Do math compare for a and b. Returns zero when conditions for the operation are not met
calc()
Though you can use colon as delimiter in functions semi-colon is preferred and recommended.
Operators
Most of the standard Javascript arithmetic operators are supported but some 10) conflict with the table markup so the following operators are available:
Added cross-table resolver and forward calculations
Added min(),max() and average() functions
Added ability to use semi-colon as a function parameters separator
Added compare functions
Added string escaping (#)
Fixed javascript/CPU float point calculation bug
Fixed invalid HTML ID's usage</todo>
07.09.2009
Initial release
Discussion
col() returns wrong number if the preceeding cells in the same row use colswap, eg:
| A | B | ~~=col()~~ |
| C || ~~=col()~~ |
gives:
A
B
2
C
1
— Michał Sacharewicz 2012/01/11
Is it possible to make math calculations (like multiplication)… So that to add the VAT to the price for example. for or sthg similiar… Vandra Ákos 08/31/2011
very nice indeed, I need to borrow your syntax a bit, so I don't need to use ~~tm: James Lin08/09/2009
Some coding advice: You're working with a blacklist to avoid script inclusion, a whitelist might be more secure. You're using the output of rand() as a HTML ID. Numbers alone are not allowed as IDs in XHTML, you should prefix them with your plugin name. Also have a look at using_ids — Andreas Gohr 2009/09/09 15:42
The plugin definitely needs max/min and conditional functions and/or :)
Can you add support for comma as decimal separator? madenate 2010/06/25
I would appreciate this, too. (Nice work, though!) — Christian 2010/09/29
Also, it would be nice if the round() function could use the exact number of specified decimal places, even if these would be zero. See the following image as a sample why it would probably look better:
— Christian 2010/09/29
There's problem when preceeding column to calculation contains markup, it goes bezerk:
Integrates a simple task management tool into your wiki.
Usage / Components
Task
~~TASK:[user]?[due date][priority]~~
[user]
person responsible for this task – either user or full name
optional; default is unassigned
[due date]
date the task should be completed in YYYY-MM-DD form; if only year or year and month are given, the last day is assumed
optional; default is without due date
[priority]
low, medium !, high !! or critical !!! expressed with 0 to 3 exclamation marks
optional; default is low priority
Place ~~TASK~~ on any page to mark it as a task. The title (first heading) is considered to be the summary of the task, the contents its description.
If a task is unassigned, any registered user of the wiki can accept it. Once a task is taken, the user to whom it is assigned to can change the status of the task to one of these values:
rejected – task is not worthwhile or not accepted by user
new – reassign task so somebody else can take it
accepted – user took over task but did not yet start the work
started – work on task started
done – work on task completed
If the task is done, other users can verify whether it's really done. If yes, the status can be set to verified.
The priority is reflected by the intensity of the orange shade of the task box.
Next to the title of the task box is an icon. It links to download an .ics file for the task. That can be imported by almost any calendar application that understands the VTODO component of the iCalendar standard.
Colors,… can be set in the style.css file in the plugin directory (lib/plugin/todo)
Show/Hide Start/Due Date
Do (not) show the Start/Due date, allowed values: yes or no
<todo showdate:yes start:YYYY-MM-DD>Text</todo>
Formatting
Formatting is not allowed inside of the <todo></todo> tags. However, if you wish for your text to be bold or have some other type of style (other than the default one provided), you can surround the todo tag with the formatting of your choice. The resulting action text should then be displayed with your choice of formatting when your changes have been saved.
QuickButton
A quickbutton for inserting todo syntax is available in the editor toolbar. You can click the button (which is pictured as a checked-checkbox) or you can use the keyboard shortcut of [T].
Lightweight Task Management System - Lists
The new version (since version 2014-03-17) of the todo plugin allows to create an easy to use task management system to collect all todos from all pages on a single page.
First turn off caching
~~NOCACHE~~
Omit Pages from TODOLISTs
If you have pages you never want to include in TODOLISTs, you can put following on these pages:
~~NOTODO~~
Display all open and closed todos from all pages
~~TODOLIST~~
Counting todos and checked todos
Print a summary of checked todos and total todos like (10/14)
~~TODOLIST short:yes~~
Assignments (users to tasks)
Filter the assignments, allowed values: yes, no, usernames in format@username or username, or placeholders @@USER@@ or @@MAIL@@ which are replaced by username or e-mail of current logged in user.
Some default values for these options can be set in the Configuration Manager
Filter the namespace of the task list
I've added the following option to the ~~TODOLIST~~ tag: ns:
If omitted it uses ns:all.
It can be used with the following parameters:
all – displays todo's from everywhere (the current default behaviour)
/ – only displays todo's from pages containing in the ROOT namespace
<string> – Where string can be any text. It checks the page-id if it starts with this string and then returns the pages with todo's that do; for example:
. or ending in :. – display this namespace and subnamespaces (not much tested)
.: – display only subnamespaces (not much tested)
~~TODOLIST ns:todo~~
returns all todo's from the page todo in the root of the wiki, or from the namespaces starting with todo or from the page todo and the namespaces starting with todo.
~~TODOLIST ns:todo:~~
returns all todo's from the namespace todo.
~~TODOLIST ns:todo:r~~
returns all todo's from the namespaces or pages under todo, starting with an r.
Example of 'all todos'
Example of 'all todos' from many namespaces
If you want to display more than one namespace in a single page, you can put a TODOLIST for each :
~~TODOLIST ns:foo:~~
~~TODOLIST ns:bar:~~
Plugin Settings
Allow actions to also link to pages with the same name?
Default: Off
This option (when enabled) will allow your actions to also link to a page with the same name. This way, if you have important details about an action, you can place them in this link.
However, Backlinks to the TODO do not currently work. Also, if you use the Move Plugin, the link will not be updated/moved if the details page that the link points to is moved.
What namespace should your actions be created in (".:" = Current NS, Blank = Root NS)
Default: [Empty]
This option allows you specify where actions links should be placed. Using “.:” will cause the actions to link to whatever namespace you are currently in. Leaving it blank or typing “:” will cause all actions to link to the root namespace. Using something like “.:actions:” will cause the actions to link to whatever the current namespace is, plus an “actions” namespace. (Added with version 9-9-09)
Should the actions have strike-through applied when checked?
Default: On
This option (when enabled) will place a strike-through in the actions that have been completed. When disabled, an action can be checked, but the text will not have strike-through applied.
If AllowLinks is disabled, should clicking the actions' text mark the action complete?
Default: On
When this option is enabled, and the links option is disabled, then clicking on the text of an action will mark that action as being complete. (Added with version 10-14-09)
The ~~TODOLIST~~ -functionality finds every ... item, even when inside a code or a file block. Also, after being rendered on a TODOLIST page, toggling the checkbox of that item will update its code accordingly. This was reported in Issue #12 on Github
ChangeLog
For the current default download package (see start of this page) one should refer to its GitHub Atom Feed:
Version 05/14/2014 (by Markus Gschwendt):
zip version 2014-05-14
* This is no part (yet) of the “officicial” distribution but Markus' own version of the plugin, if you are installing Markus' ZIP, there may be some (but mainly harmless) confusion in the Extension Manager
new option ~~TODOLIST checkbox:yes|no~~
new option ~~TODOLIST username:user|real|none~~
new option ~~TODOLIST header:id|firstheader|none~~
Configuration of default values for above option in the Configuration Manager.
If AllowLinks is off, render the TodoText as a link to the page where the todo is located
new option: start and due date. (css) colored output when todo is started or due
add user assignment for todos (with @username syntax in todo tag e.g. do something)
add handler method _searchpatternHandler() for dokuwiki searchpattern extension.
bugfix: encoding html code (security risk <script>alert('hi')</script>) - bug reported by Andreas
bugfix: use correct tag if there are more than 1 in the same line - migrate changes made by Christian to current version of plugin (changed behaviour - when multiple todo-items have the same text, only the clicked one is checked)
* add description / comments and syntax howto about integration with searchpattern
* check compatibility with dokuwiki release 2012-10-13 "Adora Belle"
* remove getInfo() call because it's done by plugin.info.txt (since dokuwiki 2009-12-25 "Lemming")
Version 04/05/2013 (by Leo Eibler/[[doku>u:leibler]]):
* migrate to new dokuwiki version (use jQuery.post instead of sack()).
* add german language file.
Version 08/16/2010 (by Babbage):
* Fixed another bug where javascript would not decode the action text properly (replaced unescape with decodeURIComponent).
For a full changelog, please visit http://www.digitalbrink.com/programs/dokuwiki_plugin_todo/?page=vhistory (up to v2010-08-16) and http://www.eibler.at/dokuwiki-todo/index_en.php#download (since v2013-04-05)
==== Possible features for a next release ====
Please post your ** feature requests ** on [[https://github.com/leibler/dokuwiki-plugin-todo/labels/enhancement|GitHub]]
* <del>Implement time management by using square brackets // [<startdate> // for latest starttime and // ]<enddate> // for latest finish time.</del> done: 2014-05-14 on github (missing feature: filter by dates) see [[https://github.com/leibler/dokuwiki-plugin-todo/issues/16|bug #16]]
* <del>Additional Option to render a list without ckeckboxes: \\ ''%%~~TODOLIST checkbox:no|yes~~%%'' \\ interesting to put the list in the sidebar: \\ ''%%~~TODOLIST assigned:@@USER@@ checkbox:no completed:no~~%%''</del> done: 2014-05-11 on github
* <del>Headers of the list with the first Header of the Page instead of the namespaces: \\ ''%%~~TODOLIST header:firstheader~~%%''</del> done: 2014-05-11 on github
* <del>Assign multiple users to a todo ''%%<todo @user1 @user2>task''</del> done: 2014-05-15 on github
* <del>Additional option to render the real name of the user instead of the username or nothing (e.g. useful when using @@USER@@): \\ <todo username:user|real|none> \\ ''
''</del> done: 2014-05-11 on github
* <del>Can we have a filter of tasks "completedon", completedbefore and completedafter (similar to duebefore etc) so that we can see when tasks were completed. Would be good to be able to list tasks by completed date (got to keep those minions working somehow</del>
* make it possible to have more than one todo tag in the same line (e.g. separated by \\) \\ this might be useful to have more than one todo in a box in a table (workaround to assign a task to multiple users)
* Would be cool to have tags , display single page of tagged tasks, formatting inside task, quick links to the page, and priority of the task!! thanks:!
* <del>Can we have the list of tasks filtered on the start and due dates? Allow filtering of jobs to show just those due in the next 7 days, or jobs starting in the next 7 days. Full examples in the [[https://github.com/leibler/dokuwiki-plugin-todo/issues/23|GIT page]] for how it might work. Update : I think this might now work using the duebefore and due after with the +10 -10 relative references only I can't get this to work myself. \\ Should work, only issue: then only tasks with given dates will be shown. We need an 'start-/due-ignore' option to solve this.</del>
* When TODO links are turned ON per [[#Allow actions to also link to pages with the same name?|here]], could Backlinks to the original TODO be made to work? That way, when TODO details are entered, it's easy to get back to the TODO item and check the box complete. :-)
* Thank you for this wonderful plugin. I have one request. In TODOLIST, each todos links to the original page where it's located, Since table header does same action, in my opinion, that links are not needed. Instead, when I click the todo, mark as done would be nice. Also, since it's a link, changing text color doesn't work on the TODOLIST. Thanks for reading.
* This behavior can be changed on the configuration page so that the link points to a page named after the link
* absolutely great plugin! thank you! \\ Would it be possible to allow also dates formatted DD.MM.YYYY (which is very common in Austria ;-)) \\ \\ I'm from Austria too ;) but the only useful order in the date format is YMD - especially for sorting. \\ Things are possible but don't make sense in some way.
* Thank you for this excellent plugin! Would it be possible to augment each to-do item with two more fields: (a) details and (b) action taken? They are useful especially in cases where items are assigned to different people. The fields could be possibly hidden and get displayed only if a spoiler-like button is pressed. The first is needed in order to describe the assignment in detail and (b) should be a description by the person who acted on the assignment.
* Very nice plugin! Started using it only 5 minutes ago and I already love it. I do have 1 question: is it possible to display tasks, without having it in a list-like format (under each other) instead of on 1 lineing to use an actual list or paragraphs? I guess I might be able to achieve this by using \\ \\ Also, it would be nice to allow links inside the todo, now I have to put a link after the todo or place it outside the todo, resulting in a line being half todo half link
* <del>I'm looking for a short kind of info string to be displayed after a page link, displaying how many todos the page have and how many of them that are checked, such as "(5/10)"</del> \\ \\ See the //short// option. --- [[doku>u:runout|runout]] //2017-08-28 10:12//
* Is it possible to show a list of todos filtered by "completed by" and "when" depending on who checked the checkbox? Again its to keep the minions working. I'd like to add a section for each tech to my "dashboard" page that shows me who has completed what tasks and when. I currently have an outstanding task list for each tech but not a list of the work they say they've completed. Something along the lines of ''
'' will show me the work they have completed today(no matter who it was assigned to). Also something like ''
%%'' will show me their own tasks completed in the last day, when completed and by whom.
try the option completeduser for filtering which user has checked the box. Showing the completed-date is not implemented. — runout2017-08-28 09:35
Change link option from “pages with the same name” to “by Attribute”. For Example “@link:T0012” if a automatic naming scheme could be implemented, otherwise “@link:wiki:test:start” or external target like phone NR “@link:tel:+1356465654” or Websites “@link:https://www.dokuwiki.org”.
It would be great to have the option to be able to include wiki formatted links within the task so when I have a task to review another page in the wiki or an external URL I can put a formatted link in with a meaningful label rather than the full and often long URL displaying in the task and in the task list
Is it possible to see time dedicated between own tasks and colleagues and friends?
2023/10/28 01:28
· Alan Shea
Wrap Plugin
Universal plugin which combines the functionality of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction.
One plugin to rule them all
This plugin gives you the ability to wrap wiki text inside containers (divs or spans) and give them
a certain class (with loads of useful preset classes)
a width
a language with its associated text direction
Examples
The plugin comes with an example page, which should explain a lot and looks like this in the default template:
An uppercase <WRAP> (or alternatively <block> or <div>) creates a div and should be used for “big” containers, surrounding paragraphs, lists, tables, etc.
<wrap classes #id width :language>"small" content</wrap>
or
<inline classes #id width :language>"small" content</inline>
or
<span classes #id width :language>"small" content</span>
A lowercase <wrap> (or alternatively <inline> or <span>) creates a span and should be used for “small” containers, inside paragraphs, lists, tables, etc.
Please note, some things won't work with spans: alignments (including alignments generated by changing the text direction), multi-columns and widths if the according wrap isn't floated as well.
“outdents” the text, could partly be used instead of outdent
prewrap
wraps text inside pre-formatted code blocks, similar to wpre
All tables inside a column or box will always be 100% wide. This makes positioning and sizing tables possible and partly replaces tablewidth.
Known restrictions
WRAPs won't export in ODT format.
Round corners only work in modern browsers (no IE8 and below).
Multiple columns only work in modern browsers (no IE9 and below).
Width classes are experimental and only work in modern browsers (no IE8 and below).
Normal DokuWiki Headlines used to not work and a work-around was added. Now that headlines do work, the work-around is not needed anymore but kept for backwards-compatibility. The following syntax would produce two different kinds of emulated headlines inside any of the columns or boxes/notes:
//**__Big Underlined Headline__**// (They will look a bit different in safety notes.)
//**Small Headline**//
You probably need to adjust a few of the classes to your template's needs, especially hi, lo and em if you have a dark or otherwise heavily coloured theme.
The classes are easily adjustable and extensible. Any wishes are welcome.
Widths
You can set any valid widths on any uppercase <WRAP> container: %, px, em, ex, pt, pc, cm, mm, in. Just set the width before or after or with the classes, e.g.
<WRAP someclass 50% anotherclass>...
All except percentages will be reduced to have the maximum width available on smaller screens.
You can also use the width keywords half, third and quarter. To work correctly they need another wrap around them. E.g.
If you like to mark a text with a different text direction than the default one, you should use divs, i.e. uppercase <WRAP>s. Otherwise the text alignment won't change as well.
An uppercase <WRAP> (or alternatively <block> or <div>) creates a div and should be used for “big” containers, surrounding paragraphs, lists, tables, etc.
A lowercase <wrap> (or alternatively <inline> or <span>) creates a span and should be used for “small” containers, inside paragraphs, lists, tables, etc.
<wrap classes width :language>"small" content</wrap>
or
<inline classes width :language>"small" content</inline>
or
<span classes width :language>"small" content</span>
Please note, some things won't work with lowercase spans:
alignments (including alignments generated by changing the text direction)
multi-columns
and widths
if the according wrap isn't floated as well.
Classes and Styles
Columns and Floats
You can have columns easily by adding the class column and a width, e.g.
<WRAP column 30%>...content...</WRAP>
Emulated Big Headline
You can emulate a big headline with italic, bold and underlined text, e.g.
//**__Emulated Big Headline__**//
Emulated Small Headline
A smaller headline uses no underlining, e.g.
//**Emulated Small Headline**//
If you need text that is bold and italic, simply use it the other way around:
**//No Headline//**
Different Floating Options
Normally you would only need the class column, but for more sophisticated uses (not only for columns, but for any other classes, like boxes and notes as well) you can have several kinds of “floats”:
column is the same as left in LTR languages and the same as right in RTL languages
left will let you float your wrap on the left
right will let the wrap float right
center will position the wrap in the horizontal center of the page
Widths
You can set any valid widths (but only on divs): %, px, em, ex, pt, pc, cm, mm, in, but most of the time you'd only want either
type
e.g.
note
%
30%
makes sense in a liquid layout
px
420px
makes sense if your layout has a fixed pixel width or if your container contains images with a certain width
em
20em
makes sense if you like your wrap container to grow and shrink with the font size or if your layout is em-based
A table inside a column or box will always be 100% wide. This makes positioning and sizing tables possible.
After using any of the float classes, you might come across something like this, where the following text protrudes into the space where only the floating containers should be …
… to prevent that, you should simply add
<WRAP clear></WRAP>
after your last column.
You can use the same options with spans (as each element that floats is automatically a block level element), but it probably doesn't make too much sense. Widths on spans normally do not work (by design), but can make sense, when it is floating.
Attention: Widths can cause problems and will often look different and break in some browsers. If you're not a web developer, you might not understand any problems regarding the box model. Just try to test your columns in all major browsers and make your widths smaller than you initially think they should be.
All of those options will also work in the boxes and notes wraps (see below).
Multi-columns
For modern browsers (Firefox, Chrome and Safari) you can use multi-columns. Just use col2 for 2 columns, col3 for 3 columns, col4 for 4 columns and col5 for 5 columns.
Note: Multi-columns don't make sense for spans.
Alignments
You can use these different text alignments:
leftalign
rightalign
centeralign
justify
Center aligned text …
… and right aligned.
<WRAP centeralign>
Center aligned text ...
</WRAP>
<WRAP rightalign>
... and right aligned.
</WRAP>
You cannot add alignments to spans.
Boxes and Notes
round box 570px center
box creates a box around the container and uses the colours from the template's style.ini as default colours (__background_alt__ and __text__)
any of the classes info, tip, important, alert, help, download, todo will add a special note container with a corresponding icon
the classes danger, warning, caution, notice, safety use safety colours (and no icons)
round can be added to anything with a background colour or a border and will only work in modern browsers (no Internet Explorer)
Info
<WRAP info></WRAP>
Tip
<WRAP tip></WRAP>
Important
<WRAP important></WRAP>
Alert
<WRAP alert></WRAP>
Help
<WRAP round help></WRAP>
Download
<WRAP download></WRAP>
Todo
<WRAP todo></WRAP>
Safety Notes:
Danger
<WRAP danger></WRAP>
Warning
<WRAP warning></WRAP>
Caution
<WRAP caution></WRAP>
Notice
<WRAP round notice></WRAP>
Safety
<WRAP round safety></WRAP>
You can use notes and boxes also inside text with spans like this:
info, help, alert, important, tip, download, todo and round box and danger, warning, caution, notice, safety.
You can combine and nest all classes and types of boxes, e.g.
Outer green box floats right
Inner nested box floats left and is partly emphasized and highlighted with nested bigger text inside.
Text inside outer right box, but beneath inner left box.
Round tip box underneath, after a clear.
<WRAP box bggreen fgblack 350px right :en>
//**__Outer green box floats right__**//
<WRAP 165px left>
Inner nested box floats left and is partly <wrap em hi>__em__phasized and __hi__ghlighted with nested <wrap bigger>__bigger__ text</wrap> inside</wrap>.
</WRAP>
Text inside outer right box, but beneath inner left box.
<WRAP clear></WRAP>
<WRAP round tip>
Round tip box underneath, after a ''clear''.
</WRAP>
</WRAP>
Language and Text Direction
You can change the language and the reading direction of a wrap container by simply adding a colon followed by the language code, like this:
<WRAP :he>
זה עברית. ((<wrap :en>This means "This is Hebrew.", at least according to [[http://translate.google.com/|Google Translate]].</wrap>))
</WRAP>
The text direction (rtl, right to left or ltr, left to right) will get inserted automatically and is solely dependent on the language. The list of currently supported languages is taken from: http://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code
(If you specify a language not listed there, it simply won't do anything.)
When using the template “monobook for DokuWiki”, to have an Add/Remove link, in /user/tabs.php, use this code
//pdfbook plugin: add/remove selectionif(file_exists(DOKU_PLUGIN."bookcreator/action.php")&&!plugin_isdisabled("bookcreator")){$_monobook_tabs["tab-bookcreator"]["text"]="Add/Remove to selection";$_monobook_tabs["tab-bookcreator"]["href"]= wl(getID(),array("do"=>"addtobook"),false,"&");}
Changing the order of wiki pages
To change the order of wiki pages in your book, simply move the pages in the list. To do so, hover over the page title to move, click and drag it to the new location. Release the mouse button to finish moving the page to its new location.
Saving books
Format of stored book pages: when you save a book, it is stored in the format shown below.
You can also manually create a book from scratch by using the same format. To create a book from scratch, start a new page such as wiki:ebook:mybookname (default). The namespace can be changed at admin side configuration.
If it is not, metadata of the btable with the same id gets mixed up, i.e. answers to choices in a previous btable appear in the new when the choices are the same.