<%@ page autoeventwireup="false" inherits="WebExam.Web.enterExam, App_Web_f5kmzcxb" language="vb" masterpagefile="~/Page.master" title="参加考试" %>

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="ContentHead">
    <link href="style/enterexam.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="mainCopy">

    <script type="text/javascript">
// <!CDATA[

function ipRangeCheck(ip1,ip2,ip){
   if(ip1=="")ip1="0.0.0.0";
   if(ip2=="")ip2="255.255.255.255";
   var ipAry=ip.split('.');
   var ipAry1=ip1.split('.');
   var ipAry2=ip2.split('.');
  
   for(key in ipAry)
		{   if (parseInt(ipAry[key]) < parseInt(ipAry1[key]) )	return false;
			if (parseInt(ipAry[key]) > parseInt(ipAry2[key]) )	return false;
		}
   return true;
}
function ServerTime_Timer_Event(serverNow){
  var dg=document.getElementById("examlist").childNodes[0];
 
  var dgRows=dg.rows
  var examStart
  //var myip=.innerText;
  
  for(var i=1;i<dgRows.length;i++){
    //var ip1=dgRows[i].cells[7].innerText;
    //var ip2=dgRows[i].cells[8].innerText;

      if (true) {
          var startTimeStr = dgRows[i].cells[4].innerText

          var t = startTimeStr.split(" ")
          var yyyymmdd = t[0].split("-")
          var hhmmss = t[1].split(":")
          examStart = new Date(yyyymmdd[0], eval(yyyymmdd[1] - 1), yyyymmdd[2], hhmmss[0], hhmmss[1], "0")

          var button = dgRows[i].cells[0].getElementsByTagName("input")[0]
          var MinMilli = 1000 * 60;
          var SMilli = examStart.getTime()
          var NMilli = serverNow.getTime()
          if (SMilli > NMilli) {
              if ((SMilli - NMilli) < 5 * MinMilli) {
                  if (button.value == "　　　　") button.value = "准备考试"
                  else button.value = "　　　　"
                  if (button.style.color != "red") {
                      button.style.color = "red"
                      getMsg("距离" + dgRows[i].cells[1].innerText + "开考还有不到5分钟的时间，请考生抓紧时间做好准备工作.")
                  }
              }
              else {

                  button.value = "时间未到";
              }
              button.disabled = true;
          }
          else {
              button.disabled = false
              button.value = "参加考试"
              button.style.color = "red"

          }
      }
      else {
          dgRows[i].cells[0].innerHTML = "<img src='../../images/jz_ip.jpg' alt='你的IP地址遭拒绝，请到指定IP参加考试' border='0'></img>";
          dgRows[i].cells[7].style.color = "red";
          dgRows[i].cells[7].style.fontWeight = "bold";
          dgRows[i].cells[8].style.color = "red";
          dgRows[i].cells[8].style.fontWeight = "bold";
      }
  }
}

function CurentTime()
{
 var now = server_now;
 var hh = now.getHours();
 var mm = now.getMinutes();
 var ss = now.getTime() % 60000;
 ss = ( ss - ( ss % 1000 ) ) / 1000;
 var clock = hh + ':';
 if( mm < 10 )
  clock += '0';
 clock += mm + ':';
 if( ss < 10 )
  clock += '0';
 clock += ss;
 return( clock );
}
function enterExam(src1) {
  
  if(confirm("您确定要参加本次考试吗？\r\n一旦参加考试，系统将自动取消您与考试无关的其他权限，直至您成功递交试卷。"))
  return true
  else
  return false
}

