


<%@ page autoeventwireup="false" inherits="WebExam.Web.examuserlist, App_Web_plgfti2c" language="vb" masterpagefile="~/Page.master" title="考生管理" %>
<%@ MasterType VirtualPath="~/Page.master" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="mainCopy">

    <script src="menu/menu.js" type="text/javascript"></script>

    <script type="text/javascript">
// <!CDATA[
   function popMenu(div){
    var x = event.srcElement.offsetLeft;
    var y = event.srcElement.offsetTop;
    var parent = event.srcElement.parentElement;
	while(parent.id!="ccc"){
       	x += parent.offsetLeft;
		y += parent.offsetTop;

		parent = parent.offsetParent;
	}
	y += event.srcElement.offsetHeight;
    
	div.style.display = "block";
	if(div.style.width < event.srcElement.offsetWidth){
	    div.offsetwidth = event.srcElement.offsetWidth;
	}
	div.style.pixelLeft = x-50;
    div.style.pixelTop  = y;

 }

  function hideMenu(div){
     div.style.display='none';
  }


  function hide(){
    var div = document.all.menuDiv;
    hideMenu(div);
  }

  function show(){
    var div = document.all.menuDiv;
    popMenu(div);
    document.getElementById("changeOk").href=event.srcElement.href;
    return false;
  }





function submitIp(){
   var ipbox1=document.getElementById("ip1");
   var ipbox2=document.getElementById("ip2");
   if(!ipCheck(ipbox1.value)){
      alert("IP地址错误");
      ipbox1.focus();
      return false;
   }
   if(!ipCheck(ipbox2.value)){
      alert("IP地址错误");
      ipbox2.focus();
      return false;
   }
   if(!ipRangeCheck(ipbox1,ipbox2)){
      alert("IP范围错误，请修改起始范围。");
      return false;
   }
   if(document.forms[0].range0.checked){
     if(!ifCheckExamee()){
       alert("请选择考生。");
      return false;
     
     }
   
   };
   return true;
}
function alignIp(){
  if(ipTable.style.display=="block")
  ipTable.style.display="none";
  else
  ipTable.style.display="block";


}
function ifCheckExamee(){
   for (var i=0;i<document.forms[0].elements.length;i++)
    {
    var e = document.forms[0].elements[i];
    if (e.name == 'select')
       if (e.checked) return true;
    }
    return false;

}
function CheckAll(form)
  {
  for (var i=0;i<form.elements.length;i++)
    {
    var e = document.forms[0].elements[i];
    if (e.name == 'select')
       e.checked = form.chkall.checked;
    }
  }
function dataCheck(){
   var mode;
   var radioChoise=document.forms[0].changeM
   if(radioChoise[0].checked )mode=1;
   if(radioChoise[1].checked )mode=2;
   if(radioChoise[2].checked )mode=3;
   switch(mode){
     case 1:
     break;
     case 2:
     var ipbox3=document.getElementById("ip3");
   var ipbox4=document.getElementById("ip4");
   if(!ipCheck(ipbox3.value)){
      alert("IP地址错误");
      ipbox3.focus();
      return false;
   }
   if(!ipCheck(ipbox4.value)){
      alert("IP地址错误");
      ipbox4.focus();
      return false;
   }
   if(!ipRangeCheck(ipbox3,ipbox4)){
      alert("IP范围错误，请修改起始范围。");
      return false;
   }
     break;
     case 3:
      var ipbox5=document.getElementById("ip5");
      if(!ipCheck(ipbox5.value)){
      alert("IP地址错误");
      ipbox5.focus();
      return false;
      break;
   }
   }
   
   return true;

}
function ipRangeCheck(ipbox1,ipbox2){
   
   var ipAry1=ipbox1.value.split('.');
   var ipAry2=ipbox2.value.split('.');
   for(var key in ipAry1)
		{   var int1=parseInt(ipAry1[key]);
		    var int2=parseInt(ipAry2[key]);
			if ( int1<int2 )
				return true;
		    else{
		        if(int1>int2)
		    return false;
		    } 
		}
   return true;
}
function ipCheck(ipValue)
{
	var reg = /^\d{1,3}(\.\d{1,3}){3}$/;
	if (reg.test(ipValue))
	{
		var ary = ipValue.split('.');
		for(key in ary)
		{
			if (parseInt(ary[key]) > 255 )
				return false;
		}
		return true;
		
	}else
		return false;		
}

