<%@ page contentType="text/html;charset=gbk" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.database.SzPageInfo" %>
<%@ page import="net.sz600.system.SzProperties" %>
<%@ page import="net.sz600.system.SzLevelNumber" %>
<%@ page import="net.sz600.system.SzPageHelp" %>
<%@ page import="net.sz600.bulletin.*" %>
<%@ include file="/sessionInfo.jsp"%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
</head>
<%
    //读取数据
 	ReadOaConfig rc = new ReadOaConfig();
	//声明一些变量用来接收值
	String foreign_value = "0";		//外网访问设置：0,1,2
	String foreign_ip = "192.168.1.*";		//外网访问设置IP
	String verification_value = "0";	//是否需要验证码：0,1,2
	String log_value = "0";	//删除日志的期限：0,1
	String log_days = "0";//设置超过多少天
	String login_value = "0";	//一个小时内可以登陆的次数：0,1
	String login_times = "0";	//设置可登陆次数
	String loginPlace_value = "0";	//同一个用户是否可以同时在多个地方登陆：0,1
	String dog_value = "0";	//系统加密方式：0,1
	String dog_info = "0";//授权信息
	String backup_value = "0"; //0手动，1每天凌晨，2每周一凌晨
	String loginFail_value = "0";	//一个小时内可以尝试登陆的次数：0,1
	String loginFail_times = "10";	//设置可尝试登陆次数	
	
    
	rc.readXmlInfo();
	foreign_value = rc.getForeign_value();
	foreign_ip = rc.getForeign_ip();
	verification_value = rc.getVerification_value();
	log_value = rc.getLog_value();
	log_days = rc.getLog_days();
	login_value = rc.getLogin_value();
	login_times = rc.getLogin_times();
	loginPlace_value = rc.getloginPlace_value();
	dog_value = rc.getDog_value();
	dog_info = rc.getDog_info();
	backup_value = rc.getBackup_value();
	loginFail_value = rc.getLoginFail_value();
	loginFail_times = rc.getLoginFail_times();


	//声明一个变量，接受更新页面传来的id，用来判断是否更新
	String id = SzConvert.strWriteData(request.getParameter("id"));
    if(id.equals("1")){
    	rc.updateXml(request);
    	response.sendRedirect("index.jsp");
    }

%>

