%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
dim count_page
dim search_change
dim total_chapters
dim word_search, word_array, word_bound, word_len
dim word_url
dim search_condition, search_statement
dim i
total_chapters = 0
word_search = request.Form("word_search")
title="Kebra Negast"
if word_search <> "" then
search_change = Replace(word_search, "'", "~^")
search_change = Replace(search_change, "'", "~^^")
word_array = split(search_change, " ")
word_bound = Ubound(word_array)
word_len = word_bound + 1
end if
%>
JAH - <%=title%>
>
Kebra Negast
<%
if word_search = "" then
'***************** word display no search ********************
call display_speeches(search_condition, "", "")
else
if word_len = 1 then
'***************** word search one word with space ********************
search_condition = "word_title LIKE '% "&search_change&" %' OR word LIKE '% "&search_change&" %'"
search_statement = "Word Search " & """_"&search_change&"_"""
call display_speeches(search_condition, search_statement, "one-space")
'***************** word search one word NO space ********************
search_condition = "word_title LIKE '%"&search_change&"%' OR word LIKE '%"&search_change&"%'"
search_statement = "Word Search " & """"&search_change&""""
call display_speeches(search_condition, search_statement, "one-no space")
'***************************************************************************
else
'***************** word search phrase NO space ********************
search_condition = "word NOT LIKE '% "&search_change&" %' AND " &"word_title LIKE '%"&search_change&"%' OR word LIKE '%"&search_change&"%'"
search_statement = "Word Search " & """"&search_change&""""
call display_speeches(search_condition, search_statement, "one-no space")
'***************************************************************************
'***************** word search multiple with space ********************
search_condition = "(word_title NOT LIKE '%"&search_change&"%' AND word NOT LIKE '%"&search_change&"%') AND "
for i=0 to word_bound
if i <> 0 then
search_condition = search_condition & " AND "
end if
search_condition = search_condition & "(word_title LIKE '% "&word_array(i)&" %' OR word LIKE '% "&word_array(i)&" %')"
Next
search_statement = "Word Search "
for i=0 to word_bound
if i <> 0 then
search_statement = search_statement & " AND "
end if
search_statement = search_statement & """_"&word_array(i)&"_"""
Next
call display_speeches(search_condition, search_statement, "multiple-space")
'***************** word search multiple NO space ********************
search_condition = "(word_title NOT LIKE '%"&search_change&"%' AND word NOT LIKE '%"&search_change&"%') AND "
for i=0 to word_bound
if i <> 0 then
search_condition = search_condition & " AND "
end if
search_condition = search_condition & "(word_title LIKE '%"&word_array(i)&"%' OR word LIKE '%"&word_array(i)&"%')"
Next
search_statement = "Word Search "
for i=0 to word_bound
if i <> 0 then
search_statement = search_statement & " AND "
end if
search_statement = search_statement & """"&word_array(i)&""""
Next
call display_speeches(search_condition, search_statement, "multiple-no space")
'***************************************************************************
end if
end if
%>
<%
'**************************************************************************************
'************************** FUNCTIONS *****************************
'**************************************************************************************
sub display_speeches(s_condition, s_statement, s_type)
dim WordData
Set WordData = New Ark_Data
dim word_title, prev_word_title
dim word_id, word_status, prev_word_status
prev_word_title = "zzz"
prev_word_status = "zzz"
Set WordData = Ark_DBAccess.DBSelect("kebra_negast", "word_title, word_id, status", s_condition, "status, word_id")
if WordData.DataExists then
if word_search <> "" then
response.Write("
")
if s_type = "one-space" OR s_type = "multiple-space" then
response.Write("_ represents a space
")
end if
response.Write("")
response.Write(s_statement)
response.Write("
")
end if
response.Write("")
WordTitleIndex = WordData.GetItemIndex("word_title")
WordIDIndex = WordData.GetItemIndex("word_id")
WordStatusIndex = WordData.GetItemIndex("status")
For WrPos= 0 to WordData.UpperBound
word_title = WordData.GetItemByIndex(WordTitleIndex, WrPos)
word_id = WordData.GetItemByIndex(WordIDIndex, WrPos)
word_status = WordData.GetItemByIndex(WordStatusIndex, WrPos)
if word_title <> prev_word_title then
if word_search = "" then
if word_status <> prev_word_status then
if word_status = "new" then%>
|
New Speeches
|
<%elseif word_status = "nrecent" then%>
|
Recent Speeches
|
<%elseif word_status = "old" then%>
|
<%end if
end if
end if
if word_search <> "" then
word_url = "&word_search="&server.URLEncode(word_search)&"&search_type="&server.URLEncode(s_type)
end if
%>
| <%=replace(word_title, "~", "'")%> |
<%total_chapters = total_chapters + 1
end if
prev_word_title = word_title
prev_word_status = word_status
Next%>
<%
end if
end sub
%>