% dim authornames(6,6) REM TITLE HERE title ="Logo" REM subject ID a="=11" REM Curriculum ID b="" REM Module ID c="" REM 1 is AND search; 2 is OR search f="2" REM show additional fields comments="1" url="1" lib="1" DIM DataConn Set DataConn = Server.CreateObject("ADODB.Connection") DataConn.Open("Driver={Microsoft Access Driver (*.mdb);DBQ="& Server.MapPath("\httpdocs\books\fpdb\books.mdb")) REM a and b are multiple selections; c is a single selection REM a= request("subject") REM b= request("curriculum") REM c= request("module") e= 0 REM f=request("type") REM removes "None Selected" from multiple selection if left(a,1)="," then a=MID(a,3,len(a)-2) if left(b,1)="," then b=MID(b,3,len(b)-2) if a<>"" then SubjectArray = Split(a,",",-1,1) if b<>"" then CurricArray = Split(b,",",-1,1) if c<>"" then ModuleArray = Split(c,",",-1,1) set rsbooks = Server.CreateObject("ADODB.recordset") set rschapters=Server.CreateObject("ADODB.recordset") set rsbchapters=Server.CreateObject("ADODB.recordset") set rsjournals = server.CreateObject("ADODB.recordset") set rsurls = server.CreateObject("ADODB.recordset") set rsbauthors=Server.CreateObject("ADODB.recordset") set rscbauthors=Server.CreateObject("ADODB.recordset") set rscauthors=Server.CreateObject("ADODB.recordset") set rsjauthors = server.CreateObject("ADODB.recordset") set rsuauthors = server.CreateObject("ADODB.recordset") QBAuthors="" Qbooks ="" QCAuthors="" QCBAuthors="" QChapters ="" QBChapters = "" QJAuthors="" QJournal = "" QUAuthors="" QURL = "" qstring1=" In (select bookid from keywords where " qstring1a=" In (select chapid from keywords where " qstring1b=" In (select journid from keywords where " qstring1c=" In (select urlid from keywords where " QSTRING2= " (keywords.BookID) " QSTRING2a= " (keywords.chapID) " QSTRING2b= " (keywords.journID) " QSTRING2c= " (keywords.urlID) " if f = 2 then Qstring3=" OR " else qstring3 =" AND " Qstring4= " In (select bookid from keywords where " Qstring5 = ")" Qstring6 = " subjectid " Qstring7 = " curricid " Qstring8 = " moduleid " subjectquerybooks="" curricquerybooks="" modulequerybooks="" subjectquerychapters="" curricquerychapters="" modulequerychapters="" subjectqueryjournals="" curricqueryjournals="" modulequeryjournals="" subjectqueryurls="" curricqueryurls="" modulequeryurls="" function assemble(textid,slct,idkword, array) assemble = textid & slct & idkword & array(0)&qstring5 if ubound(array)>0 then for x=1 to ubound(array) assemble = assemble & qstring3&textid&slct & idkword &array(x)&Qstring5 next end if end function REM deal with subject id array if a<>"" then subjectquerybooks=assemble(qstring2,qstring1,qstring6,subjectarray) subjectquerychapters=assemble(qstring2a,qstring1a,qstring6,subjectarray) subjectqueryjournals=assemble(qstring2b,qstring1b,qstring6,subjectarray) subjectqueryurls=assemble(qstring2c,qstring1c,qstring6,subjectarray) end if REM deal with curric id array if b<>"" then curricquerybooks=assemble(qstring2,qstring1,qstring7,curricarray) curricquerychapters=assemble(qstring2a,qstring1a,qstring7,curricarray) curricqueryjournals=assemble(qstring2b,qstring1b,qstring7,curricarray) curricqueryurls=assemble(qstring2c,qstring1c,qstring7,curricarray) end if REM deal with module id if c<>"" then modulequerybooks=assemble(qstring2,qstring1,qstring8,modulearray) modulequerychapters=assemble(qstring2a,qstring1a,qstring8,modulearray) modulequeryjournals=assemble(qstring2b,qstring1b,qstring8,modulearray) modulequeryurls=assemble(qstring2c,qstring1c,qstring8,modulearray) end if REM Book Queries Qbooks ="SELECT DISTINCT keywords.BookID, Books.BEds, Books.BYear, Books.BTitle, Books.BEdition, Books.BPlace, Books.BPublisher, Books.BLibrary, Books.BURL, Books.BComments" Qbooks= Qbooks & " FROM Books INNER JOIN Keywords ON Books.BookID = Keywords.BookID where" QBAuthors="SELECT distinct authors.id,keywords.bookid, AuthorNames.AuthorLName, AuthorNames.AuthorInit " QBAuthors= QBAuthors & " from (Keywords INNER JOIN Authors ON Keywords.BookID = Authors.BookId) INNER JOIN AuthorNames ON Authors.NameID = AuthorNames.NameID where" REM Chapter Queries REM Authors QCAuthors="SELECT DISTINCT authors.id, keywords.ChapId, AuthorNames.AuthorLName, AuthorNames.AuthorInit " QCAuthors= QCAuthors & " from (Keywords INNER JOIN Authors ON Keywords.chapID = Authors.chapId) INNER JOIN AuthorNames ON Authors.NameID = AuthorNames.NameID where" REM Chapters (i) title and year QChapters = "SELECT DISTINCT Keywords.ChapID, Books.BYear, Chapters.CTitle" QChapters = QChapters & " FROM (Keywords INNER JOIN Chapters ON Keywords.ChapID = Chapters.ChapID) INNER JOIN Books ON Chapters.CIn = Books.BookID where" REM Authors of chapter book sources QCBAuthors= "SELECT distinct authors.id, Keywords.Chapid, AuthorNames.AuthorLName, AuthorNames.AuthorInit " QCBAuthors= QCBAuthors & " FROM Keywords INNER JOIN (Chapters INNER JOIN (AuthorNames INNER JOIN Authors ON AuthorNames.NameID = Authors.NameID) ON Chapters.CIn = Authors.BookId) ON Keywords.ChapID = Chapters.ChapID where" REM Chapters (ii) remaining chapter details; QBChapters = "SELECT DISTINCT keywords.Chapid, Books.BEds, Books.BTitle, Books.BEdition, Books.BPlace, Books.BPublisher, Chapters.CChapterno, Chapters.CPagenos, Books.BLibrary, chapters.curl, Chapters.CComments" QBChapters = QBChapters & " FROM (Keywords INNER JOIN Chapters ON Keywords.ChapID = Chapters.ChapID) INNER JOIN Books ON Chapters.CIn = Books.BookID where" REM Journals; QJAuthors="SELECT DISTINCT authors.id,Keywords.JournID, AuthorNames.AuthorLName, AuthorNames.AuthorInit " QJAuthors= QJAuthors & " FROM (Keywords INNER JOIN Authors ON Keywords.journID = Authors.journalId) INNER JOIN AuthorNames ON Authors.NameID = AuthorNames.NameID where" rem QJournals = "SELECT DISTINCT Keywords.journID, Journals.JYear, Journals.JTitle, Journals.JidTitle, Journals.JVolume, Journals.JPagenos, Journals.JLibrary, Journals.JURL, Journals.JComments" rem QJournals = QJournals & " FROM Journals INNER JOIN Keywords ON Journals.JID = Keywords.JournID where" qjournals = "SELECT distinct Keywords.JournID, Journals.JYear, Journals.JTitle, journaltitles.jjournaltitle,Journals.JMonth, Journals.JVolume, Journals.JPart, Journals.JPagenos,Journals.JLibrary, Journaltitles.JURL, Journals.JComments" qjournals = qjournals & " FROM (JournalTitles INNER JOIN Journals ON JournalTitles.JIDtitle = Journals.JidTitle) INNER JOIN Keywords ON Journals.JID = Keywords.JournID where" REM WebSites; QUAuthors="SELECT DISTINCT authors.id,keywords.URLId, AuthorNames.AuthorLName, AuthorNames.AuthorInit " QUAuthors= QUAuthors& " FROM (Keywords INNER JOIN Authors ON Keywords.urlID = Authors.urlId) INNER JOIN AuthorNames ON Authors.NameID = AuthorNames.NameID where" QURL = "SELECT DISTINCT keywords.UrliD, URLs.UYear, URLs.UDocumentTitle, URLs.UFormat, URLs.UURL, URLs.UDate, URLs.UComments" QURL = QURL & " FROM URLs INNER JOIN Keywords ON urls.uID = Keywords.urlID where" if a<>"" and b<>"" and c<>"" then QBooks= Qbooks & modulequerybooks& qstring3 & subjectquerybooks & qstring3& curricquerybooks QBAuthors = QBAuthors & modulequerybooks& qstring3 & subjectquerybooks & qstring3& curricquerybooks qcauthors=qcauthors& modulequerychapters& qstring3 & subjectquerychapters & qstring3& curricquerychapters qchapters=qchapters& modulequerychapters& qstring3 & subjectquerychapters & qstring3& curricquerychapters qcbauthors=qcbauthors& modulequerychapters& qstring3 & subjectquerychapters & qstring3& curricquerychapters qbchapters=qbchapters& modulequerychapters& qstring3 & subjectquerychapters & qstring3& curricquerychapters qjournals = qjournals &modulequeryjournals& qstring3 & subjectqueryjournals & qstring3& curricqueryjournals qjauthors = qjauthors & modulequeryjournals& qstring3 & subjectqueryjournals & qstring3& curricqueryjournals qurl = qurl &modulequeryurls& qstring3 & subjectqueryurls & qstring3& curricqueryurls quauthors = quauthors &modulequeryurls& qstring3 & subjectqueryurls & qstring3& curricqueryurls end if if A<>"" and b<>"" and c="" then QBooks= Qbooks & subjectquerybooks & qstring3& curricquerybooks QBAuthors = QBAuthors & subjectquerybooks & qstring3& curricquerybooks qcauthors=qcauthors& subjectquerychapters & qstring3& curricquerychapters qchapters=qchapters& subjectquerychapters & qstring3& curricquerychapters qcbauthors=qcbauthors& subjectquerychapters & qstring3& curricquerychapters qbchapters=qbchapters& subjectquerychapters & qstring3& curricquerychapters qjournals = qjournals & subjectqueryjournals & qstring3& curricqueryjournals qjauthors = qjauthors & subjectqueryjournals & qstring3& curricqueryjournals qurl = qurl &subjectqueryurls & qstring3& curricqueryurls quauthors = quauthors &subjectqueryurls & qstring3& curricqueryurls end if if A<>"" and b="" and c="" then QBooks= Qbooks & subjectquerybooks QBAuthors = QBAuthors & subjectquerybooks qcauthors=qcauthors & subjectquerychapters qchapters=qchapters& subjectquerychapters qcbauthors=qcbauthors& subjectquerychapters qbchapters=qbchapters& subjectquerychapters qjournals = qjournals & subjectqueryjournals qjauthors = qjauthors & subjectqueryjournals qurl = qurl &subjectqueryurls quauthors = quauthors &subjectqueryurls end if if A<>"" and b="" and c<>"" then QBooks= Qbooks & modulequerybooks& qstring3 & subjectquerybooks QBAuthors = QBAuthors & modulequerybooks& qstring3 & subjectquerybooks qcauthors=qcauthors& modulequerychapters& qstring3 & subjectquerychapters qchapters=qchapters& modulequerychapters& qstring3 & subjectquerychapters qcbauthors=qcbauthors& modulequerychapters& qstring3 & subjectquerychapters qbchapters=qbchapters& modulequerychapters& qstring3 & subjectquerychapters qjournals = qjournals &modulequeryjournals& qstring3 & subjectqueryjournals qjauthors = qjauthors & modulequeryjournals& qstring3 & subjectqueryjournals qurl = qurl &modulequeryurls& qstring3 & subjectqueryurls quauthors = quauthors &modulequeryurls& qstring3 & subjectqueryurls end if if a="" and b="" and c<>"" then QBooks= Qbooks & modulequerybooks QBAuthors = QBAuthors & modulequerybooks qcauthors=qcauthors& modulequerychapters qchapters=qchapters& modulequerychapters qcbauthors=qcbauthors& modulequerychapters qbchapters=qbchapters& modulequerychapters qjournals = qjournals &modulequeryjournals qjauthors = qjauthors & modulequeryjournals qurl = qurl &modulequeryurls quauthors = quauthors &modulequeryurls end if if a="" and b<>"" and c<>"" then QBooks= Qbooks & modulequerybooks& qstring3& curricquerybooks QBAuthors = QBAuthors & modulequerybooks& qstring3& curricquerybooks qcauthors=qcauthors& modulequerychapters& qstring3& curricquerychapters qchapters=qchapters& modulequerychapters& qstring3& curricquerychapters qcbauthors=qcbauthors& modulequerychapters& qstring3& curricquerychapters qbchapters=qbchapters& modulequerychapters& qstring3& curricquerychapters qjournals = qjournals &modulequeryjournals& qstring3& curricqueryjournals qjauthors = qjauthors & modulequeryjournals& qstring3& curricqueryjournals qurl = qurl &modulequeryurls& qstring3& curricqueryurls quauthors = quauthors &modulequeryurls& qstring3& curricqueryurls end if if a="" and b<>"" and c="" then QBooks= Qbooks & curricquerybooks QBAuthors = QBAuthors & curricquerybooks qcauthors=qcauthors& curricquerychapters qchapters=qchapters& curricquerychapters qcbauthors=qcbauthors& curricquerychapters qbchapters=qbchapters& curricquerychapters qjournals = qjournals &curricqueryjournals qjauthors = qjauthors & curricqueryjournals qurl = qurl &curricqueryurls quauthors = quauthors &curricqueryurls end if if a="" and b="" and c="" then e=1 %>
<%response.write(title)%> |
Books<% if e=0 then rsbooks.Open Qbooks, DataConn, 3 booknum=checkfornone(rsbooks) else booknum=0 end if if booknum=0 then nodisplay("Books") else booklist=rsbooks.getrows bookcolumns=ubound(booklist,1) bookrows=ubound(booklist,2) redim slist(bookrows) rsbooks.close set rsbooks=nothing rsbauthors.open qbauthors, dataconn, 3 authorlist=rsbauthors.getrows authornum=checkfornone(rsbauthors) authorcolumns=ubound(authorlist,1) authorrows=ubound(authorlist,2) rsbauthors.close set rsbauthors=nothing REM Loop variable for authors (AR) and texts (TR) tr=0 REM Create list using text rows as main control do while tr<=bookrows thisrow=0 REM Initialise list item="" REM Assemble author string for c=0 to authorrows if authorlist(1,c)=booklist(0,tr) then authornames(0,thisrow)=authorlist(2,c) authornames(1,thisrow)=authorlist(3,c) thisrow=thisrow+1 end if next for c = 0 to thisrow-1 for x = 0 to 1 item = item & " "&authornames(x,c) next if c=thisrow-2 then item = item & " and " elseif (thisrow-1)>0 and c[Library: " & booklist(x,tr)&"]" end if if url="1" and booklist(x+1,tr)<>"" then item = item & " URL: " & booklist(x+1,tr)&"" end if if comments="1" and booklist(x+2,tr)<>"" then item = item &" Comments: " & booklist(x+2,tr) end if REM add to array slist(tr)=item REM Do again until texts are expired tr=tr+1 loop REM Display list call displaylist(sortarray(slist),tr) end if %> Chapters from Books<% if e=0 then rschapters.open qchapters, dataconn, 3 chapternum=checkfornone(rschapters) else chapternum=0 end if if chapternum=0 then nodisplay("Chapters") else chapterlist=rschapters.getrows chaptercolumns=ubound(chapterlist,1) chapterrows=ubound(chapterlist,2) redim slist(chapterrows) rschapters.close set rschapters=nothing rscauthors.open qcauthors, dataconn, 3 cauthorlist=rscauthors.getrows cauthornum=checkfornone(rscauthors) cauthorcolumns=ubound(cauthorlist,1) cauthorrows=ubound(cauthorlist,2) rscauthors.close set rscauthors=nothing rsbchapters.open qbchapters, dataconn, 3 bchapterlist=rsbchapters.getrows bchapternum=checkfornone(rsbchapters) bchaptercolumns=ubound(bchapterlist,1) bchapterrows=ubound(bchapterlist,2) rsbchapters.close set rsbchapters=nothing rscbauthors.open qcbauthors, dataconn, 3 cbauthorlist=rscbauthors.getrows cbauthornum=checkfornone(rscbauthors) cbauthorcolumns=ubound(cbauthorlist,1) cbauthorrows=ubound(cbauthorlist,2) rscbauthors.close set rscbauthors=nothing REM Loop variable for authors (AR) and texts (TR) ar1=0 ar2=0 tr=0 REM Create list using text rows as main control do while tr<=chapterrows thisrow=0 REM Initialise list item="" REM Assemble author string for c=0 to cauthorrows if cauthorlist(1,c)=chapterlist(0,tr) then authornames(0,thisrow)=cauthorlist(2,c) authornames(1,thisrow)=cauthorlist(3,c) thisrow=thisrow+1 end if next for c = 0 to thisrow-1 for x = 0 to 1 item = item & " "&authornames(x,c) next if c=thisrow-2 then item = item & " and " elseif (thisrow-1)>0 and c[Library: " & bchapterlist(x,tr)&"]" end if if url="1" and bchapterlist(x+1,tr)<>"" then item = item & " URL: " & bchapterlist(x+1,tr)&"" end if if comments="1" and bchapterlist(x+2,tr)<>"" then item = item &" Comments: " & bchapterlist(x+2,tr) end if REM add to array slist(tr)=item REM Do again until texts are expired tr=tr+1 loop REM Display list call displaylist(sortarray(slist),tr) end if %> Journal Articles<% if e=0 then rsjournals.open qjournals, dataconn, 3 jnum=checkfornone(rsjournals) else jnum=0 end if if jnum=0 then nodisplay("Journals") else jlist=rsjournals.getrows jcolumns=ubound(jlist,1) jrows=ubound(jlist,2) redim slist(jrows) rsjournals.close set rsjournals=nothing rsjauthors.open qjauthors, dataconn, 3 jauthornum=checkfornone(rsjauthors) REM What to do if journal authors is empty. REM for development: sort out how to display just journal titles. if jauthornum<>0 then jauthorlist=rsjauthors.getrows jauthorcolumns=ubound(jauthorlist,1) jauthorrows=ubound(jauthorlist,2) rsjauthors.close set rsjauthors=nothing end if REM Read ros and columsn for diagnostic purposes rem FOR Y=0 TO JROWS rem FOR X = 0 TO JCOLUMNS rem RESPONSE.WRITE X&" "&y&" "&JLIST(X,Y) & "" rem NEXT rem NEXT REM Loop variable for authors (AR) and texts (TR) tr=0 REM Create list using text rows as main control do while tr<=jrows thisrow=0 REM Initialise list item="" if jauthornum<>0 then REM Assemble author string for c=0 to jauthorrows if jauthorlist(1,c)=jlist(0,tr) then authornames(0,thisrow)=jauthorlist(2,c) authornames(1,thisrow)=jauthorlist(3,c) thisrow=thisrow+1 end if next for c = 0 to thisrow-1 for x = 0 to 1 item = item & " "&authornames(x,c) next if c=thisrow-2 then item = item & " and " elseif (thisrow-1)>0 and c [Library: " & jlist(8,tr)&"]" end if if url="1" and jlist(9,tr)<>"" then item = item & " URL: " & jlist(9,tr)&"" end if if comments="1" and jlist(10,tr)<>"" then item = item &" Comments: " & jlist(10,tr) end if REM add to array slist(tr)=item REM Do again until texts are expired tr=tr+1 loop REM Display list call displaylist(sortarray(slist),tr) end if %> Web Sites<% if e = 0 then rsurls.open QURL, dataconn, 3 unum=checkfornone(rsurls) else unum=0 end if if unum=0 then nodisplay("WWW Sources") else ulist=rsurls.getrows ucolumns=ubound(ulist,1) urows=ubound(ulist,2) redim slist(urows) rsurls.close set rsurls=nothing rsuauthors.open QUAuthors, dataconn, 3 uauthorlist=rsuauthors.getrows uauthornum=checkfornone(rsuauthors) uauthorcolumns=ubound(uauthorlist,1) uauthorrows=ubound(uauthorlist,2) rsuauthors.close set rsuauthors=nothing REM Loop variable for authors (AR) and texts (TR) ar=0 tr=0 REM Create list using text rows as main control do while tr<=urows thiscol=0 thisrow=0 REM Initialise list item="" REM Assemble author string for c=0 to uauthorrows if uauthorlist(1,c)=ulist(0,tr) then authornames(0,thisrow)=uauthorlist(2,c) authornames(1,thisrow)=uauthorlist(3,c) thisrow=thisrow+1 end if next for c = 0 to thisrow-1 for x = 0 to 1 item = item & " "&authornames(x,c) next if c=thisrow-2 then item = item & " and " elseif (thisrow-1)>0 and cComments: " & ulist(x,tr) end if REM add to array slist(tr)=item REM Do again until texts are expired tr=tr+1 loop REM Display list call displaylist(sortarray(slist),tr) end if %> |