DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:bureaucracy

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:bureaucracy [2017-05-27 18:15] – [CSS Formatting] 88.78.7.121plugin:bureaucracy [2024-02-09 10:35] (current) Aleksandr
Line 2: Line 2:
  
 ---- plugin ---- ---- plugin ----
-description: Easily create HTML forms to collect data which can be sent via email or used to create pages.+description: Easily create HTML forms to collect data which can be sent via email or used to create pages
 author     : Andreas Gohr author     : Andreas Gohr
 email      : andi@splitbrain.org email      : andi@splitbrain.org
 type       : syntax, action type       : syntax, action
-lastupdate : 2017-03-27 +lastupdate : 2023-05-16 
-compatible : HrunPonder StibbonsBinkyDetritusElenor Of Tsort+compatible : Frusterick MannersGreeboHogfatherIgorJack Jackrum, Kaos
 depends    :  depends    : 
-conflicts bureaucracy-au, form+conflicts bureaucracyau, form
 similar    : form, contact, contactmodern, conform similar    : form, contact, contactmodern, conform
 tags       : form, email, poll, create tags       : form, email, poll, create
 screenshot_img: :plugin:bureaucracy.png screenshot_img: :plugin:bureaucracy.png
 +
 downloadurl: https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/zipball/master downloadurl: https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/zipball/master
 sourcerepo : https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/ sourcerepo : https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/
Line 23: Line 24:
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download and install the plugin using the [[plugin:plugin|Plugin Manager]] using the download link given above. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
 ==== 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 is installed, bureaucracy integrate automatically the captcha check in its form submit handling. The [[SMTP]] plugin may help when your DokuWiki can't send mails. When you use the template action of bureaucracy, 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.+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 ===
  
-//additional actions// \\  +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 [[data#bureaucracy_plugin_and_type_aliases|example]].
-An additional plugin to look at is the [[pagemod]] plugin which add an action ''pagemod'' for the bureaucracy plugin to add data to an existing page (in addition to the current templating and mailing functionality)+
  
