DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:pagemod

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:pagemod [2015-08-20 02:20] 220.244.230.6plugin:pagemod [2024-01-20 07:55] (current) Aleksandr
Line 1: Line 1:
-====== pagemod plugin ======+====== pagemod Plugin ======
  
 ---- plugin ---- ---- plugin ----
-description: A plugin which allows you to add information to existing pages via forms. It works with the bureaucracy plugin.+description: A plugin which allows you to add information to existing pages via forms. It works with the Bureaucracy Plugin
 author     : Baseline IT author     : Baseline IT
 email      : info@baseline-remove-this-it.co.za email      : info@baseline-remove-this-it.co.za
 type       : syntax type       : syntax
 lastupdate : 2014-11-10 lastupdate : 2014-11-10
-compatible : Hrun, Ponder Stibbons+compatible : 2016-06-26, Detritus, Hrun, Ponder Stibbons, Greebo, Hogfather, Igor
 depends    : bureaucracy depends    : bureaucracy
 conflicts  conflicts 
 similar    :  similar    : 
 tags       : form, create, update, editing tags       : form, create, update, editing
-screenshot_img :+
 downloadurl: https://github.com/rendezz/dokuwiki-pagemod/archive/master.zip downloadurl: https://github.com/rendezz/dokuwiki-pagemod/archive/master.zip
 bugtracker : https://github.com/rendezz/dokuwiki-pagemod/issues bugtracker : https://github.com/rendezz/dokuwiki-pagemod/issues
 sourcerepo : https://github.com/rendezz/dokuwiki-pagemod/ sourcerepo : https://github.com/rendezz/dokuwiki-pagemod/
 +
 +screenshot_img :
 ---- ----
  
 ===== Download and Installation ===== ===== Download and Installation =====
  
-Download and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.+Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. 
  
 ===== Overview ===== ===== Overview =====
Line 33: Line 36:
       * this placeholder is enclosed by the ''<pagemod> </pagemod>'' tags       * this placeholder is enclosed by the ''<pagemod> </pagemod>'' tags
     - The form is filled in and submitted. Subsequently the pagemod action extends the target page by including a copy of the placeholder wherein the variables are replaced with the form values.      - The form is filled in and submitted. Subsequently the pagemod action extends the target page by including a copy of the placeholder wherein the variables are replaced with the form values. 
- 
  
 So here are the features: So here are the features:
Line 40: Line 42:
   * Each ''<pagemod>'' enclosure has an id, so multiple forms can be used to update different parts of a page.   * Each ''<pagemod>'' enclosure has an id, so multiple forms can be used to update different parts of a page.
   * The form can update multiple sections of a page.     * The form can update multiple sections of a page.  
-    * All the sections needs to have the same ''pagemod_id'' as the submitting form +    * All the sections need to have the same ''pagemod_id'' as the submitting form 
-  * A person can update page that they **don't** have write access to.  +  * A person can update page that they **don't** have write access to.  
     * Only read access is required to modify a page via the form.  (This is not a bug, its a feature.)     * Only read access is required to modify a page via the form.  (This is not a bug, its a feature.)
     * It means you can prevent people from modifying a page unless they do it via a form.     * It means you can prevent people from modifying a page unless they do it via a form.
-    * If want people to only have access to read the resultant page, but not change it, protect the **form** page.+    * If you want people to only have access to read the resultant page, but not change it, protect the **form** page.
     * No read access to result page for a user, prevents modifying it via form.     * No read access to result page for a user, prevents modifying it via form.
   * Updating more pages at once is possible by adding an action field for each page   * Updating more pages at once is possible by adding an action field for each page
  
 That's it. That's it.
 +
  
 ===== Usage ===== ===== Usage =====
 +
 +
 ==== Form Syntax ==== ==== Form Syntax ====
  
Line 69: Line 74:
     * Relative pageids, which are solved with respect to current page (e.g. ''.:neighbourpage'')     * Relative pageids, which are solved with respect to current page (e.g. ''.:neighbourpage'')
     * **_self** to denote the same page as the form     * **_self** to denote the same page as the form
-  * ''pagemod_id'' : If using multiple pagemod enclosures in a page, this is to identify which enclosure to fill and include in the page. +  * ''pagemod_id'' : If using multiple pagemod enclosures in a page, this is to identify which enclosure to fill and include in the page. **NOTE: the ''pagemod_id'' value cannot include a dash character ("-"). A dash character will break the ''<pagemod>...</pagemod>'' section such that it will render as mere text and not function. The underscore character ("_") works.** 
-    + 
 +   
 ==== Template Syntax ==== ==== Template Syntax ====
  
 Defining a pagemod template is done within a page with the following code: Defining a pagemod template is done within a page with the following code:
 +
 <code> <code>
 <pagemod <pagemod_id> <params>> <pagemod <pagemod_id> <params>>
Line 84: Line 91:
 Some other wiki text around, that is visible again. Some other wiki text around, that is visible again.
 </code> </code>
 +
 Or an real example for adding rows to a table: Or an real example for adding rows to a table:
 +
 <code> <code>
 Some more text, and a table with as last row the pagemod placeholder. Some more text, and a table with as last row the pagemod placeholder.
Line 92: Line 101:
 </pagemod> </pagemod>
 </code> </code>
 +
 +**Note:** If the resulting table is later edited with [[plugin:edittable|EditTable Plugin]], then the above pagemod code will disappear (only existing contents remain).
 +
  
 The pagemod enclosure starts with: The pagemod enclosure starts with:
-<code> + 
-<pagemod <pagemod_id> <params>> +  <pagemod <pagemod_id> <params>> 
-</code>+
 where the following is true: where the following is true:
  
-  * ''pagemod_id'' : This is the id of the pagemod.  The form has an pagemod_id, it will modify all the pagemod enclosures with the same id.+  * ''pagemod_id'' : This is the id of the pagemod. The form has an pagemod_id, it will modify all the pagemod enclosures with the same id.
   * ''params'' : params are separated by '','' and can be one of the following:   * ''params'' : params are separated by '','' and can be one of the following:
     * ''output_after'' : indicates that the output of the translation must come after the rewrite of the pagemod enclosure, the default is to output before the rewrite     * ''output_after'' : indicates that the output of the translation must come after the rewrite of the pagemod enclosure, the default is to output before the rewrite
Line 108: Line 120:
   </pagemod>   </pagemod>
  
-and the contents are not shown when the wiki page is viewed.  Converting of the contents of the pagemod enclosure is done with the [[plugin:bureaucracy]] plugin's replacements function. So similar patterns are available.+and the contents are not shown when the wiki page is viewed. Converting of the contents of the pagemod enclosure is done with the [[plugin:bureaucracy]] plugin's replacements function. So similar patterns are available. 
  
 ===Meta variables=== ===Meta variables===
 +
 The meta variable are some extra variables for the pagemod plugin. The meta variables values are generated by the plugin at runtime. They are the following: The meta variable are some extra variables for the pagemod plugin. The meta variables values are generated by the plugin at runtime. They are the following:
  
Line 126: Line 140:
  
  
-===== FAQ =====+==== Incrementing number (by 1) ====
  
