[dokuwiki] Re: HTML_EDITFORM_INJECTION event

  • From: Chris Smith <chris@xxxxxxxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Mon, 29 Jan 2007 00:29:52 +0000

Gunther wrote:
Hello list!

Just some thoughts about the ' HTML_EDITFORM_INJECTION' event, which is currently only available in the devel version.

If I "Use this to inject additional form fields into the form. " I have at least two problems.

The first one will be the actual place where the trigger is placed. It's inside the <form> tag. So I could only add some fields to the form but no separate form (with different action attribute).

You also have the option of handling TPL_ACT_RENDER and completely replacing the output for certain actions with your own. E.g. you could check for "register" and generate your own register form and send the preventDefault signal to stop dw painting its own form. Then process the results by handling ACTION_ACT_PREPROCESS.

Another alternative is to post process tpl_content output by handling TPL_CONTENT_DISPLAY. You can modify the form before its sent to the user, changing the action attribute or whatever else.


This leads to the second problem: If I got it right, the form values are processed by the doku.php. And there only 3 predefined $_POST vars are handled. So if I want to use my additional form values I have to change the code in doku.php.


Your action plugin can be triggered by any event from DOKUWIKI_STARTED to DOKUWIKI_DONE. Your own post vars are available to them all. ACTION_ACT_PREPROCESS allows you to nab the current action before dokuwiki does anything with it.

Andi added the injection events so I guess he is using them somewhere. Ask him which plugins and take a look at that code - CAPTCHA maybe a could place to start.


There should be an alternativ handling of $_POST vars and a trigger which sends me back to my action plugin for processing my values.

HTTP is stateless, that is DW doesn't remember that your action plugin did anything the time before. In fact DW knows nothing about what your plugin does. If your plugin wants to intercept something it needs to register for an appropriate event, examine the information available to it and decide whether to act - or perhaps decide to flag the necessity to act at other points. E.g you can check incoming variables in DOKUWIKI_STARTED and if there is something you are interested in, register an appropriate event to handle that something later on.


Just my 2 cents!

Greetings
Gunther


So, no, I don't think there is a need for further alternatives to handle $_POST vars. :)

Cheers,

Chris
--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist

Other related posts: