%
Dim MainTopicID
Dim TopicsArray
Const Max_Topic_Listing=3
Const Path_Seprator="…"
Const Topic_Heading_Dot ="2 "
'">"'">"
MainTopicID=Request.QueryString("ID")
if MainTopicID="" OR Not IsNumeric(MainTopicID) Then MainTopicID=0 Else MainTopicID=CLng(MainTopicID)
PageTitle=" فهرس مواضيع القرءان الكريم"
Call GetAllTopics()
ShowHeader
Response.Write("" & GetTopicPath(MainTopicID,0) & "")
Call ShowTopics(MainTopicID)
Call ShowTopicsAyat(MainTopicID)
ShowFooter
%>
<%
Sub GetAllTopics()
Dim SQL,ADO,RS
SQL="Select Topic_No,Mother_Topic,Topic_Name From Topics_Name Order By Mother_Topic ASC;"
Set ADO=Server.CreateObject("ADODB.Connection")
ADO.ConnectionString=DbConnection
ADO.Open
Set RS=ADO.Execute(SQL)
TopicsArray=RS.GetRows
ADO.Close
Set RS=Nothing
Set ADO=Nothing
End Sub
Function GetSubTopics(TopicID)
Dim TheString,n,SubTopic_counter
SubTopic_counter=1
for n=0 to UBound(TopicsArray,2)
if SubTopic_counter<= Max_Topic_Listing then
if CLng(TopicsArray(1,n))=CLng(TopicID) then
TheString=TheString & "" & TopicsArray(2,n) & ", "
SubTopic_counter=SubTopic_counter+1
end if
else
' TheString=TheString & " المزيد "
TheString=TheString & " .... "
exit for
end if
next
if Right(theString,2)=", " then theString=Left(theString,Len(theString)-2)
if SubTopic_counter=1 then
TheString=""
else
TheString="
" & TheString & ""
end if
GetSubTopics=TheString
End Function
Function GetTopicPath(TopicID,RoundNo)
dim theString,n
if TopicID=0 then
if RoundNo>0 then
GetTopicPath="الفهرس" & Path_Seprator
else
GetTopicPath="الفهرس" & Path_Seprator
end if
exit function
end if
for n=0 to UBound(TopicsArray,2)
if CLng(TopicsArray(0,n))=CLng(TopicID) then
theString=theString & GetTopicPath(TopicsArray(1,n),RoundNo+1)& "" & TopicsArray(2,n) & ""& Path_Seprator
end if
next
GetTopicPath=theString
End Function
Sub ShowTopicsAyat(TopicID)
dim n, m,i 'integers
Dim TopicAyatArray
dim AyatWhereCluseArray,AyatWhereCluseString
Dim AyatRange
Dim Ayat_Result_Array
Dim sID:sID=0
Dim ayID:ayID=0
Dim index:index=0
Dim outputString
Dim AyatCounter:AyatCounter=0
Dim SorahCounter:SorahCounter=0
for n=0 to UBound(TopicsArray,2)
if CLng(TopicsArray(1,n))=TopicID then exit sub
' if this topic has inner topics exit and don't show any ayah...
next
Dim SQL,ADO,RS
SQL="Select Topic_No,Sura_No,Ayat_No From Topic_Ayat Where Topic_No=" & TopicID & " Order By Sura_No ASC;"
Set ADO=Server.CreateObject("ADODB.Connection")
ADO.ConnectionString=DbConnection
ADO.Open
Set RS=ADO.Execute(SQL)
if Rs.EOF Then
ADO.Close
Set RS=Nothing
Set ADO=Nothing
Response.Write("
"
ayID=0
SorahCounter=SorahCounter+1
END IF
index=m+1
outputString=outputString & "" &Ayat_Result_Array(4,m) & " (" & Ayat_Result_Array(1,m) & ") "
if index<=UBound(Ayat_Result_Array,2) Then
if Clng(Ayat_Result_Array(1,index))-Clng(Ayat_Result_Array(1,m))<>1 Then
outputString=outputString & "
"
Else
outputString=outputString & " "
End if
Else
outputString=outputString & "
" & outputString & "
" Response.Write(outputString) ADO.Close Set ADO=Nothing End Sub %> <% Sub ShowTopics(TopicID) Dim TopicDic,MothorTopicDic dim Topics,CurrentTopic Dim n set TopicDic=Server.CreateObject("Scripting.Dictionary") set MothorTopicDic=Server.CreateObject("Scripting.Dictionary") for n=0 to UBound(TopicsArray,2) TopicDic.Add TopicsArray(0,n),TopicsArray(2,n) 'TopicID ===== TopicName if MothorTopicDic.Exists(TopicsArray(1,n)) Then 'MothorTopicDic(TopicsArray(0,n))=MothorTopicDic(TopicsArray(0,n)) & "," & TopicsArray(1,n) if MothorTopicDic(TopicsArray(1,n))="" then MothorTopicDic(TopicsArray(1,n))=TopicsArray(0,n) else MothorTopicDic(TopicsArray(1,n))=MothorTopicDic(TopicsArray(1,n)) & "," & TopicsArray(0,n) end if else MothorTopicDic.Add TopicsArray(1,n),TopicsArray(0,n) end if next Response.Write("| " & Topic_Heading_Dot & "" & TopicDic(CurrentTopic) & "" & GetSubTopics(CurrentTopic) & " | ") else Response.Write("") end if if n+1<=UBound(Topics) then CurrentTopic=clng(Topics(1+n)) if TopicDic.Exists(CurrentTopic) then Response.Write(" | " & Topic_Heading_Dot & "" & TopicDic(CurrentTopic) & "" & GetSubTopics(CurrentTopic) & " | ") else Response.Write("") end if else Response.Write(" | ") end if Response.Write(" |