plugin:bureaucracy
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:bureaucracy [2017-10-13 18:00] – [Script Mode] improved example dregad | plugin:bureaucracy [2024-02-09 10:35] (current) – Aleksandr | ||
---|---|---|---|
Line 2: | Line 2: | ||
---- plugin ---- | ---- plugin ---- | ||
- | description: | + | description: |
author | author | ||
email : andi@splitbrain.org | email : andi@splitbrain.org | ||
type : syntax, action | type : syntax, action | ||
- | lastupdate : 2017-07-27 | + | lastupdate : 2023-05-16 |
- | compatible : Frusterick Manners | + | compatible : Frusterick Manners, Greebo, Hogfather, Igor, Jack Jackrum, Kaos |
depends | depends | ||
- | conflicts | + | conflicts |
similar | similar | ||
tags : form, email, poll, create | tags : form, email, poll, create | ||
screenshot_img: | screenshot_img: | ||
+ | |||
downloadurl: | downloadurl: | ||
sourcerepo : https:// | sourcerepo : https:// | ||
Line 23: | Line 24: | ||
===== Download and Installation ===== | ===== Download and Installation ===== | ||
- | Download | + | Search |
==== Changes ==== | ==== Changes ==== | ||
Line 33: | Line 34: | ||
==== Recommended additional Plugins ==== | ==== Recommended additional Plugins ==== | ||
- | You might want to use on an open wiki the [[CAPTCHA]] plugin to avoid automated spam. When captcha plugin | + | On an open wiki, you might want to use the [[CAPTCHA]] plugin to avoid automated spam. When it is installed, |
+ | |||
+ | The [[SMTP]] plugin may help when your DokuWiki can't send mails. | ||
+ | |||
+ | When you use Bureaucracy' | ||
+ | |||
+ | 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' | ||
+ | |||
+ | === Additional Actions === | ||
+ | |||
+ | An additional plugin to look at is [[pagemod]], | ||
+ | |||
+ | === Additional Fields === | ||
- | // | + | The [[Data]] plugin |
- | An additional plugin to look at is the [[pagemod]] plugin | + | |
- | // | + | With [[Struct]] plugin, you can use any [[plugin: |
- | The [[Data]] plugin can be useful in templates as mentioned before, but it provides a '' | + | |
==== Warning ==== | ==== Warning ==== | ||
Line 91: | Line 102: | ||
* **action** | * **action** | ||
- | * The first parameter needs to be a supported action (see [[#action modes|below]]).\\ Currently supported are '' | + | * The first parameter needs to be a supported action (see [[#action modes|below]]).\\ Currently supported are '' |
* Additional parameters for type '' | * Additional parameters for type '' | ||
* one or more email addresses to send the data to (required) | * one or more email addresses to send the data to (required) | ||
Line 137: | Line 148: | ||
* creates a checkbox | * creates a checkbox | ||
* needs a label | * needs a label | ||
- | * needs default values for yes and no ('' | + | * needs default values for yes and no ('' |
* **select** | * **select** | ||
* creates a dropdown list | * creates a dropdown list | ||
* needs a label | * needs a label | ||
* needs a second argument containing the select options separated by a pipe '' | * needs a second argument containing the select options separated by a pipe '' | ||
+ | * **multiselect** | ||
+ | * you can select multiple values | ||
+ | * needs a label | ||
+ | * needs a second argument containing the select options separated by a pipe '' | ||
+ | * example: '' | ||
+ | * In mail action: all options will be joined by "'', | ||
+ | * In template action: | ||
+ | * if field is marked with " | ||
+ | * during template substitution all options will be joined by "'', | ||
* **radio** | * **radio** | ||
* creates a set of radiobuttons | * creates a set of radiobuttons | ||
Line 176: | Line 196: | ||
* page_tgt is relative to destination of page created by action field. e.g. action field tries to create '' | * page_tgt is relative to destination of page created by action field. e.g. action field tries to create '' | ||
* When in the '' | * When in the '' | ||
+ | * **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. '' | ||
* **data_aliastextbox** (needs plugin) | * **data_aliastextbox** (needs plugin) | ||
* requires [[Data|Data plugin]] to display the field (See [[data# | * requires [[Data|Data plugin]] to display the field (See [[data# | ||
Line 182: | Line 208: | ||
* datatypes with a type alias that defines 'valid values' | * datatypes with a type alias that defines 'valid values' | ||
* otherwise it appears as usual textbox, sometimes with [[data# | * otherwise it appears as usual textbox, sometimes with [[data# | ||
- | * **labels** | + | * **struct_field** + **struct_fieldhidden** (needs plugin) |
- | * parameter is a wiki page containing | + | * Just specify |
- | * **file** | + | * Label is used from definition as well as validation rules |
- | * let user select | + | * See [[plugin: |
- | * needs a label | + | * **struct_schema** (needs plugin) |
+ | * Just specify | ||
+ | * Adds the whole scheme | ||
+ | * See [[plugin: | ||
==== Constraints and Defaults ==== | ==== Constraints and Defaults ==== | ||
Line 192: | Line 221: | ||
* Start with a ''>'' | * Start with a ''>'' | ||
* Start with a ''<'' | * Start with a ''<'' | ||
- | * Start with a '' | + | * Start with a '' |
* Use a single '' | * Use a single '' | ||
* Use a single '' | * Use a single '' | ||
Line 255: | Line 284: | ||
< | < | ||
- | * field = Tell us about yourself" | + | * field = Tell us about yourself |
* name = Your Name | * name = Your Name | ||
* age = Your Age | * age = Your Age | ||
Line 303: | Line 332: | ||
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 '' | 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 '' | ||
- | When the user marks the checkbox of the '' | + | When the user marks the checkbox of the '' |
NOTE: | NOTE: | ||
* Apparently dependencies don't work when the choice is provided by " | * Apparently dependencies don't work when the choice is provided by " | ||
- | * How to use dependencies to adapt a select list. Example:\\ First level " | + | |
- | select " | + | ===Dependencies with Fieldsets - creating two levels of selects === |
- | select " | + | How to use dependencies to adapt a select list. Example: |
+ | |||
+ | First level " | ||
+ | < | ||
+ | |||
+ | Second level " | ||
+ | < | ||
+ | select " | ||
+ | and | ||
+ | < | ||
+ | select " | ||
+ | |||
+ | To show only the shown value of both select fields | ||
+ | The chosen one will be filled out and the not chosen one will be replaced by an empty string ("" | ||
==== Prefilling fields from Links ==== | ==== Prefilling fields from Links ==== | ||
Line 321: | Line 363: | ||
===== Action Modes ===== | ===== Action Modes ===== | ||
- | The bureaucracy | + | Bureaucracy |
- it displays a neat form | - it displays a neat form | ||
- it validates user input | - it validates user input | ||
- | - it gives the user input to a action mode | + | - it sends the user' |
- | The last step is where the data is processed. | + | The last step is where the data is processed. |
==== Mail Mode ==== | ==== 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 spaces. | + | 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. |
Line 358: | Line 400: | ||
<code html> | <code html> | ||
- | Dear @@Your Name@@, | + | Dear @@Your Name@@,</br> |
- | + | </br> | |
- | You are < | + | You are < |
- | + | </br> | |
- | We will deliver it fast as possible, see the | + | We will deliver it fast as possible, see the </br> |
- | <a href=" | + | <a href=" |
- | + | </br> | |
- | Kind regards, | + | Kind regards,</br> |
- | Future Machines company | + | Future Machines company</br> |
</ | </ | ||
Line 456: | Line 498: | ||
=== Creating Templates === | === Creating Templates === | ||
- | The templates need to contain the same fields as your form, and some other placeholders are available too: | + | 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 ^ | ^Placeholder ^ action ^ | ||
| '' | | '' | ||
+ | |'' | ||
| '' | | '' | ||
|'' | |'' | ||
| %Y %F %a %Y-%m-%d %s... etc | [[phpfn> | | %Y %F %a %Y-%m-%d %s... etc | [[phpfn> | ||
- | | < | + | | < |
- | |''< | + | |''< |
| '' | | '' | ||
+ | | '' | ||
|'' | |'' | ||
|'' | |'' | ||
|''< | |''< | ||
+ | |''< | ||
|'' | |'' | ||
|'' | |'' | ||
Line 500: | Line 545: | ||
Note: the '' | Note: the '' | ||
+ | |||
+ | === Accessing user field infos === | ||
+ | |||
+ | When using a '' | ||
+ | |||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | |||
+ | * ' | ||
+ | * ' | ||
+ | * ' | ||
+ | * separator may be omitted then the comma is used as a separator. Eg. @@users.mail@@, | ||
+ | * @@users.grps@@ is not supported | ||
==== Script Mode ==== | ==== 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. | This action gives the data to a PHP script supplied by the administrator. The script then can do whatever it wants with the data. | ||
- | The script must be placed in '' | + | The script must be placed in '' |
That means the class has to have the '' | That means the class has to have the '' | ||
Line 524: | Line 584: | ||
use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface; | use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface; | ||
- | class bureaucracy_handler_example | + | class helper_plugin_bureaucracy_handler_example |
/** | /** | ||
Line 569: | Line 629: | ||
* Fifth Number field returns values which are completed with leading zeros. Input of 23 will be returned as 023. | * 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 | * Sixth Number is a combination of Two and Fifth | ||
+ | |||
+ | ==== Template placeholder @DATE@ ==== | ||
+ | |||
+ | hidden " | ||
+ | hidden " | ||
+ | |||
+ | * in the template placeholder @DATE(..., | ||
+ | * the second parameter (behind the comma) with the strftime syntax can be used for formating the date output, as needed -> note that % in the [[phpfn> | ||
===== Development ===== | ===== Development ===== | ||
Line 610: | Line 678: | ||
' | ' | ||
); | ); | ||
+ | </ | ||
+ | |||
+ | ==== Hook into email action ==== | ||
+ | |||
+ | The event '' | ||
+ | |||
+ | 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: | ||
+ | |||
+ | < | ||
+ | $evdata = [ | ||
+ | ' | ||
+ | ' | ||
+ | ]; | ||
</ | </ | ||
Line 737: | Line 820: | ||
* [[: | * [[: | ||
- | * User-Forum: [[https:// | + | * User-Forum: [[https:// |
===== Issues ===== | ===== Issues ===== | ||
Please report bug or feature request on the [[https:// | Please report bug or feature request on the [[https:// |
plugin/bureaucracy.1507910425.txt.gz · Last modified: 2017-10-13 18:00 by dregad