MarkVote.pm


NAME

MarkVote - handles voting


SYNOPSIS

 <:Form type=special:>
  <:Input radiogroup ANSWER "" PassiveTyped(PART,ANSWER) ITEM_ID TITLE:>
  <:Do preedit MarkVote @ANSWER:>
 <:EndForm:>


DESCRIPTION

It is assumed that this postprocessor is executed in POLL item's context. It accepts the only parameter - comma separated list of given answer's ids. It may be as well list attribute.

There are several voting modes which are controlled by STATUS of POLL item.

ANONYMOUS
Everybody is allowed to vote. No checks are performed.

STANDARD
Everybody is allowed to vote - no Communiware authentification required. Repeated voting denied. Information about made voting is kept in user cookies. No information about ``who and for what has voted'' is stored in database.

OPEN
Only authentificated Communiware users can vote. Information about made voting is stored in database - VOTED links are set between user and POLL item as well as between user and choosen ANSWERs. Repeated voting is disallowed.

OPEN2
Like OPEN but repeated voting is allowed, but user's vote would be substracted from the count of votes for answer, he've voted previously, so only last vote takes effect.

SECRET
Like OPEN (only authentificated users are allowed to vote, no repeated voting is allowed, information is stored in database). The difference is that no information about which answers were choosen is stored. This means no VOTED links are set between user and ANSWERs.

After successful voting TOTAL attribute of POLL item is incremented (unless it is OPEN2 poll and user is voting second time). RESULT attribute of each choosen ANSWER is incremented as well.

16 октябрь 2007 13:45