📄 inst_view_update_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
'-----------------------------------------------------------
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
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>"
' display delimited question
question = oRS("Question_Ask")
FoundPos = instr(question, "|")
Response.Write "<td><input type='text' size='30' name='mc_question_" & session("question_number") & "' value='" & Left(question, FoundPos - 1) & "' ></td>"
' display choices
Response.Write "<td><table><tr>"
session("mc_choices_counter") = 1
DO WHILE FoundPos < len(question)
NextPos = InStr(FoundPos + 1, question, "|")
IF NextPos THEN
Response.Write "<td><b>" & chr(64 + session("mc_choices_counter")) & ".</b></td>" & _
"<td><input type='text' name='mc_choice_" & session("question_number") & chr(64 + session("mc_choices_counter")) & "'" & _
" value='" & Mid(question, FoundPos + 1, NextPos - FoundPos - 1) & "' ></td>"
ELSE
Response.Write "<td><b>" & chr(64 + session("mc_choices_counter")) & ". </b></td>" & _
"<td><input type='text' name='mc_choice_" & session("question_number") & chr(64 + session("mc_choices_counter")) & "'" & _
" value='" & Right(question, len(question) - FoundPos) & "' ></td>"
'FoundPos = len(question)
EXIT DO
END IF
IF session("mc_choices_counter") mod 3 = 0 THEN
Response.Write "</tr><tr>"
END IF
FoundPos = NextPos
session("mc_choices_counter") = session("mc_choices_counter") + 1
LOOP
' allow user to enter one more choice past the choices they already had
IF session("mc_choices_counter") mod 3 = 0 THEN
Response.Write "</tr><tr>"
END IF
session("mc_choices_counter") = session("mc_choices_counter") + 1
Response.Write "<td><b>" & chr(64 + session("mc_choices_counter")) & ". </b></td>" & _
"<td><input type='text' name='mc_choice_" & session("question_number") & chr(64 + session("mc_choices_counter")) & "' ></td>"
Response.Write "</table></td>"
' display answer
Response.Write "<td><center><select name='mc_answer_" & session("question_number") & "' >"
FOR answer_counter = 1 to session("mc_choices_counter")
Response.Write "<OPTION VALUE='" & ucase(chr(64 + answer_counter)) & "'>"
Response.Write chr(64 + answer_counter) & "</OPTION>"
NEXT
Response.Write "</center></select></td></tr>"
session("mc_modify_count") = session("mc_modify_count") + 1
session("modified_mc_questions") = session("modified_mc_questions") & session("question_number") & " "
mc_previous_print = TRUE
'-------------------
' display true/false
'-------------------
CASE "TF"
IF NOT tf_previous_print THEN
Response.Write "</table></p><p><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
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>" & _
"<td><input type='text' name='tf_question_" & session("question_number") & "' value='" & oRS("Question_Ask") & "'></td>"
tf_answer = oRS("Question_Answer")
Response.Write "<td><select name='tf_answer_" & session("question_number") & "' >"
Response.Write "<OPTION VALUE='" & ucase(tf_answer) & "'>" & ucase(tf_answer) & "</OPTION>"
Response.Write "<OPTION VALUE='" & ucase(not tf_answer) & "'>" & ucase(not tf_answer) & "</OPTION>"
Response.Write "</select></td></tr>"
session("tf_modify_count") = session("tf_modify_count") + 1
session("modified_tf_questions") = session("modified_tf_questions") & session("question_number") & " "
tf_previous_print = TRUE
'----------------------------
' display modified true/false
'----------------------------
CASE "MTF"
IF NOT mtf_previous_print THEN
Response.Write "</table></p><p><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
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>"
' display delimited question and keyword
question = oRS("Question_Ask")
FoundPos = instr(question, "|")
Response.Write "<td><input type='text' name='mtf_question_" & session("question_number") & "' value='" & Left(question, FoundPos - 1) & "' ></td>"
Response.Write "<td><input type='text' name='mtf_keyword_" & session("question_number") & "' value='" & Right(question, Len(question) - FoundPos) & "' ></td>"
' display delimited answer and correction
mtf_answer = oRS("Question_Answer")
FoundPos = instr(mtf_answer, "|")
IF FoundPos THEN
Response.Write "<td><select name='mtf_answer_" & session("question_number") & "' >"
Response.Write "<OPTION VALUE='" & ucase(Left(mtf_answer, FoundPos - 1)) & "'>" & ucase(Left(mtf_answer, FoundPos - 1)) & "</OPTION>"
Response.Write "<OPTION VALUE='" & ucase((not Left(mtf_answer, FoundPos - 1))) & "'>" & ucase((not Left(mtf_answer, FoundPos - 1))) & "</OPTION>"
Response.Write "</select></td>"
Response.Write "<td><input type='text' name='mtf_correction_" & session("question_number") & "' value='" & Right(mtf_answer, Len(mtf_answer) - FoundPos) & "' ></td></tr>"
ELSE
Response.Write "<td><select name=mtf_answer_" & session("question_number") & " >"
Response.Write "<OPTION VALUE='" & ucase(mtf_answer) & "'>" & ucase(mtf_answer) & "</OPTION>"
Response.Write "<OPTION VALUE='" & ucase(not mtf_answer) & "'>" & ucase(not mtf_answer) & "</OPTION>"
Response.Write "<td><input type='text' name='mtf_correction_" & session("question_number") & "' ></td>"
Response.Write "</select></td></tr>"
END IF
session("mtf_modify_count") = session("mtf_modify_count") + 1
session("modified_mtf_questions") = session("modified_mtf_questions") & session("question_number") & " "
mtf_previous_print = TRUE
'-----------------
' display matching
'-----------------
CASE "MATCH"
IF NOT match_previous_print THEN
Response.Write "</table></p><p><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>"
print_counter = 1
END IF
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>"
' display delimited match list and answers jumbled
match_list = oRS("Question_Ask")
FoundPos = instr(match_list, "|")
Response.Write "<td><input type='text' name='match_list_" & session("question_number") & "' value='" & Left(match_list, FoundPos - 1) & "' ></td>"
Response.Write "<td><table><tr><td width='20'><b>" & chr(64 + print_counter) & ".</b></td>" & _
"<td><input type='text' name='match_jumbled_" & session("question_number") & "' value='" & Right(match_list, Len(match_list) - FoundPos) & "' ></td></tr></table>"
Response.Write "</td><td><center><select name='match_answer_" & session("question_number") & "' >"
FOR answer_counter = 1 to session("match_count")
Response.Write "<OPTION VALUE='" & ucase(chr(64 + answer_counter)) & "'>"
Response.Write chr(64 + answer_counter) & "</OPTION>"
NEXT
Response.Write "</center></select></td></tr>"
session("match_modify_count") = session("match_modify_count") + 1
session("modified_match_questions") = session("modified_match_questions") & session("question_number") & " "
print_counter = print_counter + 1
match_previous_print = TRUE
'-------------------
' display completion
'-------------------
CASE "COMP"
IF NOT comp_previous_print THEN
Response.Write "</table></p><p><div id=secheader>Completion</div>"
Response.Write "<table border='1'><tr><td></td>"
Response.Write "<td>Statement</td><td>Completion</td></tr>"
END IF
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>" & _
"<td><input type='text' name='comp_question_" & session("question_number") & "' value='" & oRS("Question_Ask") & "' ></td>" & _
"<td><input type='text' name='comp_answer_" & session("question_number") & "' value='" & oRS("Question_Answer") & "' ></td></tr>"
session("comp_modify_count") = session("comp_modify_count") + 1
session("modified_comp_questions") = session("modified_comp_questions") & session("question_number") & " "
comp_previous_print = TRUE
'---------------------
' display short answer
'---------------------
CASE "SA"
IF NOT sa_previous_print THEN
Response.Write "</table></p><p><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
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>" & _
"<td><input type='text' name='sa_question_" & session("question_number") & "' value='" & oRS("Question_Ask") & "' ></td>" & _
"<td><input type='text' name='sa_answer_" & session("question_number") & "' value='" & oRS("Question_Answer") & "' ></td></tr>"
session("sa_modify_count") = session("sa_modify_count") + 1
session("modified_sa_questions") = session("modified_sa_questions") & session("question_number") & " "
sa_previous_print = TRUE
'--------------
' display essay
'--------------
CASE "ESSAY"
IF NOT essay_previous_print THEN
Response.Write "</table></p><p><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
session("question_number") = oRS("Question_Number")
Response.Write "<tr><td>" & session("question_number") & "</td>" & _
"<td><input type='text' size='30' name='essay_question_" & session("question_number") & "' value='" & oRS("Question_Ask") & "' ></td>" & _
"<td><textarea cols='50' name='essay_answer_" & session("question_number") & "' >" & oRS("Question_Answer") & "</textarea></td></tr>"
session("essay_modify_count") = session("essay_modify_count") + 1
session("modified_essay_questions") = session("modified_essay_questions") & session("question_number") & " "
essay_previous_print = TRUE
CASE ELSE
Response.Write "FATAL ERROR...INCORRECT QUESTION_TYPE_CODE"
END SELECT
oRS.MoveNext
LOOP
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -