<%@ Language=VBScript EnableSessionState=False %>
<% Option Explicit
Response.Buffer = true
Response.expires = 0
Dim sThisPage, sFileName, sDBpath, objDT, sID, sFirst, sLast, sStudent, sFullName, vData
Set objDT = Server.CreateObject("dteach40.clsDac")
'--------------------------------------------------------------------------------------
' Get the file name of the current exam database into the sFileName variable.
' For example, if the current exam page is A_Final_Exam.asp, the database file name is
' A_Final_Exam.wsd.
'--------------------------------------------------------------------------------------
sThisPage = Request.ServerVariables("URL")
sFileName = Right(sThisPage, len(sThisPage)-InstrRev(sThisPage, "/"))
sFileName = Replace(sFileName, ".asp", ".wsd")
'--------------------------------------------------------------------------------------
' Get the full, physical path to the current exam database into the sDBpath variable.
'
' The sDBpath is a string variable that contains the physical location of the
' current Digital Teacher exam database file (.wsd). It must be a combination of
' the "directory path" and the "database file name" such as
'
' (Example) "C:\Inetpub\wwwroot\dteacher\database\" & sFileName
'
' So, you must first determine which directory you want to place the database file in.
' And replace the "directory path" value shown in the above example with your actual
' path string.
' Note: For the purpose of previewing on a local computer, the [Database Folder -
' Physical Path] setup in the Digital Teacher authoring program's
' Web Preview Setup option tab should point to the same database directory.
' This will allow Digital Teacher to automatically save the database file
' in the specified directory when an exam file is generated.
'
' Note: For actual publishing on the Web, if your web site resides on a web hosting
' provider's system, you are usually limited to place your files inside an FTP
' (disk) space allocated to you - such as F:\FTP\Username\RootDir\. In order for
' the path reference to be effective both for the local preview and for Web
' publishing, you should use one of the following references.
'
' sDBpath = Server.Mappath("../database") & "\" & sFileName
' sDBpath = Server.Mappath("\dteacher\database") & "\" & sFileName
'---------------------------------------------------------------------------------------
sDBpath = Server.Mappath("../database") & "\" & sFileName
If (Request.Form("Result") = "") Then 'When the student is loading the exam
' -------------------------------------------------------------------------------
' Fetch the student's ID, first and last name that have been passed from the
' login page (dtLoginNT.htm). Save them in variables. Fetch the login page's
' URL and save it in a cookie.
' -------------------------------------------------------------------------------
sID = Trim(Request.Form("StudID")) ' ID
sFirst = Trim(Request.Form("FirstName")) ' First name
sLast = Trim(Request.Form("LastName")) ' Last name
sStudent = sID & " " & sFirst & " " & sLast
sFullName = sFirst & " " & sLast
Response.Cookies("LoginURL") = Request.Form("LoginPath") ' Login page URL
' -------------------------------------------------------------------------------
' Get the student list from the current exam database at sDBpath. Check the
' student's identity against the list. If unidentified, display feedback and
' provide a link to allow the student to go back to the login page. If identified
' continue loading the exam page.
' -------------------------------------------------------------------------------
If Not (objDT.getStudent(sDBpath, sStudent, False)) Then
Response.write objDT.getFeedback("To return to Login, ", Request.Cookies("LoginURL"))
Response.End
Set objDT = Nothing
End If
Else 'When the student is submitting
Dim sRptOptions
sRptOptions = ""
Dim sRptShowAnswer,sRptTitle,sRptQuestion,sRptScore,sRptEarned
Dim sRptPercent,sRptMark,sRptFooter,sRptCorrect,sRptIncorrect,sRptPartly
'----------------------------------------------------------
' Define the report captions in your language (Chapter 9).
'----------------------------------------------------------
sRptShowAnswer = "1"
sRptTitle = "Performance Report"
sRptQuestion = "Question"
sRptScore = "Score"
sRptEarned = "Earned"
sRptPercent = "Percent"
sRptMark = "Mark"
sRptFooter = "Score and Weighted Average Total(%):"
sRptCorrect = "Correct"
sRptIncorrect = "Incorrect"
sRptPartly = "Partly"
sRptOptions = sRptShowAnswer & "^" & sRptTitle & "^" & sRptQuestion & "^" & sRptScore & "^" & sRptEarned & "^" & sRptPercent & "^" & sRptMark & "^" & sRptFooter & "^" & sRptCorrect & "^" & sRptIncorrect & "^" & sRptPartly & "^"
'--------------------------------------------------------------------------------
' Define report style ((Chapter 9). Display a short message on the browser before
' our server completes data processing.
'--------------------------------------------------------------------------------
Response.Write "<HTML><HEAD><TITLE>Digital Teacher Exam</TITLE>" _
& "<STYLE TYPE=""text/css"">" _
& "TABLE {border-style:none;}" _
& "TH {border-style:none;font-family: verdana,arial,helvetica,serif;font-size: 9pt;color: white;background-color: navy;}" _
& "TD {font-family: verdana,arial,helvetica,serif;font-size: 9pt;color: black;}" _
& "CAPTION.title {font-family: verdana,arial,helvetica,serif; font-size: 16pt; color:navy;}" _
& "TD.footer {background-color: #c6eff7; font-weight:600; text-align:right;}" _
& "</STYLE>" _
& "</HEAD><BODY BACKGROUND=""../program_images/back.gif"">" _
& "<FONT FACE=Verdana SIZE=3 COLOR=Purple>Submitting Your Answers...</FONT> "
Response.Flush
' -------------------------------------------------------------------------------
' Save the data ("Result") in the current exam's database. We may or may not
' encounter unexpected errors before the data is saved. In either case, display
' an appropriate feedback and provide a link that allows the student to return
' to the login page.
'
' Note: If the current exam has been created with a trial version of Digital
' Teacher, clicking the "To return to Login" link will send the current
' exam URL to the Digital Teacher web site. If you are currently on a local
' computer with PWS running, or evaluating Digital Teacher on an intranet,
' your browser may attempt to connect to the Internet. If this concerns you
' and you do not want your URL sent back to our web site, use the Browser
' history list to return to the login page.
' We have added this functionality to allow ourselves to find who are using
' the evaluation copy of Digital Teacher on the Web. When you purchase a
' licensed copy of Digital Teacher, this functionality is automatically
' disabled.
' -------------------------------------------------------------------------------
If Not (objDT.saveResult(sDBpath, Request.Form("Result"), sRptOptions)) then
Response.write objDT.getFeedback("To return to Login, ", Request.Cookies("LoginURL"))
Else
Response.write objDT.getFeedback("To return to Login, ", Request.Cookies("LoginURL"))
End if
Response.Write "</BODY></HTML>"
Response.End
Set objDT = Nothing
End If
%>
Copyright 2001-2002 Francis Software, Sunnyvale, California