<%@page import="com.zky.para.Para"%>
<%@page import="java.text.SimpleDateFormat"%>
<%@page import="org.apache.jasper.tagplugins.jstl.core.ForEach"%>
<%@include file="/auth.jsp"%>
<%@page language="java" contentType="text/html;charset=utf-8"%>
<jsp:useBean id="getPara" scope="application" class="com.zky.para.SyncPara"/>
<%
    String schoolid       = (String)request.getAttribute("schoolid");
    String targetDepartid=(String)request.getAttribute("targetDepartid");
    String areaid1 = Common.convertNull(request.getParameter("areaid"));
    String frameworkid1 = Common.convertNull(request.getParameter("frameworkid"));
	String schoolid1=Common.convertNull(request.getParameter("schoolid"));
	String targetDepartid1=Common.convertNull(request.getParameter("targetDepartid"));
    String employeeId=(String)request.getAttribute("writeempid");
    String employeeId1=Common.convertNull(request.getParameter("writeempid"));
  	String filevalidity=(String)request.getAttribute("filevalidity");
  	String fileTitle=(String)request.getAttribute("fileTitle");
  	String fileCode=(String)request.getAttribute("fileCode");
  	String fileName=(String)request.getAttribute("fileName");
	String fileDescribe=(String)request.getAttribute("fileDescribe");
	String purpose=(String)request.getAttribute("purpose");
	String remark=(String)request.getAttribute("remark");
  	HashFmlBuf targetDepart=(HashFmlBuf)request.getAttribute("deptBuf");
    String areaid=(String)request.getAttribute("areaid");
    String studentid=(String)request.getAttribute("studentid");	
    Login loginObj = (Login)session.getAttribute("login");
    String optrid = loginObj.optrid;
    String optrname = getPara.getDesc("TAB_EMPLOYEE","EMPID","EMPNAME",optrid);
%>
<%
    String sysdate = new String("");
    sysdate = Common.getSysDate(request);
    String year="",month="",day="",hour="",minute="";
    year = sysdate.substring(0,4);
    month = sysdate.substring(4,6);
    day = sysdate.substring(6,8);
    hour = sysdate.substring(8,10);
    minute = sysdate.substring(10,12);
%>
<html>
<head>
<title>文件下发管理</title>
<link rel="stylesheet" type="text/css" href="../../../css/font.css">
<script src="/js/check.js"></script>
<script type="text/javascript" src="/myjs/popCal.js"></script>

