Poll Mod v2.0.8 - Posted (5535 Views)
Development Team Member
Davio
Posts: 12217
12217
Poll Mod Version: 2.0.8
Current Author: Davio
Original Author: Slemieux
Last Modified: October 30, 2006
For Snitz Version: 3.4.06

Description: This version is a new and upgraded version from the pervious ones. With new features and lots of bug fixes. View the list of changes I have made in the list below. I hope everyone enjoys the new poll mod as much as I enjoyed working on it (yeah right). Thanks for your patience.
This update is mainly bug fixes and made compatible with Snitz FOrums 3.4.06.
Ease of Installation (1-Easy, 10-Hard): 8

Downloads:
3.4 Version
Main Link: http://www.snitzbitz.com/mods/details.asp?Version=All&mid=76
Updated Files Only: http://www.snitzbitz.com/mods/details.asp?Version=All&mid=76

Demo: http://www.dsilvera.com/forum/


Version 2.0.8 (October 3, 2006)
  • Updated files with latest forum version, 3.4.06.
  • Fixed bug in pop_poll.asp that allowed everyone to vote in a members only poll. (Ref.: Topic #62378)
  • Fixed bug in pop_poll.asp where vote results where not updated after a user voted. (Ref.: Topic #62378)
  • Fixed bug in inc_poll.asp where clicking on the View Results button did not take you to the results. (Ref.: Topic #62406)
Modified Files: pop_poll.asp, inc_poll.asp (for bug fixes only)


Version 2.0.7.01 (November 30, 2003)
  • Fixed bug when you use a quote in the poll answers, it comes out as 2 quotes instead.
Modified Files: post_info.asp


Version 2.0.7 (October 25, 2003)
  • Fixed bug when you delete a poll the poll data is not removed from the poll tables in the database.
Modified Files: pop_delete.asp

INSTALLATION/UPGRADE: Please read the readme.html file that is included. It also includes a FAQ section to common questions that you might ask about the mod.
SUPPORT:
If you have any problems please post them in the Help: MOD Implementation forum. DO NOT ASK FOR HELP OR POST YOUR ERROR MESSAGES IN THIS TOPIC!!

Poll Mod Add-On! Also check out the Site Poll Mod. It allows you to put your featured forum poll on your website. http://forum.snitz.com/forum/topic.asp?TOPIC_ID=40335<
 Sort direction, for dates DESC means newest first  
 Page size 
Posted
Average Member
SiSL
Posts: 671
671
POST.ASP

Code:
' ############################## Poll Mod ################################
if Request.QueryString("poll") = "1" then
'### Get poll from POLLS table
strSql = "SELECT " & strTablePrefix & "POLLS.P_WHOVOTES "
' CAREFUL FOR COMMAS
'for i = 1 to 15
' strSql = strSql & strTablePrefix & "POLLS.ANSWER" & CStr(i) & ", "
' strSql = strSql & strTablePrefix & "POLLS.COUNT" & CStr(i)
' if i <> 15 then
' strSql = strSql & ", "
' end if
'next
strSql = strSql & " FROM " & strTablePrefix & "POLLS"
strSql = strSql & " WHERE " & strTablePrefix & "POLLS.TOPIC_ID = " & strRqTopicID
set rsPoll = my_Conn.Execute (strSql)

if rsPoll.EOF or rsPoll.BOF then
Go_Result "You are trying to edit a topic that is not a poll"
else
strWhoVotes = rsPoll("P_WHOVOTES")
' I think I also removed something from here? end if
rsPoll.Close
set rsPoll = nothing

strSql = "SELECT ANSWER_TEXT "
strSql = strSql & " FROM " & strTablePrefix & "POLL_ANSWERS "
strSql = strSql & " WHERE POLL_ID = " & strRqTopicID & " ORDER BY ANSWER_ORDER ASC"
set rsPoll = my_Conn.Execute (strSql)

if rsPoll.EOF or rsPoll.BOF then
Go_Result "You are trying to edit a topic that is not a poll"
else
nTotal = 0
ReDim txtAns(15)
tumPollAnswers = rsPoll.GetRows
For i=0 to UBound(tumPollAnswers,2)
z = i+1
txtAns(z) = tumPollAnswers(0,i)
nTotal = nTotal + 1
Next

if CInt(strMaxVotes) > nTotal then
nCount = strMaxVotes
else
nCount = nTotal
end if
end if
rsPoll.Close
set rsPoll = nothing

end if
' ############################################################
Posted
Average Member
SiSL
Posts: 671
671
POST_INFO.asp

Code:
'############################ Poll Mod ##############################
if Request.Form("poll") = "1" then
strSql = "SELECT " & strTablePrefix & "TOPICS.TOPIC_ID "
strSql = strSql & "FROM " & strTablePrefix & "TOPICS "
strSql = strSql & "WHERE " & strTablePrefix & "TOPICS.T_ISPOLL = " & 1 & " "
strSql = strSql & "ORDER BY " & strTablePrefix & "TOPICS.T_DATE DESC"
set rsPollID = my_Conn.Execute (strSql)

PollID = rsPollID("TOPIC_ID")

rsPollID.close
set rsPollID = nothing

'## Forum_SQL - Add new poll to Polls Table
strSql = "INSERT INTO " & strTablePrefix & "POLLS (CAT_ID"
strSql = strSql & ", FORUM_ID"
strSql = strSql & ", TOPIC_ID"
strSql = strSql & ", P_WHOVOTES"
'for i = 1 to ubound(txtAns)
' strSql = strSql & ", ANSWER" & CStr(i)
' strSql = strSql & ", COUNT" & CStr(i)
'next
strSql = strSql & ") VALUES ("
strSql = strSql & Cat_ID
strSql = strSql & ", " & Forum_ID
strSql = strSql & ", " & PollID
strSql = strSql & ", '" & chkString(Request.Form("WhoVotes"),"SQLString") & "'"
'for i = 1 to ubound(txtAns)
' strSql = strSql & ", '" & chkString(txtAns(i),"") & "'"
' strSql = strSql & ", " & 0
'next
strSql = strSql & ")"

strSql = strSql & ""
For i=1 to UBound(txtAns)
if Trim(txtAns(i)) <> "" Then
strSql = strSql & ";INSERT INTO " & strTablePrefix & "POLL_ANSWERS (POLL_ID, ANSWER_TEXT, ANSWER_ORDER, ANSWER_COUNT) VALUES ("
strSql = strSql & PollID & ", '" & chkString(txtAns(i),"SQLString") & "'," & i & ", " & 0 & ")"
Else
exit for
End If
next
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
end if
'####################################################################

Also in POST_INFO.ASP

Code:
'############################ Poll Mod ###################################
if Request.Form("poll") = "1" then
'### Update poll answers and counts
strSql = "SELECT ANSWER_COUNT FROM " & strTablePrefix & "POLL_ANSWERS WHERE POLL_ID=" & Topic_ID & " ORDER BY ANSWER_ORDER ASC"
set rs=my_Conn.Execute(strSql)
if not rs.EOF Then
tumPolls = rs.GetRows
toplamPAnswers = UBound(tumPolls,2) + 1
Else
toplamPAnswers = 0
End If
rs.Close
set rs=nothing

strSql = "UPDATE " & strTablePrefix & "POLLS "
strSql = strSql & " SET P_WHOVOTES = '" & chkString(Request.Form("WhoVotes"),"SQLString") & "', "
strSql = strSql & " CAT_ID = " & cLng(aryForum(0)) & ", "
strSql = strSql & " FORUM_ID = " & cLng(aryForum(1)) & " "
'for i = 1 to CInt(Request.Form("count"))
' strSql = strSql & "ANSWER" & CStr(i) & " = '" & chkString(txtAns(i),"") & "'"
' if txtAns(i) = "" or chkString(Request.Form("resetpoll"),"SQLString") = "1" then
' strSql = strSql & ", COUNT" & CStr(i) & " = " & 0
' end if
' if ubound(txtAns) <> i then
' strSql = strSql & ", "
' end if
'next
strSql = strSql & " WHERE TOPIC_ID = " & Topic_ID
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords

strSQL = "DELETE FROM " & strTablePrefix & "POLL_ANSWERS WHERE POLL_ID = " & Topic_ID
my_Conn.Execute(strSQL)
strSQL = ""
for i=1 to CInt(Request.Form("count"))
if Trim(chkString(txtAns(i),"")) <> "" Then
strSQL = strSQL & "INSERT INTO " & strTablePrefix & "POLL_ANSWERS (POLL_ID, ANSWER_TEXT, ANSWER_ORDER, ANSWER_COUNT) VALUES ("
strSQL = strSQL & Topic_ID & ", "
strSQL = strSQL & "'" & chkString(txtAns(i),"SQLString") & "', "
strSQL = strSQL & i & ","
if chkString(Request.Form("resetpoll"),"SQLString") = "1" then
strSQL = strSQL & 0
Else
if i <= toplamPAnswers Then
z = i-1
strSQL = strSQL & tumPolls(0,z)

Else
strSQL = strSQL & 0
End If
End If
Else
Exit for
End If
strSql = strSql & ");"
next

my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
if Request.Form("resetpoll") = "1" then
'### Delete poll votes from POLL_VOTES table for this topic
strSql = "DELETE FROM " & strTablePrefix & "POLL_VOTES "
strSql = strSql & "WHERE " & strTablePrefix & "POLL_VOTES.TOPIC_ID = " & Topic_ID
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
end if
end if
'#########################################################################


Posted
Average Member
SiSL
Posts: 671
671
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
ANSWER_ORDER should not be nullable.
Posted
Average Member
SiSL
Posts: 671
671
Posted
Average Member
SiSL
Posts: 671
671
I think have to add good indexes to that too :P like my previous problem :)

PS: I'm such a mess code-writer, I guess it is like coding but not able to express what you did after :p Anarchic :)
Posted
Snitz Forums Admin
ruirib
Posts: 26364
26364
Althought not needed, a clustered index for POLL_ID in table Polls won't hurt and then another clustered on for POLL_ID,Order in Answers. Don't think you will have that many polls, so this should be enough...
You Must enter a message