%
'Articles System
'Subs:
'DisplayArticleNavigation Displays the Categories upper the actual category
'DisplayArticleCats Displays the cats under the actual category and the related forum
'DisplayArticles Displays the Links in the actual category
'DisplayArticleDetail Displays the Links in the actual category
'getAuthorShortBio(Author_Number) Displays the Authors Name and Bio
%>
<%
Public Sub DisplayArticleNavigation %>
|
<%
Dim arCatIDs()
Redim arCatIDs(1)
Set objRec2 = CreateObject("ADODB.Recordset")
Dim arCatTitles()
Redim arCatTitles(1)
Dim i
Dim ArraySize
CatID = Request.QueryString("catid")
If Request.QueryString("catid") = "" then
CatID = 0
End If
TempCatID = CatID
'Create a recordset with the top level categories in it.
strSQL = "SELECT ParentID, CatID, Title FROM " & strTablePrefix & "Site_Cats WHERE Articles = 1;"
Set objRec2 = my_Conn.Execute (strSQL)
i = 0
'Loop until the top level category is found.
DO UNTIL CatID = 0
'Create a filtered recordset with only one record.
objRec2.Filter = "CatID = " & CatID
arCatIDs(i) = objRec2("CatID")
arCatTitles(i) = objRec2("Title")
If NOT objRec2("ParentID") = 0 then
Redim Preserve arCatIDs(i+1)
Redim Preserve arCatTitles(i+1)
End If
CatID = objRec2("ParentID")
i = i + 1
LOOP
'It might be the top level in which case Home shouldn't be a link.
If NOT Request.QueryString("catid") = "" then
Response.Write "Home >> "
Else
Response.Write "Home >> "
End If
'The array holds the information in the wrong order so read it backwards.
For i = UBound(arCatIDs) to 0 Step - 1
If i = 0 then
Response.Write arCatTitles(i)
Else
'This is a stupid line of code. Remove it and see what happens to the first level of categories.
If NOT arCatIDs(i) = "" then
Response.Write ""&arCatTitles(i)&" : "
End If
End If
Next
'Cleany Cleany
objRec2.Close
Set objRec2 = Nothing
%>
|
<% End Sub 'DisplayLinkNavigation %>
<%
Public Sub DisplayArticles
If Request.QueryString("catid") = "" then
CatID = 4
CatTitle = SiteName
Else
CatID = Request.QueryString("catid")
CatTitle = Request.QueryString("cattitle")
End If
'Create a recordset with the top level categories in it.
Set objRec2 = CreateObject("ADODB.Recordset")
Set objRec2.ActiveConnection = my_Conn
objRec2.LockType = 2
If mLev = 4 Then
SQL = "SELECT Top 3 * FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 3 ORDER BY Added DESC;"
Else
SQL = "SELECT Top 3 * FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 3 ORDER BY Name, Hits DESC;"
End If
objRec2.Open SQL, my_Conn, 3, 3
%>
<%
i = 0
do while i < 2
if Not objRec2.EOF then
objRec2.MoveNext
end if
i= i+1
loop
if not objRec2.EOF then
%>
|
More Articles
|
<%
DO UNTIL objRec2.EOF %>
<%
LinkStatus = objRec2("Badlink")
Select Case LinkStatus
Case 0
LinkStatus = "Working"
Case Else
LinkStatus = "Down!!"
End Select
%>
|
|
<%
FirstPara= split(objRec2("LinkDesc")," ")
t_Message= FirstPara(0)
response.write t_Message
%>
|
<% If mLev >= 3 OR mLev = 1 Then %>
| | &category=<%=CatID%>')">Edit Link |
<% If mLev = 4 Then %>
')">Delete Link |
<% If objRec2("Validated") = 0 Then %>
')"> Validate Link |
<% End If %>
<% End If %>
|
<% End If %>
<%
'Move to the next record in the record set.
objRec2.MoveNext
LOOP
end if%>
<% 'Time to clean up
objRec2.Close
Set objRec2 = Nothing
End Sub 'Displaylinks
Sub FillArray
i = 0
'Loop until the top level category is found.
DO UNTIL CatID = 0
'Create a filtered recordset with only one record.
objRec2.Filter = "CatID = " & CatID
arCatIDs(i) = objRec2("CatID")
arCatTitles(i) = objRec2("Title")
If NOT objRec2("ParentID") = 0 then
Redim Preserve arCatIDs(i+1)
Redim Preserve arCatTitles(i+1)
End If
CatID = objRec2("ParentID")
i = i + 1
LOOP
End Sub
%>
<%
Public Sub DisplayArticleDetail
If Request.QueryString("catid") = "" then
CatID = 0
CatTitle = SiteName
Else
CatID = Request.QueryString("catid")
CatTitle = Request.QueryString("cattitle")
End If
'Create a recordset
Set objRec2 = CreateObject("ADODB.Recordset")
Set objRec2.ActiveConnection = my_Conn
objRec2.LockType = 2
If mLev = 4 Then
SQL = "SELECT * FROM " & strTablePrefix & "Site_Links WHERE LinkID = " & Request.QueryString("linkid") & " ORDER BY Added DESC;"
Else
SQL = "SELECT * FROM " & strTablePrefix & "Site_Links WHERE LinkID = " & Request.QueryString("linkid") & " AND Validated = 1 ORDER BY Added DESC;"
End If
objRec2.Open SQL, my_Conn, 3, 3
if objRec2.EOF then
' do Nothing
else
%>
|
go back ...
|
<% DO UNTIL objRec2.EOF
If objRec2("Votes") <> "0" then
Rate = round(objRec2("Score")/objRec2("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "
"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
%>
|
<%
'Move to the next record in the record set.
objRec2.MoveNext
LOOP %>
|
<%
end if
%>
<% 'Time to clean up
objRec2.Close
Set objRec2 = Nothing
End Sub 'DisplayArticleDatail %>
<%
Function Read1stPara(Content)
FirstPara= split(content,"
")
t_Message= FirstPara(0)
if len(content) > len(t_Message) then
T_Message = t_Message & "
read entire Article ..."
end if
Read1stPara = t_Message
end Function
%>
<%
public sub getAuthorShortBio
'## Forum_SQL
temp = objRec2("SubmittedBY")
id = getMemberID(temp)
'response.write "UserID: " & id
strSql = "SELECT *"
strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
strSql = strSql & " WHERE MEMBER_ID = " & id
'response.write strSQL
set rsGetAuthor = my_Conn.Execute(strSql)
if rsGetAuthor.EOF or rsGetAuthor.BOF then
' do nothing
else
%>
<%
if rsgetAuthor("M_PHOTO_URL") <> "" THEN
%>
">
|
<%
end if
%>
<%
if LEN(rsgetAuthor("M_LASTNAME")) > 1 THEN
%>
Author: <%=rsgetAuthor("M_FIRSTNAME")%> <%=rsgetAuthor("M_LASTNAME")%>
<%
else
%>
Author: <%=rsgetAuthor("M_Name")%>
<%
end if
%>
read more from <%=rsgetAuthor("M_Name")%>
|
<%=ChkDate(objRec2("Added"))%>
|
<%
end if
end sub
%>
<%
Public Sub DisplayCats
CatID = Request.QueryString("CatID")
Set objCat = CreateObject("ADODB.Recordset")
Set objCat.ActiveConnection = my_Conn
objCat.LockType = 2
If Len(CatID) > 0 Then
' this is a subcat: display its data.
objCat.Open("SELECT Title, Forum_ID, IMG, Links, CatDesc FROM " & strTablePrefix & "Site_Cats WHERE CatID=" & CatID & "AND Articles = 1")
if not objCat.eof then
catDesc = objCat("CatDesc")%>
|
<%=objCat("Title")%>
|
<% if not strDisplayCatImg = "0" AND objCat("IMG") <>"" then %>
"> |
<% end if %>
<%=CatDesc%>
|
|
<% ' check if we have a forums entry
If objCat("Forum_ID") <> "" Then
'display the related Forum
%>
|
Related Forum: |
<%
strSQL = "SELECT " & strTablePrefix & "FORUM.FORUM_ID, " & strTablePrefix & "FORUM.F_DESCRIPTION, " & strTablePrefix & "FORUM.F_SUBJECT FROM " & strTablePrefix & "FORUM WHERE " & strTablePrefix & "FORUM.FORUM_ID = " & objCat("FORUM_ID")
set rsForum = my_Conn.Execute (strSql)
if rsForum.eof or rsForum.bof then
Response.Write """No Forum Found!"""
Else%>
<%
End If
rsForum.Close
set rsForum = nothing
%>
|
<% end if %>
|
<%
' read the subcategorys
end if
objCat.Close
objCat.Open("SELECT * FROM " & strTablePrefix & "Site_Cats WHERE ParentID=" & CatID &" AND Articles = 1 ORDER BY Title ASC;")
Else
objCat.Open("SELECT * FROM " & strTablePrefix & "Site_Cats WHERE ParentID = 0 AND Articles = 1 ORDER BY Title ASC;")
End If
Set objRec2 = Server.CreateObject ("ADODB.Recordset")
objRec2.Open strTablePrefix & "Site_Links", my_Conn, 3, 3
Set objRec3 = Server.CreateObject ("ADODB.Recordset")
objRec3.Open strTablePrefix & "Site_Cats", my_Conn, 3, 3
If objCat.EOF AND objCat.BOF then
Response.Write " "
Else%>
<%
cellwidth = 100 mod strNumCols
i = 1
DO UNTIL objCat.EOF
if i-1 mod strNumCols = 0 then
response.write "
"
end if
response.write ""
response.write " " & objCat("Title") & ""
if not strDisplayCatStats = "0" then
response.write "  "
'Find the Number of Resources
objRec2.Filter = "CatID="&objCat("CatID")
'Display amount of resources.
If objRec2.RecordCount = 0 then
Response.Write ""
ElseIf objRec2.RecordCount = 1 then
Response.Write "(1 Article) "
Else
Response.Write "(" & objRec2.RecordCount & " Articles) "
End If
objRec2.Filter = 0
objRec3.Filter = "ParentID="&objCat("CatID")
'Display the amount of categories.
If objRec3.RecordCount = 0 then
Response.Write "(0 Categories)"
ElseIf objRec3.RecordCount = 1 then
Response.Write "(1 Category)"
Else
Response.Write "(" & objRec3.RecordCount & " Categories)"
End If
Response.Write ""
end if
if not strDisplayCatDesc = "0" then
response.write " "& CatDesc &""
end if
If mLev >= 3 Then %>
<% End If
response.write " | "
if i mod strNumCols = 0 then
response.write "
"
end if
i = i+1
objCat.MoveNext
LOOP
do until i mod strNumCols = 0
response.write " | "
i=i+1
LOOP
response.write " |
"
' response.write ""
end if
End Sub 'DisplayCats
%>
<%
Public Sub Displaylinks
If Request.QueryString("catid") = "" then
CatID = 0
CatTitle = SiteName
Else
CatID = Request.QueryString("catid")
CatTitle = Request.QueryString("cattitle")
End If
' paging settings
mypage=request("whichpage")
If mypage="" then
mypage=1
end if
mypagesize=request("pagesize")
If mypagesize="" then
mypagesize=10
end if
'Create a recordset with the top level categories in it.
Set objContent = CreateObject("ADODB.Recordset")
Set objContent.ActiveConnection = my_Conn
objContent.LockType = 2
objContent.cursorlocation=3
objContent.cachesize=5
If mLev = 4 Then
SQL = "SELECT * FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 3 ORDER BY Added DESC;"
Else
SQL = "SELECT * FROM " & strTablePrefix & "Site_Links WHERE CatID = " & CatID & " AND LinkType = 3 ORDER BY Name, Hits DESC;"
End If
objContent.Open SQL, my_Conn, 3, 3
if not objContent.EOF then
objContent.movefirst
objContent.pageSize = 10
objContent.cacheSize = 10
maxPages = cint(objContent.pageCount)
maxRecs = cint(objContent.pageSize)
objContent.absolutePage = myPage
maxpages = cint(objContent.pagecount)
'objContent.movefirst
'objContent.pagesize=mypagesize
'maxpages=cint(objContent.pagecount)
'maxrecs=cint(objContent.pagesize)
'objContent.absolutepage=mypage
if cint(strLinkAddPermission) <= mlev then
%>
<%
end if
if maxpages > 1 then %>
| Page <%=mypage%> of <%=maxPages %> |
<% Call Paging() %> |
<% else %>
<% end if
DO UNTIL objContent.EOF
If objContent("Votes") <> "0" then
Rate = round(objContent("Score")/objContent("Votes"))
star = 0
Rating = ""
DO UNTIL star = Rate
Rating = Rating & "
"
star = star +1
Loop
Else
Rating = "Not Rated"
End If
LinkStatus = objContent("Badlink")
Select Case LinkStatus
Case 0
LinkStatus = "Working"
Case Else
LinkStatus = "Down!!"
End Select
' begin display of a link%>
<%end if %>
<%
' end display of a link
'Move to the next record in the record set.
objContent.MoveNext
LOOP
else
' no records found
end if
'howmanyrecs=0
'howmanyfields=objContent.fields.count -1
'response.write maxpages & "
"
if maxpages > 1 then %>
| Page <%=myPage%> of <%= maxpages %> |
<% Call Paging %> |
<% else %>
<% end if
if cint(strLinkAddPermission) <= mlev then
%>
<%
end if
End Sub ' Displaylinks
%>