%
' This needs to be global for the recursive function
Dim objMiscRS
ProcessForumPage True
%>
<%
'== BEGIN MAIN =================================================================
Sub Main()
Dim iActiveMessageId
Dim iActiveForumId
Dim objMessageRS
'Dim objMiscRS
iActiveMessageId = Request.QueryString("mid")
If IsNumeric(iActiveMessageId) Then
iActiveMessageId = CInt(iActiveMessageId)
Else
iActiveMessageId = 0
End If
Set objMessageRS = GetRecordset("SELECT * FROM messages WHERE message_id=" & iActiveMessageId & ";")
If Not objMessageRS.EOF Then
objMessageRS.MoveFirst
'For I = 0 to objMessageRS.Fields.Count - 1
' WriteLine objMessageRS.Fields(I).Name & ": "
' WriteLine objMessageRS.Fields(I) & "
"
'Next
iActiveForumId = objMessageRS.Fields("forum_id")
%>
Author: |
<%= objMessageRS.Fields("message_author") %> |
E-mail: |
<% If IsNull(objMessageRS.Fields("message_author_email")) Then %>
not available |
<% Else %>
"><%= objMessageRS.Fields("message_author_email") %> |
<% End If %>
Date: |
<%= objMessageRS.Fields("message_timestamp") %> |
Subject: |
<%= Lineify(objMessageRS.Fields("message_subject")) %> |
Message: |
<%= Lineify(objMessageRS.Fields("message_body")) %> |
&pid=<%= objMessageRS.Fields("message_id") %>&level=<%= objMessageRS.Fields("thread_level") + 1 %>&subject=<%= Server.URLEncode(objMessageRS.Fields("message_subject")) %>">Post a Reply
Back to the Folder
<%
Set objMiscRS = GetRecordset("SELECT * FROM forums WHERE forum_id=" & iActiveForumId & ";")
If Not objMiscRS.EOF Then
objMiscRS.MoveFirst
ShowForumLine objMiscRS.Fields("forum_id"), "open", objMiscRS.Fields("forum_name"), objMiscRS.Fields("forum_description"), 0
End If
objMiscRS.Close
Set objMiscRS = Nothing
Set objMiscRS = Server.CreateObject("ADODB.RecordSet")
objMiscRS.CursorLocation = adUseClient
objMiscRS.ActiveConnection = cnnForumDC
objMiscRS.CursorType = adOpenStatic
objMiscRS.LockType = adLockReadOnly
objMiscRS.Open "SELECT * FROM messages WHERE thread_id=" & objMessageRS.Fields("thread_id").Value & " ORDER BY thread_parent;"
objMiscRS.ActiveConnection = Nothing
ShowChildren 0, 0, 0, iActiveMessageId
objMiscRS.Close
Set objMiscRS = Nothing
Else
WriteLine "Unable to locate that message!" & "
"
End If
objMessageRS.Close
Set objMessageRS = Nothing
End Sub 'Main
'== END MAIN ===================================================================
'== BEGIN SUBS & FUNCTIONS =====================================================
Sub ShowChildren(iParentId, iPreviousFilter, iCurrentLevel, iActiveMessageId)
Dim iCurrentLocation
objMiscRS.Filter = "thread_parent = " & iParentId
If objMiscRS.RecordCount <> 0 Then
If Not objMiscRS.BOF Then objMiscRS.MoveFirst
Do While Not objMiscRS.EOF
ShowMessageLine iCurrentLevel, objMiscRS.Fields("message_id"), objMiscRS.Fields("message_subject"), objMiscRS.Fields("message_author"), objMiscRS.Fields("message_author_email"), FormatTimestampDisplay(objMiscRS.Fields("message_timestamp")), 0, "message", iActiveMessageId
iCurrentLocation = objMiscRS.AbsolutePosition
'Response.Write iCurrentLocation
ShowChildren objMiscRS.Fields("message_id").Value, objMiscRS.Filter, iCurrentLevel + 1, iActiveMessageId
'Response.Write iCurrentLocation
objMiscRS.AbsolutePosition = iCurrentLocation
objMiscRS.MoveNext
Loop
End If
objMiscRS.Filter = iPreviousFilter
End Sub ' ShowChildren
'== END SUBS & FUNCTIONS =======================================================
%>