How to create ZAPForum

Summary: Step by step instructions for creating a forum using ZAP.
Version:
Prerequisites: PmWiki, ZAP, AuthUser
Status: discontinued
Maintainer: Caveman (+ Jiri)

This recipe works with ZAP modules pre2007. Now I am testing JForum? (with ZAP200703!) which I expect to release in the middle of Apr 2007. Jiri

The instructions below will give you a nice threaded forum with controlled access.
More importantly it illustrates some of the principles involved with using ZAP.
There are many ways to modify this recipe. Thank you Jiri for sharing this fine tutorial! Caveman

Question
How to create PmWiki forum with controlled access using ZAP recipe
Follow the step by step instructions below.
Prerequisities:

Changes:

5.1.2007

  • New version using ZAP modules version Jan 1, 2007
  • There are two basic pages containing forms in Forms group.
    • Forms.ForumAddThread
    • Forms.ForumContents

These pages are shared in all ZAPforums created according to this recipe in the site.


Step 1 - Chose the forum name

Chose the forum name (for example ForumExample - this name is used in following text).
Following steps will create

  • PmWiki group named ForumExample
  • ForumExample.ForumExample will be the forum home page
  • ForumExample.GroupFooter will be the forum group footer
  • ForumExample.xxxx will be the threads home pages (xxxx is the thread id number)
  • ForumExample.xxxxCtttttttttt will be the "comment" (contributions) pages. (tttttttttt is a timestamp)

Step 2 - Create forum home page

  • Create and edit ForumExample.ForumExample page
    • Enter any text explaining what is the purpose of the forum
    • Append following snippet