<body onload="fvcheck();">
<!-----上面的工具栏------>
<%@ include file="/share/title.jsp"%>
<form name="formup" method="post" action="index.jsp?id=1" style="margin: 0px;" onsubmit="return check();">
<% if (isSystemManager_SESSION) { %>
<input type="submit"  class="btnClass" value="保存" style="margin: 4px;">
<% } %>
		<table width="750"  bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="5" cellspacing="0">
				  <tr>
					    <td width="34%" align="right">外网访问设置</td>
					    <td align="left">
						    <input type="radio" name="foreign_value" id="fv1"  value="0" onclick="fvcheck();" <% if(foreign_value.equals("0") || foreign_value.equals("")) {%>checked<% } %>>内外网都可以访问</br>
	        				<input type="radio" name="foreign_value"  value="1" onclick="fvcheck();" <% if(foreign_value.equals("1")) {%>checked<% } %>>只有内网能访问，帐号管理中设置了外网访问也没有作用</br>
	        				<input type="radio" name="foreign_value"  value="2" onclick="fvcheck();" <% if(foreign_value.equals("2")) {%>checked<% } %>>指定人员可以在外网访问，未指定人员只能内网访问（在帐号管理中设置）
        				</td>
				  </tr>
				  
				  <tr>
					    <td align="right">内网IP段设置</td>
					    <td align="left">
					    	&nbsp;<input type="text"  style="width: 97%;" name="foreign_ip" id="fi" class="txtClass1" value="<%=foreign_ip%>"/>
					    	</br>（例：192.168.1.*,127.0.0.* 多个之间用逗号隔开，请谨慎设置）
					    </td>
				  </tr>
				  
				  <tr>
					    <td align="right">是否需要验证码</td>
					    <td align="left">
					    	<input type="radio" name="verification_value"  value="0" <% if(verification_value.equals("0") || verification_value.equals("")) {%>checked<% } %>>全部不需要验证码</br>
	        				<input type="radio" name="verification_value"  value="1" <% if(verification_value.equals("1")) {%>checked<% } %>>外网访问需要</br>
					    	<input type="radio" name="verification_value"  value="2" <% if(verification_value.equals("2")) {%>checked<% } %>>全部需要验证码
					    </td>
				  </tr>
				  
				  <tr>
					    <td align="right">删除日志的期限</td>
					    <td align="left">
					    	<input type="radio" name="log_value" id="lv1"  value="0" onclick="fvcheck();" <% if(log_value.equals("0") || log_value.equals("")) {%>checked<% } %>>不限制时间，都能删除</br>
	        				<input type="radio" name="log_value"  value="1" onclick="fvcheck();" <% if(log_value.equals("1")) {%>checked<% } %>>超过<input type="text" style="width: 25px;" name="log_days" id="ld" class="txtClass1" value="<%=log_days%>"/>天可以删除
					    </td>
				  </tr>
				  
				  <tr>
					    <td align="right">同一用户1小时内可以登陆的次数</td>
					    <td align="left">
					    	<input type="radio" name="login_value" id="lv2"   value="0" onclick="fvcheck();" <% if(login_value.equals("0") || login_value.equals("")) {%>checked<% } %>>不限制登陆次数
	        				<input type="radio" name="login_value"  value="1" onclick="fvcheck();" <% if(login_value.equals("1")) {%>checked<% } %>>限制<input type="text" style="width: 25px;text-align: center;" name="login_times" id="lt" class="txtClass1" value="<%=login_times%>"/>次
					    </td>
				  </tr>
				  
				  <tr>
					    <td align="right">同一用户1小时内可以尝试登陆的次数</td>
					    <td align="left">
					    	<input type="radio" name="loginFail_value"  value="0"  <% if(loginFail_value.equals("0") || loginFail_value.equals("")) {%>checked<% } %>>不限制尝试次数
	        				<input type="radio" name="loginFail_value"  value="1"  <% if(loginFail_value.equals("1")) {%>checked<% } %>>限制<input type="text" style="width: 25px;text-align: center;" name="loginFail_times" id="lt" class="txtClass1" value="<%=loginFail_times%>"/>次
					    </td>
				  </tr>				  
				  
				  <tr>
					    <td align="right">同一用户是否可以同时在多个地方登陆</td>
					    <td align="left">
					    	<input type="radio" name="loginPlace_value"  value="0" <% if(loginPlace_value.equals("0") || loginPlace_value.equals("")) {%>checked<% } %>>允许
	        				<input type="radio" name="loginPlace_value"  value="1" <% if(loginPlace_value.equals("1")) {%>checked<% } %>>不允许
					    </td>
				  </tr>
				  
				  <tr>
					    <td align="right">自动备份（含数据库和附件）<br>注：修改备份方式后，需要重新启动服务</td>
					    <td align="left">
					    	<input type="radio" name="backup_value"  value="0" <% if(backup_value.equals("0") || backup_value.equals("")) {%>checked<% } %>>手动备份</br>
	        				<input type="radio" name="backup_value"  value="1" <% if(backup_value.equals("1")) {%>checked<% } %>>每天凌晨自动备份</br>
	        				<input type="radio" name="backup_value"  value="2" <% if(backup_value.equals("2")) {%>checked<% } %>>每周一凌晨自动备份
					    </td>
				  </tr>				  

				  <tr style="display:none">
					    <td align="right">系统加密方式</td>
					    <td align="left">
					    	<input type="radio" name="dog_value" id="dv1"  value="0" onclick="fvcheck();" <% if(dog_value.equals("0") || dog_value.equals("")) {%>checked<% } %>>加密狗</br>
	        				<input type="radio" name="dog_value"  value="1" onclick="fvcheck();" <% if(dog_value.equals("1")) {%>checked<% } %>>授权码
					    </td>
				  </tr>
				  <tr style="display:none">
					    <td align="right">授权信息</td>
					    <td align="left">
					    	&nbsp;<input type="text" name="dog_info" id="di" style="width: 97%;" class="txtClass1" value="<%=dog_info%>"/>
					    </td>
				  </tr>
				  
				  <tr >
					    <td align="right" colspan="2"></td>
				  </tr>				  
			
		</table>
</form>
</body>


<script language="javascript">
  //判断选中后是否禁止文本框的填写
  function fvcheck() {
  		var fv = document.getElementById("fv1");
  		var fip = document.getElementById("fi");
      	if(fv.checked == true){
      		fip.readOnly="true";
      		fip.style.backgroundColor="#EEEEEE";
      	}else{
      	    fip.readOnly="";
      	    fip.style.backgroundColor="";
      	}
      	
      	var lv = document.getElementById("lv1");
  		var ld = document.getElementById("ld");
  		if(lv.checked == true){
      		ld.readOnly="true";
      		ld.style.backgroundColor="#EEEEEE";
      	}else{
      	    ld.readOnly="";
      	    ld.style.backgroundColor="";
      	}
      	
      	var lv2 = document.getElementById("lv2");
  		var lt = document.getElementById("lt");
  		if(lv2.checked == true){
      		lt.readOnly="true";
      		lt.style.backgroundColor="#EEEEEE";
      	}else{
      	    lt.readOnly="";
      	    lt.style.backgroundColor="";
      	}
      	
      	var dv = document.getElementById("dv1");
  		var di = document.getElementById("di");
  		if(dv.checked == true){
      		di.readOnly="true";
      		di.style.backgroundColor="#EEEEEE";
      	}else{
      	    di.readOnly="";
      	    di.style.backgroundColor="";
      	}
  }    	
  
   	//将提交的信息进行验证
      	function check(){
      		var lv = document.getElementById("lv1");
	  		var ld = document.getElementById("ld");
	  		var ldtext = ld.value;
	  		
	  		var lv2 = document.getElementById("lv2");
	  		var lt = document.getElementById("lt");
	  		var lttext = lt.value;
	  		
	  		if(lv.checked == false && isNaN(ldtext)){
	      	    	alert("超过天数可以删除设置有误，请输入数字！");
	      	    	return false;
	      	}
	      	
	      	if(lv2.checked == false && isNaN(lttext)){
	      	    	alert("次数设置有误，请输入数字！");
	      	    	return false;
	      	}
	      	alert("保存成功！");
	      	return true;
      }
  
     
</script>