Prototype Poll
ACTIONS | FUNCTIONS | MACROS | SKINS | TEMPLATES | TYPE.PROPERTIES

Actions
delete_action
delete action
edit_action
edit action
main_action
main action
results_action
action renders the current result of a poll
toggle_action
action toggles poll between closed and open
 
Functions
checkAccess(action, usr, level)
permission check (called by hopobject.onRequest())
checkDelete(usr, level)
check if user is allowed to delete a poll
checkEdit(usr, level)
check if user is allowed to edit a poll
checkVote(usr, level)
check if user is allowed to vote in a poll
constructor(question, creator)
constructor function for poll objects
deleteAll()
function loops over the choices of a poll and removes them
evalPoll(question, choices, creator)
check if poll is ok. if true, save modified poll
evalVote(param, usr)
check if a vote is ok. if true, save modified vote
 
Macros
Poll.choices
macro renders one choice of a poll (either as text or as editor)
Poll.closelink
macro renders a link as switch to close/re-open a poll
Poll.closetime
macro renders the time a poll was closed
Poll.deletelink
macro rendering a link to delete a poll (only if the user also is the creator)
Poll.editlink
macro renders a link to the poll editor
Poll.question
macro renders a poll's question (either as text or editor)
Poll.results
macro renders results of a poll as bar chart
Poll.total
macro renders totals of a poll
Poll.viewlink
macro renders a link to the poll
 
Skins
edit.skin
response.action, response.choices
main.skin
response.action
mgrlistitem.skin
results.skin
 


type.properties
_db = antville
_table = AV_POLL
_id = POLL_ID
_parent = site.polls

##
## object references
##
site              = object(Site)
site.local        = POLL_F_SITE
site.foreign      = SITE_ID

creator           = object(User)
creator.local     = POLL_F_USER_CREATOR
creator.foreign   = USER_ID

modifier          = object(User)
modifier.local    = POLL_F_USER_MODIFIER
modifier.foreign  = USER_ID

##
## primitive properties
##
question    = POLL_QUESTION
closed      = POLL_CLOSED
createtime  = POLL_CREATETIME
modifytime  = POLL_MODIFYTIME

##
## collections
##
_children         = collection(Choice)
_children.local   = POLL_ID
_children.foreign = CHOICE_F_POLL
_children.order   = CHOICE_ID asc

votes             = collection(Vote)
votes.accessname  = VOTE_USERNAME
votes.local       = POLL_ID
votes.foreign     = VOTE_F_POLL