Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
[SOLVED] Bureaucracy - How to use Script mode?
x.root #1
Member since Dec 2018 · 2 posts
Group memberships: Members
Show profile · Link to this post
Subject: [SOLVED] Bureaucracy - How to use Script mode?

First, thanks to all Dokuwiki community members! I'm evaluating Dokuwiki in order to respond to several use case, and it stick with almost everything!

I would like to use Bureaucracy plugin to allow some users to perform basic tasks based on informations filled in forms. The idea is to use informations provided by user as parameter for a custom php script.

I tried to use the exemple in the Bureaucracy help ( without success ; My first objective is that users fill the following form, and the PHP page called by the plugin (example.php) simply write result in a file:

Code in form:
action script example.php
textbox "Your name"
textbox "Your department"
submit "Display it"

Could you tell me what the conf/plugin/bureaucracy/example.php page need to content for allow me to use "Your name" and "Your department" as php variable?

Can i send the "your name" and "Your department" as parameters to the php page directly in the form ? ex :
action script example.php @@You_name@@ @@your_department@@
textbox "Your name"
textbox "Your department"
submit "Display it"
This is really in order to understand how it works before trying to use script mode to performs other tasks (AD User creation, SCCM application creation, create directory structure in a filer etc...).

Ideally, i would like to know how to use fields as follow in the example.php file:
if(isset($_POST['Your_Name']) && isset($_POST['Your_Department'])) {
    $data = $_POST['Your_Name'] . '-' . $_POST['Your_Department'] . "\r\n";
    $ret = file_put_contents('/tmp/mydata.txt', $data, FILE_APPEND | LOCK_EX);
    if($ret === false) {
        die('There was an error writing this file');
    else {
        echo "$ret bytes written to file";
else {
   die('no post data to process');

Thanks in advance!
This post was edited 3 times, last on 2019-01-21, 17:12 by x.root.
x.root #2
Member since Dec 2018 · 2 posts
Group memberships: Members
Show profile · Link to this post

I finally get it working!

Maybe it's not the right way to use it but it's work...

The form :

action script AddSccmApp.php
Thanks "Creation de l'application"
select   "Type d'ajout" "Logiciel|Materiel|Configuration type"
textbox  "Nom de l'éditeur ou fabricant"
submit "Exécuter le script"

In the source code of the page, I retrieved the array's structure:

<label class=" control-label"><span>Type d&#039;ajout <sup>*</sup></span> <select name="bureaucracy[1]" class=" form-control">
<option value="Logiciel" selected="selected">Logiciel</option><option value="Materiel">Materiel</option><option value="Configuration type">Configuration type</option>
<fieldset ><legend>Identité</legend>
<label class=" control-label"><span>Nom de l&#039;éditeur ou fabricant <sup>*</sup></span> <input type="text" name="bureaucracy[3]" class="edit required form-control" required="required" /></label>

In my php script (<Dokuwiki>\conf\Plugin\bureaucracy\AddSccmApp.php)
use dokuwiki\plugin\bureaucracy\interfaces\bureaucracy_handler_interface;
class helper_plugin_bureaucracy_handler_addsccmapp implements bureaucracy_handler_interface {
     * Log the form fields to DokuWiki's debug log
    public function handleData($fields, $thanks)

foreach($fields['1'] as $result) {if (isset($result['value'])) {$TypeAjout = $result['value'];}}
echo '<br> TypeAjout: ' .$TypeAjout, '<br />';
foreach($fields['3'] as $result) {if (isset($result['value'])) {$NomEditeur = $result['value'];}}
echo '<br> NomEditeur: ' .$NomEditeur, '<br />';
        //return $thanks;

After that, i'm able to use php variables to launch my Powershell script...

Script mode seems to be a niche feature but really usefull in my use case!

Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Go to forum
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-06-17, 03:01:06 (UTC +02:00)