<%@ 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.tool.SzDateHelp" %>
<%@ page import="net.sz600.system.*" %>
<%@ page import="net.sz600.docEngine.*" %>
<%@ page import="net.sz600.weboffice.*" %>
<%@ page import="net.sz600.flow.*" %>
<%@ include file="/docEngine/docEngineSession.jsp"%>
<%
  String strSkin_SESSION = "../../images/skin2_blue2";
  String strLevel = "../../";
%>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk">
<link href="<%=strSkin_SESSION%>/css2007detail.css" rel="stylesheet" type="text/css">
<style type=text/css>
.detailTitle {
    height:30px;
    font-size:13pt;
}
</style>
</head>
<%
    //String sKEY =  SzConvert.toZeroStr(request.getParameter("KEY"));
    String sReadonly = "";
    boolean bReadonly = false;
        sReadonly = "readonly";
        bReadonly = true;
    //读取数据
    WdyqDocInfo wdyqDocInfo = null;
    WdyqDoc wdyqDoc = new WdyqDoc(moduleId);
    wdyqDocInfo = (WdyqDocInfo)wdyqDoc.getInfoByCond(" 1=1 ORDER BY XXID DESC");
    int iKEY = wdyqDocInfo.getXXID();    
    String sContent = wdyqDocInfo.getXXNR();
    String sKEY = Integer.toString(iKEY);
%>
<body  onload="javascript:ResizeFrame();">
<form name="formUpdate">
  <input type="hidden" name="KEY" value="<%=iKEY%>">
</form>
<!-----信息维护------>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" class="detailTitle"><font size="5"><b><%=wdyqDocInfo.getXXBT()%></b></font></td>
  </tr>

  <tr>
    <td align="center" class="detailTitle">
     <%  
       out.println("" + wdyqDocInfo.getXXDLXM());
       if (!wdyqDocInfo.getXXBMMC().equals("")) {
       	out.println("(" + wdyqDocInfo.getXXBMMC() + ")");
       }       
       out.println("&nbsp;" + wdyqDocInfo.getXXSJ());
     %>
   </td>    
  </tr>  
  <tr>
    <td>
      <table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">

    
<%  //文档是否带有word?
	if (docEngineInfo.getEditor().equals(".doc")
			|| docEngineInfo.getEditor().equals(".xls")
			|| docEngineInfo.getEditor().equals(".ppt")) {  		
	} else {
%>
        <tr>
          <td colspan="3" width="100%">
<table width="100%" height="200" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td><%out.println(wdyqDocInfo.getXXNR()); %>
    </td>
  </tr>
</table>
          </td>
        </tr>
<%		
	}
%>	                    

      </table>
    </td>
  </tr>
</table>
<%  //文档是否带有word?
	if (docEngineInfo.getEditor().equals(".doc")) {  
		String FileType   = docEngineInfo.getEditor();
		String ModuleType = "docEngine";
		int    ModuleID   = SzConvert.toInt( moduleId );
		
	    //取得RecordID
	    OfficeRecordID officeRecordID = new OfficeRecordID();
	    String RecordID  = officeRecordID.loadRecordID(ModuleType,ModuleID,Integer.parseInt(sKEY));				
%>
<table width="100%" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td>

      <table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
        <tr>
          <td>
      		<iframe id="docDetail" width="100%"  height="100%"
              frameborder="0" 
              src="../../HTML/<%=RecordID %>.htm">
      		</iframe>
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<% 		
	} 
%>	

<% if (docEngineInfo.getHasAnnex().equals("1")) {%>
<table width="100%" border="1" bordercolorlight="#C0C0C0" bordercolordark="#FFFFFF" class="tableClass" cellpadding="3" cellspacing="0">
  <tr>
    <td><%=SzPageHelp.detailAnnex(readDocEngineXml.getAnnexTable(moduleId), sKEY, docEngineInfo.getPicture())%></td>
  </tr>
</table>
<% } %>
</form>
<%
	if (docEngineInfo.getEditor().equals(".xls")
			|| docEngineInfo.getEditor().equals(".ppt")
			) {
		
		String FileType   = docEngineInfo.getEditor();
		String ModuleType = "docEngine";
		int    ModuleID   = SzConvert.toInt( moduleId );
		
	    //取得RecordID
	    OfficeRecordID officeRecordID = new OfficeRecordID();
	    String RecordID  = officeRecordID.loadRecordID(ModuleType,ModuleID,Integer.parseInt(sKEY));		
%>

<table width="100%" border="0" cellpadding="3" cellspacing="0">
  <tr>
    <td>
      <iframe id="webOffice" width="100%" height="1380" 
              frameborder="0"
              src="../../share/weboffice/DocumentEdit.jsp?FileType=<%=FileType%>&ModuleType=<%=ModuleType %>&ModuleID=<%=ModuleID %>&RecordID=<%=RecordID%>&EditType=0">
      </iframe>
    </td>
  </tr>
</table>
<% } %>
</body>
<script language="javascript">
  function ResizeFrame() {
  	var oFrame = document.getElementById("docDetail");
	if (oFrame != null) {
          var vHeight2 = oFrame.document.body.scrollHeight;
   	  var vHeight= document.frames("docDetail").document.body.scrollHeight + 20;  
	  //alert(vHeight2 + "==" + vHeight);
	  if (vHeight < 200) {
	    vheight = 200;
	  }
	
	  oFrame.height = vHeight;  
	}
  }
  
</script>
<script language="javascript"  defer>
  function ResizeFrame1() {
  	var oFrame = document.getElementById("docDetail");
  	var vHeight= document.frames("docDetail").document.body.scrollHeight;  	
	oFrame.height = vHeight;  
  }  

  //ResizeFrame1();
</script>
<script language="javascript">
	var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
	var checkresult=null; 

	function CheckMessage() { 
		xmlhttp.open("POST", "newAction.jsp", false);
		xmlhttp.send(null); 
		xmlhttp.abort();
		var response = xmlhttp.responseText;
		var vKEY = "0";
		var vIndex = response.indexOf("SzNewKEY");		
		if (vIndex >=0) {
		    var vIndex1 = response.indexOf("SzEnd");
		    vKEY = response.substring(vIndex + 8, vIndex1);
		    //比较一下
		    var vKEY_OLD = formUpdate.KEY.value;
		    if (vKEY_OLD == vKEY) {
		    } else {
			document.location.reload();
		    }
		} else {
		}
	} 
	
	window.setInterval('CheckMessage()',5000);
</script>

