pagemod plugin by Baseline IT
A plugin which allows you to add information to pages in a structured way (via forms), it works with the bureaucracy plugin
Last updated on 2009-10-12. Provides Syntax.
Compatible with DokuWiki 20080505.
Requires bureaucracy.
Similar to data, datapdo.
Download and install the plugin using the Plugin Manager using the following URL. Refer to Plugins on how to install plugins manually.
IMPORTANT NOTE: When you have installed it, you WILL need to UPDATE it once. This is because it installs some stuff into the bureaucracy directory, but this action doesn't happen on install (BUG), but does happen on update. To update the plugin, click “Update” in the Admin/Plugins section of your DokuWiki.
I created this plugin because I have long wished for a way to add data structured in a specific way to a page in a repetitive fashion. A clear example of this is adding data to a table. How about a form on that page which could ask the right questions and when submitted add the information submitted as an additional row at the end of the table.
When I saw the bureaucracy plugin I knew it could be done and the way that plugin is written lends itself well to extension and so here it is and it works loosely in the following way:
That's really the functionality, its quite simple.
So here are the features:
(Does this mean they still have access to the form, but it generates an error when they try to use it?)That's it.
Example Files can be found here:
Defining a form is done via the bureaucracy plugin, please check that for complete syntax. But here are the changes:
<form> action pagemod <target page/namespace> <pagemod_id> <...various fields for submit...> submit </form>
To make bureaucracy use the pagemod action, you need to add action pagemod with the following parameters:
Defining a pagemod template is done within a page with the following code:
<pagemod <pagemod_id> <params>> wiki text while will be parsed for transform tags like @@field from form@@ or ##field2 from form## the contents of this section are invisible and will not show up on this page. </pagemod> some other wiki text then some more ^ table header 1 ^ table header 2 ^ <pagemod table_adder output_before>| @@table value 1@@ | @@table value 2@@ | </pagemod>
The pagemod enclosure starts with:
<pagemod <pagemod_id> <params>>
where the following is true:
The pagemod enclosure ends with the following:
</pagemod>
and the contents are not shown when the wiki page is viewed. Translation of the contents of the pagemod enclosure is done inline with the bureaucracy plugin's template function.
Since release 2009/10/12 There also exists the concept of meta variables, they are variables that are generated by the plugin at runtime. They are the following
New meta information tag requests should be sent to me for implementation.
2010-03-20 I added a auto-increment meta tag to your plugin. I needed it for a bug tracker/feature request system. If you're interested, I'll send it to you. Just send me an email to laplix¢2010¢at$gmail$dot¢com (remove the money symbols). It is not fully tested yet (right now, I only tested it with _self) but it does what I want, so…
Please let me know of any bugs or issues, requests. I know a large number of people have requested a plugin like this, so I hope people find it useful.
We're using this plugin to log activity reports so I required the feature to include some non-editable runtime values like current date and user attributes in pagemod's output. I've done it this way:
13a14 > global $INFO; 32a34,41 > $patterns[] = '/(@@|##)@DATE@(@@|##)/'; > $values[] = strftime($conf['dformat']); > $patterns[] = '/(@@|##)@USER@(@@|##)/'; > $values[] = $_SERVER['REMOTE_USER']; > $patterns[] = '/(@@|##)@NAME@(@@|##)/'; > $values[] = $INFO['userinfo']['name']; > $patterns[] = '/(@@|##)@MAIL@(@@|##)/'; > $values[] = $INFO['userinfo']['mail'];
I've no experience in PHP so maybe this solution isn't optimal but it does work
— Dmitry Rubinstain.
From Author : This is now possible using the meta tags described in the documentation above
This plugin rocks ! IMHO, it provides such great features that it should be advertised on the front page. I'm planning to use it as a commenting system. Would it be possible to auto-detect the current page id (like the backlinks2 plugin does) ? For example :
<form> action pagemod auto new_comment fieldset "Add your comments below" textbox "Name" select "Rate it" "Excellent|Good|Bad" textarea "Comment" submit </form>
It would save an incredible amount of time when you have to insert forms in many pages ! — Laynee 2009/10/05 16:22
From Author : This is now possible using the _self target described in the documentation above
Woohooh! The new version works like a charm ! Thank you very much :) — Laynee 2009/10/12 16:00
Hi, I installed pagemod together with the bureaucracy plugin, but I can't get them to work. After submitting data through a bureaucracy form (e.g. the demo-page) I receive the following error:
Fatal error: Class 'syntax_plugin_bureaucracy_actions' not found in /lib/plugins/bureaucracy/actions/pagemod.php on line 7
What am I doing wrong? I tried this on DokuWiki 2009-12-25c as well as on older versions, with same error.
I've updated my installation to DokuWiki 2009-12-25c, Pagemod 2009-10-12 and Bureaucracy 2010-01-22. I now encounter the same error. I guess Pagemod needs to be updated to work with the latest versions of Bureaucracy. I reinstalled my old version of Bureaucracy (it should be this one) and now it works — Laynee 2010/02/03 18:03
Replace in the file bureaucracy/actions/pagemod.php from line 32 to 40 with that
// run through fields and prepare replacements
foreach($data as $opt) {
$label = preg_quote($opt->getParam('label'));
$value = $opt->getParam('value');
if(in_array($opt->getParam('cmd'),$this->nofield)) continue;
$label = preg_replace('/([\/\.])/','\\\$1',$label);
$patterns[] = '/(@@|##)'.$label.'(@@|##)/i';
$values[] = $value;
}
— Rdemont 2010/02/19
I tried both solutions above, but still remain with the same error. Something else I might be missing? — LWolf 2010/02/25
Its a type syntax_plugin_bureaucracy_actions needs to be replaced by syntax_plugin_bureaucracy_action. At least, this worked for me — Gerione 2010/3/4
I have the same big problem ! Help me please— Ph LAPEYRIE 2010/03/16 23:25
THE SOLUTION = Rdemont + Gerione. It's all right for me.— Ph LAPEYRIE 2010/03/16 23:51
After I submit the form the page reloads but shows only the header, footer and sidebar without the content. The results output doesn't work regardless that I try to add them to the same or another page.
The other bureaucracy actions (email and template) work fine.
Multiple forms + pagemod sections on one page (and not only, read more) do not work.
Scenario 1: I have one page (name it: materials) with two pagemod forms and two datasets,
am311 and cm113 if that matters),
Scenario 2: I have one page with form (materials) and two datasets with data (materials:am311 and materials:cm113)
am311 and cm113 if that matters),
In both scenarios, data gets added to both datasets, instead of one of them (am311 or cm113).
From Author : This is not a bug in this module, its a bug in bureaucracy. If you have multiple bureaucracy forms on a page, the result is always generated from the first's parameters (action parameters) since it doesn't set these in the form, but re-reads them from the page
From Author : This bug is fixed by redeploying bureaucracy with the file with my patch detailed here, I have mailed Andreas and asked him to include my fix in his code.
From Author : This bug appears to have been fixed, many thanks to the bureaucracy maintainer for this
Great plugin ! I use it all the time. small bug for @@meta.user.id@@ which doesn't work for me : I think it should use return $INFO['user']; instead of return $INFO['userinfo']['user'];
I was wondering if there is a way to use the period in field names, so you could make numbered items like “1. What is your name?”, etc. (using a period currently breaks the template) The only way I'm able to do this currently is writing a static “1. What is your name?” which is followed immediately by a “Name [ ]” line, which gets really cluttered if you're trying to do something like a numbered questionnaire.
On the other hand, is there any way to show a field title like “Please enter you name”, but assign it to a variable like @@name@@ for use in the pagemod tag? I apologize if this question is better asked on the bureaucracy plugin page.— Kououken 2010/03/02
Hi! I am quite new to wikis, so please forward me to the right place if my question is wrong here. Is there any way to check the value of a placeholder and treat the form depending on its value? Something like “if @@name@@=='Green' then <show output of the form>”? Anna 2010/03/03