<link rel="stylesheet" type="text/css" href="../../../js/2k3Grid.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Menu.css">
<link rel="stylesheet" type="text/css" href="../../../js/2k3Dialog.css">
<style type="text/css">
select
{
   width:155px;
}
</style>
<script>
function setValue()
{
	<%
		if(!Common.isNull(frameworkid1))
		{
			out.println("form1.frameworkid.value='" + frameworkid1 + "';");
		}
		if(!Common.isNull(areaid1))
		{
			out.println("form1.areaid.value='" + areaid1 + "';");
		}
		if(!Common.isNull(schoolid1))
		{
			out.println("form1.schoolid.value='" + schoolid1 + "';");
		}
		if(!Common.isNull(employeeId1))
		{
			out.println("form1.writeempid.value='" + schoolid1 + "';");
		}
		if(!Common.isNull(fileCode))
		{
			out.println("form1.fileCode.value='" + fileCode + "';");
		}
		if(!Common.isNull(fileName))
		{
			out.println("form1.fileName.value='" + fileName + "';");
		}
		if(!Common.isNull(filevalidity))
		{
			out.println("form1.filevalidity.value='" + filevalidity + "';");
		}
		if(!Common.isNull(fileTitle))
		{
			out.println("form1.fileTitle.value='" + fileTitle + "';");
		}
		if(!Common.isNull(fileDescribe))
		{
			out.println("form1.fileDescribe.value='" + fileDescribe + "';");
		}
		if(!Common.isNull(remark))
		{
			out.println("form1.remark.value='" + remark + "';");
		}
		if(!Common.isNull(purpose))
		{
			out.println("form1.purpose.value='" + purpose + "';");
		}
	%>	
}
function queryStatistics(operate)
{
	form1.operate.value=operate;
}
function check(operate)
{
	form1.operate.value=operate;
		if(operate=="addFileProvide"){
		if(form1.fileName.value=="")
		{
			alert("标题不能为空");
			form1.fileName.focus();
			return;
		}
		if(form1.releaseInfo.value=="")
		{
			alert("保密期限不能为空");
			form1.releaseInfo.focus();
			return;
		}
		if(form1.instancyExtent.value=="")
		{
			alert("紧急程度不能为空");
			form1.instancyExtent.focus();
			return;
		}
		
		if(form1.fileSecret.value=="")
		{
			alert("文件密级不能为空");
			form1.fileSecret.focus();
			return;
		}
		if(form1.provideCount.value=="")
		{
			alert("发文份数不能为空");
			form1.provideCount.focus();
			return;
		}
		if(form1.borrowScope.value=="")
		{
			alert("收文单位不能为空");
			form1.borrowScope.focus();
			return;
		}
		if(form1.fileSecrety.value=="")
		{
			alert("定密依据不能为空");
			form1.fileSecrety.focus();
			return;
		}
		if(form1.remark.value=="")
		{
			alert("备注不能为空");
			form1.remark.focus();
			return;
		}
		var checkNumber=0;
		var borrowValue="";
		var borrowArray=document.getElementsByName("borrowScope");
		if(borrowArray.length==0)
		{
			var borrowArray=document.getElementsByName("borrowScope").focus();
			return;
		}
		else
		{
		for(var i=0;i<borrowArray.length;i++)
		{
			if(borrowArray[i].checked)
			{
				form1.action="/servlet/FileProvideManage?operate=addFileProvide&borrowScope="+borrowArray[i].value;
				}
				checkNumber++;
			}	
		}
		if(checkNumber==0)
		{
			alert("请选择收文单位");
			return;
		}
		window.close(); 
		}
	form1.submit();
}
function accp()
{
var game=document.getElementsByName("borrowScope");
        for(var i=0;i<game.length;i++)
        {
		if(game[i].type=="checkbox")
		{
			game[i].checked=document.getElementById("borrowScope").checked;
		}
        }
}
</script>
</head>
<body onload="setValue();" scroll="no">
<form name="form1" method="post" action="/servlet/FileProvideManage">
<table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" class="box" style="margin: 0px auto;">
  <tr>
    <td valign="top"><table width="100%" height="23"  border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td width="25%" background="/images/tab_search_01.jpg"><table width="100%" height="23" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td width="6%" align="right"><img src="/images/little_red.jpg" width="12" height="12"></td>
                <td width="94%" class="font12b">&nbsp;<b>文件登记管理</b></td>
              </tr>
          </table></td>
          <td width="82%" background="/images/tab_search_03.jpg"><img src="/images/tab_search_02.jpg" width="12" height="23"></td>
        </tr>
      </table> 
