%@Language=VBScript%>
<%
Dim oRS
Dim strSQLSI
Dim oTemplate
Dim SpID
'now get recordset from clsmydb
set mBotanic=new clsmydb
SpID = Request.QueryString("SpID")
if isEmpty(SpID) then
Response.Redirect("http://www.worldagroforestry.org/sea/Products/AFDbases/AF/index.asp")
end if
'*******************************************************************************
'now start query
'make a selection from parameter form
strSQLSI = "SELECT SpID, SpeciesName, Authority, Name, Botanic, Habitat, Biology, Cultivation"
strSQLSI = strSQLSI & " ,Biophysical, Propagation, TreeManagement, Germplasm, Products, Services, Pests"
strSQLSI = strSQLSI & " FROM Species, Family"
strSQLSI = strSQLSI & " WHERE SpID =" & Request.QueryString("SpID") & " AND Species.FID=Family.FID"
set oRSSI=mBotanic.GetList(strSQLSI,maxRes,cSize)
strSQLSy = "SELECT Synonym.Name, Synonym.SpID"
strSQLSy = strSQLSy & " FROM Synonym"
strSQLSy = strSQLSy & " WHERE SpID =" & Request.QueryString("SpID") & ""
strSQLSy = strSQLSy & " ORDER BY Name"
set oRSSy=mBotanic.GetList(strSQLSy,maxRes,cSize)
strSQLCN = "SELECT Vernacular.Name, t_Language.lang"
strSQLCN = strSQLCN & " FROM Vernacular, t_Language"
strSQLCN = strSQLCN & " WHERE Vernacular.SpID=" & Request.QueryString("SpID") & ""
strSQLCN = strSQLCN & " AND Vernacular.LID=t_Language.LID"
strSQLCN = strSQLCN & " GROUP BY Vernacular.Name, t_Language.lang"
strSQLCN = strSQLCN & " ORDER BY t_Language.lang"
set oRSCN=mBotanic.GetList(strSQLCN,maxRes,cSize)
strSQLDis = "SELECT isoname, Distribution"
strSQLDis = strSQLDis & " FROM Distribution, Country"
strSQLDis = strSQLDis & " WHERE SpID =" & Request.QueryString("SpID") & ""
strSQLDis = strSQLDis & " AND Country.iso = Distribution.iso"
strSQLDis = strSQLDis & " GROUP BY Distribution,isoname"
strSQLDis = strSQLDis & " ORDER BY Distribution"
set oRSDis=mBotanic.GetList(strSQLDis,maxRes,cSize)
strSQLBib = "SELECT SpRef.SpID, References.Reference"
strSQLBib = strSQLBib & " FROM SpRef, [References]"
strSQLBib = strSQLBib & " WHERE SpRef.SpID =" & Request.QueryString("SpID") & ""
strSQLBib = strSQLBib & " AND SpRef.RefID=References.RefID"
strSQLBib = strSQLBib & " ORDER BY References.Reference"
set oRSBib=mBotanic.GetList(strSQLBib,maxRes,cSize)
strSQLai = "SELECT Development, Distributions, Properties, Trade, Yield, Genetic, Prospects"
strSQLai = strSQLai & " FROM AddInfo"
strSQLai = strSQLai & " WHERE SpID =" & Request.QueryString("SpID") & ""
set oRSai=mBotanic.GetList(strSQLai,maxRes,cSize)
'*******************************************************************************
'after make query now fill the content
loadContent= ""
'loadContent=loadContent & "
"
'loadContent=loadContent & "
"
'make some validation here]
if not (oRSSI.Bof and oRSSI.Eof) then
with oRSSI
.MoveFirst
Do While not .Eof
loadContent=loadContent & "" & .fields("SpeciesName") & "
"
Species = .fields("SpeciesName")
.MoveNext
Loop
end with
end if
loadContent=loadContent & ""
loadContent=loadContent & ""
loadContent=loadContent & "
"
with oRSSI
.MoveFirst
Do While not .Eof
loadContent=loadContent & "Species identity
"
loadContent=loadContent & "Taxonomy"
loadContent=loadContent & "Current name: " & .fields("SpeciesName") & ""
loadContent=loadContent & "Authority: " & .fields("Authority") & ""
loadContent=loadContent & "Family: " & .fields("Name") & ""
.MoveNext
Loop
end with
loadContent=loadContent & "
"
if not (oRSSy.BOF and oRSSy.EOF) then
with oRSSy
loadContent=loadContent & "Synonym(s)"
.MoveFirst
Do While not .EOF
loadContent=loadContent & "" & .fields("name") & ""
.MoveNext
loop
end with
loadContent=loadContent & "
"
end if ' end selection for objSynonym
if not (oRSCN.BOF and oRSCN.EOF) then
with oRSCN
loadContent=loadContent & "Common names
"
AllCommon=""
.MoveFirst
FirstPass=false
Do While not .EOF
vnewbookmark=.fields("lang")
if vnewbookmark <> vlastbookmark then
AllCommon=AllCommon & "
" & " (" & vnewbookmark & ") : "
fFirstPass=false
vlastbookmark=.fields("lang")
else
end if
if fFirstPass = true then
AllCommon = AllCommon & ", " & .fields("name")
else
AllCommon = AllCommon & .fields("name")
fFirstPass = true
end if
.MoveNext
Loop
end with
loadContent=loadContent & AllCommon
loadContent=loadContent & "
"
end if 'end for obj common names
loadContent=loadContent & "Botanic description
"
if not oRSSI.BOF and oRSSI.EOF then
with oRSSI
.MoveFirst
do while not .EOF
loadContent=loadContent & .fields("Botanic")
loadContent=loadContent & "
"
.MoveNext
loop
end with
end if 'end for obj Species Info
loadContent=loadContent & ""
loadContent=loadContent &"Ecology and distribution
"
with oRSSI
.movefirst
do while not .EOF
if not IsNull(.fields("Cultivation")) then
loadContent=loadContent & "History of cultivation
"
loadContent=loadContent & .fields("cultivation")
loadContent=loadContent & "
"
end if
if not IsNull( .fields("habitat")) then
loadContent=loadContent & "Natural Habitat
"
loadContent=loadContent & .fields("habitat")
loadContent=loadContent & "
"
end if
.MoveNext
loop
end with
if not (oRSDis.BOF and oRSDis.EOF) then
loadContent=loadContent & "Geographic distribution"
with oRSDis
AllCountries=""
.MoveFirst
FirstPass=false
vnewbookmark=""
vlastbookmark=""
Do While not .EOF
if ( .fields("Distribution")=1) then
vnewbookmark="Native"
elseif ( .fields("Distribution")=2) then
vnewbookmark="Exotic"
end if
if vnewbookmark <> vlastbookmark then
AllCountries=AllCountries & "
" & vnewbookmark & " : "
fFirstPass=false
vlastbookmark=vnewbookmark
else
end if
if fFirstPass = true then
AllCountries = AllCountries & ", " & .fields("isoname")
else
AllCountries = AllCountries & .fields("isoname")
fFirstPass = true
end if
.MoveNext
Loop
end with
loadContent=loadContent & AllCountries
loadContent=loadContent & "
"
end if 'end for obj Distribution
'now for addinfo
if not (oRSai.BOF and oRSai.EOF) then
with oRSai
.moveFirst
do while not .eof
loadContent=loadContent & .fields("Distributions")
loadContent=loadContent & "
"
.movenext
loop
end with
end if
with oRSSI
.movefirst
do while not .eof
if not IsNull(.fields("Biophysical")) then
loadContent=loadContent & "Biophysical limits"
loadContent=loadContent & .fields("Biophysical")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Biology")) then
loadContent=loadContent & "Reproductive Biology
"
loadContent=loadContent & .fields("Biology")
loadContent=loadContent & "
"
end if
.movenext
loop
end with
loadContent=loadContent & ""
loadContent=loadContent & "Propagation and management
"
with oRSSI
.movefirst
do while not .eof
if not IsNull(.fields("Propagation")) then
loadContent=loadContent & "Propagation methods"
loadContent=loadContent & .fields("Propagation")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("TreeManagement")) then
loadContent=loadContent & "Tree Management
"
loadContent=loadContent & .fields("TreeManagement")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Germplasm")) then
loadContent=loadContent & "Germplasm Management
"
loadContent=loadContent & .fields("Germplasm")
loadContent=loadContent & "
"
end if
.movenext
loop
end with
loadContent=loadContent & ""
loadContent=loadContent & "Functional uses
"
with oRSSI
.movefirst
do while not .eof
if not IsNull(.fields("Products")) then
loadContent=loadContent & "Products"
loadContent=loadContent & .fields("Products")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Services")) then
loadContent=loadContent & "Services
"
loadContent=loadContent & .fields("Services")
loadContent=loadContent & "
"
end if
.movenext
loop
end with
loadContent=loadContent & ""
with oRSSI
.movefirst
do while not .eof
if not IsNull(.fields("Pests")) then
loadContent=loadContent & "Pests and diseases"
loadContent=loadContent & .fields("Pests")
loadContent=loadContent & "
"
end if
.movenext
loop
end with
with oRSai
if not .BOF and .EOF then
loadContent=loadContent & ""
loadContent=loadContent & "Additional Information
"
.movefirst
do while not .eof
if not IsNull(.fields("Development")) then
loadContent=loadContent & "Development"
loadContent=loadContent & .fields("Development")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Properties")) then
loadContent=loadContent & "Properties
"
loadContent=loadContent & .fields("Properties")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Trade")) then
loadContent=loadContent & "Trade
"
loadContent=loadContent & .fields("Trade")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Yield")) then
loadContent=loadContent & "Yields
"
loadContent=loadContent & .fields("Yield")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Genetic")) then
loadContent=loadContent & "Genetic
"
loadContent=loadContent & .fields("Genetic")
loadContent=loadContent & "
"
end if
if not IsNull(.fields("Prospects")) then
loadContent=loadContent & "Prospects
"
loadContent=loadContent &.fields("Prospects")
loadContent=loadContent & "
"
end if
.movenext
loop
loadContent=loadContent & "
"
end if
end with
loadContent=loadContent & ""
loadContent=loadContent & "Bibliography
"
with oRSBib
.movefirst
do while not .eof
loadContent=loadContent & .fields("Reference")
loadContent=loadContent & "
"
.movenext
loop
end with
'*******************************************************************************
'now assign for template
set oTemplate = new template_cls
const TMPLDIR = "../templates/tmpl/"
with oTemplate
.TemplateFile = TMPLDIR & "main.html"
.AddToken "title", 1, "Species Information"
.AddToken "content", 1,"" & loadContent & ""
.parseTemplateFile
end with
set oTemplate = nothing
'end of this job
%>