📄 inst_view_test.asp
字号:
<!-- Author: Brad Pierce -->
<% If not Session("inst_authenticated") Then
Response.Redirect("inst_login.asp")
End If
'-----------------------------------------------------------
'Cannot declare variables because page is called throughout
'the same page.....would cause a variable declaration error
'-----------------------------------------------------------
'dim choices_counter
'dim FoundPos
'dim NextPos
'dim question
'dim answer
'dim match_list
' counters to ensure header is only printed once
'dim mc_previous_print
'dim tf_previous_print
'dim mtf_previous_print
'dim match_previous_print
'dim comp_previous_print
'dim sa_previous_print
'dim essay_previous_print
IF session("multi_visit") = FALSE THEN
session("match_count") = 0
session("mc_count") = 0
session("tf_count") = 0
session("mtf_count") = 0
session("match_count") = 0
session("comp_count") = 0
session("sa_count") = 0
session("essay_count") = 0
END IF
IF session("print_header") THEN
' print test name and instructions
sqltext = "SELECT Test_Name,Course_Code,Section_Code FROM Test WHERE Test_Code=" & session("selected_test") & ""
oRS.Open sqltext, oConn
session("course") = oRS("Course_Code")
session("section") = oRS("Section_Code")
test_name = oRS("Test_Name")
oRS.Close
sqltext = "SELECT Course_Name FROM Course WHERE Course_Code='" & session("course") & "'"
oRS.Open sqltext, oConn
session("course_name") = oRS("Course_Name")
oRS.Close
' print course and test name
Response.Write "<h3>" & session("course")
IF session("section") <> "" THEN
Response.Write "-" & session("section") & " "
ELSE
Response.Write " "
END IF
Response.Write session("course_name") & "<br>" & test_name & "</h3>"
sqltext = "SELECT Test_Instructions FROM Test WHERE Test_Code=" & session("selected_test") & ""
oRS.Open sqltext, oConn
Response.Write "<div id=secheader>Test Instructions</div>"
Response.Write "<table border='1'><tr><td>" & oRS("Test_Instructions") & "</td></tr></table><br>"
oRS.Close
' print the test out
sqltext = "SELECT * FROM Question WHERE Test_Code=" & session("selected_test") & " ORDER BY Test_Code, Question_Number"
oRS.Open sqltext, oConn
END IF
question_counter = 1
DO WHILE NOT oRS.EOF
SELECT CASE oRS("Question_Type_Code")
'------------------------
' display multiple choice
'------------------------
CASE "MC"
IF NOT mc_previous_print THEN
Response.Write "<p><div id=secheader>Multiple Choice</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Question</td><td>Choices</td><td>Answer</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td>"
' display delimited question
question = oRS("Question_Ask")
FoundPos = instr(question, "|")
Response.Write "<td width='300'>" & Left(question, FoundPos - 1) & "</td>"
' display choices
Response.Write "<td><table border='0'><tr>"
choices_counter = 1
DO WHILE FoundPos < len(question)
NextPos = InStr(FoundPos + 1, question, "|")
IF NextPos THEN
Response.Write "<td><b>" & chr(64 + choices_counter) & ".</b></td><td width='75'>" & Mid(question, FoundPos + 1, NextPos - FoundPos - 1) & "</td><td width='15'></td>"
ELSE
Response.Write "<td><b>" & chr(64 + choices_counter) & ".</b></td><td width='75'>" & Right(question, len(question) - FoundPos) & "</td><td width='15'></td>"
FoundPos = len(question)
EXIT DO
END IF
IF choices_counter mod 3 = 0 THEN
Response.Write "</tr><tr>"
END IF
FoundPos = NextPos
choices_counter = choices_counter + 1
LOOP
Response.Write "</table></td>"
' display answer
Response.Write "<td><center>" & oRS("Question_Answer") & "</center></td></tr>"
question_counter = question_counter + 1
session("mc_count") = session("mc_count") + 1
mc_previous_print = TRUE
'-------------------
' display true/false
'-------------------
CASE "TF"
IF NOT tf_previous_print THEN
IF session("mc_count") THEN
response.write "</table><br>"
END IF
Response.Write "<div id=secheader>True/False</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Question</td><td>Answer</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td><td>" & oRS("Question_Ask") & _
"</td><td><center>" & Ucase(oRS("Question_Answer")) & "</center></td></tr>"
question_counter = question_counter + 1
session("tf_count") = session("tf_count") + 1
tf_previous_print = TRUE
'----------------------------
' display modified true/false
'----------------------------
CASE "MTF"
IF NOT mtf_previous_print THEN
IF session("mc_count") OR session("tf_count") THEN
response.write "</table><br>"
END IF
Response.Write "<div id=secheader>Modified True/False</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Question</td><td>Keyword</td><td>Answer</td><td>Correction If False</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td>"
' display delimited question and keyword
question = oRS("Question_Ask")
FoundPos = instr(question, "|")
Response.Write "<td>" & Left(question, FoundPos - 1) & "</td>"
Response.Write "<td>" & Right(question, Len(question) - FoundPos) & "</td>"
' display delimited answer and correction
answer = oRS("Question_Answer")
FoundPos = instr(answer, "|")
IF FoundPos THEN
Response.Write "<td><center>" & Ucase(Left(answer, FoundPos - 1)) & "</center></td>"
Response.Write "<td>" & Right(answer, Len(answer) - FoundPos) & "</td>"
ELSE
Response.Write "<td><center>" & Ucase(answer) & "</center></td>"
END IF
question_counter = question_counter + 1
session("mtf_count") = session("mtf_count") + 1
mtf_previous_print = TRUE
'-----------------
' display matching
'-----------------
CASE "MATCH"
IF NOT match_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") THEN
response.write "</table><br>"
END IF
Response.Write "<div id=secheader>Matching</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Match List</td><td>Answers Jumbled</td><td>Correct Match</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td>"
' display delimited match list and answers jumbled
match_list = oRS("Question_Ask")
FoundPos = instr(match_list, "|")
Response.Write "<td>" & Left(match_list, FoundPos - 1) & "</td><td>"
Response.Write "<table><tr><td width='20'><b>" & chr(65 + session("match_count")) & ".</b></td><td>" & Right(match_list, Len(match_list) - FoundPos) & "</td></tr></table></td>"
Response.Write "<td><center>" & oRS("Question_Answer") & "</center></td>"
question_counter = question_counter + 1
session("match_count") = session("match_count") + 1
match_previous_print = TRUE
'-------------------
' display completion
'-------------------
CASE "COMP"
IF NOT comp_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") THEN
response.write "</table><br>"
END IF
Response.Write "<div id=secheader>Completion</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Statement</td><td>Completion</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td><td>" & oRS("Question_Ask") & _
"</td><td>" & oRS("Question_Answer") & "</td></tr>"
question_counter = question_counter + 1
session("comp_count") = session("comp_count") + 1
comp_previous_print = TRUE
'---------------------
' display short answer
'---------------------
CASE "SA"
IF NOT sa_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") OR session("comp_count") THEN
response.write "</table><br>"
END IF
Response.Write "<div id=secheader>Short Answer</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Question</td><td>Answer/Keywords</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td><td>" & oRS("Question_Ask") & _
"</td><td>" & oRS("Question_Answer") & "</td></tr>"
question_counter = question_counter + 1
session("sa_count") = session("sa_count") + 1
sa_previous_print = TRUE
'--------------
' display essay
'--------------
CASE "ESSAY"
IF NOT essay_previous_print THEN
IF session("mc_count") OR session("tf_count") OR session("mtf_count") OR session("match_count") OR session("comp_count") OR session("sa_count") THEN
response.write "</table><br>"
END IF
Response.Write "<div id=secheader>Essay</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Question</td><td>Answer/Keywords</td></tr>"
END IF
Response.Write "<tr><td>" & oRS("Question_Number") & "</td><td>" & oRS("Question_Ask") & _
"</td><td>" & oRS("Question_Answer") & "</td></tr>"
question_counter = question_counter + 1
session("essay_count") = session("essay_count") + 1
essay_previous_print = TRUE
CASE ELSE
Response.Write "FATAL ERROR...INCORRECT QUESTION_TYPE_CODE"
END SELECT
oRS.MoveNext
LOOP
' check for a test without any questions and for page that calls viewer multiple times
'IF question_counter > 1 OR session("print_header") THEN
' Response.Write "</table>"
'END IF
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -