📄 showtestitem.jsp
字号:
<%--
/**
* Copyright 1988-2004, Huawei Tech. Co., Ltd.
* filename: ShowTestItem.jsp
* description:
* date: 2004-06-10
* @author 黄育源
* @version 3.0
*
* History: // 历史修改记录
* <author> <time> <version > <desc>
*/
--%>
<%@ page language="java" contentType= "text/html; charset=gb2312"%>
<%@ page import = "com.huawei.icd30.common.systemconfig.*" %>
<%@ page import = "com.huawei.icd30.agt.util.*" %>
<%@ page import = "java.util.*" %>
<%
String maxCountStr = (String)session.getAttribute("maxCount");
String userCountStr = (String)session.getAttribute("userCount");
String examTimeStr = (String)session.getAttribute("examTime");
String titleStr = (String)session.getAttribute("title");
int maxCount = 0;
int leaveCount = 0;
int examTime = 0;
String startTimeStr = request.getParameter("startTime");
long startTime = 0l;
if(null != startTimeStr)
{
startTime = Long.parseLong(startTimeStr);
}
if(maxCountStr != null)
{
maxCount = Integer.parseInt(maxCountStr);
leaveCount = maxCount - Integer.parseInt(userCountStr);
}
if(examTimeStr != null)
{
examTime = Integer.parseInt(examTimeStr);
}
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
SCROLLBAR-FACE-COLOR: #d6efff; SCROLLBAR-HIGHLIGHT-COLOR: #9E9E9E; SCROLLBAR-SHADOW-COLOR: #9E9E9E; SCROLLBAR-3DLIGHT-COLOR: #ffffff; SCROLLBAR-ARROW-COLOR: #666666; SCROLLBAR-TRACK-COLOR: #d6efff; SCROLLBAR-DARKSHADOW-COLOR: #ffffff}
</STYLE>
<title>考试题自测页面 </title>
<link href="/agt/public/css/gb.css" rel="stylesheet" type="text/css">
<script LANGUAGE="JAVASCRIPT">
var time = <%=examTime%>;
var time_total = time * 60;
//var time_start = new Date();
//var clock_start = time_start.getTime();
var clock_start = <%=startTime%>;
var dl_ok=false;
function get_time_spent ()
{
var time_now = new Date();
return((time_now.getTime() - clock_start)/1000);
}
function show_secs () // show the time user spent on the side
{
var i_total_secs = Math.round(get_time_spent());
var i_secs_spent = i_total_secs % 60;
var i_mins_spent = Math.round((i_total_secs-30)/60);
var s_secs_spent = "" + ((i_secs_spent>9) ? i_secs_spent : "0" + i_secs_spent);
var s_mins_spent = "" + ((i_mins_spent>9) ? i_mins_spent : "0" + i_mins_spent);
if(time != 0)
{
if (time_total - i_total_secs == 600) alert ("考试还剩下10分钟了!!!");
if (time_total == i_total_secs) document.onexamform.submit();
}
document.onexamform.time_spent.value = s_mins_spent + ":" + s_secs_spent;
window.setTimeout('show_secs()',1000);
}
</script>
<body bgcolor="B7D5F9" leftmargin="0" topmargin="00" marginwidth="0" marginheight="0" onLoad=" window.setTimeout('show_secs()',1);" oncontextmenu=return(false); onselectstart="return false" onbeforeprint="document.body.style.display = 'none';" >
<table width="550" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><p align="left"><font color="#FF0000" face="宋体"><br>
自测考试,点击提交按钮可查看所得分数与答案</font></p></td>
</tr>
</table>
<form name="onexamform" method="POST" action="/OnlineExam.do">
<input type="hidden" name="opeType" value="<%=OperatorFlagCode.ONLINEEXAM_RANK_TESTDEAL%>">
<input type="hidden" name="paperId" value="<%=request.getParameter("paperId")%>">
<input type="hidden" name="lessonId" value="<%=request.getParameter("lessonId")%>">
<table width="550" border="0" cellpadding="3" cellspacing="1" class="table-cs1" align="center">
<tr>
<td height="25" align="center" class="td-cs1">试卷名称:<%=titleStr%></td>
</tr>
</table>
<table width="550" border="0" cellpadding="3" cellspacing="1" class="table-cs1" align="center">
<%
ArrayList alTestId = (ArrayList)session.getAttribute("alTestId");
ArrayList alContent = (ArrayList)session.getAttribute("alContent");
ArrayList alExplain = (ArrayList)session.getAttribute("alExplain");
ArrayList alClassId = (ArrayList)session.getAttribute("alClassId");
ArrayList alTestType = (ArrayList)session.getAttribute("alTestType");
ArrayList alTypeName = (ArrayList)session.getAttribute("alTypeName");
ArrayList alDegree = (ArrayList)session.getAttribute("alDegree");
ArrayList alDegreeName = (ArrayList)session.getAttribute("alDegreeName");
ArrayList alScore = (ArrayList)session.getAttribute("alScore");
ArrayList alTestOption = (ArrayList)session.getAttribute("alTestOption");
ArrayList alResult = (ArrayList)session.getAttribute("alResult");
ArrayList alUserLevel = (ArrayList)session.getAttribute("alUserLevel");
ArrayList alUseFrequency = (ArrayList)session.getAttribute("alUseFrequency");
ArrayList alReferenceTime = (ArrayList)session.getAttribute("alReferenceTime");
ArrayList alReply = (ArrayList)session.getAttribute("alReply");
int testItemCount = ((Integer)session.getAttribute("testItemCount")).intValue();
int testItemNum = Integer.parseInt(Initor.systemConfig.get("agt/testItemNum","10"));
int pageNo = Integer.parseInt(request.getParameter("pageNo"));
int startLocate = 0;
String optionRsSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
//获取上个页面的数据,把它们放到session里面去
String[] replayArr = request.getParameterValues("reply");
if(pageNo > 1)
{
for(int i = 0; i < replayArr.length; i++)
{
alReply.add(replayArr[i]);
}
}
if((pageNo>0)&&(testItemNum>0))
{
startLocate = (pageNo-1)*testItemNum;
}
int pageCount = 1;
if(0!=testItemNum)
{
pageCount = testItemCount/testItemNum;
if(0!=(testItemCount%testItemNum))
{
pageCount++;
}
}
for(int i = 0; i < testItemNum; i++)
{
if(startLocate>=testItemCount)
{
break;
}
//4:试题类型 5:试题类型名称,1:试题内容,9:试题选项,8:试题分数,10:试题答案
%>
<tr>
<td width="20%" align="center" valign="top" class="td-cs2" ><%=alTypeName.get(startLocate)%></td>
<input type="hidden" name="testIds" value="<%=alTestId.get(startLocate)%>">
<input type="hidden" name="testType" value="<%=alTestType.get(startLocate)%>">
<input type="hidden" name="score" value="<%=alScore.get(startLocate)%>">
<input type="hidden" name="reply" value="">
<input type="hidden" name="result" value="<%if(("1".equals(((String)alTestType.get(startLocate)).trim())) || ("2".equals(((String)alTestType.get(startLocate)).trim())) || ("3".equals(((String)alTestType.get(startLocate)).trim()))){%><%=alResult.get(startLocate)%><%}%>">
<td valign="top" class="td-cs2" style="word-break:break-all"> <%=alContent.get(startLocate)%> (<%=alScore.get(startLocate)%>分)
<table border="0" cellpadding="3" cellspacing="0">
<%
//对试题选项进行处理
int testType = Integer.parseInt((String)alTestType.get(startLocate));
int loc = 0;
StringTokenizer stoken = new StringTokenizer((String)alTestOption.get(startLocate),"#");
while(stoken.hasMoreTokens())
{
String optionRs = optionRsSet.substring(loc,loc+1);
if(testType==1 || testType==2)
{
%>
<tr>
<td class="td-cs2" width="30"></td>
<td class="td-cs2" ><%=optionRs%>.<input type="radio" name="A<%=alTestId.get(startLocate)%>" value="<%=optionRs%>"><%=stoken.nextToken()%></td>
</tr>
<%
}
else if(testType==3)
{
%>
<tr>
<td class="td-cs2" width="30"></td>
<td class="td-cs2" ><%=optionRs%>.<input type="checkbox" name="A<%=alTestId.get(startLocate)%>" value="<%=optionRs%>"><%=stoken.nextToken()%></td>
</tr>
<%
}
else
{
%>
<tr>
<td class="td-cs2" width="30"></td>
<td class="td-cs2" ><%=optionRs%>.
<textarea name="A<%=alTestId.get(startLocate)%>" cols="45" rows="<%=stoken.nextToken()%>" class="remark"></textarea></td>
</tr>
<%
}
loc++;
}
%>
</table>
</td>
</tr>
<%
startLocate++;
}
%>
</table>
<table width="550" border="0" cellspacing="0" cellpadding="8" align="center">
<tr>
<td width="41%" align="right">
<table width="224" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="right">
<td width="107"> </td>
<td width="109">
<%
if(pageNo==pageCount)
{
%>
<input name="submit" type="image" onclick="submitPaper();return false;" src="/agt/public/images/submit.gif" width="82" height="22" border="0" onmouseover="this.src='/agt/public/images/'+ this.name + '_2.gif';" onmouseout="this.src='/agt/public/images/'+ this.name + '.gif'">
<%
}
else
{
%>
<input name="nextstep" type="image" onclick="nextPaper();return false;" src="/agt/public/images/nextstep.gif" width="82" height="22" border="0" onmouseover="this.src='/agt/public/images/'+ this.name + '_2.gif';" onmouseout="this.src='/agt/public/images/'+ this.name + '.gif'">
<%
}
%>
</td>
</tr>
</table>
</td>
<td width="59%">
<input name="time_spent" type="text" class="input1" onFocus="this.blur()" size="10" >
</td>
</tr>
</table>
</form>
<script language="javascript">
function submitPaper()
{
dealPaper();
document.onexamform.submit();
}
function nextPaper()
{
var nextPage = <%=pageNo%> + 1;
dealPaper();
document.onexamform.action = "/agt/lessonmng/ShowTestItem.jsp?pageNo=" + nextPage + "&startTime=" + <%=startTimeStr%>;
document.onexamform.submit();
}
function dealPaper()
{
var testIds = document.onexamform.testIds;
var testType = document.onexamform.testType;
var reply = document.onexamform.reply;
for(var i=0;i<testIds.length;i++)
{
var replyItemStr = "document.onexamform.A" + testIds[i].value;
replyItem = eval(replyItemStr);
if(testType[i].value == "1" || testType[i].value == "2" || testType[i].value == "3")
{//判断题 - 单选题-多选题
for(var j=0;j<replyItem.length;j++)
{
if(replyItem[j].checked == true)
{
reply[i].value = reply[i].value + replyItem[j].value;
}
}
}
else
{//填空题,问答题
if(!(replyItem.length > 1))
{//只有一条输入
reply[i].value = replyItem.value;
if(replyItem.value == "")
{
reply[i].value = " ";
}
}
else
{//有多条输入
reply[i].value = replyItem[0].value;
if(replyItem[0].value == "")
{
reply[i].value = " ";
}
for(var j=1;j<replyItem.length;j++)
{
if( replyItem[j].value != "")
{
reply[i].value = reply[i].value + "#" + replyItem[j].value;
}
else
{
reply[i].value = reply[i].value + "#" + " ";
}
}
}
}
}
if(!(testIds.length > 1))
{//只有一道题
var replyItemStr = "document.all.A"+testIds.value;
replyItem = eval(replyItemStr);
if(testType.value == "1" || testType.value == "2" || testType.value == "3")
{//判断题 - 单选题-多选题
for(var j=0;j<replyItem.length;j++)
{
if(replyItem[j].checked == true)
{
reply.value = reply.value + replyItem[j].value;
}
}
}
else
{//填空题,问答题
if(!(replyItem.length > 1))
{
reply.value = replyItem.value;
/*
if(replyItem.value == "")
{
reply[i].value = " ";
}*/
}
else
{
reply.value = replyItem[0].value;
for(var j=1;j<replyItem.length;j++)
{
if( replyItem[j].value != "")
{
reply[i].value = reply[i].value + "#" + replyItem[j].value;
}
else
{
reply[i].value = reply[i].value + "#" + " ";
}
}
}
}
}
}
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -