Not logged in. · Lost password · Register
Forum: General Help and Support Plugins RSS
Bureaucracy - How to use Script mode?
Avatar
x.root #1
Member for a month · 1 post
Group memberships: Members
Show profile · Link to this post
Subject: Bureaucracy - How to use Script mode?
Hi!

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 (https://www.dokuwiki.org/plugin:bureaucracy#script_mode) 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:
<form>
action script example.php
textbox "Your name"
textbox "Your department"
submit "Display it"
</form>

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 :
<form>
action script example.php @@You_name@@ @@your_department@@
textbox "Your name"
textbox "Your department"
submit "Display it"
</form>
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:
<?php
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!
Regards
This post was edited 2 times, last on 2018-12-26, 17:54 by x.root.
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
Imprint
This board is powered by the Unclassified NewsBoard software, 20150713-dev, © 2003-2015 by Yves Goergen
Current time: 2019-01-17, 20:30:34 (UTC +01:00)