-//additional fields// \\  +With [[Struct]] plugin, you can use any [[plugin:struct:bureaucracy#single_field|field]] from any defined schema as a field in a bureaucracy form. You can also add a [[plugin:struct:bureaucracy#complete_schema|whole schema]] to the form.
-The [[Data]] plugin can be useful in templates as mentioned before, but it provides a ''data_aliastextbox'' field too, 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 [[data#bureaucracy_plugin_and_type_aliases|example]].\\ With [[Struct]] plugin, you can use any [[plugin:struct:bureaucracy#single_field|field]] from any defined schema as a field in a bureaucracy form. You can also add a [[plugin:struct:bureaucracy#complete_schema|whole schema]] to the form.+
  
 ==== Warning ==== ==== Warning ====
Line 91: Line 102:
  
   * **action**   * **action**
-    * The first parameter needs to be a supported action (see [[#action modes|below]]).\\ Currently supported are ''mail'', ''template'' and ''[[plugin:pagemod|pagemod]]'' (if this plugin is installed).+    * The first parameter needs to be a supported action (see [[#action modes|below]]).\\ Currently supported are ''mail'', ''template'', ''script''.\\ Or if respective plugin is installed: ''[[plugin:pagemod|pagemod]]'' or ''[[plugin:struct:bureaucracy#action_struct_lookup|struct_lookup]]''.
     * Additional parameters for type ''mail'':     * Additional parameters for type ''mail'':
       * one or more email addresses to send the data to (required)       * one or more email addresses to send the data to (required)
Line 98: Line 109:
       * namespace:prefix or namespace: (mind the trailing colon) where new pages shall be created (optional)       * 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)       * 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     * Multiple actions can be defined by adding another action field
   * **thanks**   * **thanks**
Line 135: Line 148:
     * creates a checkbox     * creates a checkbox
     * needs a label     * needs a label
-    * needs default values for yes and no ('' =true_value !false_value '')+    * needs default values for yes and no (''%% "=true value" "!false value" %%''). If only used for a fieldset the default values are not required.
   * **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 ''|'' char\\ (''%% "Peaches|Apples|Oranges" %%'')     * needs a second argument containing the select options separated by a pipe ''|'' char\\ (''%% "Peaches|Apples|Oranges" %%'')
 +  * **multiselect**
 +    * you can select multiple values
 +    * needs a label
 +    * needs a second argument containing the select options separated by a pipe ''|'' char\\ (''%% "Peaches|Apples|Oranges" %%'')
 +    * example: ''%% multiselect "Label" "Opt1|Opt2|Opt3" =Opt1,Opt3 %%''
 +    * 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**   * **radio**
     * creates a set of radiobuttons     * creates a set of radiobuttons
Line 174: Line 196:
     * 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''     * 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.     * 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 ''.''
   * **data_aliastextbox** (needs plugin)   * **data_aliastextbox** (needs plugin)
     * requires [[Data|Data plugin]] to display the field (See [[data#bureaucracy_plugin_and_type_aliases|example]])     * requires [[Data|Data plugin]] to display the field (See [[data#bureaucracy_plugin_and_type_aliases|example]])
Line 180: Line 208:
       * datatypes with a type alias that defines 'valid values' will appear as a (multi)select field       * datatypes with a type alias that defines 'valid values' will appear as a (multi)select field
       * otherwise it appears as usual textbox, sometimes with [[data#custom_entry_editor|added features]] as datepicker and pagesuggestions       * otherwise it appears as usual textbox, sometimes with [[data#custom_entry_editor|added features]] as datepicker and pagesuggestions
-  * **labels** +  *  **struct_field** + **struct_fieldhidden** (needs plugin) 
-    * parameter is wiki page containing list of label translations +    * Just specify field from defined schema "<schema>.<name>" from [[Struct|Struct plugin]] 
-  * **file** +    * Label is used from definition as well as validation rules 
-    * let user select file for upload (which is added to media by template action, or added as attachment in mail action) +    * See [[plugin:struct:bureaucracy#single_field|plugin:struct:bureaucracy#single_field]] 
-    * needs a label+  *  **struct_schema** (needs plugin) 
 +    * Just specify defined schema "<schema>" from [[Struct|Struct plugin]] 
 +    * Adds the whole scheme to the form 
 +    * See [[plugin:struct:bureaucracy#complete_schema|plugin:struct:bureaucracy#complete_schema]]
  
 ==== Constraints and Defaults ==== ==== Constraints and Defaults ====
Line 190: Line 221:
   * 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 bigger than the given number
   * Start with a ''<'' followed by a number to require numeric data smaller 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+  * Start with a ''='' to set a default value, you can also use [[#creating_templates|placeholders]] here
   * Use a single ''!'' char to make a field optional   * 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 give a field the focus (possible for only one field at a page)
Line 253: Line 284:
  
 <code> <code>
-  * field  = Tell us about yourself"+  * field  = Tell us about yourself
   * name   = Your Name   * name   = Your Name
   * age    = Your Age   * age    = Your Age
Line 301: 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 ''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. 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, so it will check if the referred field is set.+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:  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.   * 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.
-  * How to use dependencies to adapt a select list. Example:\\ First level "select" list <code>select "Vehicule" "Car|Motorbike"</code>\\ Second level "select" lists:\\ <code>fieldset  "Car spareparts" "Vehicule" "Car" + 
-select "Sparepart1" "4 wheels|steering wheel"</code> and\\ <code>fieldset  "Motorbike spareparts" "Vehicule" "Motorbike" +===Dependencies with Fieldsets - creating two levels of selects === 
-select "Sparepart2" "3 wheels|handle bar"</code>\\  To create an unique destination for both arguments "Sparepart1" and "Sparepart2" use the construct <code>@@Sparepart1|@@@@Sparepart2|@@</code>\\ The chosen one will be filled out and the not chosen one will be replaced by ""+How to use dependencies to adapt a select list. Example: 
 + 
 +First level "select" list  
 +<code>select "Vehicule" "Car|Motorbike"</code> 
 + 
 +Second level "select" lists: 
 +<code>fieldset  "Car spareparts" "Vehicule" "Car" 
 +select "Sparepart1" "4 wheels|steering wheel"</code>  
 +and 
 +<code>fieldset  "Motorbike spareparts" "Vehicule" "Motorbike" 
 +select "Sparepart2" "3 wheels|handle bar"</code> 
 + 
 +To show only the shown value of both select fields "Sparepart1" and "Sparepart2" in a template, use the construct <code>@@Sparepart1|@@@@Sparepart2|@@</code> 
 +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 319: Line 363:
 ===== Action Modes ===== ===== Action Modes =====
  
-The bureaucracy does three things:+Bureaucracy does three things:
  
   - it displays a neat form   - it displays a neat form
   - it validates user input   - it validates user input
-  - it gives the user input to action mode+  - it sends the user'input to an action mode
  
-The last step is where the data is processed. What action is to be used is defined in the ''action'' field as described above. Currently two modes are supported: ''mail'' and ''template''. Additional modes (e.g. for storing the data in a database) can easily be added.+The last step is where the data is processed. The action to use is defined in the ''action'' fieldas 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 ==== ==== 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 defaultall 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 356: Line 400:
  
 <code html> <code html>
-Dear @@Your Name@@, +Dear @@Your Name@@,</br> 
- +</br> 
-You are <b>great<b>, you just <i>purchased</i> our @@What do you want@@! +You are <b>great</b>, you just <i>purchased</i> our @@What do you want@@!</br> 
- +</br> 
-We will deliver it fast as possible, see the  +We will deliver it fast as possible, see the </br> 
-<a href="http://example.com/conditions">conditions</a>+<a href="http://example.com/conditions">conditions</a>.</br> 
- +</br> 
-Kind regards, +Kind regards,</br> 
-Future Machines company+Future Machines company</br>
 </code> </code>
  
Line 454: 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 ^
 | ''@@Field label@@''\\ ''##Field label##'' | Will be replaced by the actual values the user filled into\\ the form. | | ''@@Field label@@''\\ ''##Field label##'' | Will be replaced by the actual values the user filled into\\ the form. |
 +|''@curNS(arg)@''\\ ''@getNS(arg)@''\\ ''@noNS(arg)@''\\ ''@p_get_first_heading(arg)@''|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   | | ''@@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'' | |''@NSBASE@''                               | (only template action) Namespace that contains new page.\\ eg. if the new page is ''foo:bar:baz:bang'', ''@NSBASE@'' will contain ''baz'' |
 | %Y %F %a %Y-%m-%d %s... etc               | [[phpfn>strftime]] parameters to refer to current time   | | %Y %F %a %Y-%m-%d %s... etc               | [[phpfn>strftime]] parameters to refer to current time   |
-| <nowiki>%%</nowiki>                       | Replaced by ''%'' char, needed to avoid accidental time\\ replacements in your template.| +| <nowiki>%%</nowiki>                       | Replaced by ''%'' char, needed to avoid accidental time replacements in your template.| 
-|''<nowiki>@DATE(<datetime>,%%Y-%%m-%%e)@</nowiki>''\\ ''@DATE(<datetime>)@''  | Accepts different datetime formats, which are outputted in the\\ requested [[phpfn>strftime]] format. Providing no format returns date\\ with format of the [[config:dformat]] setting. |+|''<nowiki>@DATE(<datetime>,%%Y-%%m-%%d)@</nowiki>''\\ ''@DATE(<datetime>)@''  | Accepts different [[phpfn>class.datetime|datetime]] formats, which are outputted in the requested [[phpfn>strftime]] format. If no format is provided, date is returned with format of the [[config:dformat]] setting. ([[plugin:bureaucracy#template_placeholder_date|Example]]) |
 | ''@ID@ @USER@ @MAIL@'' ... etc | DokuWiki [[:namespace_templates#replacement_patterns|replacement patterns]] for templates are available too | | ''@ID@ @USER@ @MAIL@'' ... etc | DokuWiki [[:namespace_templates#replacement_patterns|replacement patterns]] for templates are available too |
 +| ''@FORMPAGE_ID@ @FORMPAGE_NS@ @FORMPAGE_CURNS@'' ... etc | Works like [[:namespace_templates#replacement_patterns|replacement patterns]] but refers to the page with the form |
 |''@YEAR@'', ''@MONTH@'', ''@DAY@'', ''@TIME@'', ''@TIMESEC@''| Print current: year, month, day, time as hh:mm\\ and time as hh:mm:ss | |''@YEAR@'', ''@MONTH@'', ''@DAY@'', ''@TIME@'', ''@TIMESEC@''| 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 | |''@TABLEHTML@'', ''@TABLETEXT@''           | (only mail action) html or text table of all field values |
 |''<noinclude>...</noinclude>''             | Tags with their content are removed       | |''<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                | |''@LANG@''                                 | Languagecode as configured                |
 |''@TRANS@''                                | Languagecode obtained from page id of form| |''@TRANS@''                                | Languagecode obtained from page id of form|
Line 498: Line 545:
  
 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. 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.
 +
 +The script must be placed in ''conf/plugin/bureaucracy/'' directory. It must contain one class that is named ''helper_plugin_bureaucracy_handler_//scriptname//'' and implements the interface ''[[https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/blob/master/interfaces/bureaucracy_handler_interface.php|dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface]]''
 +
 +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.
 +
 +<code>
 +<form>
 +action script example.php
 +textbox "Type something"
 +submit "Write to log"
 +</form>
 +</code>
 +
 +<file php conf/plugin/bureaucracy/example.php>
 +<?php
 +use 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
 +     */
 +    public function handleData($fields, $thanks)
 +    {
 +        dbglog($fields, __FILE__ . ': ' . __LINE__);
 +        dbglog($thanks, __FILE__ . ': ' . __LINE__);
 +
 +        return $thanks;
 +    }
 +}
 +</file>
  
 ===== Examples ===== ===== Examples =====
Line 521: Line 621:
   hiddenautoinc "Four (notice: conflicts with Two)"   hiddenautoinc "Four (notice: conflicts with Two)"
   number "Fifth" 000   number "Fifth" 000
 +  number "Sixth" ++ 000
  
   * One Number field accepts only numbers   * One Number field accepts only numbers
Line 527: Line 628:
   * 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.)   * 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.   * 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
 +
 +==== Template placeholder @DATE@ ====
 +
 +  hidden "today" "=%Y-%m-%d"
 +  hidden "backtrack" "=@DATE(now -3 years,%%Y-%%m-%%d)@"
 +
 +  * in the template placeholder @DATE(...,...)@ the first parameter (before the comma) with the [[phpfn>class.datetime|datetime]] format can be used, for example, to dynamically calculate a date relative to today's date, powered by the php function [[phpfn>datetime.modify]] -> note specific locations of whitespaces in the syntax
 +  * 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>strftime]] parameters here have to be escaped by %%
  
 ===== Development ===== ===== Development =====
Line 568: Line 678:
   'fields' => helper_plugin_bureaucracy_field[], // all the fields of the form   'fields' => helper_plugin_bureaucracy_field[], // all the fields of the form
 ); );
 +</code>
 +
 +==== 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:
 +
 +<code>
 +$evdata = [
 +    'fields' => $fields,
 +    'values' => &$this->values
 +];
 </code> </code>
  
Line 695: Line 820:
  
   * [[:tips:button_align|How to align a <button> element?]]   * [[:tips:button_align|How to align a <button> element?]]
-  * User-Forum: [[https://forum.dokuwiki.org/thread/13956|Left align in Bureaucracy Plugin]]+  * User-Forum: [[https://forum.dokuwiki.org/d/13956|Left align in Bureaucracy Plugin]]
  
 ===== Issues ===== ===== Issues =====
  
 Please report bug or feature request on the [[https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/issues|Github bugtracker]]. Please report bug or feature request on the [[https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/issues|Github bugtracker]].
plugin/bureaucracy.1495901738.txt.gz · Last modified: 2017-05-27 18:15 by 88.78.7.121

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