function addUserFromGroup(){
  
  
    
    var userid=getCookie("user:id");
    if (userid == null) return;
    if (userid=="")return;
    var arr = showModalDialog("../../common/mygroup/mygrouplist.aspx?id="+userid, "", "dialogHeight:300px;dialogWidth:350px;help:0; status:0");
 
    if (arr==null) return;
    document.getElementById("addusers").value =arr
    document.getElementById("_ctl0_mainCopy_BtnadduserFromgroup").click() 
 

}
function addUserFromDepart() {

    var arr = showModalDialog("../../department/users/allusers.htm?type=partforexaminer", "", "dialogHeight:600px;dialogWidth:630px;help:0; status:0");

  if (arr==null) return;

  document.getElementById("addUsersBox").value =join(arr[0]);
  document.getElementById("addPartBox").value =arr[1];
  document.getElementById("addSubPartBox").value =arr[2];
  document.getElementById("<%= btnaddUserFromDepart.ClientID %>").click() 

}
function join(arr){
  var t="";
  for(var i=0;i<arr.length;i++){
    t+=arr[i].toString()+",";
  }
 
  return t.substr(0,t.length -1); 
}
function addUserFromExam() {
  var exam=window.location.search.substring(4)
 
 
  var arr =window.open("examinee_filter.aspx?toexam="+exam, "mm", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500,screenX=1,screenY=1,top=" + (screen.AvailHeight-500)/2 +",left=" +(screen.AvailWidth-540)/2);
 arr.focus();
 return;
 

}

function userInfo_onclick(userid) {
 //window.showModelessDialog('adduser.aspx'+window.location.search,'','scroll:yes;Status:no;help:no');
    var newwin=window.open('../../department/userInfo.aspx?userid='+encodeURIComponent(userid),"msgWindow","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=500,height=500,screenX=1,screenY=1,top=" + (screen.AvailHeight-500)/2 +",left=" +(screen.AvailWidth-540)/2);
    newwin.focus();
    
  //window.location ="newuser.aspx"+window.location.search
}
function btnshx_onclick() {
parent.document.all(self.name).style.width  = document.body.scrollWidth-20
window.location =self.location 
//document.execCommand('refresh');
}
function checkselect() {
   var selectObj=document.forms[0].select;
   if(selectObj==null)return false;
   var checklength=selectObj.length;
   var xz=false

   if (checklength==undefined)//
   {
     if (selectObj.checked)
     {xz=true}
   }
  for(var i=0; i<checklength;i++)
   {
     if (selectObj(i).checked)
      xz=true
   }
 
  return xz
  
}
function reexam() {
if (!checkselect())
   {
    alert("请先选择用户！")
    return }
    
   if (confirm('允许所选用户在本次考试时间内再次考试（适用于意外交卷的考生），确定吗？')){
   var imgbtn=event.srcElement.children[0];
   
  return imgbtn.click();}
    
}
function print(){var imgbtn=event.srcElement.children[0];if(imgbtn)
return imgbtn.click();
}
function Btndel_onclick() {
if (!checkselect())
   {
    alert("请先选择用户！");
    return }
    
   if (confirm('将从考试名单中删除所选用户，确定吗？')){
   
   var imgbtn=event.srcElement.children[0];
   
  return imgbtn.click();
  
   }
 
}

// ]]>
    </script>

    <div id="menuDiv" onmouseover="this.style.display='block'" style="border-right: 0px;
        border-top: 0px; display: none; border-left: 0px; border-bottom: 0px; position: absolute;z-index:55;">
        <table class="U1">
            <tr>
                <td>
                    <input checked="checked" name="changeM" type="radio" value="1">考生可以更换任意一台计算机参加考试</td>
            </tr>
            <tr>
                <td>
                    <input name="changeM" type="radio" value="2">考生更换的计算机的ip地址必须在下面ip范围之内</td>
            </tr>
            <tr>
                <td>
                    &nbsp;&nbsp;<input id="ip3" name="ip3" title="如：192.168.0.10" type="text">--<input
                        id="ip4" name="ip4" title="如：192.168.0.100" type="text"></td>
            </tr>
            <tr>
                <td>
                    <input name="changeM" type="radio" value="3">考生更换的计算机的ip地址必须是下面指定的ip地址</td>
            </tr>
            <tr>
                <td>
                    &nbsp;&nbsp;<input id="ip5" name="ip5" title="如：192.168.0.10" type="text"></td>
            </tr>
            <tr>
                <td>
                    <a id="changeOk" onclick="return dataCheck()">确定</a> <a href="#" onclick="javascript:menuDiv.style.display='none'">
                        取消</a></td>
            </tr>
        </table>
    </div>
    <table id="ccc" align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
 
        <tr>
            <td align="center">
                
                <asp:Label ID="Lbl_examid" runat="server" ForeColor="Red"></asp:Label>考生名单</td>
        </tr>
        <tr>
            <td align="center">
            
            
            
                <asp:DataGrid ID="DataGriduser" runat="server"
                    AutoGenerateColumns="False" BackColor="White" BorderColor="#E7E7FF" BorderStyle="None"
                    BorderWidth="1px" CellPadding="3" DataKeyField="examinee" GridLines="Horizontal">
                    <SelectedItemStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
                    <AlternatingItemStyle BackColor="#F7F7F7" />
                    <ItemStyle BackColor="#E7E7FF" ForeColor="Black" />
                    <HeaderStyle BackColor="#E0E0E0" Font-Bold="True" ForeColor="#F7F7F7" />
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <Columns>
                        
                        <asp:TemplateColumn HeaderText="选择">
                            <ItemTemplate>
                                <font face="宋体">
                                    <input name="select" type="checkbox" value='<%# DataBinder.Eval(Container.DataItem, "examinee") %>'></font>
                            </ItemTemplate>
                        </asp:TemplateColumn>
                        <asp:BoundColumn DataField="examinee" HeaderText="考生ID"></asp:BoundColumn>
                        <asp:BoundColumn DataField="enterTime" HeaderText="发卷时间"></asp:BoundColumn>
                        <asp:BoundColumn DataField="Times" HeaderText="重考次数"></asp:BoundColumn>
                      <asp:BoundColumn DataField="usedMinutes" HeaderText="累计用时（分钟）"></asp:BoundColumn>
                        <asp:BoundColumn DataField="score" HeaderText="成绩"></asp:BoundColumn>
                       
                        <asp:BoundColumn DataField="ip" HeaderText="登入IP"></asp:BoundColumn>
                     
                        <asp:HyperLinkColumn DataNavigateUrlField="examinee" DataNavigateUrlFormatString="javascript:userInfo_onclick('{0}')"
                            Text="详细资料"></asp:HyperLinkColumn>
                        
                    </Columns>
                    <PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" Mode="NumericPages"
                        Visible="False" />
                </asp:DataGrid>
                <div style ="text-align:left;"><input name="chkall" onclick="CheckAll(this.form)" type="checkbox" value="on" />选中所有目前显示的用户
                <pagers:PageNumbersPager ID="PageNumbersPager1" runat="server" /></div>
                </td>
        </tr>
     
        <tr style ="display:none">
            <td>
              <input id="addUsersBox" name ="addUsersBox" /><input id="addPartBox" name ="addPartBox" /><input id="addSubPartBox" name ="addSubPartBox" />
                <asp:Button ID="btnaddUserFromDepart"　runat="server" Height="0px" Width="0px" />
                <asp:Button ID="BtnadduserFromgroup" runat="server" Height="0px" Width="0px" />
            </td>
        </tr>
        <tr>
            <td>
                <iframe id="Hfrm" class="NN" src="about:blank"></iframe>
                <table id="HMTB" align="center" border="0" cellpadding="0" cellspacing="0" class="N"
                    width="100%">
                    <tbody>
                        <tr>
                            <td colspan="2">
                                <img height="1" src="menu/spacer.gif" width="100%"></td>
                        </tr>
                        <tr>
                            <td>
                                <table border="0" cellpadding="0" cellspacing="0" class="O" width="100%">
                                    <tbody>
                                        <tr>
                                            <td style="width: 8px">
                                                <img height="1" src="menu/spacer.gif" width="8"></td>
                                            <td class="P" nowrap="nowrap" onclick="Btndel_onclick();" onmouseout="MU()"
                                                onmouseover="MO()">
                                                <asp:ImageButton ID="btndel" runat="server" ToolTip="从考试名单中删除" ImageUrl="menu/i.p.delete.gif" ImageAlign="AbsMiddle" BorderWidth="0" />
                                                删除
                                            </td>
                                            <td class="LL">
                                                |</td>
                                            <td id="JunkTD" class="P" nowrap="nowrap" onblur="MME(event, Junk);" onclick="MCH(event,Junk);ipTable.style.display='none';"
                                                onmouseout="MME(event, Junk);" onmouseover="MME(event, Junk);">
                                                <img align="absMiddle" alt="添加考生" border="0" hspace="1" src="menu/i.p.cont.individual.gif">添加考生<img
                                                    align="absMiddle" border="0" hspace="1" src="menu/i.p.downarrow.gif">
                                            </td>
                                            <td class="LL">
                                                |</td>
                                            <td class="P" nowrap="nowrap" onclick="return reexam();" onmouseout="MU()" onmouseover="MO()">
                                                <asp:ImageButton ID="btnreexam" runat="server" BorderWidth="0" ImageAlign="AbsMiddle"
                                                    ImageUrl="menu/i.p.writenew.gif" ToolTip="重考" />
                                                重考
                                            </td>
                                            <td class="LL">
                                                |</td>
                                           <!-- td class="P" nowrap="nowrap" onclick="return alignIp();" onmouseout="MU()" onmouseover="MO()">
                                                <img align="absMiddle" alt="指派IP" border="0" hspace="1" src="menu/i.p.writenew.gif">指派IP
                                            </td>
                                            <td class="P" nowrap="nowrap" onmouseout="MU()" onclick ="print()"
                                                onmouseover="MO()">
                                                <asp:ImageButton ID="ImageButton1" runat="server" ToolTip="打印准考证"  ImageUrl="menu/i.p.writenew.gif" ImageAlign="AbsMiddle" BorderWidth="0" />
                                                打印准考证
                                            </td-->
                                            <td width="100%">
                                                &nbsp;</td>
                                        </tr>
                                    </tbody>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <img height="1" src="menu/spacer.gif" width="100%"></td>
                        </tr>
                    </tbody>
                </table>
                <table id="ipTable" align="center" class="U1" style="display: none">
                    <tr>
                        <td>
                            考生必须在指定IP范围内参加考试
                            <input id="ip1" name="ip1" title="如：192.168.0.10" type="text">--<input id="ip2" name="ip2"
                                title="如：192.168.0.100" type="text">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <input id="range1" name="range" type="radio" value="1"><label for="range1">适用于全部考生</label>
                            <input id="range0" checked="checked" name="range" type="radio" value="0"><label for="range0">适用于所选考生</label>
                            <asp:Button ID="BtnIp" runat="server" Text="确定" />
                        </td>
                    </tr>
                </table>
                <table id="JunkTable" class="U" onclick="MCH(event,Junk,true)">
                    <tbody>
                        <tr>
                            <td class="W" onclick="addUserFromDepart();" onmouseout="MU_D()" onmouseover="MO_D()"
                                title="从部门中选择">
                                <img align="absMiddle" border="0" hspace="1" src="menu/i.p.cont.group.gif">从部门中</td>
                        </tr>
                        <!--tr>
                            <td class="W" onclick="addUserFromGroup();" onmouseout="MU_D()" onmouseover="MO_D()"
                                title="从我的群体中选择">
                                <img align="absMiddle" border="0" hspace="1" src="menu/i.p.cont.group.gif">从群体中</td>
                        </tr-->
                        <tr>
                            <td class="W" onclick="addUserFromExam();" onmouseout="MU_D()" onmouseover="MO_D()"
                                title="按照一定的条件，对某次考试结果中的考生进行筛选，可用于补考或选拔考试">
                                <img align="absMiddle" border="0" hspace="1" src="menu/i.p.cont.group.gif">筛选考生</td>
                        </tr>
                    </tbody>
                </table>

                <script language="javascript">
var Junk = new MenuObj("Junk", "JunkTable", "JunkTD", "", "T", "P", "Q","Hfrm","");

</script>

                <br>
            </td>
        </tr>
      
     
    </table>
</asp:Content>
 
