DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:numbering

Numbering Plugin

Compatible with DokuWiki

  • 2024-02-06 "Kaos" unknown
  • 2023-04-04 "Jack Jackrum" unknown
  • 2022-07-31 "Igor" unknown
  • 2020-07-29 "Hogfather" yes

plugin Sequential Numbering

Last updated on
2020-02-25
Provides
Action
Repository
Source

Installation

Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually.

This plugin requires JQuery and therefore will not work in versions of DokuWiki earlier than Angua.

Examples/Usage

This plugin installs the toolbar button shown at the left. When clicked it outputs a formatted number string. This number is unique and next in sequence. The plugin can be used in multi-user wikis: a new number will not be output until the previous number has been processed.

In addition to the unique number, the output string can include images, text and date. All of this is controlled by configuration options set in the Configuration Manager. The default output is as follows:

Number: 00001003 –2013/03/18 09:40

This string can have many different formats and the number can be left padded with whatever character you choose. The default is padding “0”. Inclusion of the date is optional and so, too, is text, such as the word “Number” in the above example. You might, instead, have “Invoice number: ”, for instance, or “ID: ”, etc.

You can also include images in the output string–a company logo, a separator, etc. For instance:

Configuration and Settings

Options Set in Configuration Manager

Option Default Value Description
nstart 0 The number-1 at which you want to start your count
padding 0 Character to pad the number with, if the number is smaller than the minimum number of digits desired for the number
pad_length 8 The minimum number of digits in the number string. This does not control the size of the number itself, which can outgrow the padded size.
set_date true If set to true the date will be printed with the number
datestyle '//'.$conf['dformat'].'//' This sets the date format for strftime, which can include DokuWiki format specifiers for bold, italic, etc. The default uses italics and the format specified by dformat.
use_imgs false If set to true, the plugin will attempt to insert images into the format string
format Number: %n –%d Format string, where %d represents the date, %n the number, %i<n> image number n, and %R a text selection from the editor. Like the date style this can also take format specifiers. For instance: ** Date: %d Number: %n **
imgs Comma separated list of images located in data/media,
e.g :image.png,:wiki:other_image.png, . . ..
These will be inserted into the format string in the order in which they are listed at positions %i1. . . %i<n>
bureaucracy For use with bureaucracy plugin. Comma separated list of field names of numeric fields which require unique sequential numbers

To reset the counters please manually edit file named seqnum.ser located at data\meta\numbring. a:2:{s:5:“saved”;i:0;s:5:“start”;s:1:“1”;} set i: (to desired value)

multi_dbUse individual counts for each separate bureaucracy number field specified in the bureaucracy option.

Examples

The image settings can include sizes. For instance: :wiki:dokuwiki-128.png?50. This is the technique used in the example above, which used this format string:

  %i1 Document Number: %n --%d 

Markup other than character formatting can be included in the format string. For instance, you can put the output on two lines:

   Document Number: %n \\  --%d 

This will give you:

Document Number: 00001022
–2013/03/19 07:14

Text Selection

The %R formatting specifier is a place-holder for a string selected in the editor; a selection is made by highlighting the text. Whatever is selected will replace the %R. If nothing is selected this specifier is ignored. Using this format: %i1 %R %n --- %d, and selecting the text Myron Turner, the numbering plugin outputs the following markup:

  {{:wiki:dokuwiki-128.png?50}} Myron Turner 00000038 --- //2017/04/06 21:36//

The result in the browser is:

Tool tip

When you run your mouse over the numbering icon, the current tool tip which pops up is “Insert next number”. You can change this in the file title.js found in the plugin directory. This file has one line:

  var NumberingToolBarTtitle =  ""; //"Insert your number";

The tool tip can be reset to anything you wish by resetting the tool tip variable shown above.

Automated numbering

The following syntax markup inserted in a page will be replaced by the next number available when the page is saved:

~~GetNextNumber~~

This can be used on any page and anywhere in the page. However, it might have it most practical use with namespace templates. For instance:

__template.txt
@DATE@ Invoice number: ~~GetNextNumber~~

This template will produce a page with the current date and the next available number. The output for this would be, for instance:

  2019/03/29 09:36 Invoice number: 00000031     

The ~~GetNextNumber~~ markup does not remain on the page. It is replaced by the next number when the page is saved. Notice, except for padding, the leading zeroes, it does not use any of the formatting which is configured for the tool button version of the plugin.

Automated unique sequential numbering in Bureaucracy Plugin

This feature was made in response to a particular problem in the built-in auto-increment feature of the bureaucracy plugin, that is, if two users use the same bureaucracy-form at same time, the same number will be given twice. 1). By contrast, numbering plugin always outputs a number which is unique and next in sequence.

How this works

You must enter the name of the bureaucracy number field into the numbering plugin's bureaucracy option in the Configuration Manager. Entering numbr will result in the following configuration. Clicking on the numbering icon inserts the next number into the textbox. If you have more than one such field, you enter their names as a comma separated list: numbr,num, . . etc.

If the multi_db option is set to true, each field specified for numbering in the bureaucracy option will maintain its own count. If not, all will be part of the same count.

Development

Change Log

Known Bugs and Issues

Discussion

plugin/numbering.txt · Last modified: 2023-10-30 22:40 by Klap-in

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki