[pmwiki-users] Tweak to saving a page

Hans design5 at softflow.co.uk
Fri Feb 13 06:40:54 CST 2009

Friday, February 13, 2009, 12:08:51 PM, Peter Lutz wrote:

> I want pmwiki to always save as the next page in queue not yet existent.

> Example:
> "Assume a page Querygroup.5 and 3 users A,B and C click a button to
> make and edit Querygroup.6. A drops and he is not saving anything. B
> saves first and his page becomes Querygroup.6, C saves last and his page becomes Querygroup.7."

> Is there already a recipe for this?

I would use Cookbook:Fox and create a custom new page form.
You can set it up with whatever input fields you wish, not just a
textarea field. You set up  a template which determines how the
submitted content shall appear in the target page. And you set up the
target page using the serialname markup expression as you do for you
present NewPage form, but with this twist:

(:input hidden target {$$(serialname ..........)} :)

The two $$ signs make Fox evaluate the expression on page submission,
and not when a user opens the form page. So your ne wpage names will
automatically be in serial, no conflict if a user drops out of
creating a new page.

With Fox forms you can also add a parameter pagecheck=1 which will
check if the target page exists already, and throw a warning.
But it should not be necessary if you use the method above, as the
serialname expression will look up the existing pages, finds the
highest in the serial numbers, and goes one higher. as long as it
does so at time of form submission and not the time the form page is
opened it should be fine.


More information about the pmwiki-users mailing list