<%@ Page Language="C#" AutoEventWireup="true" CodeFile="DoTest.aspx.cs" Inherits="Tester_DoTest" ValidateRequest="false"%>

<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>考试进行中</title>
    <link href="../StyleSheet.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function show()
        {
            var timeTip=document.getElementById("timeTip");
            if(timeTip.style.display=="none")
               timeTip.style.display="";
            else
                timeTip.style.display="none";
         }
        
        function document.onkeydown()    
        {    
            if ( (event.keyCode==116)||                  //屏蔽 F5 刷新键    
                (event.ctrlKey && event.keyCode==82))
                { //Ctrl + R    
                     event.keyCode=0;    
                     event.returnValue=false;    
                }    
        }    
    </script>
</head>
<body >
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        
    <script type="text/javascript">
    
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
         
    function EndRequestHandler(sender, args)
    {
       if (args.get_error() != undefined)
        {
             if ((args.get_response().get_statusCode() == '12007') || (args.get_response().get_statusCode() == '12029'))
             {        
               alert('请检查您是否已经连接到Internet');
               window.onerror=true;
             }
        }
    }
    
    </script>
        
        <table cellpadding="0" cellspacing="0" class="form" width="800">
            <tr>
                <td class="formName" colspan="2">
                    <span><asp:Label ID="lblTestName" runat="server" Text="考试题目"></asp:Label></span>
                </td>
            </tr>
            <tr>
                <td class="titleName" style="width: 200px; height: 16px;">
                    考试题目： 
                </td>
               <td style="text-align:left; color: #ff0000;">
                <iframe height='300px' width='700' scrolling='yes' src='testContent.aspx?paperID=<%=PaperID %>'>  </iframe>
                </td>
            </tr>
            <tr style="color: #ff0000">
                <td class="titleName" style="width: 200px; height: 25px">
                &nbsp;
                </td>
                <td class="inputArea">
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            &nbsp;服务器时间:：<asp:Label ID="Label1" runat="server"></asp:Label>
                   <div class="tip" id="timeTip" style="float:left; width: 521px;"><span class="content"> 提示： 考试时长（<asp:Label ID="lblNeededMinutes" runat="server" Text="0"></asp:Label>分钟） 剩余时间（<asp:Label
                           ID="lblTimeLeft" runat="server" Text="0小时0分钟0秒"></asp:Label><span style="color:Gray"></span>）<asp:Label
                               ID="Label2" runat="server"></asp:Label></span></div>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                            <asp:AsyncPostBackTrigger ControlID="Timer2" EventName="Tick" />
                        </Triggers>
                    </asp:UpdatePanel>
                    &nbsp;&nbsp;
                </td>
            </tr>
            <tr>
                <td class="titleName" style="width: 200px; height: 25px">
                    回答：
                </td>
                <td class="inputArea" style="color: #ff0000">
                   <asp:TextBox ID="txtTesterAnswer" runat="server" CssClass="txt" Height="200px" TextMode="MultiLine"
                            Width="700px" ></asp:TextBox>
                    <div class="tip" style="width: 88%"><span class="content">提示：考试期间请勿关闭窗口、刷新页面！(系统每隔<span style="color: gray"><asp:Label ID="lblAutoSaveMinutes" runat="server"
                            Text="0"></asp:Label>分钟</span>自动保存一次答案
                        )</span></div>
                </td>
            </tr>
            <tr align="right">
                <td style="background-color: darkgray; color:White; " colspan="2">
                    &nbsp;</td>
            </tr>
            <tr>
                <td class="submitArea" colspan="2">
                    <span style="margin-right: 10px">
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
                        <ContentTemplate>
                            <asp:Label ID="Label3" runat="server" ForeColor="Red"></asp:Label>
                            <asp:Button ID="btnSaveAnswer" runat="server" CssClass="btn" Text="保存答案" Width="80px" OnClick="btnSaveAnswer_Click" />
                        <asp:Button ID="btnSubmitTest" runat="server" CssClass="btn" Text="交 卷" Width="80px" OnClick="btnSubmitTest_Click" OnClientClick="return confirm('你确定交卷吗？')" />
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="btnSaveAnswer" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="btnSubmitTest" EventName="Click" />
                            <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
                        </Triggers>
                    </asp:UpdatePanel>
                    
                        </span></td>
            </tr>
        </table>
        &nbsp;
        <asp:Timer ID="Timer1" runat="server" Interval="1000" OnTick="Timer1_Tick" Enabled="False">
        </asp:Timer>
        <asp:Timer ID="Timer2" runat="server" OnTick="Timer2_Tick" Enabled="False">
        </asp:Timer>
        <asp:HiddenField ID="hdfTestID" runat="server" />
    </form>
</body>
</html>
