<%@ 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.mail.*" %>
<%@ 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">

</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 sOPERATOR = request.getParameter("OPERATOR");
    String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    String sReadonly = "";
    boolean bReadonly = false;
    if (sOPERATOR.equals("detail") || sOPERATOR.equals("manage")) {
        sReadonly = "readonly";
        bReadonly = true;
    }
    //读取数据
    YjMailInfo yjMailInfo = null;
    YjMailNew yjMail = new YjMailNew();
    

    
    YjMailReceive yjMailReceive = new YjMailReceive();
    if (!sKEY.equals("0")) {
        //阅读邮件，同时判断是否需要回执：先改变读的状态，再读信息
        if (!sOPERATOR.equals("manage")) {
        	yjMailReceive.readMail(Integer.parseInt(sKEY), iDLID_SESSION);
        }
        
        yjMailInfo = (YjMailInfo)yjMail.getInfoByKey(Integer.parseInt(sKEY));
        //收件人
        yjMailInfo.setJSDLXM(SzUserHelp.getLoginName(yjMailReceive.getReceiveUserId(yjMailInfo.getFSID(), yjMail.intReceiveType)));
        yjMailInfo.setCSDLXM(SzUserHelp.getLoginName(yjMailReceive.getReceiveUserId(yjMailInfo.getFSID(), yjMail.intReceiveTypeCS)));
        yjMailInfo.setMSDLXM(SzUserHelp.getLoginName(yjMailReceive.getReceiveUserId(yjMailInfo.getFSID(), yjMail.intReceiveTypeMS)));
        yjMailInfo.setJSYJDZ(SzUserHelp.getLoginName(yjMailReceive.getReceiveUserId(yjMailInfo.getFSID(), yjMail.intReceiveTypeYJ)));
        

    }
    if (yjMailInfo == null) {
        yjMailInfo = new YjMailInfo();
    } else {
    }
    


%>

<body>
<!-----上面的工具栏------>
<form name="formUpdate" method="post">
  <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="FSID" value="<%=yjMailInfo.getFSID()%>">
  <input type="hidden" name="YJBZ" value="<%=yjMailInfo.getYJBZ()%>">
  <input type="hidden" name="type" value="<%=sType%>">
<%@ include file="title.jsp"%>
<table width="100%">
  <tr>
    <td>
      <%
      if (!sOPERATOR.equals("manage")) {
    	  out.println(SzPageHelp.button("回复","javascript:FormSave(formUpdate, 'update.jsp');"));    	  
    	  out.println(SzPageHelp.button("转发","javascript:FormTransfer(formUpdate, 'update.jsp');"));
      }
      %>
      <%=SzPageHelp.backButton()%>
    </td>
  </tr>
</table>

<!-----信息维护------>
<table width="650" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td>发&nbsp;件&nbsp;人:&nbsp;<b><%=yjMailInfo.getFSDLXM()%>&nbsp;<%=yjMailInfo.getFSYJDZ()%></b></td>
  </tr>
  <tr>
    <td>发件时间:&nbsp;<b><%=yjMailInfo.getFSSJ()%></b></td>
  </tr>   
  <% if (!yjMailInfo.getJSDLXM().equals("")) { %> 
  <tr>
    <td>收&nbsp;件&nbsp;人:&nbsp;<b><%=yjMailInfo.getJSDLXM()%></b></td>
  </tr>
  <% } %>
  <% if (!yjMailInfo.getCSDLXM().equals("")) { %>   
  <tr>
    <td>抄&nbsp;送&nbsp;人:&nbsp;<b><%=yjMailInfo.getCSDLXM()%></b></td>
  </tr>  
  <% } %>
  <% if (!yjMailInfo.getMSDLXM().equals("")  && yjMailInfo.getFSDLID() == iDLID_SESSION ) { %>     
  <tr>
    <td>密&nbsp;送&nbsp;人:&nbsp;<b><%=yjMailInfo.getMSDLXM()%></b></td>
  </tr>   
  <% } %>
  <% if (!yjMailInfo.getJSYJDZ().equals("")) { %>     
  <tr>
    <td>收件邮箱:&nbsp;<b><%=yjMailInfo.getJSYJDZ()%></b>&nbsp;<%=yjMail.getForeignMailStateName(yjMailInfo) %></td>
  </tr>  
  <% } %>  
  <tr>
    <td height="2" class="main_title">邮件标题:&nbsp;<b><%=yjMailInfo.getFSBT()%></b>
    <%=yjMail.getStateImage(yjMailInfo.getYJYD(), yjMailInfo.getYJBZ(), yjMailInfo.getYJZFBZ())%><%=yjMail.getTargImage(yjMailInfo.getYJBLZT())%>
    <%=yjMail.getForeignMailStateName(yjMailInfo) %>
    </td>
  </tr>  
  <tr>
    <td height="200" valign="top" align="left" class="">&nbsp;<br>
    <!-- 采用iframe，避免内容的html样式被css屏蔽，比如大字体 -->
    <iframe frameborder="0"  width="100%" height="100%" src="content.jsp?id=<%=sKEY%>"></iframe>
        <%
    String sContent = yjMailInfo.getFSNR();
    sContent = sContent.replaceAll("\n", "<br>");
    out.println(sContent);
    %>
    
    </td>
  </tr>


</table>

<table width="650" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0"> 
  <tr> 
    <td><b>附件</b><br><%=SzPageHelp.detailAnnexNew2(yjMail.strAnnexTable, "" + yjMailInfo.getFSID(), strLevel_SESSION)%></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" src="../share/js/commonTool.js"></script>
<script language="javascript">

  function FormSave(formName, url) {
    formName.OPERATOR.value = "return";
    formName.action = url;
    formName.submit();
  }
  
  function FormTransfer(formName, url) {
    formName.OPERATOR.value = "transfer";
    formName.action = url;
    formName.submit();
  }   
</script>
</body>