(:title ForumExample :)
(:noGroupFooter:)
(:include Forms/ForumAddThread #start#end:)

Replace ForumExample strings with the forum name and adjust the title
accordingly in the snippet.
This page displays "New thread" button and a list of existing threads.
The page is reloaded and displays the "New thread form" when "New thread" button is used.

Step 3 - Create forum group footer page

  • Create and edit ForumExample.GroupFooter page
    • Enter any text you wish
    • Append following snippet
(:include Forms/ForumContents:)

Step 4 - maintain security

Use .../ForumExample/GroupAttributes?action=attr
and set passwords

  • Read to @nopass or to @someusersgroup
  • Edit to @admins
  • Set ZAP forms password to enable submitting the posts
    (to restrict to loggedin users only set id:*)

Use steps 1 - 4 to create any forum (i.e. ForumFilms, Trobleshooting etc.)

Following steps create 2 pages in Forms group and an optional PmWikiLc.XLPageLocal page for I18n.


Step 5 - Create Forms.ForumAddThread page

insert snippet

[[#start]]
(:zapget:)
(:if !equal {$addthread} "yes":)
(:zapform name=formNew action={$PageUrl}?addthread=yes:)
(:input submit value="$[New thread]" formNew:)
(:ifend:)

(:if equal {$addthread} "yes":)
(:zapdata {$Group}.#:)
'''$[Create new thread]:'''

(:zapform name=formthread:)
(:zap datapage="{$Group}.#" formthread:)
(:zap nextpage="{$Group}.#" formthread:)
(:input hidden addthread " ":)
(:input hidden ThreadId value={#g {$Group}|thread}:) 
(:input hidden DateWritten "{#t +|%e.%m.%Y  %R}":)
||border=0
||  ||(:input hidden WrittenBy value={$AuthId}:)
||$[Thread]: ||(:input text Topic size=40:)
||$[Post]: ||(:textarea name=Post cols=40 rows=5:)(:keep {$MagicBox}:)(:textareaend:)
|| ||(:input submit value="$[Submit]" formthread:)
(:zap savedata="ThreadId,DateWritten,WrittenBy,Topic,Post" formthread:)
(:tableend:)
(:ifend:)
(:zapend:)
----
(:if !equal {$addthread} "yes":)
[[#forumthreadslist]]
'''$[Threads]:'''  
(:pagelist group="{$Group}" name=-*C*,-{$Group},-New,-RecentChanges,-GroupAttributes,-GroupFooter, fmt=Forms/ForumAddThread#forumthreadsfmt:)
[[#forumthreadslistend]]
(:ifend:)

[[#end]]

[[#forumthreadsfmt]]
(:if equal {<$Group}:)||border=1 cellpadding=5px bgcolor=#ffffcc cellspacing=0px
||'''ID''' ||'''$[Thread]'''                 ||  '''$[Date]'''||'''$[By]'''
(:ifend:)
||[[{=$Group}/{=$Name}]] ||{=$:Topic} || {=$:DateWritten}||{=$:WrittenBy} 
[[#forumthreadsfmtend]]

(:noGroupFooter:)

Step 6 - Create Forms.ForumContents page

insert snippet

[[#gfstart]]
(:zapdata:)
>>right<<[[{$PageUrl}?action=rss?order=-time?group={*$Group}?name={*$Name}*,-{*$Name}C*?list=normal |Pic:/feed.gif"{$Topic}"]]
>><<
(:table border=0:)
(:cellnr valign=bottom:)$[Thread]: 
(:cell:)
>><<
{$Topic}
>><<
(:cellnr:)Id: 
(:cell:){*$Name}
(:cellnr:)$[Author]: 
(:cell:){$WrittenBy}
(:cellnr:)$[Date]: 
(:cell:) {$DateWritten}
(:cellnr valign=top:)$[Post]: 
(:cell:)
>><<
{$Post}
>><<
(:tableend:)

''$[The most recent comments are listed first]''

(:pagelist name="{*$Group}.{*$Name}C*" fmt="Forms/ForumContents#forumcomments" -RecentChanges -GroupHeader -GroupFooter order=-time:)


'-[[#gfstart|&uarr; $[up] ]]-'

----

[[#addcom]]
'-$[Add comment]:-'
(:zapdata:)
(:zapform:)
(:input hidden WrittenBy value={$AuthId}:)\\
(:input hidden time "{#t +|%e.%m.%Y  %R}":)
(:input hidden ThreadId value={*$Name}:)
(:textarea name=Remark cols=60 rows=4:)(:keep {$MagicBox}:)(:textareaend:)\\
(:zap datapage="{$Group}.{$Name}C+":)
(:zap savedata="WrittenBy,Remark,time,ThreadId":)
(:input submit value="Submit":)
(:zapend:)


'-[[#gfstart|&uarr; $[up] ]]-'

(:if false:)
[[#forumcomments]]
(:table cellpadding=2px cellspacing=0px width=95%:)
(:cellnr bgcolor=#ffffcc:)$[commented by] '''{=$:WrittenBy}'''
(:cell bgcolor=#ffffcc align=right width=100:)'-{=$:time}-'
(:cellnr :){=$:Remark}
(:tableend:)

[[#forumcommentsend]]
(:ifend:)
Notes:
There is the RSS feed icon in the begining - remove the right aligned block
if you don't wish the icon.
I used Pic:/feed.gif - this works if you have
defined "Pic" in the Site.InterMap

Step 7 - Create PmWikiLc.XLPageLocal (optional)

to display text constans in proper language.
Included snippet is PmWikiLc.XLPageLocal template.
*Make translations and save with proper name
(ie German page should be PmWikiDe.XLPageLocal)

  • add
    XLPage('lc','PmWikiLc.XLPageLocal'); # my local translations
    to your local config.php - replace "lc" and "Lc" properly ie:
    XLPage('de','PmWikiDe.XLPageLocal'); # my local German translations

If no local translation is present, the default language is English.

## Jiri's ZAPForum snippets

'TimeFmt' => '%Y-%m-%d %H:%M EET'

'Follow all threads' =>'',
'follow this thread' =>'',
'This is a threads list and links to their comments' =>'',
'Choose any thread and add your comment' =>'',
'create new thread' => '',
'Threads' =>'',
'Thread' =>'',
'New thread' =>'',
'login' =>'',
'Create new thread' =>'',
'Post' =>'',
'Submit' =>'',
'group' =>'',
'Author' =>'',
'Date' =>'',
'add comment' =>'',
'The most recent comments are listed first' =>'',
'up' =>'',
'By' =>'',
'commented by' =>'',

Jiri, 5.1.2007


Comments


:: Expiration Notice

It Seems to be that http://www.zapsite.org resgistration has expired. E. Marte Dic-17-2007