-==== Incrementing number possible? ==== +The [[plugin:bureaucracy#number_field|bureaucracy plugin]] has the following fields working perfectly with Pagemod Plugin:  
-The [[plugin:bureaucracy|bureaucracy plugin]] has some an ''number'' field and a ''hiddenautoinc'' which has auto incrementing counter on each succesfull submit.+  * ''number'' field, for example: 
 +    * ''number "Auto Incremental Nr. by one" ++ 0000 !'' where the field show up the following number, being able top modify it acording to your moment needs and 
 +  * ''hiddenautoinc'', hidden field. Ex: 
 +    * ''hiddenautoinc "Hidden Auto incremental field" '' 
 +  *  Both of them has auto incrementing counter on each succesfull submit.
  
 +<code>
 +number "One"
 +number "Two" ++
 +number "Third" >3 <40
 +hiddenautoinc "Four (notice: conflicts with Two)"
 +number "Fifth" 000
 +number "Sixth" ++ 000
 +</code>
 +
 +
 +==== Upload ====
 +
 +For the moment, //2019-04-02 14:53// the pagemod upload do not work right of the box. it needs the patpatch offered here:
 +
 +[[https://github.com/BaselineIT/dokuwiki-pagemod/blob/891b6465a4b2a1db1d548611cc2584b49ec815c1/helper/pagemod.php]]
 +
 +**On the same page example:**
 +
 +<code>
 +<form>
 +action pagemod _self add_sale
 +
 +fieldset "Add your bits to the table" !
 +number "Nr. de ordine internă automat" ++
 +date "Data începerii melodiei"
 +select   "Supplier" "B&C|Computer Corporation|IT Vision|Compu Cable|Matrix"
 +textbox  "Our Cost (Single)" !
 +textbox  "Quantity Ordered" !
 +
 +
 +fieldset  "Your Order"
 +textbox   "Your Name" !
 +select    "What do you want"  "Car|Blimp" !
 +
 +fieldset  "Car Parameters" "What do you want" "Car"
 +number    "Number of Wheels" !
 +textbox   "Extras" !
 +
 +fieldset  "Blimp Parameters" "What do you want" "Blimp"
 +select    "Filling" "Helium|Hot Air"
 +number    "Size" !
 +
 +fieldset  "Payment" 
 +yesno     "Can you pay right now?" !
 +
 +fieldset  "Details" "Can you pay right now?"
 +textbox   "Name" !
 +number    "Amount" !
 +
 +
 +fieldset  ""
 +yesno     "Incarci un fisier?"
 +
 +fieldset  "" "Incarci un fisier?"
 +file "Incarca un fisier"
 +
 +hidden "acoldesch" "={{"
 +hidden "acolinch" "=}}"
 +
 +hidden "foldedin" "=++Upload|"
 +hidden "foldedout" "=++"
 +
 +fieldset  ""
 +submit "Salveaza"
 +</form>
 +</code>
 +
 +<code>
 +<sortable r2>
 +^ Nr.  ^ Data Automata  ^ Date Manuala  ^ Supplier  ^ Our Cost (Single)  ^ Rotile?  ^ Quantity Ordered  ^ Upload  ^
 +| a12 | 06 Nov 2018 | 2018-11-06  | B&C |       | ++Upload|{{..:10_fl.mid}}++ |
 +<pagemod add_sale>| a@@Nr. de ordine internă automat@@ | @@meta.date.format.d M Y@@ | @@Data începerii melodiei@@  | @@Supplier| @@ | @@Quantity Ordered| @@ | @@Filling| @@ | @@Quantity Ordered| @@ | @@foldedin| @@@@acoldesch| @@@@Incarca un fisier| @@@@acolinch| @@@@foldedout| @@ |
 +</pagemod>
 +</sortable>
 +</code>
 +
 +--- [[user>florious|Florin C.]] //2019-04-02 15:10//
 +
 +
 +===== FAQ =====
  
 ===== Development ===== ===== Development =====
 +
 In November 2014 the pagemod plugin is updated to use a helper for the pagemod action. The Bureaucracy Plugin is updated in November 2014 as well, it will load this helper automatically if used in a form. The new version of Bureaucracy supports only the new version of Pagemod. In November 2014 the pagemod plugin is updated to use a helper for the pagemod action. The Bureaucracy Plugin is updated in November 2014 as well, it will load this helper automatically if used in a form. The new version of Bureaucracy supports only the new version of Pagemod.
  
 Remark: the file ''bureaucracy/actions/pagemod.php'' is now unused. You may remove it manually. Remark: the file ''bureaucracy/actions/pagemod.php'' is now unused. You may remove it manually.
  
-====Previous versions====+==== Previous versions ====
  
   * http://freecode.baselineit.net/dokuwiki/pagemod-latest.zip (previous version 1.2 - 2010-09-29)   * http://freecode.baselineit.net/dokuwiki/pagemod-latest.zip (previous version 1.2 - 2010-09-29)
Line 147: Line 246:
  
  
-**Manual installation of previous version**\\ +=== Manual installation of previous version === 
 In ''[wiki-root]/lib/plugins/'' this plugin adds: In ''[wiki-root]/lib/plugins/'' this plugin adds:
 +
 <code> <code>
 pagemod/       pagemod/      
Line 156: Line 257:
 bureaucracy/actions/pagemod.php   bureaucracy/actions/pagemod.php  
 </code> </code>
 +
 (note: since November 2014 no files are copied to bureaucracy plugin folder anymore) (note: since November 2014 no files are copied to bureaucracy plugin folder anymore)
  
 ===== Bugs and feature requests===== ===== Bugs and feature requests=====
-The pagemod plugin is strong related with the bureaucracy plugin. For general questions and issues see also the [[bureaucracy|Bureaucracy plugin]] wiki page and the [[https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/issues|Bureaucracy issue tracker]].+ 
 +The pagemod plugin is strongly intertwined with the bureaucracy plugin. For general questions and issues see also the [[bureaucracy|Bureaucracy plugin]] wiki page and the [[https://github.com/splitbrain/dokuwiki-plugin-bureaucracy/issues|Bureaucracy issue tracker]].
  
 Please report issues and requests for Pagemod Plugin at https://github.com/rendezz/dokuwiki-pagemod/issues Please report issues and requests for Pagemod Plugin at https://github.com/rendezz/dokuwiki-pagemod/issues
  
-\\ \\+QUESTION: Can pagemod be triggered conditionally? Let's say there is a form with a yesno field. Could pagemod be called only when the yesno field is checked? 
 + 
 + 
 +==== Problem and solution ==== 
 + 
 +The standard pagemod helper code does not do any substitution of page names according to bureaucracy variables.  I have designed a form which contains: 
 +  textbox Hnode 
 +  action  smg:config:@@Hnode@@ add_hwchange 
 +the problem being that ''@@Hnode@@'' is interpreted as "Hnode" and not the entered value.  The problem seems to lie in the helper script in ''public function run'' I have added a call to ''$this->replace'' (as is done in ''public function parsePagemod'') just before the ''resolve_pageid'' call.  It now appears to be working. 
 + 
 +diff: 
 +  39,40d38 
 +  <             //Allow for the substitution os elements of the page name 
 +  <             $page_to_modify = $this->replace($page_to_modify); 
  
 ===== Example usecases ===== ===== Example usecases =====
 +
 An bundle of example pages is available: An bundle of example pages is available:
-  * http://freecode.baselineit.net/dokuwiki/pagemod-namespace.tar.bz2   8-)+  * http://freecode.baselineit.net/dokuwiki/pagemod-namespace.tar.bz2
  
 Content: Content:
Line 173: Line 291:
   * Extending an existing table   * Extending an existing table
   * Adding additional list items   * Adding additional list items
 +
  
 ==== Minimalistic Guestbook ==== ==== Minimalistic Guestbook ====
 +
 I used this plugin for a minimalistic guestbook. Although my wiki can be edited by everyone, I think visitors would be more willing to leave a message through a little form. See http://windhoff.net/wiki/playground/playground how it works. An javascript based alternative to this is the [[plugin:disqus|plugin:disqus]]. I used this plugin for a minimalistic guestbook. Although my wiki can be edited by everyone, I think visitors would be more willing to leave a message through a little form. See http://windhoff.net/wiki/playground/playground how it works. An javascript based alternative to this is the [[plugin:disqus|plugin:disqus]].
-<file>+ 
 +<code>
 ======Guestbook===== ======Guestbook=====
 +
 ===== New Comment ===== ===== New Comment =====
 +
 <form> <form>
 action pagemod _self add_comment action pagemod _self add_comment
Line 189: Line 312:
  
 ===== Comments ===== ===== Comments =====
 +
 <pagemod add_comment output_after> <pagemod add_comment output_after>
 //@@meta.date.format.r@@:// //@@meta.date.format.r@@://
Line 194: Line 318:
 |<nowiki>@@Comment@@</nowiki> || |<nowiki>@@Comment@@</nowiki> ||
 </pagemod> </pagemod>
-</file+</code
- --- //M. 2010/04/02//+--- //M. 2010/04/02//
plugin/pagemod.1440030002.txt.gz · Last modified: 2015-08-20 02:20 by 220.244.230.6

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