<input type="hidden" name="operate" />
   <table width="98%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="d8e9fe" class="table02">
		<tr bgcolor="#FFFFFF" height="35px">
	    <td class="cell1" width="20%">文件标题</td>
		<td class="cell2" width="30%">
		<input type="text" style="width:155px;" id="fileName" name="fileName"  valid="required" errmsg="用户名不能为空!"/>&nbsp;&nbsp;&nbsp;<font style="color: red;">*</font>
   		</td>
		<td class="cell1" width="20%">登记人员</td>
   				<td class="td1" width="30%">
	             <input type="text"  style="color: red;" id="writeempid" name="writeempid"  value="<%=optrname%>" readonly="readonly"/>&nbsp;&nbsp;&nbsp;<font style="color: red;">*</font>
		  </td>
	    </tr>
	    <tr bgcolor="#FFFFFF" height="35px">
	    <td class="cell1">保密期限</td>
		<td class="cell2">
   		<input type="text" style="width:155px;" id="releaseInfo" name="releaseInfo" maxlength="3"/>&nbsp;&nbsp;&nbsp;<font style="color: red;">*</font>
   	    </td>
		<td class="cell1">文件密级</td>
		<td class="cell2">
		<select class='aselect' name="fileSecret" id="fileSecret">
   			<%=Para.getProductState(getPara,"SECURITYLVL")%>    
   		</select>	
		</td>		
	    </tr>
	   	<tr bgcolor="#FFFFFF">
	    	<td class="cell1">紧急程度</td>
			<td class="cell2">
				<select class='aselect' name="instancyExtent" id="instancyExtent">
   					<%=Para.getProductState(getPara,"INSTANCYTYPE")%>    
   				</select>
   			</td>
			<td class="cell1">文&nbsp;&nbsp;&nbsp;&nbsp;号</td>
			<td class="cell2">
			<input type="text" style="width:250px; height:25px; line-height:25px;" id="fileNum" name="fileNum"   value="【<%=year%>】/<%=day%>" />	
		    </td>		
	   </tr>
       <tr bgcolor="#FFFFFF" height="35px">
			<td class="cell1">收文单位</td>
			<td class="cell2" >
	        <input type="checkbox" name="borrowScope" value=""  id="123" onclick="accp()"/> 全选/取消
		    </td>
		    <td class="cell1" width="20%">发文份数</td>
		    <td class="cell2" width="30%">
		     <input type="text" style="width:155px;" id="provideCount" name="provideCount"  maxlength="3" onKeyUp="value=value.replace(/[^\d|]/g,'')"/>&nbsp;&nbsp;&nbsp;<font style="color: red;">*</font>
		    </td>	
	        </tr>
	        <tr bgcolor="#FFFFFF">
			<td class="cell1"></td>
			<td class="cell2" colspan="3" width="700"  height="100">
			<div style="height:100;width:410;overflow:auto;background:#EEEEEE;">
			   <%
			   HashFmlBuf receiveDept=(HashFmlBuf)request.getAttribute("receiveBuf");
			      
    				if(receiveDept!=null&&receiveDept.getResultRowCount()>0){
    					for(int i=0;i<receiveDept.getRowCount();i++){
    			%>
    			<input type="checkbox" id="borrowScope" name="borrowScope" value="<%=receiveDept.fget("departid",i)%>"/><%=receiveDept.fget("departname",i) %><br>
    			<%}}else{ %>无单位信息<%} %>
		    </div>
		    </td>
	        </tr>
	          <tr bgcolor="#FFFFFF">
			<td class="cell1">定密依据</td>
			<td class="cell2" colspan="3">
			<textarea onblur="checklength(this,200)" maxlength="300" name="fileSecrety" id="fileSecrety" rows="3" cols="75"></textarea>
		    </td>
	        </tr>
	          <tr bgcolor="#FFFFFF">
			<td class="cell1">文件备注</td>
			<td class="cell2" colspan="3">
			<textarea onblur="checklength(this,200)" maxlength="300" name="remark" id="remark" rows="3" cols="75"></textarea>
		    </td>
	        </tr>
</table>
	<table width="100%" align="center">
		<tr align="center" height="40px" valign="middle">
		<td>
		  <input type="button" name="button1" style="background:url(../images1/bc1.png); width:60px; height:22px; border:none;cursor: pointer;" onclick="check('addFileProvide');"/>&nbsp;&nbsp;
		  <input type="button" name="button2" style="background:url(../images1/fh.png); width:60px; height:22px; border:none; cursor: pointer;" onClick="history.back();"/>
		</td>
		</tr>
	</table>
</td>
</tr>
</table>
</form>
	<%@include file="/foot.jsp"%>	
   	</body>
</html>