[pmwiki-users] brainstorm.ubuntu.com

Hans design5 at softflow.co.uk
Sat Mar 1 13:43:53 CST 2008

Saturday, March 1, 2008, 3:15:55 PM, Martin Kerz wrote:
> Do you have an idea, how something like brainstorm.ubuntu.com could be
> implemented in pmwiki?

Since i know Fox inside out i would do everything with Fox ;-)

> I would create a dedicated group (ideas) in which every proposal has  
> it's own page. The page name should be automatically generated and  
> have a unique number. Idea #4 will have the pagename: Ideas.4

> So far so good. I guess the automatic numbering could be achieved by
> using newpageboxplus.

see heading:
    Creating a page with a serial number in name
for a fox form example to create a new page with a serial.
It is using serial.php to calculate the next serial
number available.

An example:

(:fox newideas template=#newidea redirect=1:)
(:input hidden newedit '{$$(serial Ideas)}':)
Title: (:input text title:)
(:input submit post "Create New Ideas Page":)
(:foxend newideas:)

template for this (put on same page):

(:if false:)
(:title {$$title}:)(:votes: 0:)

%comment% add your idea here 
[[#newideaend]] (:if:)

There is actually no need for serial number page names, pages could
have the title as a page name.

Note that in above form 'newedit' is used as a special page target:
the target gets opened in edit mode.

> Every page should have a PTV, probably called "votes".

> On Ideas.HomePage, I would display a pagelist displayed by title,  
> together wth the first lines of the page and, seperately, the value of
> $votes, sorted by $votes.

> The only tricky part would be to implement the up and down arrows to  
> increment or decrement $votes for the specific title from the pagelist
> _and_ from within the page itself. Does anyone have an idea how to  
> properly implement this?

Again i would use  a fox form, or several:
one for the upvotes, one for the downvotes.
The arrow images could be the submit buttons of the forms.
The fox forms would be included as part of the custom pagelist format.
Both upvotes and downvotes forms would update the 'votes' PTV on the
associated page. We could use a math markup expression to increase or
decrease by one the existing PTV votes value.
http://www.pmwiki.org/wiki/Cookbook/MarkupExprPlus will do nicely.

Here is an example for the pagelist template, I tested it:

(:template first:)
(:table width=100% :)
(:template each:)
(:cellnr width=10%:)
(:fox upvotes redirect={*$FullName} post=1:)
(:foxptv target={=$FullName} ptvfields=votes:)
(:input hidden votes '{$$(add {{=$FullName}$:votes} 1)}':)
(:input image name=post src='http://pathtoimages/up.png' :)
(:foxend upvotes:)
(:fox downvotes redirect={*$FullName} post=1:)
(:foxptv target={=$FullName} ptvfields=votes :)
(:input hidden votes '{$$(sub {{=$FullName}?:votes} 1)}':)
(:input image name=post src='http:/pathtoimages/down.png' :)
(:foxend downvotes:)
(:include {=$FullName}:)
(:template last:)

Note that a standard fox submit button would be like
(:input submit post 'Button label':)
and Fox expects the 'post' name. Putting that into
(:input image post ....:) did lead to a fox error, so I had to
specify the post=1 option.
Note also that i could not use Attach:up.png inside the markup, like
(:input image post Attach:up.png :)
I had to use a url with src=fullimageurl

> Combine this with commentbox, and you should have a similar feature  
> like brainstorm.ubuntu.com

Okay, or use  a FoxCommentBox

How do you set a pagelist order according to the PTV votes value?


More information about the pmwiki-users mailing list