PollMgr.evalNewPoll (question, choices, creator)
check if poll is ok. if true, save new Poll

  • Parameter Object:
    the req.data object coming in from the action
  • Parameter Object:
    the user as creator of the poll
  • Returns
    Object containing the properties - error (boolean): true if error occured, false otherwise - message (String): an error or a confirmation message - url (String): the URL string of the poll - id (Number): the internal Hop ID of the poll
Sourcecode in PollMgr/objectFunctions.js:
1:   function evalNewPoll(question, choices, creator) {
2:      if (!question || !choices || choices.length < 2)
3:         throw new Exception("pollMissing");
4:      var newPoll = new Poll(question, creator);
5:      this.add(newPoll);
6:      for (var i=0; i<choices.length; i++)
7:         newPoll.add(choices[i]);
8:      return new Message("pollCreate");
9:   }