__section__
default
__description__
Display votes and graph of votes

* qid = question ID

__title__

__page__
misc
__lang__
en_US
__name__
pollplug
__template__
[% pb = Slash.getObject("Slash::PollBooth") %]
[% IF !qid && skid;
	qid = pb.getCurrentQidForSkid(skid);
 END %]
[%
   poll =  pb.getPollQuestion(qid);
   answers  = pb.getPollAnswers(qid, ['answer', 'votes']);
   totalvotes = poll.voters;
%]
[% maxvotes = -1 %]
[% FOR answer = answers %]
	[% IF answer.1 > maxvotes;
		poll_option     = answer.0;
		votes      = answer.1;
		percent    = poll.voters ? (votes / totalvotes * 100) : 0; 
		percent = percent.int;
		maxvotes = votes || "";
        END; 
END %]
<div id="pollplug">
[% percent %]% Voted '[% poll_option %]' for '<a href="[% gSkin.rootdir %]/pollBooth.pl?op=vote&amp;qid=[% qid %]&amp;aid=-1" onclick="$('pollplug_pb').style.display='block'; $('pollplug').style.display='none'; return false;">[% poll.question %]</a>'
</div>
<div id="pollplug_pb" style="display:none">

[% is_open = pb.isPollOpen(qid) 
   has_activated = pb.hasPollActivated(qid);
   pollfull = pb.getPoll(qid);
   commentcnt = 0;
   disc = Slash.db.getDiscussion(pollfull.discussion);
   IF disc;
	   commentcnt = disc.commentcount;
   END;
%]
[% PROCESS pollbooth question = poll.question answers = pollfull.answers qid = qid has_activated = has_activated poll_open = is_open voters = poll.voters comments = commentcnt %]
</div>

__seclev__
10000
__version__
$Id: pollplug;misc;default,v 1.7 2008/02/05 19:10:34 tvroom Exp $
