Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Topic Rating Mod for 3.4.03
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

beznas
Starting Member

Morocco
23 Posts

Posted - 30 September 2002 :  19:21:48  Show Profile
This is a Rating system for topics the version 3.4.03

Members of your forums can rate a Topic from 1 to 10.

The average of the ratings of a topic are displayed in a graphical way.




Download it here: http://www.beznas.com/download/



Free Palestine!

Edited by - beznas on 30 September 2002 20:41:59

dayve
Forum Moderator

USA
5820 Posts

Posted - 30 September 2002 :  19:32:27  Show Profile  Visit dayve's Homepage
no demo? no additional info? I'm not sure people are going to want and try this without some more info.

Go to Top of Page

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 30 September 2002 :  20:03:37  Show Profile
No readme file either.. There is only the 2 new files and the TOPIC.ASP. Is there instructions in that?

Cheers,

David Greening
Go to Top of Page

beznas
Starting Member

Morocco
23 Posts

Posted - 30 September 2002 :  20:23:57  Show Profile
I'm sorry, I was so excited that it worked after a long day writing the mod!

[size=2]


Just upload the:
dbs_beznas_topic_rating_3.4.03.asp
topic.asp
rate.asp
and the 3 images to your main forum folder if you're running a virgin version of the forums

You will have to update your database by running the Mod Setup from your Admin Options.

An other way to do it is to cut and paste these lines in your topic.asp

'######################### BEZNAS RATING MOD ######################



%>


<table>
<tr valign="middle">
<td valign="top">
<%

dim rs
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = my_conn


rs.Open "SELECT *FROM " & strTablePrefix & "TOPICS " & _
" WHERE TOPIC_ID = " & TopicID




const MIN_RATINGS_BEFORE_SHOW = 1

dim rs1
dim avgRating
dim avgWhole
dim decPart
dim decCalc
dim finalRating
dim altText

set rs1 = Server.CreateObject("ADODB.Recordset")

rs1.ActiveConnection = my_conn
rs1.Open "SELECT SUM(rating), COUNT(*) FROM " & strTablePrefix & "RATING " & _
" WHERE tId= " & TopicID

if rs1.Fields(1) < MIN_RATINGS_BEFORE_SHOW then
'No ratings
Response.Write "<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """> Be the first to rate this topic! </font>"
else
'This CD has ratings, let's display the average
avgRating = rs1.Fields(0).Value / rs1.Fields(1).Value

if Instr(1, CStr(avgRating), ".") > 0 then
'The average rating is a decimal, we need to either
'round the value up/down
avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1)
decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2)

if decPart <> "" then
'Work out whether or not we have to round this
'rating up or down

if CInt(decPart) >= 5 then
decCalc = .5
else
decCalc = 0
end if

finalRating = CInt(avgWhole) + CCur(decCalc)
else
finalRating = avgRating
end if
else
finalRating = avgRating
end if

'Setup the alt text for the images
altText = "Average visitor rating of " & finalRating & " out of 10"

for i = 1 to CInt(finalRating)
Response.Write "<img alt='" & altText & "' src='rating_on.gif'>"
next

if CInt(finalRating) <> finalRating then
'This article has a .5 rating, such as 5.5
Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"

for i = CInt(finalRating)+2 to 10
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
next
else
for i = CInt(finalRating)+1 to 10
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
next
end if
end if
%>
</td>
<td valign="middle">
<form name="frmRate<%=rs.Fields(0).value%>" action="rate.asp" method="post">
<input type="hidden" name="tId" value="<%=TopicID%>">
<Select name=rating>
<%
for i = 1 to 10
Response.Write "<option name='rating' value='" & i & "'>"& i &"</option> "
next
%>
</select><font face=verdana size=1>  /10</font> 
<input type="submit" value="Rate It!">
</form>
</td></tr></table>
<%

rs.Close
set rs = Nothing
rs1.Close
set rs1 = Nothing

'##### END OF BEZNAS RATING MOD ######################




right after these:




if (AdminAllowed = 1) or (TMember_ID = MemberID and Topic_Replies < 1) then
Response.Write "  <a href=""JavaScript:openWindow('pop_delete.asp?" & ArchiveLink & "mode=Topic&TOPIC_ID=" & Topic_ID & "&FORUM_ID=" & Forum_ID & "&CAT_ID=" & Cat_ID & "')"">" & getCurrentIcon(strIconDeleteReply,"Delete Topic","align=""absmiddle"" hspace=""6""") & "</a>" & vbNewLine
end if


rate.asp and the images should stay as they are.

Here's a snap shot at my forums. (Excuse my French )





Free Palestine!

Edited by - beznas on 01 October 2002 00:58:25
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 30 September 2002 :  22:09:43  Show Profile
Does this mod have anything to do with the original topic rating mod?
Go to Top of Page

beznas
Starting Member

Morocco
23 Posts

Posted - 30 September 2002 :  23:27:14  Show Profile
quote:
Originally posted by bjlt

Does this mod have anything to do with the original topic rating mod?



It's the same idea but different. I have seen that MOD but I could never have it to work. I wanted it so badly because I have a jokes site and I need people to rate them. So I just wrote the whole thing from scratch






Free Palestine!

Edited by - beznas on 30 September 2002 23:30:04
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 30 September 2002 :  23:30:54  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
I don't think you need to set a connection because there is already one open.

