📄 onexaminput.jsp
字号:
<%@ page language="java" contentType= "text/html; charset=gb2312"%>
<%@ page import = "com.huawei.icd30.common.db.*"%>
<%@ page import = "com.huawei.icd30.agt.util.*" %>
<%@ page import = "java.util.*" %>
<% String maxCountStr = (String)request.getAttribute("maxCount");
String userCountStr = (String)request.getAttribute("userCount");
String examTimeStr = (String)request.getAttribute("examTime");
String recordId = (String)request.getAttribute("recordId");
String paperFlag = (String)request.getAttribute("paperFlag");
int maxCount = 0;
int leaveCount = 0;
int examTime = 0;
if(maxCountStr != null)
{
maxCount = Integer.parseInt(maxCountStr);
leaveCount = maxCount - Integer.parseInt(userCountStr);
}
if(examTimeStr != null)
{
examTime = Integer.parseInt(examTimeStr);
}
%>
<!-- <title>业务代表管理系统考试页面</title>-->
<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 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)
{
dealReply();
document.onexamform.submit();
}
}
document.onexamform.timeLong.value = s_mins_spent + ":" + s_secs_spent;
document.onexamform.time_spent.value = s_mins_spent + ":" + s_secs_spent;
window.setTimeout('show_secs()',1000);
}
</script>
<!--huang yuyuan modify 2004-05-28 -->
<body bgcolor="B7D5F9" leftmargin="0" topmargin="00" marginwidth="0" marginheight="0" onLoad=" window.setTimeout('show_secs()',1);" onbeforeunload="forceSubmitPaper();" oncontextmenu=return(false); onselectstart="return false" onbeforeprint="document.body.style.display = 'none';">
<!-- onbeforeunload="forceSubmitPaper();" -->
<!-- // -->
<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">
<table width="550" border="0" cellpadding="3" cellspacing="1" class="table-cs1" align="center">
<input type="hidden" name="byClass" value="1">
<%if(maxCountStr == null || maxCount== 0)
{
%>
<tr>
<td height="25" align="center" class="td-cs1">这份试卷没有限制考试次数,你已经考了 <font color="#FF0000"><%=userCountStr%></font> 次。 </td>
</tr>
<%}
else
{%>
<tr>
<td height="25" align="center" class="td-cs1">这份试卷你最多有 <font color="#FF0000"><%=maxCountStr%></font> 次考试机会,你已经考了 <font color="#FF0000"><%=userCountStr%></font> 次,还剩下 <font color="#FF0000"><%=leaveCount%></font> 次。</td></tr>
<%}%>
<tr>
<%if(examTimeStr == null || "0".equalsIgnoreCase(examTimeStr))
{%>
<td height="25" align="center" class="td-cs1">这份试卷没有限制考试时间,关闭该窗口试卷被自动提交。
<input name="timeLong" type="text" class="input1" onFocus="this.blur()" size="10" ></td>
<%}
else
{%>
<td align="center" class="td-cs1">考试时间是 <font color="#FF0000"><%=examTimeStr%></font> 分钟,如果考试超时与关闭该窗口,试卷被自动提交。
<input name="timeLong" type="text" class="input1" onFocus="this.blur()" size="10">
</td>
<%}%>
</tr>
<tr>
<td height="25" align="center" class="td-cs1"><%=request.getAttribute("title")%>
</td>
</tr>
</table>
<input type="hidden" name="recordId" value="<%=recordId%>">
<input type="hidden" name="paperFlag" value="<%=paperFlag%>">
<input type="hidden" name="opeType" value="<%=OperatorFlagCode.ONLINEEXAM_DEAL%>">
<input type="hidden" name="examId" value="<%=request.getParameter("examId")%>">
<table width="550" border="0" cellpadding="3" cellspacing="1" class="table-cs1" align="center">
<%
SysResultSet rs = (SysResultSet)request.getAttribute("ONLINEEXAM-GETTEST-RESULTSET");
String optionRsSet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
if(rs != null)
{ for(int i=0;rs.setRecord(i)&&i<rs.getMetaData().getRecordCount();i++)
{
//4:试题类型 5:试题类型名称,1:试题内容,9:试题选项,8:试题分数,10:试题答案
%>
<tr>
<td width="20%" align="center" valign="top" class="td-cs2" ><%=i+1%>、(<%=rs.getString(5)%>)</td>
<input type="hidden" name="testIds" value="<%=rs.getString(0)%>">
<input type="hidden" name="testType" value="<%=rs.getString(4)%>">
<input type="hidden" name="score" value="<%=rs.getString(8)%>">
<input type="hidden" name="reply" value="">
<input type="hidden" name="result" value="<%if(rs.getInt(4)==1 || rs.getInt(4)==2 || rs.getInt(4)==3){%><%=rs.getString(10)%><%}%>">
<td valign="top" class="td-cs2" style="word-break:break-all"> <%=rs.getString(1)%> (<%=rs.getString(8)%>分)
<table border="0" cellpadding="3" cellspacing="0">
<%
//对试题选项进行处理
int testType = Integer.parseInt(rs.getString(4));
if(testType==1 || testType==2)
{
int count = Tools.countCharacter(rs.getString(9),"#");
ArrayList option = new ArrayList(count);
ArrayList optionKey = new ArrayList(count);
Tools.randOrderOption(rs.getString(9),option,optionKey);
for(int j=0;j<option.size();j++)
{
String optionRs = optionRsSet.substring(j,j+1);
%>
<tr>
<td class="td-cs2" width="30"></td>
<td class="td-cs2" ><%=optionRs%>.<input type="radio" name="A<%=rs.getString(0)%>" value="<%=(String)optionKey.get(j)%>"><%=(String)option.get(j)%></td>
</tr>
<%
}
}
else if(testType==3)
{
int count = Tools.countCharacter(rs.getString(9),"#");
ArrayList option = new ArrayList(count);
ArrayList optionKey = new ArrayList(count);
Tools.randOrderOption(rs.getString(9),option,optionKey);
for(int j=0;j<option.size();j++)
{
String optionRs = optionRsSet.substring(j,j+1);
%>
<tr>
<td class="td-cs2" width="30"></td>
<td class="td-cs2" ><%=optionRs%>.<input type="checkbox" name="A<%=rs.getString(0)%>" value="<%=(String)optionKey.get(j)%>"><%=(String)option.get(j)%></td>
</tr>
<%
}
}
else
{
int loc = 0;
StringTokenizer stoken = new StringTokenizer(rs.getString(9),"#");
while(stoken.hasMoreTokens())
{
String optionRs = optionRsSet.substring(loc,loc+1);
%>
<tr>
<td class="td-cs2" width="30"></td>
<td class="td-cs2" ><%=optionRs%>.
<textarea name="A<%=rs.getString(0)%>" cols="45" rows="<%=stoken.nextToken()%>" class="remark"></textarea></td>
</tr>
<%
loc++;
}
}
%>
</table>
</td>
</tr> <% }
}
%>
</table>
<input type="hidden" name="unload" value="0">
<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">
<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'"></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()
{
if( window.confirm("是否真的要提交答卷,请确认。"))
{
dealReply();
document.onexamform.unload.value = "1";
document.onexamform.submit();
}
}
function forceSubmitPaper()
{
if(document.onexamform.unload.value != "1")
{
dealReply();
document.onexamform.unload.value = "1";
document.onexamform.submit();
}
}
function dealReply()
{
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.value = " ";
}
}
else
{
reply.value = replyItem[0].value;
if(reply.value == "")
{
reply.value = " ";
}
for(var j=1;j<replyItem.length;j++)
{
if( replyItem[j].value != "")
{
reply.value = reply.value + "#" + replyItem[j].value;
}
else
{
reply.value = reply.value + "#" + " ";
}
}
}
}
}
}
document.onkeydown = function() {
if(event.keyCode==116) {
event.keyCode=0;
event.returnValue = false;
}
}
document.oncontextmenu = function() {event.returnValue = false;}
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -