<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="net.sz600.basicdata.*" %>
<%@ page import="net.sz600.tool.SzConvert" %>
<%@ page import="net.sz600.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.online.*" %>
<%@ page import="com.soarwell.weixin.oa.*" %>
<%@ include file="/sessionInfoWeixin.jsp"%>
<% 
  String strLevel = "../../"; 
  String sFromUrl = SzConvert.toSpaceStr(request.getParameter("from"));
  if (sFromUrl.equals("")) {
	  sFromUrl = "index.jsp";
  }
%> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="format-detection" content="telephone=no" />
<%@ include file="/share/oa_app_title.jsp"%>
 <link href="<%=strLevel_SESSION%>app/images/soarwell_css.css" rel="stylesheet" type="text/css" />
 <script type="text/javascript" src="<%=strLevel_SESSION%>share/js/commonTool.js"></script>
 <script type="text/javascript" src="<%=strLevel_SESSION%>app/share/appWinOpen.js"></script>
 <script language="javascript">
  function OpenUserSelectWinApp() {
    var vUrl = "../../share/organize/user_win2_app.jsp?type=all"
    	+ "&objName=formUpdate.JSDLXM"
    	+ "&objId=formUpdate.JSDLID"
    	+ "&objDescName=formUpdate.JSBMMC"
    	+ "&objDesc=formUpdate.JSBMID";
    	
  	//window.open(vUrl,"","left=10,top=10,scrollbars=yes,resizable=yes,status=yes,width=400px,height=430px");
  	//window.showModalDialog(vUrl,window,"status=no;dialogWidth=680px;dialogHeight=450px");
    var vElementTop = getElementTop(window.event.srcElement);
    var vWebHeight = document.body.scrollHeight;    
    DivWinOpen(vUrl, vElementTop, vWebHeight);
  } 
 </script>    
</head>
<%
    //获取提交的参数
    String sType = SzConvert.toZeroStr(request.getParameter("type"));
    String sPage = SzConvert.toZeroStr(request.getParameter("page"));
    String sSearch = SzConvert.strWriteData(request.getParameter("txtSearch"));
    String sPKEY = SzConvert.toZeroStr(request.getParameter("PKEY"));
    String sTable_type = "SZKC_CPFL";
%>
<%
    SzData szData = null;
    SzDataInfo szDataInfo = null;
    String sTitle  = "";
    String sJSDLID =  SzConvert.toZeroStr(request.getParameter("JSDLID"));
    String sJSDLXM = SzUserHelp.getLoginName(Integer.parseInt(sJSDLID));
    String sOPERATOR = SzConvert.strWriteData(request.getParameter("OPERATOR"));
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    String sReadonly = "";
    boolean bReadonly = false;
    if (sOPERATOR.equals("detail")) {
        sReadonly = "readonly";
        bReadonly = true;
    }
    //读取数据
		OlMessageControl olMessageControl = new OlMessageControl();
    OlMessageInfo messageInfo = null;
    //getInfo的时候会更新map，所以下一条的数据已经改变了。在更新map前先读上一条、下一条
    int iKEY = SzConvert.toInt(sKEY); 
    if (iKEY >0) {
    	messageInfo = (OlMessageInfo)olMessageControl.readMessage(iKEY);  
    }
		if (messageInfo == null) {
			messageInfo = new OlMessageInfo();
		}
		Message message = new Message();
    if (sOPERATOR.equals("reply")) {
    	sJSDLID = "" + messageInfo.getFSDLID();
    	sJSDLXM = messageInfo.getFSDLXM();
    	sTitle  = "Re:" + message.cutHref(messageInfo.getFSBT());
    }	
    String sTableAnnex = "SZJS_XXFJ";
%>
<body>
<!-----上面的工具栏------>
<form name="formUpdate" method="post" ENCTYPE="multipart/form-data">
  <input type="hidden" name="PKEY" value="<%=sPKEY%>">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="OPERATOR" value="<%=sOPERATOR%>">
  <input type="hidden" name="KEY" value="<%=sKEY%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="from" value="<%=sFromUrl%>">  
<%@ include file="title.jsp"%>  
<table width="100%">
  <tr>
    <td>
      <%=SzPageHelp.button("发送","FormSave(formUpdate, 'control.jsp')")%>
    	<%=SzPageHelp.button("返回", "FormSubmit(formUpdate, '" + sFromUrl + "')")%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table height="227" width="100%" border="0" cellspacing="3" cellpadding="3" style="border:#D7D7D9 1px solid;">
  <input type="hidden" name="FSDLID" class="txtClass1" value="<%=iDLID_SESSION%>" <%=sReadonly%> >
	<input type="hidden" name="JSDLID" value="<%=sJSDLID%>" readonly >
  <input type="hidden" name="JSBMID" value="0" readonly > 
   
  <tr>
    <td><span class="product_content">接收人员</span><input type="button" value="选择接收人员或部门" class="btnClassLong" OnClick="javascript:OpenUserSelectWinApp();" >
    	<br><br><span class='padding5'></span><input type="text" name="JSDLXM" class="txtClass" value="<%=sJSDLXM%>" readonly >    
    </td>
  </tr> 
  <tr>
    <td><span class="product_content">接收部门</span>
    	<br><span class='padding5'></span><input type="text" name="JSBMMC" class="txtClass" value="" readonly >    
    </td>
  </tr> 
  <tr>
    <td><span class="product_content">发送标题</span>
    	<br><span class='padding5'></span><input type="text" name="FSBT" class="txtClass" value="<%=sTitle%>" <%=sReadonly%> >    
    </td>
  </tr>   
  <tr>
    <td><span class="product_content">发送内容</span>
    	<br><span class='padding5'></span><textarea name="FSNR" class="areaClass"></textarea>    
    </td>
  </tr>        
  <tr>
    <td><span class="product_content">微信通知</span>
    	<br><input type="checkbox" name="JSWJJ" value="1" checked> (同时将消息标题、内容发到接收人已绑定的微信上)  
    </td>
  </tr>  
  <tr>
    <td><span class="product_content">发送文件</span>
    	<br><%=SzPageHelp.updateAnnexNew2(sTableAnnex, sKEY, strLevel_SESSION)%>  
    </td>
  </tr>      
</table>
<table width="100%">
  <tr>
    <td>
      <%=SzPageHelp.button("发送","FormSave(formUpdate, 'control.jsp')")%>
			<%=SzPageHelp.button("返回", "FormSubmit(formUpdate, 'index.jsp')")%>   
    </td>
  </tr>
</table>

</form>

<!-----这里包含要提交的内容--->
<form name="formHidden" method="post">
  <input type="hidden" name="page" value="<%=sPage%>">
  <input type="hidden" name="txtSearch" value="<%=sSearch%>">
  <input type="hidden" name="type" value="<%=sType%>">
  <input type="hidden" name="from" value="<%=sFromUrl%>">  
</form>

<script language="javascript">

  function FormSave(formName, url) {
    //检查是否可以保存
    if (!notNum(formName.FSDLID, "发送人ID")) {
      return false;
    }
    //2014-12增加
    if (formName.JSDLXM.value == "" && formName.JSBMMC.value == "" ) {
    	alert("请至少选择一个接收人员或部门");
      return false;
    }        
    if (!notSpace(formName.FSBT, "发送标题")) {
      return false;
    }

    //2012-01-11增加
    //vBeforeFrameHtmlUnload = false;
    formName.action = url;
    formName.submit();
  }
</script>
<div id="divWinOpenBg"></div>
<div id="divWinOpen">
 <iframe id="frameWinOpen" frameborder="0"  width="100%" height="100%"></iframe>
</div>
</body>