// ]]>
    </script>

    <div id="toparea">
        <table>
            <tr>
                <td>
                    <img alt="照片要求150*200像素，JPG格式。" onerror="this.src='../../data/usersphoto/nophoto.gif'"
                        id="serverView" height="200" width="150" />

                    <script type="text/javascript">
					      document.getElementById("serverView").src ="../../data/usersphoto/"+getUserId()+".jpg"					    
                    </script>

                </td>
                <td><table>
                <tr><td>用户名：</td><td><script type="text/javascript">
					                               document.write(getUserId())
                        </script></td></tr>
              
                <tr><td>当前IP：</td><td><asp:Label ID="LL_ip" runat="server"></asp:Label></td></tr>
                </table>
                   
                </td>
            </tr>
        </table>
    
    </div>
    <div id="examlist">
        <asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="False" BackColor="White"
            BorderColor="#3366CC" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyField="examId">
            <FooterStyle BackColor="#99CCCC" ForeColor="#003399" />
            <SelectedItemStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
            <ItemStyle BackColor="White" ForeColor="#003399" />
            <HeaderStyle BackColor="#003399" Font-Bold="True" ForeColor="#CCCCFF" />
            <Columns>
                <asp:ButtonColumn ButtonType="PushButton" CommandName="Select" Text="参加考试"></asp:ButtonColumn>
                <asp:BoundColumn DataField="examId" HeaderText="考试名称"></asp:BoundColumn>
                <asp:BoundColumn DataField="examiner" HeaderText="主考"></asp:BoundColumn>
                <asp:TemplateColumn HeaderText="成绩公开">
                    <ItemTemplate>
                        <asp:Label ID="Label5" runat="server" Text="完全" Visible='<%# cbyte(DataBinder.Eval(Container, "DataItem.displayScore"))=2 %>'>
                        </asp:Label>
                        <asp:Label ID="Label6" runat="server" Text="本人" Visible='<%# cbyte(DataBinder.Eval(Container, "DataItem.displayScore"))=1 %>'>
                        </asp:Label>
                        <asp:Label ID="Label7" runat="server" Text="保密" Visible='<%# cbyte(DataBinder.Eval(Container, "DataItem.displayScore"))=0 %>'>
                        </asp:Label>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="startTime" DataFormatString="{0:yyyy-M-d H:m}" HeaderText="开考时间">
                </asp:BoundColumn>
                <asp:BoundColumn DataField="endTime" DataFormatString="{0:yyyy-M-d H:m}" HeaderText="结束时间">
                </asp:BoundColumn>
                <asp:BoundColumn DataField="timeLen" HeaderText="答卷时间"></asp:BoundColumn>
               
                <asp:BoundColumn DataField="allowEnterTimes" HeaderText="可重考次数"></asp:BoundColumn>
                
                <asp:BoundColumn DataField="score" HeaderText="上次成绩"></asp:BoundColumn>
                <asp:BoundColumn DataField="usedMinutes" HeaderText="累计用时（分钟）"></asp:BoundColumn>
                <asp:TemplateColumn>
                    <ItemTemplate>
                      
                       <asp:Image ID="Image1" runat="server" Visible='<%# CBool(DataBinder.Eval(Container, "DataItem.locked")) %>' ImageUrl="../images/lock_16x16.png" ToolTip="本次考试将您锁定在考试状态，请完成本次考试" />
                      
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:BoundColumn DataField="useLevelForResult" Visible="false"></asp:BoundColumn>
            </Columns>
            <PagerStyle BackColor="#99CCCC" ForeColor="#003399" HorizontalAlign="Left" Mode="NumericPages" />
        </asp:DataGrid>
    </div>
    <div id="alert1">
        考生须知
        <ul>
            <li>本系统需要IE浏览器8.0以上版本支持</li>
            <li>请在指定的准入IP参加考试。 </li>
            <li>可重考次数是指考生可重复参加本次考试的次数，以最后一次作为最终成绩。</li>
            <li>考试时，请不要在浏览器上进行<font color="#ff0000">刷新</font>、<font color="#ff0000">后退</font>、<font
                color="#ff0000">前进</font>、<font color="#ff0000">关闭浏览器</font>等操作，这些操作有可能导致您的答卷丢失。考试进行中，请不要更改考试用机的时间。
            </li>
            <li>倒计时并不是很精确的，实际时间以服务器为准。请提前几分钟交卷。 </li>
            <li>倒计时还有5分钟时，客户端会自动与服务器联系，校正客户端的倒计时。 </li>
            <li>倒计时还有59秒时，系统会强制收卷，但并不能保证该强制收卷会成功完成。 </li>
            <li>倒计时的准确度受服务器性能、网络阻塞情况、客户端的反应速度的影响，一般会有几秒到几十秒的误差。 </li>
        </ul>
    </div>
</asp:Content>