@tomic

SportsBettingAcumen.com
Go to Top of Page

beznas
Starting Member

Morocco
23 Posts

Posted - 30 September 2002 :  23:34:10  Show Profile
quote:
Originally posted by @tomic

I don't think you need to set a connection because there is already one open.

@tomic



I'm no scripting guru but If you can do that please let me know so that I can remove it from the original script.



Free Palestine!
Go to Top of Page

@tomic
Senior Member

USA
1790 Posts

Posted - 30 September 2002 :  23:48:25  Show Profile  Visit @tomic's Homepage  Send @tomic an ICQ Message
remove:

dim conn

set conn = Server.CreateObject("ADODB.Connection")

conn.Open strConnString



Change this:
rs.ActiveConnection = conn

to:
rs.ActiveConnection = my_Conn


Change:
rs1.ActiveConnection = conn

To:
rs1.ActiveConnection = my_Conn

Add this to the bottom of the code:

<%
rs.Close
set rs = Nothing
rs1.Close
set rs1 = Nothing
'########## END OF BEZNAS RATING MOD ######################


@tomic

SportsBettingAcumen.com

Edited by - @tomic on 30 September 2002 23:50:13
Go to Top of Page

minhluan70
Junior Member

USA
120 Posts

Posted - 01 October 2002 :  01:58:34  Show Profile  Visit minhluan70's Homepage
http://www.vietsuns.com/phorum/topic.asp?TOPIC_ID=533
This is original script from Beznas. I haven't modified what @tomic recommended!

Man proposes, God disposes
Go to Top of Page

red1
Junior Member

355 Posts

Posted - 01 October 2002 :  04:21:35  Show Profile
is it posssible to view the rating in forum.asp, and maybe to sort topics according to rating?

My Mods:
New Events Calendar
New Non-database Active Users
Go to Top of Page

beznas
Starting Member

Morocco
23 Posts

Posted - 01 October 2002 :  04:49:53  Show Profile
quote:
Originally posted by red1

is it posssible to view the rating in forum.asp, and maybe to sort topics according to rating?




I'm working on that.



Free Palestine!
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 01 October 2002 :  06:02:59  Show Profile
Beznas, here's a read.me / asp file you can use for your zip file:

Extract all files EXCEPT topic.asp to forum root directory.

Go to Administrative options page, Mod Setup, and select "Beznas Topic Rating 1.0 for 3.4.03".

When complete, make the following modifications to topic.asp.



Search for this line:

' DEM --> Start of Code added for Full Moderation

Insert all of the following immediately ABOVE it. That's it.


'######################### BEZNAS RATING MOD ######################

%>
<table>
<tr valign="middle">
<td valign="top">
<%
dim rs
set rs = Server.CreateObject("ADODB.Recordset")
rs.ActiveConnection = my_conn

rs.Open "SELECT *FROM " & strTablePrefix & "TOPICS " & _
" WHERE TOPIC_ID = " & TopicID

const MIN_RATINGS_BEFORE_SHOW = 1

dim rs1
dim avgRating
dim avgWhole
dim decPart
dim decCalc
dim finalRating
dim altText

set rs1 = Server.CreateObject("ADODB.Recordset")

rs1.ActiveConnection = my_conn
rs1.Open "SELECT SUM(rating), COUNT(*) FROM " & strTablePrefix & "RATING " & _
" WHERE tId= " & TopicID

if rs1.Fields(1) < MIN_RATINGS_BEFORE_SHOW then
'No ratings
Response.Write "<font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """> Rate topic? </font>"
else
'This CD has ratings, let's display the average
avgRating = rs1.Fields(0).Value / rs1.Fields(1).Value

if Instr(1, CStr(avgRating), ".") > 0 then
'The average rating is a decimal, we need to either
'round the value up/down
avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1)
decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2)

if decPart <> "" then
'Work out whether or not we have to round this
'rating up or down

if CInt(decPart) >= 5 then
decCalc = .5
else
decCalc = 0
end if

finalRating = CInt(avgWhole) + CCur(decCalc)
else
finalRating = avgRating
end if
else
finalRating = avgRating
end if

'Setup the alt text for the images
altText = "Average visitor rating of " & finalRating & " out of 10"

for i = 1 to CInt(finalRating)
Response.Write "<img alt='" & altText & "' src='rating_on.gif'>"
next

if CInt(finalRating) <> finalRating then
'This article has a .5 rating, such as 5.5
Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"

for i = CInt(finalRating)+2 to 10
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
next
else
for i = CInt(finalRating)+1 to 10
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
next
end if
end if
%>
</td>
<td valign="middle">
<form name="frmRate<%=rs.Fields(0).value%>" action="rate.asp" method="post">
<input type="hidden" name="tId" value="<%=TopicID%>">
<Select name=rating>
<%
for i = 1 to 10
Response.Write "<option name='rating' value='" & i & "'>"& i &"</option> "
next
%>
</select><font face=verdana size=1>  /10</font> 
<input type="submit" value="Rate It!">
</form> </td></tr></table>
<%
rs.Close
set rs = Nothing
rs1.Close
set rs1 = Nothing

'######################### BEZNAS RATING MOD ######################
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.25 seconds. Powered By: Snitz Forums 2000 Version 3.4.07