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 [2018-07-07 01:02] – [Fields] add documentation about new multiselect field grosseplugin:bureaucracy [2024-02-09 10:35] (current) Aleksandr
Line 6: Line 6:
 email      : andi@splitbrain.org email      : andi@splitbrain.org
 type       : syntax, action type       : syntax, action
-lastupdate : 2018-05-17 +lastupdate : 2023-05-16 
-compatible : Frusterick Manners, Greebo+compatible : Frusterick Manners, Greebo, Hogfather, Igor, Jack 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
Line 157: Line 157:
     * 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" %%'')
-    * example: ''multiselect "Label" "Opt1|Opt2|Opt3" =Opt1,Opt3''+    * example: ''%% multiselect "Label" "Opt1|Opt2|Opt3" =Opt1,Opt3 %%''
     * In mail action: all options will be joined by "'', ''" in e-mail message     * In mail action: all options will be joined by "'', ''" in e-mail message
     * In template action:     * In template action:
Line 208: 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
-  *  **struct_field** (needs plugin)+  *  **struct_field** + **struct_fieldhidden** (needs plugin)
     * Just specify a field from a defined schema "<schema>.<name>" from [[Struct|Struct plugin]]     * Just specify a field from a defined schema "<schema>.<name>" from [[Struct|Struct plugin]]
     * Label is used from definition as well as validation rules     * Label is used from definition as well as validation rules
Line 284: 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 373: Line 373:
 ==== 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 400: 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 502: Line 502:
 ^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 | | ''@FORMPAGE_ID@ @FORMPAGE_NS@ @FORMPAGE_CURNS@'' ... etc | Works like [[:namespace_templates#replacement_patterns|replacement patterns]] but refers to the page with the form |
Line 512: Line 513:
 |''@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 562: Line 564:
 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 ''conf/plugin/bureaucracy/'' directory. It must contain one class that is named ''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]]''+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. 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.
Line 582: Line 584:
 use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface; use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface;
  
-class bureaucracy_handler_example implements bureaucracy_handler_interface {+class helper_plugin_bureaucracy_handler_example implements bureaucracy_handler_interface {
  
     /**     /**
Line 627: 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 "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 668: 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 795: 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.1530918123.txt.gz · Last modified: 2018-07-07 01:02 by grosse

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