[pmwiki-users] zap: edit q's

The Editor editor at fast.st
Wed Jun 20 08:45:40 CDT 2007


On 6/20/07, noskule <noskule at gmx.net> wrote:
> hi list/dan
> I'm checking out zap to edit pages.
>
> My goal is to use the pmwiki edit command for admins and the zap edit
> command for  authors:
>
> pmwiki edit:
>    admin that us it will see all the wiki syntax as usual.
>
> zap edit:
>    authors will see a form with fields but shouldn't see data markup
>
>
> Example: http://netstreams.org/test/pmwiki/index.php/ZapEdit/TestEditForm
>
>
> The code:
> (:zapform:)
> '''Title:'''\\
> (:input text Title '{ZapEdit.TestEdit$:Title}':)\\
> '''Summary:'''\\
> (:input text Summary '{ZapEdit.TestEdit$:Summary}':)\\
> '''Text:'''\\
> (:textarea name=editbody rows=7 cols=40:){(source ZapEdit.TestEdit)}\\
> '''Categories:'''\\
> (:input text Categories '{ZapEdit.TestEdit$:Categories}':)\\
> '''Author Comment:'''\\
> (:input text Author_Comment '{ZapEdit.TestEdit$:Author_Comment}':)\\
> (:zap editsavedata="Title,Summary,Categories,Author_Comment":)
> (:zap edit="ZapEdit.TestEdit":)
> (:input submit:)
> (:zapend:)
>
>
> The textarea is saved. But not the other textfields. What I'm doing wrong.

First of all to get the fields to save, you need to change
editsavedata to savedata. ZAP doesn't recognize the editsavedata
command.

> How to hide the datamarkup? The texatea is not only shows the content
> but also the datamarkup. Is there a way to hide it?

The ZAP edit form does not really work that much differently than
PmWiki's I don't think--ie, it pulls in the same source and resaves
the changes. However, ZAP's edit command does have the ability to edit
sections defined by an anchor id. So you could set up a page to look
like this:

[[#IDcontent]]
page content....

[[#IDdata]]
(:title: my title:)
(:summary: my summary:)

etc.

Then your edit form would look something like:

> (:zapform:)
> '''Title:'''\\
> (:input text Title '{ZapEdit.TestEdit$:Title}':)\\
> '''Summary:'''\\
> (:input text Summary '{ZapEdit.TestEdit$:Summary}':)\\
> '''Text:'''\\
> (:textarea name=editbody rows=7 cols=40:){(source ZapEdit.TestEdit#IDcontent)}\\
> '''Categories:'''\\
> (:input text Categories '{ZapEdit.TestEdit$:Categories}':)\\
> '''Author Comment:'''\\
> (:input text Author_Comment '{ZapEdit.TestEdit$:Author_Comment}':)\\
> (:zap savedata="Title,Summary,Categories,Author_Comment":)
> (:zap edit="ZapEdit.TestEdit#IDcontent":)
> (:input submit:)
> (:zapend:)

Basically the anchor in the source marup only pulls in part of the
markup, and the anchor in the edit command only resaves that part. The
savedata command saves to the bottom of the page as usual. This
requires that you setup the pages with the content and data sections
when you create the page (which can be done easily enough using a
template).

Or you could rename the editbody field to postbody, remove the anchor
from the edit command, move savedata to after the edit command, and
add this line:

(:zap editbody="[[#IDcontent]]{postbody}\n[[#Ddata]]":)

This resaves the entire page, creating the proper format
automatically, overwriting the data fields, but then resaving them
immediately thereafter. The nice thing is it could be used both to
create and edit pages. For what it's worth this is basically how
ZAPwiki handles page attributes. They are all admin defined and are
only created and used when and where you want them. They are also
invisible when editing page content.

I haven't tested the suggestions above, just a quick off the cuff
answer. Let me know if this works for you. It would make a great
snippet. Of course as you could also add data fields like author and
time created, time modified, it kind of makes the whole page
attributes idea in PmWiki's current page format rather redundant...
Other than passwords perhaps.

Cheers,
Dan



More information about the pmwiki-users mailing list