<% pollid=request("p") if pollid="" or not(isnumeric(pollid)) then response.end zoneid=request("z") msg=request("msg") if msg="already" then msg=alreadyvotedmsg elseif msg="voted" then msg=thankyou end if set conn=server.createobject("ADODB.Connection") conn.open connection '//// Get poll properties //// psql="select * from xlaAPMpolls where pollid="&pollid set rs=conn.execute(psql) if not(rs.eof) then allowcomments=rs("allowcomments") allowviewresults=rs("allowviewresults") allowmultiplevotes=rs("allowmultiplevotes") displaynumbers=rs("displaynumbers") displaycomments=rs("displaycomments") displaytotalreplies=rs("displaytotalreplies") viewtextreplies=rs("viewtextreplies") pollreplies=rs("pollreplies") inprevious=rs("inprevious") status=rs("status") end if rs.close set rs=nothing '/// get Answers with replies if allowviewresults<>"" or (inprevious<>"" and status=0) then psql="SELECT Sum(numreply) AS totalreplies, answerid FROM xlaAPMreplies where answerid in (select answerid from xlaAPManswers where questionid in (select questionid from xlaAPMquestions where pollid="&pollid&")) GROUP BY answerid;" set conn=server.createobject("ADODB.Connection") conn.open connection set d=Server.CreateObject("Scripting.Dictionary") set rs=conn.execute(psql) do until rs.eof answerid=rs("answerid") totalreplies=rs("totalreplies") d.add answerid,totalreplies rs.movenext loop rs.close set rs=nothing end if '/// Check if Zone allows for previous polls if zoneid<>"" then psql="select zoneid from xlaAPMzones where zoneid="&zoneid&" and allowprevious<>''" set rs=conn.execute(psql) if rs.eof then allowprevious="" else allowprevious="checked" rs.close set rs=nothing end if conn.close set conn=nothing response.buffer=true response.flush %> Poll Results
<% '/// Can the voter view the results ? /// if allowviewresults<>"" then '/// Get Questions /// psql="select * from xlaAPMquestions where pollid="&pollid&" order by qorder" set conn=server.createobject("ADODB.Connection") conn.open connection set rs=conn.execute(psql) do until rs.eof qorder=rs("qorder") question=rs("question") questionid=rs("questionid") qtype=rs("qtype") if displaynumbers<>"" then qnumber=qorder&") " else qnumber="" %> <% '//// Get Answers and Replies psql2="select * from xlaAPManswers where questionid="&questionid set rs2=conn.execute(psql2) c=0 do until rs2.eof answerid=rs2("answerid") answer=rs2("answer") if d.exists(answerid) then replies=d.item(answerid) else replies=0 percent=0 averagescale=0 if pollreplies>0 then percent=replies*100/pollreplies averagescale=formatnumber(replies/pollreplies,2) end if if displaytotalreplies="" then replies="" if qtype<3 then '/// Multiple Selection barlength=int(percent*120/100)+7 c=c+1 if c>4 then c=1 barname="bar"&c&".gif" %> <%elseif qtype=5 then '/// Rating / Scale%> <%elseif viewtextreplies<>"" then '/// Free Text%> <%else%> <%end if 'Qtype rs2.movenext loop rs2.close set rs2=nothing %> <% rs.movenext loop '/// get Next Question rs.close set rs=nothing set d=nothing conn.close set conn=nothing if displaytotalreplies<>"" then%> <%end if if displaycomments<>"" then%> <%end if if allowprevious<>"" and zoneid<>"" then%> <%end if end if 'allowviewresults%>
 
<%=msg%>
<%=qnumber & rs("question")%>
<%=answer%>
<%=replies%>
(<%=formatnumber(percent,2)%>%)
<%=answer%> <%=averagescale%>
    <% psql3="select textreply from xlaAPMreplies where answerid="&answerid&" order by voteid asc" set rs3=conn.execute(psql3) do until rs3.eof if rs3("textreply")<>"" then response.write "
  • "&server.htmlencode(rs3("textreply")&"")&"
  • " rs3.movenext loop rs3.close %>
Replies to this question are not available.
 
Total Replies : <%=pollreplies%>

Powered By Absolute Poll Manager XE
By XIGLA SOFTWARE