<%@ 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.*" %>
<%@ include file="/sessionInfo.jsp"%>
<% 
  String strLevel = "../../"; 
%> 
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="<%=strSkin_SESSION%>/css2007.css" rel="stylesheet" type="text/css">
<script language="javascript" src="../../share/js/commonTool.js"></script>
<script language="javascript" src="../../share/js/annexTool.js"></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();
	}
    if (sOPERATOR.equals("reply")) {
    	sJSDLID = "" + messageInfo.getFSDLID();
    	sJSDLXM = messageInfo.getFSDLXM();
    	sTitle  = "Re:" + 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%>">
<table width="100%">
  <tr>
    <td align="center">

    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="750" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0" align="center">
  <input type="hidden" name="FSDLID" class="txtClass1" value="<%=iDLID_SESSION%>" <%=sReadonly%> >
  <tr>
    <td class="tdClassTitle">接收人员<br>接收部门</td>
    <td><input type="hidden" name="JSDLID" value="<%=sJSDLID%>" readonly >
        <input type="hidden" name="JSBMID" value="0" readonly >
        <input type="text" name="JSDLXM" class="txtClass2R" value="<%=sJSDLXM%>" readonly ><br>
        <input type="text" name="JSBMMC" class="txtClass2R" value="" readonly >
        <input type="button" value="选择" class="btnClassShort" OnClick="javascript:DepartUserWin2('formUpdate.JSDLID', 'formUpdate.JSDLXM', 'formUpdate.JSBMID', 'formUpdate.JSBMMC');" >
    </td>
  </tr>
  <tr>
    <td class="tdClassTitle">发送标题</td>
    <td><input type="text" name="FSBT" class="txtClass2" value="<%=sTitle%>" <%=sReadonly%> ></td>
  </tr>
  <tr>
    <td class="tdClassTitle">发送内容</td>
    <td><textarea name="FSNR" class="areaClass2"></textarea></td>
  </tr>
  <tr>
    <td class="tdClassTitle">表情地址</td>
    <td valign="middle">
    <%
      for (int i=1; i<=30; i++) {
    	  out.println("<input type='radio' name='FSBQ' value='" + i + ".gif'><img src='../../" + OlMessageControl.IMAGE_PATH + "face/" + i + ".gif'>");
		  if (i % 10 == 0) {
			  out.println("<br>");
		  }
      }
    %>
    </td>    
  </tr>
  <% if (ReadOaConfig.getAlert_button().indexOf("weixin") >=0) { %> 
  <tr>
    <td class="tdClassTitle">微信通知</td>
    <td>
      <%//=SzPageHelp.annex(sTableAnnex, sKEY, bReadonly)%>
      <input type="checkbox" name="JSWJJ" value="1" checked> (同时将消息标题、内容发到接收人已绑定的微信上)
    </td>
  </tr>  
  <% } %>
  <tr>
    <td class="tdClassTitle">发送文件</td>
    <td>
      <%//=SzPageHelp.annex(sTableAnnex, sKEY, bReadonly)%>
      <%=SzPageHelp.updateAnnexNew2(sTableAnnex, sKEY, strLevel_SESSION)%>
    </td>
  </tr>
</table>
<table width="100%">
  <tr>
    <td align="center">
      <%=SzPageHelp.button("发送","FormSave(formUpdate, 'control.jsp')")%>
      <%=SzPageHelp.closeButton()%>      
    </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%>">
</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>
</body>
