[pmwiki-devel] zap rewrite process...

The Editor editor at fast.st
Fri Dec 15 05:53:58 CST 2006

The ZAP rewrite is coming along great, but I do have one conceptual
hurdle, and a couple minor questions related to how PmWiki works.  The
minor questions first:

I've switched a lot of the ways zap works to plug into existing PmWiki
architecture, including custom page variables and custom conditionals.
 Not only does this simplify the zap code, but it makes it more
flexible for admins.  For example, now you can use any conditional
expression recognized in PmWiki for post submission form processing.
It seems to be working but...

1). I use this line modified from what Pm gave, where $zapif[0] is the
exact conditional expression, and changing the $ZAParray results in
changes in how the script is processed.

     if (CondText($pagename, "! $zapif[0]", true))
$ZAParray[$zapif[1]] = $zapif[2];

For some reason this seems to give the exact opposite of what I would
expect.  Thus the ! before $zapif[0].  It works fine like this, but if
I have a negative conditional expression like "!equal var1 someval"
then the value passed to CondText will look like "! !equal var1
someval".  Or if I use a complex expression, I will be sending "! expr
...".  I'm wondering if anyone can suggest a workaround?

2). On a more specific note, I have a (:if pagefmt Bob:) to test
whether or not Bob would make a valid page name using this line

     if ($x == PageVar(MakePageName($pagename, $x), '$Name')) return true;

It works but fails if I put (:if pagefmt Bob.Test:).  How do I change
my test line to determing if it is a valid full page name?

Here's the bigger conceptual problem...  The way zap now works is
something like this:

(:input text Field1 value:)
(:zap Field2="value" :)
(:input submit:)

The zap markup adds Field2 to the session variable ZAParray at markup.
 When the form is submitted zap takes the Field1 post value and
appends it to the ZAParray.  Normally this works fine.  BUT as you can
see the order of ZAParray will be reversed with Field2 being processed
first and Field1 processed second.  In most cases this won't matter,
but it some it does.  Can anyone think of a simple way the order can
be preserved?  I don't have any great ideas, other than to replace all
the input field with custom markups, but I do NOT want to do that.


More information about the pmwiki-devel mailing list